Test method and device of geometric modeling engine, electronic equipment and storage medium

By registering command class instances in the testing system and using test scripts, the problems of high difficulty and cost in testing geometric modeling engines are solved, cross-programming language parameter data processing is realized, and testing efficiency and flexibility are improved.

CN120295904BActive Publication Date: 2025-11-21粤港澳大湾区(广东)国创中心
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510220009.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-26
Publication Date
2025-11-21
Estimated Expiration
2045-02-26

AI Technical Summary

Technical Problem

The testing process for geometric modeling engines is characterized by high testing difficulty and high testing costs.

Method used

By registering command class instances in the testing system, test scripts based on the first programming language are used to parse and process test parameters from different programming languages, thus enabling the transfer of test parameters across programming languages.

Benefits of technology

It reduces the workload of program development and maintenance, improves testing efficiency and flexibility, and supports parameter data transmission for different programming languages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120295904B_ABST
    Figure CN120295904B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a kind of geometry modeling engine test method, device, electronic equipment and storage medium, it is related to software testing technical field, the method comprises: in test system, the command class instance for testing geometry modeling engine is registered;Determine the test case for geometry modeling engine, execute test case by test script, determine the test command corresponding to test case and each the parameter sequence corresponding to the test command, the parameter type of parameter sequence is first programming language;According to parameter sequence, from the registered command class instance, the target command class instance matched with test command is extracted;According to the function interface of target command class instance, parameter sequence is parsed, obtains the test parameter of parameter type for second programming language, and according to test parameter, geometry modeling engine is tested, obtains corresponding test result, flexibly and efficiently parses, processes different types of parameter data, reduces the workload of program development and maintenance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of software testing technology, and in particular to a testing method for a geometric modeling engine, a testing device for a geometric modeling engine, an electronic device, and a computer-readable storage medium. Background Technology

[0002] A geometric modeling engine is a software tool or library used for creating, manipulating, and analyzing geometric models. It is widely used in computer-aided design, computer graphics, simulation, 3D printing, game development, and other fields. The core functions of a geometric modeling engine include the creation, editing, Boolean operations (such as union, difference, and intersection), deformation, and rendering of geometric objects. However, the presence of numerous C++ structures or class parameters in geometric modeling engines can significantly increase the difficulty and cost of testing for users. Summary of the Invention

[0003] The present invention provides a testing method, apparatus, electronic device, and computer-readable storage medium for geometric modeling engines, in order to solve or partially solve the problems of high testing difficulty and high testing cost in the process of testing geometric modeling engines.

[0004] This invention discloses a testing method for a geometric modeling engine, involving a testing system and a geometric modeling engine. The testing system runs a test script, which is a script program configured based on a first programming language. The method includes:

[0005] Register a command class instance in the testing system for testing the geometric modeling engine. The command class instance provides several function interfaces.

[0006] Determine test cases for the geometric modeling engine, execute the test cases through the test script, determine the test commands corresponding to the test cases and the parameter sequences corresponding to each test command, wherein the parameter type of the parameter sequence is the first programming language;

[0007] Based on the parameter sequence, extract the target command class instance that matches the test command from the registered command class instances;

[0008] Based on the function interface of the target command class instance, the parameter sequence is parsed to obtain test parameters of the second programming language type, and the geometric modeling engine is tested based on the test parameters to obtain the test results corresponding to the test cases.

[0009] In some feasible embodiments, it also includes:

[0010] In response to the completion of all test cases, all command class instances in the test system are deregistered.

[0011] In some feasible embodiments, the parameter sequence includes at least a command identifier, and the step of extracting a target command class instance matching the test command from the registered command class instances based on the parameter sequence includes:

[0012] Extract the target command class instance that matches the command identifier from the registered command class instances.

[0013] In some feasible embodiments, the testing system includes at least a model library, which includes at least all model object instances generated during the test run of the geometric modeling engine and model identifiers corresponding to each model object instance. The method further includes:

[0014] If a model identifier for representing a model object instance exists in the parameter sequence, then a target model object instance matching the model identifier is extracted from the model library.

[0015] In some feasible embodiments, the step of testing the geometric modeling engine according to the test parameters and obtaining the test results corresponding to the test cases includes:

[0016] The geometric modeling engine is tested based on the test parameters and the target model object instance to obtain the test results corresponding to the test cases.

[0017] In some feasible embodiments, the command class instance includes a parameter parsing function interface, the first programming language is Python, and the second programming language is C++. The step of parsing the parameter sequence according to the function interface of the target command class instance to obtain test parameters of the second programming language type includes:

[0018] The parameter sequence of Python language type is passed to the parameter parsing function interface for parameter type conversion to obtain test parameters of C++ language type.

[0019] In some feasible embodiments, the command class instance further includes an execution function interface, the test parameters include at least a first geometric modeling parameter, and the step of testing the geometric modeling engine according to the test parameters to obtain the test results corresponding to the test cases includes:

[0020] The first geometric modeling parameters are passed to the geometric modeling engine through the execution function interface. In response to the geometric modeling engine, the first geometric modeling operation corresponding to the first geometric modeling parameters is executed, and the test result corresponding to the test case is obtained based on the first geometric modeling operation.

[0021] In some feasible embodiments, the test parameters include at least first geometric modeling parameters, and the step of testing the geometric modeling engine based on the test parameters and the target model object instance to obtain test results corresponding to the test cases includes:

[0022] Obtain the second geometric modeling parameters corresponding to the target model object instance;

[0023] The first geometric modeling parameter and the second geometric modeling parameter are passed to the geometric modeling engine. In response to the geometric modeling engine, a second geometric modeling operation corresponding to the first geometric modeling parameter and the second geometric modeling parameter is executed. The test result corresponding to the test case is obtained based on the second geometric modeling operation.

[0024] In some feasible embodiments, the command class instance further includes a cleanup function interface, and the method further includes:

[0025] In response to the completion of the geometric modeling engine test, the test parameters are cleared through the clear function interface.

[0026] This invention also discloses a testing device for a geometric modeling engine, relating to a testing system and a geometric modeling engine. The testing system runs a test script, which is a script program configured based on a first programming language. The device includes:

[0027] A registration module is used to register command class instances for testing the geometric modeling engine in the testing system. The command class instances provide several function interfaces.

[0028] The test case determination module is used to determine test cases for the geometric modeling engine, execute the test cases through the test script, determine the test commands corresponding to the test cases and the parameter sequences corresponding to each test command, wherein the parameter type of the parameter sequence is the first programming language;

[0029] The command class instance extraction module is used to extract a target command class instance that matches the test command from the registered command class instances according to the parameter sequence.

[0030] The testing module is used to parse the parameter sequence according to the function interface of the target command class instance, obtain test parameters of the second programming language, and test the geometric modeling engine according to the test parameters to obtain the test results corresponding to the test cases.

[0031] In some feasible embodiments, it also includes:

[0032] The unregister module is used to unregister all command class instances in the test system in response to the completion of all test cases.

[0033] In some feasible embodiments, the parameter sequence includes at least a command identifier, and the command class instance extraction module is specifically used for:

[0034] Extract the target command class instance that matches the command identifier from the registered command class instances.

[0035] In some feasible embodiments, the testing system includes at least a model library, which includes at least all model object instances generated during the test run of the geometric modeling engine and model identifiers corresponding to each model object instance. The device further includes:

[0036] The model object extraction module is used to extract a target model object instance that matches the model identifier from the model library if there is a model identifier in the parameter sequence that represents a model object instance.

[0037] In some feasible embodiments, the test module is specifically used for:

[0038] The geometric modeling engine is tested based on the test parameters and the target model object instance to obtain the test results corresponding to the test cases.

[0039] In some feasible embodiments, the command class instance includes a parameter parsing function interface, the first programming language is Python, the second programming language is C++, and the test module is specifically used for:

[0040] The parameter sequence of Python language type is passed to the parameter parsing function interface for parameter type conversion to obtain test parameters of C++ language type.

[0041] In some feasible embodiments, the command class instance further includes an execution function interface, the test parameters include at least the first geometric modeling parameters, and the test module is specifically used for:

[0042] The first geometric modeling parameters are passed to the geometric modeling engine through the execution function interface. In response to the geometric modeling engine, the first geometric modeling operation corresponding to the first geometric modeling parameters is executed, and the test result corresponding to the test case is obtained based on the first geometric modeling operation.

[0043] In some feasible embodiments, the test parameters include at least first geometric modeling parameters, and the test module is specifically used for:

[0044] Obtain the second geometric modeling parameters corresponding to the target model object instance;

[0045] The first geometric modeling parameter and the second geometric modeling parameter are passed to the geometric modeling engine. In response to the geometric modeling engine, a second geometric modeling operation corresponding to the first geometric modeling parameter and the second geometric modeling parameter is executed. The test result corresponding to the test case is obtained based on the second geometric modeling operation.

[0046] In some feasible embodiments, the command class instance further includes a cleanup function interface, and the apparatus further includes:

[0047] The clearing module is used to clear the test parameters through the clearing function interface in response to the completion of the geometric modeling engine test.

[0048] This invention also discloses an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

[0049] The memory is used to store computer programs;

[0050] When the processor executes a program stored in the memory, it implements the method described in the embodiments of the present invention.

[0051] This invention also discloses a computer-readable storage medium storing instructions that, when executed by one or more processors, cause the processors to perform the methods described in this invention.

[0052] The embodiments of the present invention have the following advantages:

[0053] In this embodiment of the invention, a user can test the geometric modeling engine through a testing system. The user can run corresponding test scripts on the testing system, which can be script programs configured based on a first programming language. During the testing process, a command class instance for testing the geometric modeling engine can be registered in the testing system first. This command class instance provides several function interfaces. Next, the user can set test cases for the geometric modeling engine and execute the test cases through the test scripts to determine the test commands corresponding to the test cases and the parameter sequences corresponding to each test command. The parameter types of the parameter sequences are the first programming language. Then, based on the parameter sequences, a target command class instance matching the test commands is extracted from the registered command class instances. Based on the extracted target command class instance, the parameter sequences can be further parsed according to the function interfaces of the target command class instance to obtain test parameters of a second programming language. The geometric modeling engine is then tested based on these test parameters to obtain the test results corresponding to the test cases. Therefore, during the testing of the geometric modeling engine, by registering the corresponding command class instances on the testing system, users can process the corresponding test parameters across programming languages ​​from the level of custom commands, thereby enabling the testing of the geometric modeling engine. This allows for flexible and efficient parsing and processing of different types of parameter data, supports the transmission of parameter data from different programming languages, and also facilitates test program developers in writing corresponding test cases, reducing the workload of program development and maintenance. Attached Figure Description

[0054] Figure 1 This is a flowchart of the steps of a testing method for a geometric modeling engine provided in an embodiment of the present invention;

[0055] Figure 2 This is a schematic diagram of an application scenario provided in an embodiment of the present invention;

[0056] Figure 3 This is a structural block diagram of a testing device for a geometric modeling engine provided in an embodiment of the present invention. Detailed Implementation

[0057] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0058] As an example, Python's concise and easy-to-learn syntax, along with its support for multiple programming paradigms including procedural, object-oriented, and functional programming, makes it a frequent choice as the dominant language for API binding in data-driven applications. API binding exposes functionality written in another language commonly used or essential in industry applications (such as C++) to Python programs, enabling cross-language communication and leveraging the strengths of both languages.

[0059] However, in systems testing geometric modeling engines, to perform multi-parameter and multi-boundary condition testing, it is often necessary to add various test command functions and different numbers and types of test parameters to match these functions. The test command functions involve a wide variety of parameter data types and complex structures. In particular, for testing system platforms, to better support scalability and ease of use, the functions and parameters called by test commands are often flexibly defined and adjusted according to user needs. While Python parameter lists can be directly converted to C++ format for simple parameter types, the presence of numerous C++ structures or classes in geometric modeling engines means that maintaining custom built-in object types is both difficult and costly for users.

[0060] For example, the approach of allowing users to customize a large number of built-in object types has the following drawbacks:

[0061] (1) Typically, based on the API names and parameters written in C++, corresponding Python built-in object types are written using the same or similar names (e.g., adding a consistent prefix or suffix to distinguish them). In the geometric modeling engine testing system, the C++ objects generated by the test commands have a wide variety of parameter data types and complex structures, making the programming workload quite large when writing corresponding custom Python built-in object types.

[0062] (2) C++'s polymorphism and function overloading features support the flexibility of C++ object programming methods, but Python does not have similar concepts. Therefore, when defining Python interface bindings, it is necessary to consider multiple implementation forms. Defining corresponding Python classes according to the rules of Python's built-in object types and maintaining the consistency of the command interfaces of the two language environments in the test system is quite difficult and labor-intensive.

[0063] In this invention, users can test the geometric modeling engine through a testing system. The testing system can run corresponding test scripts, which can be script programs configured based on a first programming language. During testing, command class instances for testing the geometric modeling engine are first registered in the testing system. These command class instances provide several function interfaces. Next, users can set test cases for the geometric modeling engine and execute them through the test scripts to determine the corresponding test commands and parameter sequences. The parameter types of the parameter sequences are the first programming language. Then, based on the parameter sequences, target command class instances matching the test commands are extracted from the registered command class instances. Based on the extracted target command class instances, the parameter sequences can be further parsed according to the function interfaces of the target command class instances to obtain test parameters of a second programming language. The geometric modeling engine is then tested based on these test parameters to obtain the test results corresponding to the test cases.

[0064] Reference Figure 1 This diagram illustrates a flowchart of a testing method for a geometric modeling engine provided in an embodiment of the present invention. The method involves a testing system and a geometric modeling engine. The testing system runs a test script, which is a script program configured based on a first programming language. Specifically, the method may include the following steps:

[0065] Step 101: Register a command class instance in the test system for testing the geometric modeling engine. The command class instance provides several function interfaces.

[0066] For a geometric modeling engine, it can be a software library or tool for creating, editing and analyzing geometric models (such as cuboids, cylinders, spheres, etc.). For example, it can be used for creating and editing geometric objects, Boolean operations (such as union, difference and intersection), transformations of geometric objects (such as translation, rotation, scaling, etc.), and calculation of geometric object properties (such as volume, surface area, etc.).

[0067] For testing systems, they can be frameworks or platforms used to verify the functionality of geometric modeling engines. For example, they can manage test cases and test scripts, call the interfaces of geometric modeling engines, verify test results and generate reports. Testing systems provide unified test interfaces and tools to achieve automated testing processes and improve testing efficiency.

[0068] The test script can be a script program written in a first programming language, such as a script program written in Python. It can be used to define test logic and call the functions of the geometric modeling engine, including the definition of test cases, the passing and verification of parameters, and the checking and reporting of results. This invention does not limit this.

[0069] It should be noted that the first programming language is Python and the second programming language is C++. During the testing of the geometric modeling engine, users can write corresponding test cases (including test command functions and corresponding test parameters) in Python. During the testing process, it is necessary to convert the parameters involved in the test cases into parameters that can be executed in the C++ language environment. To this end, in this embodiment of the invention, by constructing corresponding command class instances and registering the corresponding command class instances on the testing system, users can process the corresponding test parameters across programming languages ​​from the level of custom commands, thereby realizing the testing of the geometric modeling engine. This allows for flexible and efficient parsing and processing of different types of parameter data, supports the transmission of parameter data of different programming language types, and also facilitates test program developers in writing corresponding test cases, reducing the workload of program development and maintenance.

[0070] In this embodiment of the invention, when a user performs functional tests on the geometric modeling engine through a testing system, they can first register a command class instance in the testing system for testing the geometric modeling engine. This command class instance provides several different function interfaces, which are used to implement different functions during the testing process, such as executing test commands, clearing test commands, parsing parameters, and passing parameters. Thus, through the command class instance, various types of parameter data can be flexibly and efficiently parsed and processed to support the transmission of parameter data from different programming languages, reducing the workload of program development and maintenance.

[0071] It should be noted that for command class instances, configuration can be achieved by defining a custom C++ base class `CmdBase` and implementing the logic mechanism, allowing the command class instances to perform corresponding functions. During the configuration process, all custom command classes are derived from this base class and implemented in the derived classes of the application module.

[0072] In some feasible implementations, the command class instance includes parameter parsing function interfaces, execution function interfaces, and cleanup function interfaces. The parameter parsing function interface is used to parse parameters from the first programming language into parameters from the second programming language. The execution function interface is used to perform the corresponding initialization to execute the test command. The cleanup function interface is used to perform corresponding cleanup work after the test command has been executed. Therefore, by defining the corresponding function interfaces in the command class instance, various types of parameter data can be parsed and processed flexibly and efficiently to support the transmission of parameter data from different programming languages, reducing the workload of program development and maintenance.

[0073] In some examples, the parameter parsing function interface can be `AnalyzePyArgsss()`, which defines the code logic for parsing Python tuple objects containing command argument data. During test case execution, the parameter list in the Python script is directly converted into arguments passed to the C++ function, where each member item corresponds to an argument in the called parameter list. These can be converted to C++ types using Python's extension libraries. The execution function interface can be `Activate()`, which is called when a command is activated. This interface can be used to analyze the passed parameter data object, perform necessary initialization, and then execute the command. The cleanup function interface can be `Deactivate()`, which is called when a command finishes execution or terminates. This interface can be used to perform cleanup work before the command exits. Therefore, by defining corresponding function interfaces in the command class instance, various types of parameter data can be parsed and processed flexibly and efficiently to support the passing of parameter data from different programming languages, reducing the workload of program development and maintenance.

[0074] Furthermore, for command class instances, by registering command class instances that may be used during the testing process on the testing system, the command class instances are given a corresponding lifecycle concept, which allows users to allocate command class instances according to actual needs. This makes it easier for test program developers to manage the corresponding command class instances, test cases, etc., and effectively reduces testing costs.

[0075] In practical implementation, registration and deregistration functions allow test scripts to register and deregister corresponding command class instances on the test system. For example, the corresponding function interface `Register()` provides a registration function for custom commands. Before using a command class instance, the user needs to register it with the test system, which then manages the instance. Conversely, for registered command class instances, after completing the corresponding tests, the user can deregister the instance from the test system. For instance, this can be done through the corresponding function interface `Unregister()`, which provides the functionality for test scripts to deregister and deregister custom command class instances.

[0076] It should be noted that for command class instances registered in the testing system, a mapping relationship between command class instances and command identifiers has already been established. This allows the corresponding command class instances to be retrieved and found through the command identifiers during the testing process, and further geometric modeling tests of the geometric modeling engine can be implemented through the function interfaces provided by the command class instances.

[0077] Step 102: Determine test cases for the geometric modeling engine, execute the test cases through the test script, determine the test commands corresponding to the test cases and the parameter sequences corresponding to each test command, wherein the parameter type of the parameter sequence is the first programming language;

[0078] In this embodiment of the invention, for the geometric modeling engine, users can develop corresponding test cases to test the geometric modeling engine. The test cases can define the test objectives and steps, including inputs, execution conditions, and expected results. Each test case can include multiple test commands, and each test command can call a corresponding command class instance to perform a specific operation.

[0079] During testing, the test cases configured by the user are written in a primary programming language (such as Python). When executing these test cases through the test script, the Python parameter sequence involved in the test cases is passed through the unified command entry point of the API binding. Specifically, during the execution of test cases, the test script can first determine the various test commands involved in the test cases (such as creating geometry, performing Boolean operations, geometric transformations, and calculating geometric attributes) and their preconditions, thus determining the parameter sequence corresponding to each test command.

[0080] Step 103: Extract the target command class instance that matches the test command from the registered command class instances according to the parameter sequence;

[0081] Once the parameter sequence corresponding to the test command is determined, the target command class instance that matches the test command can be found from the registered command class examples based on the parameter sequence, so that the geometric modeling engine can be tested based on the target command class instance.

[0082] In some feasible implementations, the parameter sequence includes at least a command identifier. Different test commands correspond to different command identifiers. Based on the command identifier and the constructed mapping relationship, a target command class instance matching the command identifier can be found from the command class instances. Furthermore, the test system is configured with a corresponding model library, which includes at least all model object instances generated during the test run of the geometric modeling engine, as well as the model identifiers corresponding to each model object instance. For the parameter sequence, it can also be checked whether it contains a corresponding model identifier representing a model object. If a model identifier representing a model object exists in the parameter sequence, a target model object instance matching the model identifier is extracted from the model library. Thus, by extracting the target command class instance matching the test command from the command class instances, and extracting the corresponding model object instance when a model identifier exists, the geometric modeling function of the geometric modeling engine can be tested based on the target command class instance and / or the model object instance.

[0083] It should be noted that the model library configured in the testing system contains all model object instances generated during the testing process, such as cuboids and cylinders, and each model object instance corresponds to a specific model identifier. Optionally, during the testing of the geometric modeling engine, some test commands may require existing execution results as prerequisites. These prerequisites are often already generated model object instances. Therefore, corresponding model identifiers may exist in the parameter sequence to extract the corresponding model object instances from the model library using these identifiers.

[0084] Step 104: Based on the function interface of the target command class instance, parse the parameter sequence to obtain test parameters of the second programming language type, and test the geometric modeling engine based on the test parameters to obtain the test results corresponding to the test cases.

[0085] Once the target command class instance is identified, the parameter sequence can be parsed using the function interface provided by the target command class instance. This converts the relevant parameters in the parameter sequence into parameters executable in the language environment of the geometric modeling engine, obtaining test parameters of the second programming language type. The geometric modeling engine is then tested based on these test parameters, yielding test results for the corresponding test cases. Therefore, during the testing of the geometric modeling engine, registering the corresponding command class instance on the testing system allows users to process relevant test parameters across programming languages ​​from the level of custom commands. This enables flexible and efficient parsing and processing of different types of parameter data, supports the transfer of parameter data from different programming languages, and also facilitates test program developers in writing corresponding test cases, reducing the workload of program development and maintenance.

[0086] In one feasible implementation, when the first programming language is Python and the second is C++, the test script can pass a sequence of parameters of Python type to a parameter parsing function interface for parameter type conversion, obtaining test parameters of C++ type. These test parameters may include first geometric modeling parameters. The test script can then pass these first geometric modeling parameters to the geometric modeling engine through the execution function interface. The geometric modeling engine then executes the first geometric modeling operation corresponding to the first geometric modeling parameters, obtaining the test results corresponding to the test cases based on the first geometric modeling operation. Thus, during the testing of the geometric modeling engine, by registering corresponding command class instances on the testing system, users can process corresponding test parameters across programming languages ​​from the level of custom commands, enabling flexible and efficient parsing and processing of different types of parameter data, supporting the transmission of parameter data of different programming language types, and facilitating test program developers in writing corresponding test cases, reducing the workload of program development and maintenance.

[0087] It should be noted that after obtaining the corresponding geometric modeling parameters, the geometric modeling engine can perform corresponding geometric modeling operations, such as creating and editing geometric objects, Boolean operations (such as union, difference, and intersection), transforming geometric objects (such as translation, rotation, and scaling), and calculating the properties of geometric objects (such as volume and surface area). After performing the corresponding geometric modeling operations, corresponding test results can be obtained, such as whether the created geometric object matches the user's expected geometric object, whether the Boolean operation meets the corresponding conditions, and whether the transformation of the geometric object meets the preset conditions. When passing the corresponding test parameters, the test conditions can also be passed in to determine whether the geometric modeling operation meets the user's expectations. This invention does not impose any limitations on this.

[0088] In another feasible implementation, if the testing process relies on model object instances, after obtaining the corresponding model object instances, the geometric modeling engine can be tested based on the test parameters and the model object instances to obtain the test results corresponding to the test cases. Here, a model object instance can essentially be considered a complex set of parameter data, i.e., the second geometric modeling parameters. After obtaining the second geometric modeling parameters corresponding to the target model object instance, the first and second geometric modeling parameters can be passed to the geometric modeling engine. The geometric modeling engine then executes the second geometric modeling operation corresponding to the first and second geometric modeling parameters. Based on the second geometric modeling operation, the test results corresponding to the test cases are obtained. Thus, during the testing of the geometric modeling engine, by configuring a model library on the testing system, users can flexibly and efficiently parse and process sets of different types of parameter data from the level of custom commands, through parameters identified by the model. This supports the transmission of parameter data of different programming languages ​​and also facilitates test program developers in writing corresponding test cases, reducing the workload of program development and maintenance.

[0089] After completing the above testing process, test parameters can be cleared through the clear function interface. This allows for the removal of relevant test parameters after testing, releasing corresponding memory and resources. Furthermore, since the testing system also provides a command class instance deregistration function, all command class instances in the testing system can be deregistered after all test cases have been completed. This releases memory and resources and gives command class instances a lifecycle concept, allowing users to allocate command class instances according to actual needs. This facilitates test program developers in managing command class instances and test cases, effectively reducing testing costs.

[0090] In one example, refer to Figure 2 The diagram illustrates an application scenario provided in an embodiment of the present invention. Regarding the testing process, the testing system platform and operating environment can be based on a Python language system, while the geometric modeling engine can be based on a C++ language system. Parameter data can be transferred between the two through test cases (Python scripts). Specifically, the process may include the following:

[0091] (1) Define a C++ base class CmdBase for custom command classes;

[0092] (2) Define a custom command class and class instance: class myCmd:pulicCmdBase{};

[0093] (3) Register / Unregister();

[0094] (4) Custom command library (supports searching by name);

[0095] (5) Unified command entry point for API Binding;

[0096] (6) Named model object library (supports searching by name);

[0097] (7) Command to start: Activate()

[0098] Analyze parameters: AnalyzePyArgsss();

[0099] Command to stop: Deactivate();

[0100] (8) C++ parameter data, so that the corresponding test operations can be performed based on the C++ parameter data.

[0101] In the above process, the API binding mechanism provided by Python can be used to implement Python extension modules, which provide a general Python C++ extension function entry point. When a Python script (i.e., a test script) is run, the Python interpreter passes the command names and their arguments from the parameter sequence to the bound C++ API. The API performs parameter type conversion according to Python interface binding rules. This API always includes `self` and `args`. `args` can contain a set of parameters required by the Python script function (represented as C++ objects). For example, for `create_box` which generates a cuboid, it contains the three geometric parameters of the cuboid (length 1.5, width 2.3, height 4.6). `self` contains at least one default parameter, which is the command identifier of the custom command class instance. This identifier allows you to find registered command class instances. If more parameter data is passed in, the corresponding command class instance can be called to parse and process it using the `AnalyzePyArgsss()` interface. Parameter data distinguishes between ordinary text and text with specific meanings. Ordinary text represents numeric parameters, such as length 1.5 represented as '1.5'. Text with specific meanings can be used to identify model objects, such as model object names, and needs to be used in conjunction with the established model object library.

[0102] During the functional testing of the geometric modeling engine through the testing system, the testing system provides a base class CmdBase for custom commands. Then, a custom command class (such as myCmd) is defined by deriving from the base class CmdBase, and the virtual function interfaces Activate(), Deactivate(), and AnalyzePyArgsss() are overridden to implement the custom parameter data parsing logic.

[0103]

[0104]

[0105] When the test system platform starts, `Register()` is called to register user-defined command class instances. After the test ends, `Unregister()` can be called to unregister all registered command class instances. Next, the script program corresponding to the test cases can be executed, passing the Python parameter sequence through the unified command entry point of the API binding. During parameter passing, the first parameter by default is the command identifier, which is used to find the `myCmd` command class instance. If the passed parameters include a model identifier representing a model object instance, the corresponding model object instance is obtained from the model library using the model identifier. After finding the corresponding command class instance, the function interface provided by the custom command class instance can be activated to parse the Python parameter sequence into C++ type parameter data required by the `myCmd` command class instance, and other function interfaces can be executed so that the geometric modeling engine can perform corresponding geometric modeling operations based on the parsed parameter data. Therefore, during the testing of the geometric modeling engine, by registering the corresponding command class instances on the testing system, users can process the corresponding test parameters across programming languages ​​from the level of custom commands, thereby enabling the testing of the geometric modeling engine. This allows for flexible and efficient parsing and processing of different types of parameter data, supports the transmission of parameter data from different programming languages, and also facilitates test program developers in writing corresponding test cases, reducing the workload of program development and maintenance.

[0106] For example, if we need to test a geometry modeling engine's ability to generate cuboids and perform Boolean operations, the test cases would be designed as follows:

[0107] (1) When the user develops test commands, namely: create_box, create_cylinder and boolean_cut test commands, these command functions must handle the different parameter forms passed in.

[0108] (2) In the Python language environment, these test command functions can be used.

[0109] ① Test case one, as follows:

[0110]

[0111] ② Test case two, as follows:

[0112]

[0113] For the test command functions in the Python language environment mentioned above, the test script can extract the appropriate target command class instance from the command class instances registered in the test system, and execute the test command and parse the parameters through the function interface provided in the target command class instance, and pass the corresponding geometric modeling parameters to the geometric modeling engine for testing to obtain the corresponding test results.

[0114] It should be noted that the embodiments of the present invention include, but are not limited to, the examples described above. It is understood that those skilled in the art can make further settings according to actual needs under the guidance of the ideas in the embodiments of the present invention, and the present invention does not limit such settings.

[0115] In this embodiment of the invention, a user can test the geometric modeling engine through a testing system. The user can run corresponding test scripts on the testing system. These test scripts can be script programs configured based on a first programming language. During the testing process, a command class instance for testing the geometric modeling engine can be registered in the testing system. This command class instance provides several function interfaces. The user can then set test cases for the geometric modeling engine and execute them through the test script. This determines the test commands corresponding to the test cases and the parameter sequences corresponding to each test command. The parameter types of the parameter sequences are the first programming language. Then, based on the parameter sequences, a target command class instance matching the test commands is extracted from the registered command class instances. Based on the extracted target command class instance, the parameter sequences can be further parsed according to the function interfaces of the target command class instance to obtain test parameters of a second programming language. The geometric modeling engine is then tested based on these test parameters to obtain the test results corresponding to the test cases.

[0116] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.

[0117] Reference Figure 3This diagram illustrates a structural block diagram of a testing device for a geometric modeling engine provided in an embodiment of the present invention. The device relates to a testing system and a geometric modeling engine. The testing system runs a test script, which is a script program configured based on a first programming language and may specifically include the following modules:

[0118] Registration module 301 is used in the test system to register a command class instance for testing the geometric modeling engine, wherein the command class instance provides several function interfaces;

[0119] The test case determination module 302 is used to determine test cases for the geometric modeling engine, execute the test cases through the test script, determine the test commands corresponding to the test cases and the parameter sequences corresponding to each test command, wherein the parameter type of the parameter sequence is the first programming language;

[0120] The command class instance extraction module 303 is used to extract a target command class instance that matches the test command from the registered command class instances according to the parameter sequence.

[0121] The testing module 304 is used to parse the parameter sequence according to the function interface of the target command class instance, obtain test parameters of the second programming language, and test the geometric modeling engine according to the test parameters to obtain the test results corresponding to the test cases.

[0122] In some feasible embodiments, it also includes:

[0123] The unregister module is used to unregister all command class instances in the test system in response to the completion of all test cases.

[0124] In some feasible embodiments, the parameter sequence includes at least a command identifier, and the command class instance extraction module 303 is specifically used for:

[0125] Extract the target command class instance that matches the command identifier from the registered command class instances.

[0126] In some feasible embodiments, the testing system includes at least a model library, which includes at least all model object instances generated during the test run of the geometric modeling engine and model identifiers corresponding to each model object instance. The device further includes:

[0127] The model object extraction module is used to extract a target model object instance that matches the model identifier from the model library if there is a model identifier in the parameter sequence that represents a model object instance.

[0128] In some feasible embodiments, the test module 304 is specifically used for:

[0129] The geometric modeling engine is tested based on the test parameters and the target model object instance to obtain the test results corresponding to the test cases.

[0130] In some feasible embodiments, the command class instance includes a parameter parsing function interface, the first programming language is Python, the second programming language is C++, and the test module 304 is specifically used for:

[0131] The parameter sequence of Python language type is passed to the parameter parsing function interface for parameter type conversion to obtain test parameters of C++ language type.

[0132] In some feasible embodiments, the command class instance further includes an execution function interface, the test parameters include at least the first geometric modeling parameters, and the test module 304 is specifically used for:

[0133] The first geometric modeling parameters are passed to the geometric modeling engine through the execution function interface. In response to the geometric modeling engine, the first geometric modeling operation corresponding to the first geometric modeling parameters is executed, and the test result corresponding to the test case is obtained based on the first geometric modeling operation.

[0134] In some feasible embodiments, the test parameters include at least first geometric modeling parameters, and the test module 304 is specifically used for:

[0135] Obtain the second geometric modeling parameters corresponding to the target model object instance;

[0136] The first geometric modeling parameter and the second geometric modeling parameter are passed to the geometric modeling engine. In response to the geometric modeling engine, a second geometric modeling operation corresponding to the first geometric modeling parameter and the second geometric modeling parameter is executed. The test result corresponding to the test case is obtained based on the second geometric modeling operation.

[0137] In some feasible embodiments, the command class instance further includes a cleanup function interface, and the apparatus further includes:

[0138] The clearing module is used to clear the test parameters through the clearing function interface in response to the completion of the geometric modeling engine test.

[0139] As the apparatus embodiment is basically similar to the method embodiment, it is described in a relatively simple manner. For relevant details, please refer to the description of the method embodiment.

[0140] In addition, this invention also provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described geometric modeling engine testing method embodiment and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0141] This invention also provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the various processes of the above-described geometric modeling engine testing method embodiment and achieves the same technical effect. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.

[0142] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0143] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, EEPROM, Flash, and eMMC, etc.) containing computer-usable program code.

[0144] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0145] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0146] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0147] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.

[0148] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0149] The above provides a detailed description of a testing method and a testing device for a geometric modeling engine provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A testing method for a geometric modeling engine, characterized in that, The method involves a testing system and a geometric modeling engine. The testing system runs test scripts, which are script programs configured based on a first programming language. Register a command class instance in the testing system for testing the geometric modeling engine. The command class instance provides several function interfaces. Determine test cases for the geometric modeling engine, execute the test cases through the test script, determine the test commands corresponding to the test cases and the parameter sequences corresponding to each test command, wherein the parameter type of the parameter sequence is the first programming language; Based on the parameter sequence, extract the target command class instance that matches the test command from the registered command class instances; Based on the function interface of the target command class instance, the parameter sequence is parsed to obtain test parameters of the second programming language type, and the geometric modeling engine is tested based on the test parameters to obtain the test results corresponding to the test cases.

2. The method according to claim 1, characterized in that, Also includes: In response to the completion of all test cases, all command class instances in the test system are deregistered.

3. The method according to claim 1 or 2, characterized in that, The parameter sequence includes at least a command identifier, and the step of extracting a target command class instance matching the test command from the registered command class instances based on the parameter sequence includes: Extract the target command class instance that matches the command identifier from the registered command class instances.

4. The method according to claim 3, characterized in that, The testing system includes at least a model library, which includes at least all model object instances generated during the test run of the geometric modeling engine, as well as model identifiers corresponding to each model object instance. The method further includes: If a model identifier for representing a model object instance exists in the parameter sequence, then a target model object instance matching the model identifier is extracted from the model library.

5. The method according to claim 4, characterized in that, The step of testing the geometric modeling engine according to the test parameters and obtaining the test results corresponding to the test cases includes: The geometric modeling engine is tested based on the test parameters and the target model object instance to obtain the test results corresponding to the test cases.

6. The method according to claim 1 or 2, characterized in that, The command class instance includes a parameter parsing function interface. The first programming language is Python, and the second programming language is C++. The step of parsing the parameter sequence according to the function interface of the target command class instance to obtain test parameters of the second programming language type includes: The parameter sequence of Python language type is passed to the parameter parsing function interface for parameter type conversion to obtain test parameters of C++ language type.

7. The method according to claim 6, characterized in that, The command class instance also includes an execution function interface, the test parameters include at least a first geometric modeling parameter, and the step of testing the geometric modeling engine according to the test parameters to obtain the test results corresponding to the test cases includes: The first geometric modeling parameters are passed to the geometric modeling engine through the execution function interface. In response to the geometric modeling engine, the first geometric modeling operation corresponding to the first geometric modeling parameters is executed, and the test result corresponding to the test case is obtained based on the first geometric modeling operation.

8. The method according to claim 4, characterized in that, The test parameters include at least first geometric modeling parameters. The step of testing the geometric modeling engine based on the test parameters and the target model object instance to obtain test results corresponding to the test cases includes: Obtain the second geometric modeling parameters corresponding to the target model object instance; The first geometric modeling parameter and the second geometric modeling parameter are passed to the geometric modeling engine. In response to the geometric modeling engine, a second geometric modeling operation corresponding to the first geometric modeling parameter and the second geometric modeling parameter is executed. The test result corresponding to the test case is obtained based on the second geometric modeling operation.

9. The method according to claim 6, characterized in that, The command class instance also includes a clear function interface, and the method further includes: In response to the completion of the geometric modeling engine test, the test parameters are cleared through the clear function interface.

10. A testing device for a geometric modeling engine, characterized in that, The device relates to a testing system and a geometric modeling engine. The testing system runs test scripts, which are script programs configured based on a first programming language. The device includes: A registration module is used to register command class instances for testing the geometric modeling engine in the testing system. The command class instances provide several function interfaces. The test case determination module is used to determine test cases for the geometric modeling engine, execute the test cases through the test script, determine the test commands corresponding to the test cases and the parameter sequences corresponding to each test command, wherein the parameter type of the parameter sequence is the first programming language; The command class instance extraction module is used to extract a target command class instance that matches the test command from the registered command class instances according to the parameter sequence. The testing module is used to parse the parameter sequence according to the function interface of the target command class instance, obtain test parameters of the second programming language, and test the geometric modeling engine according to the test parameters to obtain the test results corresponding to the test cases.

11. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; The memory is used to store computer programs; When the processor executes a program stored in the memory, it implements the method as described in any one of claims 1-9.

12. A computer-readable storage medium having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Test method and application program starting time consumption test method

    CN112181822A

  • Smart card test method, system and device and storage medium

    CN118394648A