An Automated Testing Method and System for Interactive and Parametric Modeling Oriented to CAD
By binding mouse screen coordinates and three-dimensional world coordinates in CAD automation testing, and combining viewport size and camera transformation matrix, the problem of insufficient test coverage in the existing technology is solved, and high-precision reproduction and comprehensiveness and accuracy of full user operations are achieved.
Patent Information
- Application Number
- CN202510588230.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-08
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2045-05-08
AI Technical Summary
The existing CAD automated testing methods are difficult to cover all user operation types, especially in the interactive free modeling and parameterized modeling process, the recording and playback mechanisms have limitations, resulting in insufficient comprehensiveness and reliability of the test.
By binding the mouse screen coordinates and three-dimensional world coordinates during the script recording stage, and introducing a coordinate conversion mechanism during the playback stage, combining the viewport size, camera transformation matrix and working plane parameters, we ensure high-precision restoration of mouse operations and realize recording and accurate playback of all user operations.
It realizes high-precision reproduction in cross-environment, ensures the comprehensiveness, accuracy and reliability of tests, promptly discovers potential problems, and supports complex CAD modeling and testing requirements.
Smart Images

Figure CN120104509B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of engineering digitalization technology, and in particular to a CAD-oriented interactive and parametric modeling automated testing method and system. Background Art
[0002] Computer-aided design (CAD) is a technology that uses computers and graphics equipment to assist designers in their design work. During the CAD modeling process, users need to perform numerous interactive operations, including editing, zooming in and out, translating, rotating, and parametric modeling. To ensure the stability and functional integrity of CAD software, automated testing is a crucial component of software development and maintenance. Currently, the mainstream CAD automated testing method primarily utilizes script recording and playback, which records user commands to achieve automated testing.
[0003] However, since CAD modeling involves complex three-dimensional spatial interactions, the existing recording and playback mechanisms have certain limitations and are difficult to cover all types of user operations. Especially in the interactive free modeling and parametric modeling processes, some operation instructions cannot be correctly recorded or played back, and the user's actual operations cannot be simulated, which reduces the comprehensiveness and reliability of the test. Summary of the Invention
[0004] The present disclosure provides a CAD-oriented interactive and parametric modeling automated testing method and system, which can support a full range of user operation types, achieve high-precision reproduction of interactive free modeling and parametric modeling operations across environments, and ensure the comprehensiveness, accuracy and reliability of the test.
[0005] In a first aspect, the present disclosure provides a CAD-oriented interactive and parametric modeling automated testing method, comprising:
[0006] Step S10: Start the script recording mode to capture all user modeling operation instructions;
[0007] Step S20, serializing the user modeling operation instructions, and associating the mouse screen coordinates recorded in the mouse operation instructions with the corresponding three-dimensional world coordinates, and writing them into a script file;
[0008] Step S30, start the script playback mode and load the script file;
[0009] Step S40, parse the script file, deserialize it in sequence to generate user modeling operation instructions, and execute the user modeling operation instructions. For the mouse operation instructions, take the three-dimensional world coordinates in the script file as the reference, combine the viewport size, camera transformation matrix and working plane parameters in the current test running environment, and calculate the reconstructed mouse screen coordinates; compare the reconstructed mouse screen coordinates with the recorded mouse screen coordinates. If the comparison results are consistent, execute the current mouse operation instructions according to the recorded mouse screen coordinates; if the comparison results are inconsistent, update the current mouse operation instructions according to the reconstructed mouse screen coordinates, execute the updated mouse operation instructions, and record the inconsistent comparison results in the first error report.
[0010] In some embodiments, the user modeling operation instructions include file operation instructions, mouse operation instructions, keyboard operation instructions, tool command instructions, tool setting data operation instructions, and attribute operation instructions.
[0011] In some embodiments, the three-dimensional world coordinates are generated by the following steps:
[0012] Maps the mouse screen coordinates to 3D world coordinates based on the current viewport size, camera transformation matrix, and construction plane parameters.
[0013] In some embodiments, the step S20 further includes: if the user's operation is based on editing the initial model file, the initial model file is synchronously saved in the script file.
[0014] In some embodiments, the method further comprises:
[0015] Step S50: monitoring the process of executing the user modeling operation instructions during the test playback. If there is an exception, crash, or no response, the test is determined to have failed and a second error report is generated. If all user modeling operation instructions are executed and there are no exceptions, the test model file is output.
[0016] In step S60, the test model is compared with the reference model during recording. If they are completely consistent, the system modeling function test is determined to have passed; if there is any inconsistency, the test is determined to have failed, and a second error report is generated.
[0017] In some embodiments, in step S60 , the modeling results are verified through geometric consistency verification and attribute consistency verification.
[0018] In a second aspect, the present disclosure provides a CAD-oriented interactive and parametric modeling automated testing system for executing the CAD-oriented interactive and parametric modeling automated testing method, the system comprising:
[0019] The recording startup module is used to start the script recording mode and capture all user modeling operation instructions;
[0020] The script generation module is used to serialize the user modeling operation instructions, associate the mouse screen coordinates recorded in the mouse operation instructions with the corresponding three-dimensional world coordinates, and write them into the script file;
[0021] Playback startup module, used to start script playback mode and load script files;
[0022] The script playback module is used to parse the script file, deserialize it in sequence to generate user modeling operation instructions, and execute the user modeling operation instructions. For mouse operation instructions, the three-dimensional world coordinates in the script file are used as a reference, combined with the viewport size, camera transformation matrix and working plane parameters in the current test running environment, to calculate the reconstructed mouse screen coordinates; compare the reconstructed mouse screen coordinates with the recorded mouse screen coordinates. If the comparison results are consistent, the current mouse operation instructions are executed according to the recorded mouse screen coordinates; if the comparison results are inconsistent, the current mouse operation instructions are updated according to the reconstructed mouse screen coordinates, the updated mouse operation instructions are executed, and the inconsistent comparison results are recorded in the first error report.
[0023] In some embodiments, the system further comprises:
[0024] The test run monitoring module is used to monitor the process of executing user modeling operation instructions during test playback. If there is an exception, crash or no response, the test is judged to have failed and a second error report is generated; if all user modeling operation instructions are executed and there are no exceptions, the test model file is output.
[0025] The model verification module is used to compare the test model with the reference model during recording. If they are completely consistent, the system modeling function test is determined to have passed; if there is any inconsistency, the test is determined to have failed and a second error report is generated.
[0026] The beneficial effects of the present disclosure are that, compared with the prior art, the present disclosure has the following advantages:
[0027] The test method provided by the present invention binds and records the mouse screen coordinates and the three-dimensional world coordinates during the script recording stage, and adds a pre-coordinate conversion step when executing the mouse operation instructions during the script playback stage. This makes the mouse coordinates no longer affected by factors such as the viewport size and camera parameter changes in the test environment during script playback, thereby achieving high-precision restoration of user operations, simulating real user operations, thereby improving the stability of the test and facilitating the implementation of cross-environment testing.
[0028] Therefore, the testing method disclosed in the present invention can support all types of user operations. Within a known range, all user operations will be recorded in the script file and accurately restored during playback, achieving high-precision reproduction of interactive free modeling and parametric modeling operations across environments, ensuring the comprehensiveness, accuracy and reliability of the test.
[0029] Furthermore, the disclosed testing method, combined with real-time anomaly monitoring during the test run and comparison and verification of modeling results, can promptly identify potential issues and verify the correctness of modeling / editing operations, making the test system more adaptable to complex CAD modeling testing requirements. Errors that occur when reconstructing mouse screen coordinates do not affect core functional testing and are classified as warning-level errors, allowing testers to review and analyze test run reports for these errors as needed. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0031] Figure 1 A schematic diagram of the CAD platform framework provided in an embodiment of the present disclosure;
[0032] Figure 2 A schematic diagram of a flow chart of an interactive and parametric modeling automated testing method for CAD provided in an embodiment of the present disclosure;
[0033] Figure 3 A flow chart of another CAD-oriented interactive and parametric modeling automated testing method provided in an embodiment of the present disclosure;
[0034] Figure 4 Schematic diagram of different representations of coordinates corresponding to user mouse operations in multiple coordinate systems provided by an embodiment of the present disclosure;
[0035] Figure 5 A schematic diagram of the front-end UI interface of the CAD platform provided in an embodiment of the present disclosure;
[0036] Figure 6 A schematic diagram of a CAD-oriented interactive and parametric modeling automated testing system provided in an embodiment of the present disclosure.
[0037] The above drawings illustrate specific embodiments of the present disclosure, which will be described in more detail below. These drawings and textual descriptions are not intended to limit the scope of the present disclosure in any way, but rather to illustrate the concepts of the present disclosure to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION
[0038] The present disclosure is further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the present disclosure and are not intended to limit the scope of protection of the present disclosure.
[0039] The order of steps in the present disclosure is for illustrative purposes only. During actual implementation, the order may be adjusted as needed, or some steps may be executed in parallel. Unless the execution of a certain step is clearly dependent on the result of the previous step, the order between the steps does not constitute a limitation on the present disclosure.
[0040] Figure 1 The CAD platform framework used in the embodiments of this disclosure includes a front-end module, an interaction center, and a back-end module. The front-end module is used for display and user interaction, receiving all user operation commands and sending them to the interaction center. The interaction center serves as the distribution center for all operation commands, transferring received user operation commands and response results between the front-end and back-end. The back-end module is used to respond to user operation commands.
[0041] It should be noted that the deployment forms of the back-end module include local stand-alone services, cloud computing nodes or distributed server clusters, and this application does not make specific restrictions on this.
[0042] like Figure 2 As shown, the first embodiment of the present disclosure proposes a CAD-oriented interactive and parametric modeling automated testing method, including:
[0043] Step S10: Start the script recording mode to capture all user modeling operation instructions.
[0044] Script recording refers to recording the user's operation process on the front end of the CAD platform and recording the user's operations in a special way.
[0045] Specifically, the user starts the automated test script recording mode and captures the operation instructions input by the user at the front end of the CAD platform in real time through the interactive center.
[0046] In some embodiments, user modeling operations include file operations, mouse operations, keyboard operations, tool command operations, tool setting data operations, and attribute operations.
[0047] See also Figure 5In one example, the CAD platform's UI interface consists of multiple UI functional components arranged in zones, including the drawing area (workspace), tool settings panel component, resident command interaction component, property panel component, message display component, and menu and toolbar components. Specifically, the UI interface is divided into six zones: A, B, C, D, E, and F. These zones are: Zone A: Menu and Toolbar Components; Zone B: Property Panel Components; Zone C: Tool Settings View Components; Zone D: Drawing Area (Workspace); Zone E: Message Display Components; and Zone F: Resident Command Interaction Components.
[0048] In the embodiment of the present disclosure, the mouse operation and keyboard operation include operations such as movement, clicking, scrolling, and keyboard key input performed by the user in the drawing area (area D) based on the mouse or keyboard.
[0049] In the CAD platform, the main means of interactive free modeling is the mouse and keyboard, which are used to operate 3D models, perform 3D view control (translation, rotation, zoom), etc., as well as pick 3D points in space, create / select / edit models, and other operations.
[0050] Parametric modeling also requires the coordinated use of the mouse and keyboard. For example, when creating a parametric geometric shape, you can first draw the basic outline with the mouse, and then use the keyboard to enter parameters to control the complexity of the shape, such as the radius of an arc or the number of sides of a polygon, to meet actual modeling needs.
[0051] It should be noted that in the embodiment of the present disclosure, "mouse operation instructions" specifically refer to mouse operation instructions executed in the drawing area (area D), which are used to complete model element picking, obtaining point coordinates, etc., as well as view operations (translation / rotation / zooming, etc.).
[0052] In contrast, mouse events in other areas of the UI are handled by the front-end module and are not passed to the back-end module. For example, when a user clicks the "Draw Line" button, the front-end module processes this click event, interprets the click as an instruction to launch the line drawing tool, constructs a tool command to launch the line drawing tool, and passes it to the back-end module, which then launches the line drawing tool based on this tool command. In other words, unlike the "mouse operation instructions" in this embodiment, mouse events in other areas of the UI can be considered global, and each interactive tool requires the coordination of the mouse and keyboard.
[0053] In the embodiments of the present disclosure, tool commands refer to instructions used by users to switch and call various tools to complete modeling operations during the modeling process. The tools include two-dimensional primitive graphics drawing, two-dimensional complex line / graphics drawing, three-dimensional primitive entity creation, three-dimensional complex entity creation, etc.
[0054] For example, users can switch different tools (such as drawing lines, stretching, rotating, etc.) through tool commands to perform modeling according to modeling / editing needs;
[0055] In an embodiment of the present disclosure, the tool setting data operation is used to specify various input tool setting data of the modeling tool operation parameters, for example, the cube drawing tool setting data includes: whether orthogonal, whether to specify length, length, whether to specify width, width, whether to specify height, height.
[0056] In the embodiment of the present disclosure, property operation refers to the global operation of viewing, adding, deleting, modifying and querying model properties (including basic properties such as color, line type, line width, transparency, layer, and custom extended properties) by selecting a CAD model when the property component is in the display state during system operation.
[0057] In the embodiment of the present disclosure, file operations include creating, opening, saving, and closing files.
[0058] In some embodiments, starting the script recording mode is to initialize the system for script recording, specifically including: starting the CAD platform from the automated test mode entrance, turning on the script recording switch in the interactive center message receiving interface, so that the received user modeling operation instructions can be written into the script file (for example, the script file can be written through the script writer object).
[0059] Step S20 , serializing the user modeling operation instructions, and associating the recorded mouse screen coordinates in the mouse operation instructions with the corresponding three-dimensional world coordinates, and writing them into a script file.
[0060] Specifically, to ensure the simulation of real user usage scenarios, all instructions sent from the front-end module to the interaction center are captured and recorded during script recording to form an instruction sequence, and are written into the script file one by one in the chronological order of the operations. In this process, the mouse screen coordinates ( X s ,Y s ) and the corresponding three-dimensional world coordinates ( X w ,Y w ,Z w ) to associate the corresponding three-dimensional world coordinates ( X w ,Y w ,Z w ) is saved synchronously to the script file; when the recording is completed, the system will automatically save the script file and exit the recording mode.
[0061] The recorded mouse screen coordinates refer to the mouse screen coordinates recorded in the script file in the recording mode.
[0062] like Figure 4 As shown, the mouse screen coordinates are the rectangular coordinate system of the two-dimensional projection of the three-dimensional space on the screen. The three-dimensional world coordinates are the rectangular coordinate system of the model space of the three-dimensional space and are used as the basis for coordinate conversion during the script playback phase described later. As you can see, the three-dimensional model appears in a three-dimensional form in the 3D viewport of the CAD drawing interface.
[0063] In some embodiments, the three-dimensional world coordinates ( X w ,Y w ,Z w ) are as follows:
[0064] According to the current viewport size, camera transformation matrix and working plane parameters, the mouse screen coordinates ( X s ,Y s ) is mapped to 3D world coordinates.
[0065] Specifically, based on the current viewport size, camera transformation matrix and working plane parameters, the mouse screen coordinates are mapped to three-dimensional world coordinates using conventional image coordinate and three-dimensional coordinate conversion technology. This is a common method of interactive modeling software. The relevant method is well known to those skilled in the art and will not be repeated here.
[0066] In this embodiment, the viewport size refers to the plane size of the model space when it is rendered to a two-dimensional screen, that is, the plane size of the drawing area (area D), including width and height, and is usually expressed in pixels.
[0067] The camera transformation matrix is a mathematical matrix used in computer graphics to map a three-dimensional object into a two-dimensional screen view through view and projection transformations. The view transformation (including translation and rotation) describes the camera's orientation and position in the world coordinate system, while the projection transformation describes the projection mode used (including orthographic and perspective projection). The backend module updates the camera transformation matrix in response to user operations such as translation, rotation, and scaling of the view.
[0068] Among them, the method for determining the camera transformation matrix is a common technology in computer graphics used for mapping and converting two-dimensional projection images and three-dimensional object coordinates. The relevant method is well known to those skilled in the art and will not be repeated here.
[0069] A work plane is a specific two-dimensional plane where points are picked and graphics are drawn during the modeling process. It is used to assist in positioning and drawing operations.
[0070] For example, you can set the working plane to the XY plane in the world coordinate system: the working plane is defined by the point (0,0,0) and the normal vector (0,0,1), and all points on the plane satisfy z=0.
[0071] In this embodiment, the current viewport size, camera transformation matrix and working plane parameters are obtained from the operating data of the backend module.
[0072] In other embodiments, the mouse screen coordinates ( X s ,Y s ) corresponds to the three-dimensional world coordinates ( X w ,Y w ,Z w ).
[0073] Further optionally, the step S20 further includes generating a reference model file for recording the reference model finally generated during the script recording process.
[0074] In some embodiments, the step S20 further includes: if the user's operation is based on editing the initial model file, the initial model file is synchronously saved in the script file.
[0075] Specifically, the initial model file is synchronously saved into the script file, for example, by directly embedding the complete binary data or text structure data (such as STEP format) of the initial model file into the script file, or by recording the storage path of the initial model file in the script file.
[0076] In some embodiments, the script file uses a structured text format (such as JSON, XML) or a binary encoding format (such as Protocol Buffers, custom byte stream).
[0077] Step S30: Start the script playback mode and load the script file.
[0078] Script playback means allowing the CAD platform to automatically execute the user's operation process according to the recorded script file.
[0079] Specifically, starting the script playback mode is to initialize the system for script playback, including: starting the CAD platform from the automated test mode entrance, starting the script playback switch in the interactive center message receiving interface, loading and parsing the script file, so that the interactive center can receive the parsed user modeling operation instructions, and then execute the script playback, and specify the test model file output during the playback execution process.
[0080] Step S40, parse the script file, deserialize it in sequence to generate user modeling operation instructions, and execute the user modeling operation instructions. For the mouse operation instructions, take the three-dimensional world coordinates in the script file as the reference, combine the viewport size, camera transformation matrix and working plane parameters in the current test running environment, and calculate the reconstructed mouse screen coordinates; compare the reconstructed mouse screen coordinates with the recorded mouse screen coordinates. If the comparison results are consistent, execute the current mouse operation instructions according to the recorded mouse screen coordinates; if the comparison results are inconsistent, update the current mouse operation instructions according to the reconstructed mouse screen coordinates, execute the updated mouse operation instructions, and record the inconsistent comparison results in the first error report.
[0081] Further optionally, inconsistent comparison results are recorded in an error report and classified as warning-level errors.
[0082] It should be noted that in the CAD platform, when the command is a mouse operation, including mouse movement, clicking, scrolling, etc., the data sent by the front-end module to the interaction center contains the coordinates of the mouse, which are the coordinates Ps ( X s ,Y s ), when the back-end module performs modeling, it receives the mouse operation command sent by the front-end user, and converts it into the coordinate Pw( X w ,Y w ,Z w ), the final modeling data is based on the three-dimensional world coordinates.
[0083] However, during script playback, the execution of command sequences is a chain process. The correct execution of each command depends on the correct execution of the previous command. Among them, mouse operation commands are the most numerous. During command execution, the following problems often occur:
[0084] 1) Due to hardware or software issues, the 3D viewport size during playback is different from that during recording, which causes a deviation in the conversion of screen coordinates to 3D world coordinates during playback;
[0085] 2) When adjusting the view (translation, rotation, zoom), due to issues with the CAD platform execution, the camera is not adjusted to the orientation during recording (that is, the current camera transformation matrix is different from that during recording), resulting in deviations when converting screen coordinates to 3D world coordinates.
[0086] For example, during recording, in an 800x600 pixel viewport, clicking the screen center coordinates (400, 300) generates a cube, which corresponds to the 3D world coordinates (5, 5, 0). During playback, the viewport is changed to 1800x1012 pixels, and the screen center coordinates become (900, 506). If the recorded screen center coordinates (400, 300) are used directly, the cube will be incorrectly placed far away from the actual target.
[0087] For example, when recording, a horizontal line is drawn using a front-view angle. During playback, due to deviation, the angle is switched to a top-down angle. The same screen coordinates may be mapped to different three-dimensional space heights, causing the line to shift.
[0088] However, on the one hand, the mouse operation interface generally has no return value or exception report. During the test process, it is impossible to determine whether the system's response to the mouse operation is correct from the interface call level. Therefore, mouse operation response errors may interfere with the test run of the CAD core modeling function, making it difficult to distinguish whether the source of the error is an abnormal mouse operation response or a core modeling function failure during the test process, resulting in the inability to execute the CAD test process normally. On the other hand, when the user actually operates, the focus is not on the screen coordinates themselves, but on the target position in three-dimensional space (such as clicking on a model vertex). If the model view is not adjusted to the expected state due to response deviations such as viewport size and camera parameters, the user will reposition the target by translating / rotating the view, etc. The coordinate conversion mechanism is equivalent to simulating this adaptation process during playback.
[0089] Therefore, in order to ensure that the test operation is not affected by the deviation when the mouse screen coordinates are converted to three-dimensional world coordinates during script playback, and to ensure that the test is executed normally, the core of the test in the embodiment of the present disclosure is to verify the correctness of the modeling operation process and results. To this end, a mouse screen coordinate comparison verification and correction mechanism is introduced in the script playback stage. Specifically, in the script recording stage, when recording the mouse command, the three-dimensional world coordinates in the current modeling state are attached. In the script playback stage, when executing the mouse operation command, based on the three-dimensional world coordinates in the script file, combined with the viewport size, camera transformation matrix and working plane parameters in the current test run, the reconstructed mouse screen coordinates are calculated and compared with the recorded mouse screen coordinates. If the comparison results are consistent, the current mouse operation command is executed according to the recorded mouse screen coordinates; if the comparison results are inconsistent, the current mouse operation command is updated according to the reconstructed mouse screen coordinates, and the updated mouse operation command is executed, thereby eliminating the coordinate mapping error caused by viewport scaling, camera angle difference or working plane offset, thereby achieving high-precision restoration of interactive free modeling and parametric modeling operations across environments, and ensuring the normal execution of the test.
[0090] On the other hand, errors resulting from the inconsistency between the comparison results of the reconstructed mouse screen coordinates and the recorded mouse screen coordinates do not affect the core function test and are classified as warning-level errors so that testers can review and analyze the test run report of the error when needed.
[0091] Among them, the reconstructed mouse screen coordinates are calculated based on the three-dimensional world coordinates in the script file, combined with the viewport size, camera transformation matrix and working plane parameters in the current test run. The conventional two-dimensional projection image coordinate and three-dimensional world coordinate conversion method in this field can be used. The relevant method is well known to those skilled in the art and will not be repeated here.
[0092] Optionally, the viewport size, camera transformation matrix and working plane parameters in this embodiment can be obtained from the instruction execution data of the backend module.
[0093] In some embodiments, during the script playback phase, when executing a file opening operation instruction, the system operates as follows: importing the initial model file, and restoring the settings saved in the initial model file, including the currently activated layer, color, line type, line width, camera perspective, etc.
[0094] The disclosed embodiment binds and records the mouse screen coordinates and the three-dimensional world coordinates during the script recording stage, and introduces a mouse screen coordinate comparison, verification and correction mechanism during the script playback stage when executing mouse operation instructions. This ensures that the mouse coordinates are not affected by factors such as viewport size and camera parameter changes in the test environment during script playback, achieves accurate restoration of the model position under different test environments due to mouse operations, simulates the user's real operations, and thus accurately completes the modeling operation test, which is conducive to the implementation of cross-environment testing.
[0095] Therefore, the testing method of the embodiment of the present disclosure can support all types of user operations. Within a known range, all user operations will be recorded in the script file and accurately restored during playback, achieving high-precision reproduction of interactive free modeling and parametric modeling operations across environments, ensuring the comprehensiveness, accuracy and reliability of the test.
[0096] like Figure 3 As shown, the second embodiment of the present disclosure proposes another CAD-oriented interactive and parametric modeling automated testing method, which, based on the above-mentioned first embodiment, further includes:
[0097] Step S50, monitor the process of executing user modeling operation instructions during the test playback. If there is an exception, crash or no response, the test is determined to have failed and a second error report is generated; if all user modeling operation instructions are executed and there is no exception, the test model file is output.
[0098] In step S60, the test model is compared with the reference model during recording. If they are completely consistent, the system modeling function test is determined to have passed; if there is any inconsistency, the test is determined to have failed, and a second error report is generated.
[0099] In the embodiment of the present disclosure, the test model file is used to record the test model generated during the playback execution process, and the reference model file is used to record the reference model generated during the script recording process.
[0100] Specifically, during the judgment test process, if all user modeling operation instructions are executed and there are no abnormal situations, the test is judged to be executed without problems and the modeling / editing results need to be further verified.
[0101] After the test is completed, the executed operation information and the output test model file are saved as the basis for use case comparison.
[0102] In some embodiments, modeling results are verified through geometric consistency verification and attribute consistency verification. Geometric consistency verification includes standardized preprocessing of the test model and reference model, topological structure consistency comparison and comparison based on hash values (such as SHA-256) to ensure the consistency of the model's geometric data and record the location of any inconsistencies. Attribute consistency verification compares each model attribute (such as layer, color, line type, etc.) item by item to ensure the integrity and accuracy of the model attributes.
[0103] At the same time, the error report can be output to facilitate testers to query the running process and perform subsequent debugging and optimization based on the test running situation.
[0104] The disclosed embodiments monitor anomalies, crashes, or unresponsiveness in real time during the test run, thereby promptly discovering potential problems and avoiding the omission of erroneous results. By comparing the model generated during the test process with the reference model during recording, the correctness of the modeling / editing operations can be effectively verified, enabling the test system to better adapt to the needs of complex CAD modeling tests.
[0105] like Figure 6 As shown, the third embodiment of the present disclosure provides a CAD-oriented interactive and parametric modeling automated testing system 100, which is used to execute the CAD-oriented interactive and parametric modeling automated testing method as described in the above embodiments. The system includes:
[0106] The recording start module 101 is used to start the script recording mode and capture all user modeling operation instructions;
[0107] The script generation module 102 is used to serialize the user modeling operation instructions, associate the mouse screen coordinates recorded in the mouse operation instructions with the corresponding three-dimensional world coordinates, and write them into a script file;
[0108] The playback start module 103 is used to start the script playback mode and load the script file;
[0109] The script playback module 104 is used to parse the script file, deserialize it in sequence to generate user modeling operation instructions, and execute the user modeling operation instructions. For mouse operation instructions, the three-dimensional world coordinates in the script file are used as a reference, combined with the viewport size, camera transformation matrix and working plane parameters in the current test running environment, to calculate the reconstructed mouse screen coordinates; compare the reconstructed mouse screen coordinates with the recorded mouse screen coordinates. If the comparison results are consistent, the current mouse operation instructions are executed according to the recorded mouse screen coordinates; if the comparison results are inconsistent, the current mouse operation instructions are updated according to the reconstructed mouse screen coordinates, the updated mouse operation instructions are executed, and the inconsistent comparison results are recorded in the first error report.
[0110] In some embodiments, the system further comprises:
[0111] The test operation monitoring module 105 is used to monitor the process of executing user modeling operation instructions during test playback. If there is an exception, crash or no response, the test is judged to have failed and a second error report is generated; if all user modeling operation instructions are executed and there is no exception, the test model file is output.
[0112] The model verification module 106 is used to compare the test model with the reference model during recording. If they are completely consistent, the system modeling function test is determined to have passed; if there is any inconsistency, the test is determined to have failed and a second error report is generated.
[0113] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0114] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.
[0115] It should be understood that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present disclosure.
Claims
1. A CAD-oriented interactive and parametric modeling automated testing method, characterized in that: include: Step S10: Start the script recording mode to capture all user modeling operation instructions; Step S20, serializing the user modeling operation instructions, and associating the mouse screen coordinates recorded in the mouse operation instructions with the corresponding three-dimensional world coordinates, and writing them into a script file; Step S30, start the script playback mode and load the script file; Step S40: parsing the script file, sequentially deserializing and generating user modeling operation instructions, and executing the user modeling operation instructions. For mouse operation instructions, the reconstructed mouse screen coordinates are calculated based on the three-dimensional world coordinates in the script file and the viewport size, camera transformation matrix, and working plane parameters in the current test running environment. The reconstructed mouse screen coordinates are compared with the recorded mouse screen coordinates. If the comparison results are consistent, the current mouse operation instruction is executed according to the recorded mouse screen coordinates. If the comparison results are inconsistent, the current mouse operation instruction is updated according to the reconstructed mouse screen coordinates, the updated mouse operation instruction is executed, and the inconsistent comparison result is recorded in the first error report. The mouse operation instructions refer to mouse operation instructions executed in the drawing area of the CAD interface, which are used to complete operations including but not limited to: picking model elements, obtaining point coordinates, and view operations.
2. The CAD-oriented interactive and parametric modeling automated testing method according to claim 1, characterized in that: The user modeling operation instructions include file operation instructions, mouse operation instructions, keyboard operation instructions, tool command instructions, tool setting data operation instructions and attribute operation instructions.
3. The CAD-oriented interactive and parametric modeling automated testing method according to claim 1, characterized in that: The three-dimensional world coordinates are generated by the following steps: Maps the mouse screen coordinates to 3D world coordinates based on the current viewport size, camera transformation matrix, and construction plane parameters.
4. The CAD-oriented interactive and parametric modeling automated testing method according to claim 1, characterized in that: In the step S20, it further includes: if the user's operation is based on the initial model file for editing, the initial model file is synchronously saved in the script file.
5. The CAD-oriented interactive and parametric modeling automated testing method according to claim 1, characterized in that: The method further comprises: Step S50: monitoring the process of executing the user modeling operation instructions during the test playback. If there is an exception, crash, or no response, the test is determined to have failed and a second error report is generated. If all user modeling operation instructions are executed and there are no exceptions, the test model file is output. In step S60, the test model is compared with the reference model during recording. If they are completely consistent, the system modeling function test is determined to have passed; if there is any inconsistency, the test is determined to have failed, and a second error report is generated.
6. The CAD-oriented interactive and parametric modeling automated testing method according to claim 5, characterized in that: In step S60 , the modeling result is verified through geometric consistency verification and attribute consistency verification.
7. A CAD-oriented interactive and parametric modeling automated testing system, configured to execute the CAD-oriented interactive and parametric modeling automated testing method according to any one of claims 1 to 6, characterized in that: The system comprises: The recording startup module is used to start the script recording mode and capture all user modeling operation instructions; The script generation module is used to serialize the user modeling operation instructions, associate the mouse screen coordinates recorded in the mouse operation instructions with the corresponding three-dimensional world coordinates, and write them into the script file; Playback startup module, used to start script playback mode and load script files; The script playback module is used to parse the script file, deserialize it in sequence to generate user modeling operation instructions, and execute the user modeling operation instructions. For mouse operation instructions, the three-dimensional world coordinates in the script file are used as a reference, combined with the viewport size, camera transformation matrix and working plane parameters in the current test running environment, to calculate the reconstructed mouse screen coordinates; compare the reconstructed mouse screen coordinates with the recorded mouse screen coordinates. If the comparison results are consistent, the current mouse operation instructions are executed according to the recorded mouse screen coordinates; if the comparison results are inconsistent, the current mouse operation instructions are updated according to the reconstructed mouse screen coordinates, the updated mouse operation instructions are executed, and the inconsistent comparison results are recorded in the first error report.
8. The CAD-oriented interactive and parametric modeling automated testing system according to claim 7, characterized in that: The system further comprises: The test run monitoring module is used to monitor the process of executing user modeling operation instructions during test playback. If there are any exceptions, crashes or no response, the test is judged to have failed and a second error report is generated. If all user modeling operation instructions are executed and there are no exceptions, the test model file is output; The model verification module is used to compare the test model with the reference model during recording. If they are completely consistent, the system modeling function test is determined to have passed; if there is any inconsistency, the test is determined to have failed and a second error report is generated.
Citation Information
Patent Citations
Automatic test method and device of CAD software, storage medium and processor
CN114116485A
Automatic testing method and equipment of three-dimensional CAD system and medium
CN118503139A