Test case writing method and device, readable storage medium and electronic equipment
By automatically parsing source files and header files and obtaining and assigning function pointers, the flexibility of the instruction set emulator test case management is solved, the complexity of test case writing is reduced, and the writing efficiency and code maintainability is improved.
Patent Information
- Application Number
- CN202510783903.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-12
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2045-06-12
AI Technical Summary
In the prior art, the instruction set simulator test case management lacks flexibility, and the test case writing is complex and difficult to meet current needs.
By obtaining the file name in the specified file, extracting the source file and header file corresponding to the test case, matching and assigning the test case registry structure member variables to function pointers, and automatically updating the registry structure.
Reduces the complexity of test case writing, improves writing efficiency, ensures that the registry is consistent with the latest test case definitions, reduces manual maintenance workload, and improves code maintainability and reliability.
Smart Images

Figure CN120295927A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of testing, and in particular, to a method, device, readable storage medium, and electronic device for writing test cases. Background Art
[0002] In the prior art, there are many deficiencies in the management of instruction set simulator (simulator) test cases. The problems are particularly prominent in the firmware simulation (used to simulate the hardware environment for testing firmware code running on the windows platform). Currently, each test case can only be configured before compilation, lacking flexibility. There is no unified specification and standard for writing test cases. If more general test cases are to be written, it is necessary to configure them one by one through the command line, which means that a set of command line functions need to be written manually for each test case, greatly increasing the complexity of writing test cases and seriously reducing the writing efficiency, making it difficult to meet the current requirements for writing and managing test cases. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to provide a method, device, readable storage medium, and electronic device for writing test cases, which can reduce the complexity of writing test cases.
[0004] To solve the above technical problem, a technical solution adopted by the present invention is: A method for writing test cases includes the steps of: Obtaining all file names in a specified file, and extracting the source files and header files corresponding to each test case from the specified file according to the all file names; Obtaining the member variables of the test case registry structure; Matching the function names corresponding to the member variables of the test case registry structure from the source files and the header files, and assigning the function pointers corresponding to the function names to the member variables of the test case registry structure; Updating the specified file based on the member variables of the test case registry structure after assignment.
[0005] To solve the above technical problem, another technical solution adopted by the present invention is: A device for writing test cases includes: A file extraction module, configured to obtain all file names in a specified file, and extract the source files and header files corresponding to each test case from the specified file according to the all file names; A variable acquisition module, configured to obtain the member variables of the test case registry structure; An assignment module, configured to match function names corresponding to member variables of the test case registry structure from the source file and the header file, and assign the member variables of the test case registry structure as function pointers corresponding to the function names; A file update module, configured to update the specified file based on the member variables of the test case registry structure after assignment.
[0006] To solve the above technical problems, another technical solution adopted by the present invention is: A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each step in the above test case writing method is implemented.
[0007] To solve the above technical problems, another technical solution adopted by the present invention is: An electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, each step in the above test case writing method is implemented.
[0008] The beneficial effects of the present invention are as follows: obtaining all file names in the specified file, extracting the source file and header file corresponding to each test case from the specified file according to all file names, obtaining the member variables of the test case registry structure, matching the function names corresponding to the member variables of the test case registry structure from the source file and the header file, and assigning the member variables of the test case registry structure as function pointers corresponding to the function names, updating the specified file based on the member variables of the test case registry structure after assignment, thereby automatically parsing the source file and the header file, extracting the function names of the test cases, and assigning them as corresponding function pointers, so that the registration information of the test cases is automatically updated, without manually modifying the registry, and without manually writing similar code repeatedly for the registration and configuration of each test case, thereby reducing the complexity of writing test cases and further improving the efficiency of writing test cases. Description of the Drawings
[0009] Figure 1 It is a step flowchart of a test case writing method according to an embodiment of the present invention; Figure 2 It is a schematic structural diagram of a test case writing device according to an embodiment of the present invention; Figure 3 It is a schematic structural diagram of an electronic device according to an embodiment of the present invention; Figure 4 It is a case registration flowchart in a test case writing method according to an embodiment of the present invention; Figure 5 It is a case command line function generation flowchart in a test case writing method according to an embodiment of the present invention. Detailed implementation manners
[0010] To describe in detail the technical content, achieved objectives and effects of the present invention, the following is described in conjunction with the implementation manners and accompanied by the drawings.
[0011] Please refer to Figure 1 , a test case writing method, including the steps of: Obtain all file names in a specified file, and extract the source file and header file corresponding to each test case from the specified file according to the all file names; Obtain the member variables of the test case registry structure; Match the function names corresponding to the member variables of the test case registry structure from the source file and the header file, and assign the member variables of the test case registry structure as function pointers corresponding to the function names; Update the specified file based on the member variables of the test case registry structure after assignment.
[0012] As can be seen from the above description, the beneficial effects of the present invention are as follows: Obtain all file names in a specified file, extract the source file and header file corresponding to each test case from the specified file according to the all file names, obtain the member variables of the test case registry structure, match the function names corresponding to the member variables of the test case registry structure from the source file and the header file, assign the member variables of the test case registry structure as function pointers corresponding to the function names, and update the specified file based on the member variables of the test case registry structure after assignment, so as to automatically parse the source file and the header file, extract the function names of the test cases, and assign them as corresponding function pointers, so that the registration information of the test cases is automatically updated, without manually modifying the registry, and without manually writing similar code for the registration and configuration of each test case, thereby reducing the complexity of writing test cases and further improving the efficiency of writing test cases.
[0013] Further, the obtaining of the member variables of the test case registry structure includes: Find the structure definition from the file storing the test case registry structure; Use a parsing function to parse the structure definition to obtain the structure member variables; Store the structure member variables into the test case registry structure.
[0014] As described above, by using a parsing function to parse the structure definition, the structure member variables are obtained, and the structure member variables are stored in the test case registry structure, realizing the automatic management and update of the test case registry structure, which can reduce the workload of manually maintaining the registry, and at the same time ensure that the registry structure is always consistent with the latest test case definition, improving the maintainability and reliability of the code.
[0015] Further, the structure member variables include the member variable name and its corresponding type name; The matching of the function names corresponding to the test case registry structure member variables from the source file and the header file, and the assignment of the test case registry structure member variables as function pointers corresponding to the function names includes: Apply for a block of memory; Write the pre-data of the registration function into the memory; Traverse each type name in the test case registry structure; For the traversed type name, if the type name is a non-function type, write a preset assignment statement into the memory, and write the post-data of the registration function into the memory; And / or, if the type name is a function type, determine whether there are function declarations and function definitions of the member variable name corresponding to the type name in the header file and the source file. If so, write statement data assigning the function pointer corresponding to the function definition into the memory, and write the post-data of the registration function into the memory.
[0016] As described above, by parsing the structure member variables (including variable names and type names) and combining the function information in the source file and the header file, the structure member variables are automatically assigned as corresponding function pointers, reducing the complexity of manually writing and maintaining the registry structure, and at the same time being able to adapt to changes in test cases, thus improving the writing efficiency.
[0017] Further, the determining whether there are function declarations and function definitions of the member variable name corresponding to the type name in the header file and the source file. If so, writing statement data assigning the function pointer corresponding to the function definition into the memory, and writing the post-data of the registration function into the memory includes: A function declaration for determining whether there is a member variable name corresponding to the type name in the header file. If not, statement data with an assignment of 0 is written to the memory, and the post-data of the registration function is written to the memory. If so, it is determined whether there is a function definition corresponding to the function declaration in the source file. If so, statement data with an assignment of the function pointer corresponding to the function definition is written to the memory, and the post-data of the registration function is written to the memory. If not, an error message is output.
[0018] As can be seen from the above description, by gradually checking the function declarations in the header file and the function definitions in the source file, correct assignment statements are dynamically generated for the registry structure, avoiding runtime errors caused by missing functions or mismatched declarations. It can also promptly detect potential errors (such as the existence of function declarations but missing definitions), and remind developers to correct them through error messages, thus ensuring the correct operation of test cases.
[0019] Further, updating the specified file based on the member variables of the test case registry structure after assignment includes: Updating the data in the memory to the specified file.
[0020] As can be seen from the above description, by updating the data in the memory to the specified file, it can ensure that the latest state of the registry structure is saved, enabling subsequent program runs to be executed based on the latest registration information, and ensuring the correct registration and operation of test cases.
[0021] Further, it also includes: Loading the file data in the header file into the memory; Determining whether there is a use case information structure corresponding to the header file in the memory. If so, each member variable of the use case information structure is output, and waiting to receive the parameters required by the member variables of the use case information structure.
[0022] As can be seen from the above description, by loading the data in the header file into the memory and checking whether there is a corresponding use case information structure, the configuration parameters (member variables) of each use case can be automatically identified and output. By waiting to receive the parameter values input by the user, the required running parameters can be dynamically configured for each use case. This improves the flexibility and configurability of test cases and also reduces the workload of manually configuring parameters.
[0023] Further, it also includes: Obtaining the test case registry; Determining the test case table to be run from the test case registry; Creating a test case execution thread; Execute the test cases in the to-be-run test case table in the order of the test case execution threads.
[0024] As can be seen from the above description, by obtaining the test case registration table and determining the to-be-run test case table, it is possible to dynamically identify and load the test cases that need to be run, create test case execution threads and execute these test cases in sequence, which can improve the test efficiency, separate the test case execution from the system operation, make the simulator run more flexibly, and simplify the writing difficulty and improve the controllability of the simulator.
[0025] Please refer to Figure 2 , another embodiment of the present invention provides a test case writing device, including: A file extraction module, configured to obtain all file names in a specified file, and extract the source file and header file corresponding to each test case from the specified file according to the all file names; A variable acquisition module, configured to obtain the member variables of the test case registration table structure; An assignment module, configured to match the function names corresponding to the member variables of the test case registration table structure from the source file and the header file, and assign the member variables of the test case registration table structure as function pointers corresponding to the function names; A file update module, configured to update the specified file based on the member variables of the test case registration table structure after assignment.
[0026] Another embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each step in the above test case writing method is implemented.
[0027] Please refer to Figure 3 , another embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, each step in the above test case writing method is implemented.
[0028] The above test case writing method, device, readable storage medium and electronic device of the present invention can be applied to test scenarios, such as scenarios using a simulator for testing, which will be described below through specific embodiments: Please refer to Figure 1 , Figure 4 and Figure 5 , the first embodiment of the present invention is: A test case writing method, including steps: In this embodiment, the principles for writing cases are as follows: create a.h file and a.c or.cpp file for writing case files in the specified file, and the file names are the case name + _case; write the necessary functions, and the function names are the case name plus the member variable names corresponding to the functions of the case structure; write the structure of the configurable parameters of the case, and the structure name is the case name + _Info. The subsequent steps are all carried out according to this principle for case writing.
[0029] S1. Obtain all file names in the specified file, and extract the source files and header files corresponding to each test case from the specified file according to the all file names, as Figure 4 shown.
[0030] Specifically, according to the obtained all file names, extract the files named xxx_case.h, xxx_case.c, and xxx_case.cpp from the specified file, and the prefix xxx of the.h (header file) has the corresponding.c / .cpp (source file).
[0031] In an optional implementation manner, it may further include: saving the source files and header files corresponding to each test case extracted to the test case processing table. For example, save the extracted.c / .cpp files and.h files corresponding to each case to the case processing table in the form of xxx_case.
[0032] S2. Obtain the member variables of the test case registration table structure, specifically including S21 - S23: S21. Search for the structure definition in the file storing the test case registration table structure.
[0033] Specifically, search for the structure definition in the file storing the case registration table structure. If not found, output an error code. If found, execute S22.
[0034] S22. Use the parsing function to parse the structure definition to obtain the structure member variables.
[0035] S23. Store the structure member variables into the test case registration table structure.
[0036] In an optional implementation manner, the structure member variables include the number of member variables, the member variable names, and their corresponding type names, etc.
[0037] In an optional implementation manner, it may further include: traverse the source files and the header files corresponding one by one in the case processing table. For the traversed source files and header files, execute S3. After execution, remove the corresponding files from the case processing table until the case processing table is empty.
[0038] S3. Match the function names corresponding to the member variables of the test case registry structure from the source file and the header file, and assign the member variables of the test case registry structure as function pointers corresponding to the function names. As Figure 4 shown, it specifically includes S31 - S33: S31. Apply for a block of memory.
[0039] In an alternative embodiment, use the malloc (memory allocation) function to apply for a block of memory.
[0040] S32. Write the pre - data of the registration function into the memory.
[0041] Among them, the pre - data of the registration function includes data such as function definitions and required intermediate variables.
[0042] S33. Traverse each type name in the test case registry structure; For the traversed type name, if the type name is a non - function type, write a preset assignment statement into the memory and write the post - data of the registration function into the memory; If the type name is a function type, determine whether there are function declarations and function definitions of the member variable names corresponding to the type name in the header file and the source file. If so, write statement data assigning the function pointer corresponding to the function definition into the memory and write the post - data of the registration function into the memory.
[0043] The preset assignment statement is an assignment statement written in advance.
[0044] Among them, the determination of whether there are function declarations and function definitions of the member variable names corresponding to the type name in the header file and the source file, and if so, writing statement data assigning the function pointer corresponding to the function definition into the memory and writing the post - data of the registration function into the memory includes: Determine whether there is a function declaration of the member variable name corresponding to the type name in the header file. If not, write statement data assigning 0 into the memory and write the post - data of the registration function into the memory. If so, determine whether there is a function definition corresponding to the function declaration in the source file. If so, write statement data assigning the function pointer corresponding to the function definition into the memory and write the post - data of the registration function into the memory. If not, output an error message.
[0045] Specifically, determine whether there is a function declaration of the case name + the member variable name corresponding to the type name in the.h file. If not, append statement data with a value of 0 to the memory, and append the post-data of the registration function to the memory. If so, determine whether there is a function definition corresponding to the function declaration in the.c / .cpp file. If yes, append statement data with a value of the function pointer corresponding to the function definition to the memory, and append the post-data of the registration function to the memory. If not, output an error message.
[0046] S4. Update the specified file based on the member variables of the test case registry structure after assignment.
[0047] Specifically, update the data in the memory to the specified file.
[0048] During the process of running the simulator, if a new case needs to be added, use S1 - S4 to automatically generate a new case. Through S1 - S4, functions and case information (such as case name and case ID) required for case operation can be registered. This has two basic functions: when the sitmulator runs, it will call the corresponding functions in the registry to run; and it can find the position of the case in the registry through the case information.
[0049] In an alternative embodiment, as Figure 5 shown, it further includes: S5. Load the file data in the header file into the memory.
[0050] S6. Determine whether there is a case information structure corresponding to the header file in the memory. If so, output each member variable of the case information structure in the case information structure, and wait to receive the parameters required by the member variables of the case information structure.
[0051] Specifically, determine whether there is an _Info structure corresponding to the.h header file in the memory. If so, use the printf function to output each member variable of the _Info structure, and use the scanf function to wait to receive the parameters required by the member variables of the _Info structure.
[0052] Through S5 and S6, additional parameters required for actual case operation can be obtained.
[0053] In an alternative embodiment, it further includes: S7. Obtain the test case registry.
[0054] S8. Determine the test case table to be run from the test case registry.
[0055] S9. Create a test case execution thread.
[0056] S10. Execute the test cases in the to-be-run test case table in sequence based on the test case execution thread.
[0057] S7 - S10 can be executed synchronously with S1 - S6 or after S1 - S6.
[0058] When a case gets stuck during the operation of the simulator, the exit function in the case file is automatically called to make it exit the stuck process, so as to solve the problem that the case cannot exit the stuck process when the simulator is running.
[0059] The application scenario of the above test case writing method of the present invention is described by examples as follows. Figure 4 As shown, the case registration process includes steps (1) - (10): (1) Open the specified file.
[0060] (2) Traverse the entire file, read and sort the file names of all files in the file.
[0061] (3) Exclude non-.cpp,.c, and.h file names, pair the two types of files, and add them to the case processing table.
[0062] (4) Load the two corresponding.cpp,.c, and.h files into memory.
[0063] (5) Traverse the member variables of the case registration table structure, and splice the case name and the member variable name of the registration table structure.
[0064] (6) Determine whether the corresponding function name is found in the.cpp,.c, and.h files. If so, execute (8); if not, execute (7).
[0065] (7) Assign the corresponding structure variable to 0.
[0066] (8) Assign the corresponding structure variable to the corresponding function pointer.
[0067] (9) Write the assigned data to the specified configuration file.
[0068] (10) Remove these two files from the case processing table.
[0069] As Figure 5 shown, the case command line function generation process includes steps (a) - (g): (a) Open the specified file.
[0070] (b) Read all.h files in the folder and load the file data into memory.
[0071] (c) Concatenate the case name and the _Info structure.
[0072] (d) Determine whether the concatenated structure variable name is matched in memory. If not, execute (e). If so, execute (f).
[0073] (e) Generate an empty string.
[0074] (f) Generate strings in sequence: printf(“%s”, member variable name) scanf(“%d”, structure variable name.Temp.member variable name).
[0075] (g) Write the generated strings to a specified file.
[0076] Please refer to Figure 2 , Embodiment 2 of the present invention is: A test case writing device, comprising: A file extraction module, configured to obtain all file names in a specified file, and extract source files and header files corresponding to each test case from the specified file according to the all file names; A variable acquisition module, configured to acquire member variables of a test case registration table structure; An assignment module, configured to match function names corresponding to the member variables of the test case registration table structure from the source files and the header files, and assign the member variables of the test case registration table structure to function pointers corresponding to the function names; A file update module, configured to update the specified file based on the member variables of the test case registration table structure after assignment.
[0077] Embodiment 3 of the present invention is: A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each step of the test case writing method in Embodiment 1 can be implemented.
[0078] Embodiment 4 of the present invention is: Please refer to Figure 3 , An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, each step of the test case writing method in Embodiment 1 is implemented.
[0079] In summary, the present invention provides a test case writing method, apparatus, readable storage medium, and electronic device. It obtains all file names in a specified file, extracts the source files and header files corresponding to each test case from the specified file according to all file names, obtains the member variables of the test case registry structure, matches the function names corresponding to the member variables of the test case registry structure from the source files and header files, and assigns the member variables of the test case registry structure as function pointers corresponding to the function names. Based on the assigned member variables of the test case registry structure, the specified file is updated. In this way, by automatically parsing the source files and header files, extracting the function names of the test cases, and assigning them as corresponding function pointers, the registration information of the test cases is automatically updated, eliminating the need for manual modification of the registry and the need to repeatedly write similar code for the registration and configuration of each test case manually, thereby reducing the complexity of writing test cases and improving the efficiency of writing test cases. Moreover, by parsing the member variables of the structure (including variable names and type names) and combining the function information in the source files and header files, the member variables of the structure are automatically assigned as corresponding function pointers, reducing the complexity of manually writing and maintaining the registry structure and being able to adapt to changes in test cases, thus enhancing the writing efficiency.
[0080] In the above embodiments provided by the present application, it should be understood that the disclosed method, apparatus, computer-readable storage medium, and electronic device can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation. For example, multiple components or modules can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces, and the indirect coupling or communication connection of the device or component or module can be in an electrical, mechanical, or other form.
[0081] The components described as separate components may or may not be physically separated, and the components displayed as components may or may not be physical modules, that is, they can be located in one place or distributed to multiple network modules. Some or all of the components can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0082] In addition, in each embodiment of the present invention, the various functional modules can be integrated in one processing module, or each component can exist physically alone, or two or more modules can be integrated in one module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules.
[0083] When the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.
[0084] It should be noted that for the foregoing method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily all essential to the present invention.
[0085] In the above embodiments, the descriptions of each embodiment have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0086] The above are only the embodiments of the present invention, and do not limit the patent scope of the present invention accordingly. All equivalent transformations made by using the content of the specification and drawings of the present invention, or directly or indirectly applied in the related technical fields, are equally included in the patent protection scope of the present invention.
Claims
1. A test case writing method, characterized in that Including the steps: Obtain all file names in a specified file, and extract the source file and header file corresponding to each test case from the specified file according to the all file names; Obtain the member variables of the test case registry structure; Match the function names corresponding to the member variables of the test case registry structure from the source file and the header file, and assign the member variables of the test case registry structure to the function pointers corresponding to the function names; Update the specified file based on the member variables of the test case registry structure after assignment.
2. The method for writing test cases according to claim 1, characterized in that The obtaining the member variables of the test case registry structure includes: Search for the structure definition from the file storing the test case registry structure; Use a parsing function to parse the structure definition to obtain the structure member variables; Store the structure member variables into the test case registry structure.
3. A test case writing method according to claim 2, characterized in that, The structure member variables include the member variable names and their corresponding type names; The matching the function names corresponding to the member variables of the test case registry structure from the source file and the header file, and assigning the member variables of the test case registry structure to the function pointers corresponding to the function names includes: Apply for a block of memory; Write the pre-data of the registration function into the memory; Traverse each of the type names in the test case registry structure; For the traversed type name, if the type name is a non-function type, write a preset assignment statement into the memory, and write the post-data of the registration function into the memory; And / or, if the type name is a function type, determine whether there are function declarations and function definitions of the member variable names corresponding to the type name in the header file and the source file. If so, write statement data assigning the function pointer corresponding to the function definition into the memory, and write the post-data of the registration function into the memory.
4. A test case writing method according to claim 3, characterized in that The determining whether there are function declarations and function definitions of the member variable names corresponding to the type name in the header file and the source file. If so, write statement data assigning the function pointer corresponding to the function definition into the memory, and write the post-data of the registration function into the memory includes: Determine whether there is a function declaration of the member variable name corresponding to the type name in the header file. If not, write statement data assigning 0 into the memory, and write the post-data of the registration function into the memory. If so, determine whether there is a function definition corresponding to the function declaration in the source file. If so, write statement data assigning the function pointer corresponding to the function definition into the memory, and write the post-data of the registration function into the memory. If not, output an error message.
5. A test case writing method according to claim 3 or 4, characterized in that The updating the specified file based on the member variables of the test case registry structure after assignment includes: Update the data in the memory to the specified file.
6. A test case writing method according to claim 1, characterized in that, It also includes: Load the file data in the header file into the memory; Determine whether there is a test case information structure corresponding to the header file in the memory. If it exists, output each member variable of the test case information structure in the test case information structure, and wait to receive the parameters required by the member variables of the test case information structure.
7. A test case writing method according to claim 1, characterized in that It further includes: Obtain the test case registration table; Determine the test case table to be run from the test case registration table; Create a test case execution thread; Execute the test cases in the test case table to be run in sequence based on the test case execution thread.
8. A test case writing device, characterized in that, It includes: A file extraction module, configured to obtain all file names in a specified file, and extract the source file and header file corresponding to each test case from the specified file according to the all file names; A variable acquisition module, configured to acquire the member variables of the test case registration table structure; An assignment module, configured to match the function names corresponding to the member variables of the test case registration table structure from the source file and the header file, and assign the member variables of the test case registration table structure to the function pointers corresponding to the function names; A file update module, configured to update the specified file based on the member variables of the test case registration table structure after assignment.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements each step in a test case writing method according to any one of claims 1 to 7.
10. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements each step in a test case writing method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Test case generation method and device
CN106294138A
Method and device for generating automatic test code of embedded system
CN112328226A
Application test method and device, electronic equipment and storage medium
CN116303098A
Hardware function detection system and method, electronic equipment and storage medium
CN116627738A
Script-based data flow graph generation method and apparatus
WO2023202290A1