Test method, device and equipment of code engineering, medium and product
Through the automated test process, the test requirements and macroswitch information of code engineering are obtained, and the test combination is determined and allocated, which solves the problem of low accuracy of code engineering testing in the existing technology, and achieves more efficient and accurate test results.
Patent Information
- Application Number
- CN202411544370.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-11
AI Technical Summary
In the prior art, the accuracy of code engineering testing is low, mainly due to the high cost and low test coverage due to manual selection of test combinations.
By obtaining the test requirements and macroswitch information of the project to be tested, all test combinations are determined, and assigned to each subtest process, and multiple subtest processes are executed to obtain test results.
It improves the accuracy and coverage of code engineering testing, reduces labor costs, and realizes automated testing processes.
Smart Images

Figure CN119415397A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a testing method, device, equipment, medium and product for code engineering. Background Art
[0002] Computer language development refers to the process of writing software applications or systems using a specific programming language. During the development process, macro switch debugging, cross-platform compatibility, and functional module management are usually used. In order to ensure the correctness and reliability of macro switches, developers need to conduct comprehensive testing, including unit testing, integration testing, and system testing, to verify the code behavior under different macro switch configurations.
[0003] At present, in the computer code testing scheme including macro switches, considering the test efficiency, several macro switches or several combinations of all macro switches are usually selected for testing. However, this scheme uses manual selection to perform the test, resulting in high labor costs for the test, and the selective testing leads to low accuracy of code engineering testing. Therefore, the problem that needs to be solved at present is how to improve the accuracy of code engineering testing. Summary of the invention
[0004] The present application provides a code engineering testing method, device, equipment, medium and product to improve the accuracy of code engineering testing.
[0005] On the one hand, the present application provides a testing method for a code project, the code project includes multiple macro switches, and the method includes: obtaining the test requirements of the project to be tested, and determining the macro switch information of the project to be tested; wherein the test requirements include the identifiers of multiple sub-test processes, and the macro switch information includes the identifiers of multiple macro switches and multiple values corresponding to each macro switch; based on the macro switch information, determining all test combinations of the project to be tested, wherein each test combination includes the values of multiple macro switches, and the value combinations of multiple macro switches under different test combinations are different; according to the code of the project to be tested, creating a code copy corresponding to each sub-test process, and different code copies are distinguished by the identifier of the sub-test process; allocating all test combinations and determining the test combination corresponding to each sub-test process; according to the code copies and test combinations corresponding to each sub-test process, executing multiple sub-test processes and obtaining corresponding output results to obtain the test results of the project to be tested.
[0006] In one possible implementation, the method also includes: obtaining a test configuration template for the project to be tested, the test configuration template including a test process placeholder; sequentially bringing the identifier of each sub-test process into the test process placeholder in the test configuration template of the project to be tested to generate a test configuration file corresponding to the sub-test process; wherein the test configuration file includes: the address of the code copy corresponding to the sub-test process, the result storage address of the sub-test process, and the test tool.
[0007] In one possible implementation, each sub-test process includes a test case corresponding to each test combination under the sub-test process, and according to the code copy and test combination corresponding to each sub-test process, multiple sub-test processes are executed and corresponding output results are obtained, including: for each sub-test process, according to the code copy and test combination corresponding to the sub-test process, each test case under the sub-test process is executed, and the corresponding output results are obtained.
[0008] In one possible implementation, for each sub-test process, according to the code copy and test combination corresponding to the sub-test process, each test case under the sub-test process is executed, and the corresponding output result is obtained, including: for each sub-test process, according to the address of the code copy in the test configuration file corresponding to the sub-test process, the code copy corresponding to the sub-test process is obtained; for each test case under the sub-test process, according to the test combination corresponding to the test case, the code copy corresponding to the sub-test process is updated; based on the updated code copy, the transfer parameters are determined; the transfer parameters are sent to the test tool recorded in the test configuration file to obtain the output information of the test tool; the output information of each test case under the sub-test process is saved in the result storage address recorded in the test configuration file as the output result of the sub-test process.
[0009] In a possible implementation, after the code copy corresponding to the sub-test process is updated, the method further includes: displaying test information, where the test information includes an identifier of a test case currently being executed and an identifier of the sub-test process to which the test case belongs.
[0010] In a possible implementation, after sending the transfer parameter to the test tool recorded in the test configuration file and obtaining the output information of the test tool, the method further includes: renaming the output information, wherein the renamed output information includes an identifier of the current test case.
[0011] In one possible implementation, the method also includes: establishing a data structure including macro switch information of the project to be tested, and determining the index value of each macro switch value in the macro switch information in the data structure; establishing an array corresponding to each test combination in all test combinations, wherein the array corresponding to each test combination includes the index value corresponding to the value of each macro switch under the test combination.
[0012] On the other hand, the present application provides a testing device for a code engineering project, the device comprising: an acquisition module, used to acquire the test requirements of the project to be tested, and determine the macro switch information of the project to be tested; wherein the test requirements include the identifiers of multiple sub-test processes, and the macro switch information includes the identifiers of multiple macro switches and multiple values corresponding to each macro switch; a determination module, used to determine all test combinations of the project to be tested based on the macro switch information, wherein each test combination includes the values of multiple macro switches, and the value combinations of multiple macro switches under different test combinations are different; according to the code of the project to be tested, a code copy corresponding to each sub-test process is created, and different code copies are distinguished by the identifier of the sub-test process; a testing module, used to allocate all test combinations and determine the test combination corresponding to each sub-test process; according to the code copies and test combinations corresponding to each sub-test process, multiple sub-test processes are executed and corresponding output results are obtained to obtain the test results of the project to be tested.
[0013] On the other hand, the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the above method.
[0014] On the other hand, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the above method.
[0015] On the other hand, the present application provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0016] In the test method, device, equipment, medium and product of the code engineering provided by the present application, the test requirements of the project to be tested, including the identification of multiple sub-test processes, are obtained; according to the code of the project to be tested, a code copy corresponding to each sub-test process is created, and based on the macro switch information of the project to be tested, all the test combinations of the project to be tested are determined; all the test combinations are allocated to determine the test combination corresponding to each sub-test process; according to the code copy and test combination corresponding to each sub-test process, multiple sub-test processes are executed and corresponding output results are obtained to obtain the test results of the project to be tested. The scheme of this example, based on the constructed automated test process, improves the test coverage of the project to be tested through all test combinations, and assigns corresponding test combinations to each sub-test process for testing after considering the test requirements, thereby improving the accuracy of the code engineering test. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0018] Figure 1 A flowchart of a code engineering testing method is shown in FIG.
[0019] Figure 2 A flowchart of a code engineering testing method is shown in FIG.
[0020] Figure 3 A flowchart of a code engineering testing method is shown in FIG.
[0021] Figure 4 A flowchart of a code engineering testing method is shown in FIG.
[0022] Figure 5 A flowchart of a code engineering testing method is shown in FIG.
[0023] Figure 6 A flowchart of a code engineering testing method is shown in FIG.
[0024] Figure 7 A flowchart of a code engineering testing method is shown in FIG.
[0025] Figure 8 A schematic diagram of the structure of a testing device for code engineering is shown in FIG.
[0026] Fig. 9 A structural schematic diagram of an electronic device is shown in FIG.
[0027] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0028] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0029] It should be noted that the brief description of the terms in this application is only for the convenience of understanding the embodiments described below, and is not intended to limit the embodiments of the present application. Unless otherwise specified, these terms should be understood according to their common and usual meanings. The terms "including" and "having" in the specification and claims and the above-mentioned drawings in this application and any variation thereof are intended to cover but not exclude inclusion. For example, a product or device containing a series of components is not necessarily limited to those components clearly listed, but may include other components that are not clearly listed or inherent to these products or devices. The term "module" used in this application refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic or a combination of hardware and / or software code that can perform functions related to the element.
[0030] Computer language development refers to the process of writing software applications or systems using specific programming languages (such as C, Java, Python, etc.), which usually includes embedded system development such as microcontroller abstraction layer (MCAL) development, software development, and operating system development. This process usually includes requirements analysis, design, coding, testing, and maintenance. In the development process of code engineering, macro switches are usually used to debug cross-platform compatibility and functional module management. Among them, macro switches involve creating and managing preprocessor macros and conditional compilation instructions to selectively include or exclude code during the compilation process, thereby achieving flexibility and configurability of the code. In order to ensure the correctness and reliability of macro switches, developers need to conduct comprehensive testing, including unit testing, integration testing, and system testing to verify the code behavior under different macro switch configurations.
[0031] When testing code engineering, as the number of macro switches increases, the corresponding number of tests will increase exponentially. For example, for a code engineering that includes 10 macro switches, there are 2^10 different macro switch combination states, which means that 2^10 tests need to be built and executed separately. A related testing scheme is to manually select several important macro switches in production, or select more common macro switch combinations for testing. However, this scheme relies on manual selection of test cases for testing, which is subjective and leads to high labor costs. In addition, selectively testing only some combinations may miss some potential errors and boundary conditions, thereby reducing the accuracy of code engineering testing.
[0032] The technical content provided by this application is intended to solve the above-mentioned technical problems of related technologies. In the test method, device, equipment, medium and product of the code engineering of this application, the test requirements of the project to be tested, including the identification of multiple sub-test processes, are obtained; according to the code of the project to be tested, a code copy corresponding to each sub-test process is created, and based on the macro switch information of the project to be tested, all the test combinations of the project to be tested are determined; all the test combinations are allocated to determine the test combination corresponding to each sub-test process; according to the code copy and test combination corresponding to each sub-test process, multiple sub-test processes are executed and the corresponding output results are obtained to obtain the test results of the project to be tested. The scheme of this example, based on the constructed automated testing process, improves the test coverage of the project to be tested through all test combinations, and assigns the corresponding test combination to each sub-test process for testing after considering the test requirements, thereby improving the accuracy of the code engineering test.
[0033] The technical solutions of the present application and the technical solutions of the present application are described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. In the description of the present application, unless otherwise clearly specified and limited, each term should be understood in a broad sense in the art. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0034] Embodiment 1
[0035] Figure 1 A flowchart of a method for testing a code engineering is shown in FIG. 1 . The execution subject of this example may be a testing device for a code engineering. Figure 1 As shown, the method includes:
[0036] Step 101: Acquire the test requirements of the project to be tested, and determine the macro switch information of the project to be tested; wherein the test requirements include identifiers of multiple sub-test processes, and the macro switch information includes identifiers of multiple macro switches and multiple values corresponding to each macro switch;
[0037] Step 102: based on the macro switch information, determine all test combinations of the project to be tested, wherein each test combination includes multiple macro switch values, and the value combinations of multiple macro switches under different test combinations are different; according to the code of the project to be tested, create a code copy corresponding to each sub-test process, and different code copies are distinguished by the identifier of the sub-test process;
[0038] Step 103, allocating all test combinations, determining the test combination corresponding to each sub-test process; executing multiple sub-test processes and obtaining corresponding output results according to the code copy and test combination corresponding to each sub-test process, so as to obtain the test results of the project to be tested.
[0039] In practical applications, the execution subject of the method can be a test device for a code project, and there are many ways to implement it. For example, it can be implemented by a computer program, such as application software, etc.; or, it can also be implemented as a medium storing relevant computer programs, such as a USB flash drive, a cloud disk, etc.; or, it can also be implemented by a physical device integrated or installed with relevant computer programs, such as a chip, etc. In this example, the project to be tested includes multiple macro switches. Specifically, multiple macro switches are defined in a header file, and the header file is part of the code of the project to be tested. Exemplarily, to obtain the macro switches of the project to be tested, it is necessary to traverse the header file of the project to be tested to obtain the identification of the macro switch and the corresponding value of each macro switch. By defining macro switches in the header file, these macros can be uniformly managed throughout the code project, thereby realizing flexible configuration of the code. Correspondingly, by defining different macro switches, certain parts of the code can be selectively included or excluded during compilation, thereby realizing the configurability of the code in the project to be tested.
[0040] In this example, the test requirements of the project to be tested are obtained, and the macro switch information of the project to be tested is determined; wherein the test requirements include the identifiers of multiple sub-test processes, and the macro switch information includes the identifiers of multiple macro switches and multiple values corresponding to each macro switch. Exemplarily, an executable file can be designed, and when the executable file is executed, the identifiers of multiple sub-processes are obtained by clicking on the user's interface or by a script. In practical applications, the identifiers of the multiple sub-processes can represent the order of the sequential execution of the test. Optionally, the identifiers of the multiple sub-processes can be used to distinguish different sub-test processes when the test is executed in parallel. By executing the test in parallel, the test efficiency can be significantly improved and the test time can be shortened. The macro switch information of the project to be tested in this example can be the macro switch information of all the macro switches of the project to be tested, or the macro switch information of part selected by the user. Optionally, part of the macro switch information can also be determined based on the test requirements. In practical applications, the macro switch information can be stored in files such as text files and table files or other data structures such as databases.
[0041] After determining the macro switch information of the project to be tested, all test combinations of the project to be tested are determined based on the macro switch information, wherein each test combination includes multiple macro switch values, and the value combinations of multiple macro switches under different test combinations are different. For example, if it is determined based on the macro switch information that there are 3 macro switches A, B, and C, and each macro switch has two values, on and off, then there are 8 corresponding test combinations. For example, one of them can be: A macro switch is on, B macro switch is on, C macro switch is on; another can be: A macro switch is off, B macro switch is on, C macro switch is on, and so on, and so on, for a total of 8 test combinations. On the other hand, according to the code of the project to be tested, a code copy corresponding to each sub-test process is created, and different code copies are distinguished by the identifier of the sub-test process. In this example, by creating a code copy corresponding to each sub-test process, the interference between different sub-test processes can be reduced, and the modular management of the test can be improved.
[0042] After obtaining all the test combinations of the project to be tested and the code copies of each sub-test process, all the test combinations are allocated to determine the test combinations corresponding to each sub-test process. Exemplarily, all the test combinations can be equally allocated to each sub-test process, or the test combinations can be allocated according to the load capacity of the processor executing each sub-test process. Further, according to the code copies and test combinations corresponding to each sub-test process, multiple sub-test processes are executed and the corresponding output results are obtained to obtain the test results of the project to be tested. Among them, testing the project to be tested refers to performing code testing on the project to be tested after the value of each macro switch is determined. Exemplarily, under each sub-test process, the test combination corresponding to the sub-test process is configured in turn after the code copy corresponding to the sub-test process is tested. In actual applications, a third-party code testing tool can be called for testing, or a local code test can be performed. For example, the test content can be a compilation test, a unit test, a regression test, or a static code analysis test.
[0043] In the test method of the code engineering of this example, the test requirements of the project to be tested, including the identification of multiple sub-test processes, are obtained; based on the code of the project to be tested, a code copy corresponding to each sub-test process is created, and based on the macro switch information of the project to be tested, all the test combinations of the project to be tested are determined; all the test combinations are assigned to determine the test combination corresponding to each sub-test process; based on the code copy and test combination corresponding to each sub-test process, multiple sub-test processes are executed and the corresponding output results are obtained to obtain the test results of the project to be tested. The solution of this example, based on the constructed automated testing process, improves the test coverage of the project to be tested through all test combinations, and assigns the corresponding test combination to each sub-test process for testing after considering the test requirements, thereby improving the accuracy of the code engineering test.
[0044] As another example, Figure 2 A flowchart of a method for testing a code engineering is shown in FIG. Based on any example, the method for testing a code engineering further includes:
[0045] Step 201: Obtain a test configuration template for the project to be tested, where the test configuration template includes a test process placeholder;
[0046] Step 202: sequentially bring the identifier of each sub-test process into the test process placeholder in the test configuration template of the project to be tested to generate a test configuration file corresponding to the sub-test process; wherein the test configuration file includes: the address of the code copy corresponding to the sub-test process, the result storage address of the sub-test process, and the test tool.
[0047] This example test configuration template may include the parameters that each sub-test process needs to use when executing, or the commands that need to be executed. The test configuration template can be in various formats, such as json format, XML format, or INI format. After obtaining the test configuration template of the project to be tested, the identifier of each sub-test process is sequentially brought into the test process placeholder in the test configuration template of the project to be tested to generate a test configuration file corresponding to the sub-test process; wherein the test configuration file includes: the address of the code copy corresponding to the sub-test process, the result storage address of the sub-test process, and the test tool. Taking the json format as an example, the test configuration template includes the following key-value pairs: "ProjectRoot": "D:\\Test\\mcal{P}" represents the key and value of the address of the code copy corresponding to the sub-test process; where {P} is the test process placeholder, and when the sub-test process is identified as "1", the corresponding value is "D:\\Test\\mcal1"; accordingly, the address in the test configuration template is used as the storage address when the code copy of the sub-test process is created, and named in the same way, so that the test configuration file corresponding to the same sub-test process and the corresponding code copy can be associated. The result storage address of the sub-test process can be determined according to similar logic. On the other hand, the information of the test tool in the test configuration file may include: the storage address of the test tool, the execution code for calling the test tool, etc. In actual applications, the test content can be adjusted by adjusting the test tool. The solution of this example, through the test configuration template including the test process placeholder, can reduce the repeated configuration of multiple sub-test processes under the same test project when executing, and improve the test efficiency of the project to be tested.
[0048] As another example, based on any example, each sub-test process includes a test case corresponding to each test combination under the sub-test process. In step 103, according to the code copy and test combination corresponding to each sub-test process, multiple sub-test processes are executed and corresponding output results are obtained, including:
[0049] For each sub-test process, according to the code copy and test combination corresponding to the sub-test process, each test case under the sub-test process is executed, and the corresponding output result is obtained.
[0050] In this example, the test case corresponding to the test combination can be determined during the execution of the test case. For example, the test case under the sub-test process can be executed in a loop, wherein a test case is executed each time in the loop, and when the test case is executed, a test combination is selected from the unselected test combinations under the sub-test process for testing. Optionally, the test case corresponding to the test combination can be determined before each test case. Optionally, each test case under the sub-test process can also be executed in parallel. Exemplarily, in order to avoid the contingency of the test, the marked test combination can be determined according to user needs, and the marked test combination can correspond to multiple test cases, that is, the test combination is tested multiple times, which can improve the accuracy of the test. In practical applications, the marked test combination can be a test combination that appears more frequently in actual production. In the solution of this example, the sub-test process is further divided into multiple test cases in the test dimension to achieve a structured and clear test process.
[0051] As another example, Figure 3 A flowchart of a code engineering testing method is shown in FIG. For each sub-test process, each test case under the sub-test process is executed according to the code copy and test combination corresponding to the sub-test process, and the corresponding output results are obtained, including:
[0052] Step 301: for each sub-test process, obtain the code copy corresponding to the sub-test process according to the address of the code copy in the test configuration file corresponding to the sub-test process;
[0053] Step 302: for each test case under the sub-test process, according to the test combination corresponding to the test case, update the code copy corresponding to the sub-test process; based on the updated code copy, determine the transfer parameter; send the transfer parameter to the test tool recorded in the test configuration file, and obtain the output information of the test tool;
[0054] Step 303: Save the output information of each test case under the sub-test process to the result storage address recorded in the test configuration file as the output result of the sub-test process.
[0055] Exemplarily, for each sub-test process, first read and parse the test configuration file corresponding to the sub-test process, obtain the address of the code copy in the test configuration file, and locate and obtain the code copy corresponding to the sub-test process according to the address of the code copy. For each test case under the sub-test process, according to the test combination corresponding to the test case, the code copy corresponding to the sub-test process is updated. Exemplarily, the updating method is to update the header file to which the macro switch belongs in the corresponding code copy. Based on the updated code copy, determine the parameters that need to be passed to the test tool. These parameters may include test data, configuration options, environment variables, etc. After determining the passing parameters, send the passing parameters to the test tool recorded in the test configuration file, and start the test tool for testing. Exemplarily, during the test tool test process, the execution status of the test tool can be monitored in real time to ensure the smooth progress of the test process. Exemplarily, the output information of the test tool can include test results, log files, error reports, etc. After obtaining the output information, save the output information at the result storage address recorded in the test configuration file. Optionally, after obtaining the output information, the output information can be printed on a display screen or operation interface for interacting with the user. In actual applications, after a test case is executed, resources can be released, such as memory, file handles, network connections, etc., or logs can be recorded, such as the execution status of each sub-test process and the calling status of the test tool. In this example, for each sub-test process, the corresponding code copy is first determined according to the test configuration file of the sub-test process, and then each test case under the sub-test process is executed. The perfect process can improve the efficiency of the test and the accuracy of the test results.
[0056] As another example, based on any example, after the code copy corresponding to the sub-test process is updated, the following further includes:
[0057] Displays test information, including the ID of the currently executing test case and the ID of the subtest process to which the test case belongs.
[0058] In this example, when displaying the test information, it can be displayed in the console output or the graphical user interface. In actual applications, the execution code for displaying the test information can be saved in the test configuration file corresponding to the sub-test process. Specifically, the location of the execution code for displaying the test information in the test configuration file can be located before calling the test tool, so that the sub-test processes can be executed in sequence when executed. For example, the displayed test information can be "Test case 1 in sub-test process A". Optionally, the total number of sub-test processes can also be displayed, that is, "Test case 1 in sub-test process A among n sub-test processes". The scheme of this example, by displaying the identification of the currently executing test case and the sub-test process, the tester can understand the test progress and status in real time, improve the transparency of the test process, and facilitate monitoring and management of the test process.
[0059] As another example, based on any example, after sending the passed parameters to the test tool recorded in the test configuration file and obtaining the output information of the test tool, the method further includes:
[0060] Rename the output information. The renamed output information includes the identifier of the current test case.
[0061] In this example, the obtained output information is renamed, and the renamed output information includes the identifier of the current test case. In actual applications, the execution code for renaming the output information can be saved in the test configuration file corresponding to the sub-test process. Specifically, the execution code for renaming the output information is after obtaining the output information of the test tool, so that the sub-test process can be executed in sequence during execution. The solution of this example, by including the identifier of the test case in the output information, can clearly distinguish the output results of different test cases to improve the traceability of the results, and at the same time facilitate the classification and management of files to avoid file name conflicts and confusion.
[0062] As another example, Figure 4 A flowchart of a method for testing a code engineering is shown in FIG. Based on any example, the method for testing a code engineering further includes:
[0063] Step 401: Establish a data structure including macro switch information of the project to be tested, and determine the index value of each macro switch value in the macro switch information in the data structure;
[0064] Step 402: Establish an array corresponding to each test combination in all test combinations, wherein the array corresponding to each test combination includes an index value corresponding to the value of each macro switch under the test combination.
[0065] In this example, the data structure including the macro switch information of the project to be tested can be implemented in the form of a file in a table format, a file in a text format, or a database. In the data structure, the index value of each macro switch value is determined. If it is determined based on the macro switch information that there are 3 macro switches A, B, and C, each macro switch has two values, on and off, wherein the index of the on value of each macro switch is 2, and the index of the off value is 3. Further, an array corresponding to each test combination in all test combinations is established, wherein the array corresponding to each test combination includes the index value corresponding to the value of each macro switch under the test combination. For example, the array is in the form of [value of macro switch A, value of macro switch B, value of macro switch C]. One of the test combinations is: A macro switch is on, B macro switch is on, C macro switch is on, then the corresponding array is [2, 2, 2]; another can be: A macro switch is off, B macro switch is on, C macro switch is on, then the corresponding array is [3, 2, 2]. Optionally, the values of the macro switches in the array can also be in disorder, and each value is determined by the macro switch id and the index value. For example, one of the test combinations can be: macro switch A is on, macro switch B is on, and macro switch C is on, then the corresponding array is {[A, 2], [C, 2], [B, 2]}. Exemplarily, when all test combinations are assigned, the arrays corresponding to all test combinations are assigned to each sub-test process. Furthermore, the sub-test process is executed so that the corresponding macro switch information is obtained in the data structure according to the assigned array. The scheme of this example can simplify the data management of the test combination and further improve the test efficiency of the project to be tested by establishing a data structure and an array corresponding to each test combination.
[0066] In the code engineering testing method provided in this embodiment, the test requirements of the project to be tested, including the identification of multiple sub-test processes, are obtained; based on the code of the project to be tested, a code copy corresponding to each sub-test process is created, and based on the macro switch information of the project to be tested, all the test combinations of the project to be tested are determined; all the test combinations are assigned to determine the test combination corresponding to each sub-test process; based on the code copy and test combination corresponding to each sub-test process, multiple sub-test processes are executed and corresponding output results are obtained to obtain the test results of the project to be tested. The scheme of this example, based on the constructed automated testing process, improves the test coverage of the project to be tested through all test combinations, and assigns the corresponding test combination to each sub-test process for testing after considering the test requirements, thereby improving the accuracy of the code engineering test.
[0067] Embodiment 2
[0068] Embodiment 2 of the present application provides an example of a method for testing a code project as follows in conjunction with the corresponding drawings. The method includes:
[0069] The executable file of the method is executed through the following BAT script, and the test configuration template of the project to be tested and the identifiers of multiple sub-test processes are obtained. Among them, the BAT script includes: start{executable file}{test configuration template}{identifier of sub-test process}; for example, the script is: start main.exe config.json 1; start main.execonfig.json 2; start main.exe config.json 3; start main.exe config.json 4. Further, it can be combined with Figure 5 The flowchart of the test method of the code engineering determines the information of the macro switch to be tested, and determines the test case corresponding to the sub-test process by establishing a code loop: as shown in the figure, by reading and parsing the test configuration template, a csv format file corresponding to multiple C language header files under the project to be tested is obtained, and the csv file includes multiple related macro switches; determine the loop variable n, and determine the loop end condition: all csv files have been parsed; wherein the parsing of each csv file includes: reading the csv file content, recording the macro switch name defined in the csv file, the value of the macro switch, maintaining the macro selection information (the macro selection information includes an array representing the macro switch name and the corresponding value in the currently recorded csv file), and the loop variable n is incremented; if all csv files have been parsed, the total number of test cases is calculated by multiplying the values corresponding to all macro switches, obtaining the sub-test process identifier to determine how many sub-test processes need to be split, and the test case corresponding to each sub-test process identifier. For example, the information of the macro switch to be tested is: A, B, C, a total of 3 macro switches, and each macro switch has two values, on and off, then there are 8 corresponding test combinations. By establishing the data structure in the form of a table as shown in Table 1, the array corresponding to each test combination is determined.
[0070] Table 1
[0071] Macro Switch Value 1 Value 2 A on off B on off C on off
[0072] The array is in the form of [value of macro switch A, value of macro switch B, value of macro switch C]. One test combination is: macro switch A is on, macro switch B is on, and macro switch C is on, then the corresponding array is [2, 2, 2]; another one can be: macro switch A is off, macro switch B is on, and macro switch C is on, then the corresponding array is [3, 2, 2]. As shown in Table 2, after determining the 8 arrays corresponding to the 8 test combinations, the 8 arrays are allocated to the four sub-test processes.
[0073] Table 2
[0074] Subtest process ID Number of test cases Array corresponding to the test combination 1 2 [2,2,2]、[3,2,2] 2 2 [2,3,2]、[2,2,3] 3 2 [2,3,3]、[3,2,3] 4 2 [3,3,2]、[3,3,3]
[0075] Furthermore, based on the code of the project to be tested, a code copy corresponding to each sub-test process is created, and different code copies are distinguished by the identifier of the sub-test process. For example, if the project to be tested is the mcal project, then the code copies corresponding to the multiple sub-test processes are mcal1, mcal2, mcal3, and mcal4. Furthermore, the identifier of each sub-test process is sequentially brought into the test process placeholder in the test configuration template of the project to be tested to generate a test configuration file corresponding to the sub-test process. The test configuration file includes: the address of the code copy corresponding to the sub-test process, the result storage address of the sub-test process, display test information, test tools, and rename output information. Taking a sub-test process as an example, the sub-test process identifier of the sub-test process is 1, the code copy is mcal1, the arrays corresponding to the two assigned test combinations are [2, 2, 2] and [3, 2, 2], and the address of the corresponding code copy in the test configuration file is "D:\\Test\\mcal1". Combined with Figure 6 The flowchart of the test method of the code engineering shown is that after parsing the test configuration file corresponding to the sub-test process, the test case of the sub-test process is executed as follows: first, the initial value of the loop variable c is assigned to the first test case of the sub-test process, and the loop end judgment is performed: whether all the test cases of the sub-test process are completed, if completed, the process is terminated, if not completed, the test case is executed, and the test case execution process includes: updating the header file according to the value of the macro switch corresponding to the test case in the macro selection information, performing test preprocessing, calling the test tool, and judging the end of the test tool process: if it is not ended, the output information of the test tool is recorded and printed on the screen (the output information includes the macro switch value of the test case to facilitate the location of problems in the test case execution process); if it is ended, post-test processing is performed, the loop variable is incremented, and the macro selection information is updated to proceed to the next test case. More specifically, it can also be combined with Figure 7The flowchart of the test method of the code engineering shown in the figure, after parsing the test configuration file corresponding to the sub-test process, the execution of the sub-test process is as follows: create a test case identifier c and assign an initial value of 0, determine whether the current test case is greater than the value of the maximum test case identifier, if not, update the header file of mcal1 according to the array [2, 2, 2]: A macro switch is configured as on, B macro switch is configured as on, C macro switch is configured as on; and display the test information: test case [0] in sub-test process [1]; based on the updated mcal1, determine the transfer parameters sent to the test tool; call the test tool, obtain the output information of the test tool, print the output information in the console interface, and save it in the following path: result / mcal1_result.txt; rename the output information to: result / mcal1_result_0.txt, and advance to the next test case. It should be noted that the execution code for displaying the test information, the code for determining the transfer parameters, the calling address of the test tool, and the execution code for renaming the output information are saved in the test configuration file corresponding to the sub-test process.
[0076] In the code engineering testing method provided in this embodiment, the test requirements of the project to be tested, including the identification of multiple sub-test processes, are obtained; based on the code of the project to be tested, a code copy corresponding to each sub-test process is created, and based on the macro switch information of the project to be tested, all the test combinations of the project to be tested are determined; all the test combinations are assigned to determine the test combination corresponding to each sub-test process; based on the code copy and test combination corresponding to each sub-test process, multiple sub-test processes are executed and corresponding output results are obtained to obtain the test results of the project to be tested. The scheme of this example, based on the constructed automated testing process, improves the test coverage of the project to be tested through all test combinations, and assigns the corresponding test combination to each sub-test process for testing after considering the test requirements, thereby improving the accuracy of the code engineering test.
[0077] Embodiment 3
[0078] Figure 8 The structural diagram of the test device of the code engineering is shown as an example. Figure 8 As shown, the device comprises:
[0079] The acquisition module 61 is used to acquire the test requirements of the project to be tested and determine the macro switch information of the project to be tested; wherein the test requirements include the identifiers of multiple sub-test processes, and the macro switch information includes the identifiers of multiple macro switches and multiple values corresponding to each macro switch;
[0080] The determination module 62 is used to determine all test combinations of the project to be tested based on the macro switch information, wherein each test combination includes multiple macro switch values, and the value combinations of multiple macro switches under different test combinations are different; according to the code of the project to be tested, create a code copy corresponding to each sub-test process, and different code copies are distinguished by the identifier of the sub-test process;
[0081] The test module 63 is used to distribute all the test combinations and determine the test combination corresponding to each sub-test process; according to the code copy and test combination corresponding to each sub-test process, execute multiple sub-test processes and obtain corresponding output results to obtain the test results of the project to be tested.
[0082] In practical applications, there are many ways to test the device of the code project. For example, it can be implemented by a computer program, such as application software, etc.; or it can be implemented as a medium storing relevant computer programs, such as a USB flash drive, a cloud disk, etc.; or it can also be implemented by a physical device integrated or installed with relevant computer programs, such as a chip, etc. In this example, the project to be tested includes multiple macro switches. Specifically, multiple macro switches are defined in a header file, and the header file is part of the code of the project to be tested. Exemplarily, to obtain the macro switch of the project to be tested, it is necessary to traverse the header file of the project to be tested to obtain the identifier of the macro switch and the corresponding value of each macro switch. By defining macro switches in the header file, these macros can be uniformly managed throughout the code project, thereby realizing flexible configuration of the code. Correspondingly, by defining different macro switches, certain parts of the code can be selectively included or excluded during compilation, thereby realizing the configurability of the code in the project to be tested.
[0083] In this example, the test requirements of the project to be tested are obtained, and the macro switch information of the project to be tested is determined; wherein the test requirements include the identifiers of multiple sub-test processes, and the macro switch information includes the identifiers of multiple macro switches and multiple values corresponding to each macro switch. Exemplarily, an executable file can be designed, and when the executable file is executed, the identifiers of multiple sub-processes are obtained by clicking on the user's interface or by a script. In practical applications, the identifiers of the multiple sub-processes can represent the order of the sequential execution of the test. Optionally, the identifiers of the multiple sub-processes can be used to distinguish different sub-test processes when the test is executed in parallel. By executing the test in parallel, the test efficiency can be significantly improved and the test time can be shortened. The macro switch information of the project to be tested in this example can be the macro switch information of all the macro switches of the project to be tested, or the macro switch information of part selected by the user. Optionally, part of the macro switch information can also be determined based on the test requirements. In practical applications, the macro switch information can be stored in files such as text files and table files or other data structures such as databases.
[0084] After determining the macro switch information of the project to be tested, all test combinations of the project to be tested are determined based on the macro switch information, wherein each test combination includes multiple macro switch values, and the value combinations of multiple macro switches under different test combinations are different. For example, if it is determined based on the macro switch information that there are 3 macro switches A, B, and C, and each macro switch has two values, on and off, then there are 8 corresponding test combinations. For example, one of them can be: A macro switch is on, B macro switch is on, C macro switch is on; another can be: A macro switch is off, B macro switch is on, C macro switch is on, and so on, and so on, for a total of 8 test combinations. On the other hand, according to the code of the project to be tested, a code copy corresponding to each sub-test process is created, and different code copies are distinguished by the identifier of the sub-test process. In this example, by creating a code copy corresponding to each sub-test process, the interference between different sub-test processes can be reduced, and the modular management of the test can be improved.
[0085] After obtaining all the test combinations of the project to be tested and the code copies of each sub-test process, all the test combinations are allocated to determine the test combinations corresponding to each sub-test process. Exemplarily, all the test combinations can be equally allocated to each sub-test process, or the test combinations can be allocated according to the load capacity of the processor executing each sub-test process. Further, according to the code copies and test combinations corresponding to each sub-test process, multiple sub-test processes are executed and the corresponding output results are obtained to obtain the test results of the project to be tested. Among them, testing the project to be tested refers to performing code testing on the project to be tested after the value of each macro switch is determined. Exemplarily, under each sub-test process, the test combination corresponding to the sub-test process is configured in turn after the code copy corresponding to the sub-test process is tested. In actual applications, a third-party code testing tool can be called for testing, or a local code test can be performed. For example, the test content can be a compilation test, a unit test, a regression test, or a static code analysis test.
[0086] In the test device of the code engineering of this example, the test requirements of the project to be tested, including the identification of multiple sub-test processes, are obtained; based on the code of the project to be tested, a code copy corresponding to each sub-test process is created, and based on the macro switch information of the project to be tested, all the test combinations of the project to be tested are determined; all the test combinations are assigned to determine the test combination corresponding to each sub-test process; based on the code copy and test combination corresponding to each sub-test process, multiple sub-test processes are executed and corresponding output results are obtained to obtain the test results of the project to be tested. The solution of this example, based on the constructed automated testing process, improves the test coverage of the project to be tested through all test combinations, and assigns corresponding test combinations to each sub-test process for testing after considering the test requirements, thereby improving the accuracy of the code engineering test.
[0087] In one example, the acquisition module 61 is further used for:
[0088] Get the test configuration template of the project to be tested. The test configuration template includes the test process placeholder.
[0089] The identifier of each sub-test process is sequentially brought into the test process placeholder in the test configuration template of the project to be tested to generate a test configuration file corresponding to the sub-test process; wherein the test configuration file includes: the address of the code copy corresponding to the sub-test process, the result storage address of the sub-test process, and the test tool.
[0090] This example test configuration template may include the parameters that each sub-test process needs to use when executing, or the commands that need to be executed. The test configuration template can be in various formats, such as json format, XML format, or INI format. After obtaining the test configuration template of the project to be tested, the identifier of each sub-test process is sequentially brought into the test process placeholder in the test configuration template of the project to be tested to generate a test configuration file corresponding to the sub-test process; wherein the test configuration file includes: the address of the code copy corresponding to the sub-test process, the result storage address of the sub-test process, and the test tool. Taking the json format as an example, the test configuration template includes the following key-value pairs: "ProjectRoot": "D:\\Test\\mcal{P}" represents the key and value of the address of the code copy corresponding to the sub-test process; where {P} is the test process placeholder, and when the sub-test process is identified as "1", the corresponding value is "D:\\Test\\mcal1"; accordingly, the address in the test configuration template is used as the storage address when the code copy of the sub-test process is created, and named in the same way, so that the test configuration file corresponding to the same sub-test process and the corresponding code copy can be associated. The result storage address of the sub-test process can be determined according to similar logic. On the other hand, the information of the test tool in the test configuration file may include: the storage address of the test tool, the execution code for calling the test tool, etc. In actual applications, the test content can be adjusted by adjusting the test tool. The solution of this example, through the test configuration template including the test process placeholder, can reduce the repeated configuration of multiple sub-test processes under the same test project when executing, and improve the test efficiency of the project to be tested.
[0091] In one example, each sub-test process includes a test case corresponding to each test combination under the sub-test process. The test module 63 is further used to:
[0092] For each sub-test process, according to the code copy and test combination corresponding to the sub-test process, each test case under the sub-test process is executed, and the corresponding output result is obtained.
[0093] In this example, the test case corresponding to the test combination can be determined during the execution of the test case. For example, the test case under the sub-test process can be executed in a loop, wherein a test case is executed each time in the loop, and when the test case is executed, a test combination is selected from the unselected test combinations under the sub-test process for testing. Optionally, the test case corresponding to the test combination can be determined before each test case. Optionally, each test case under the sub-test process can also be executed in parallel. Exemplarily, in order to avoid the contingency of the test, the marked test combination can be determined according to user needs, and the marked test combination can correspond to multiple test cases, that is, the test combination is tested multiple times, which can improve the accuracy of the test. In practical applications, the marked test combination can be a test combination that appears more frequently in actual production. In the solution of this example, the sub-test process is further divided into multiple test cases in the test dimension to achieve a structured and clear test process.
[0094] In one example, the testing module 63 is specifically configured to:
[0095] For each sub-test process, according to the address of the code copy in the test configuration file corresponding to the sub-test process, obtain the code copy corresponding to the sub-test process;
[0096] For each test case under the sub-test process, according to the test combination corresponding to the test case, the code copy corresponding to the sub-test process is updated; based on the updated code copy, the transfer parameter is determined; the transfer parameter is sent to the test tool recorded in the test configuration file to obtain the output information of the test tool;
[0097] The output information of each test case under the sub-test process is saved in the result storage address recorded in the test configuration file as the output result of the sub-test process.
[0098] Exemplarily, for each sub-test process, first read and parse the test configuration file corresponding to the sub-test process, obtain the address of the code copy in the test configuration file, and locate and obtain the code copy corresponding to the sub-test process according to the address of the code copy. For each test case under the sub-test process, according to the test combination corresponding to the test case, the code copy corresponding to the sub-test process is updated. Exemplarily, the updating method is to update the header file to which the macro switch belongs in the corresponding code copy. Based on the updated code copy, determine the parameters that need to be passed to the test tool. These parameters may include test data, configuration options, environment variables, etc. After determining the passing parameters, send the passing parameters to the test tool recorded in the test configuration file, and start the test tool for testing. Exemplarily, during the test tool test process, the execution status of the test tool can be monitored in real time to ensure the smooth progress of the test process. Exemplarily, the output information of the test tool can include test results, log files, error reports, etc. After obtaining the output information, save the output information at the result storage address recorded in the test configuration file. Optionally, after obtaining the output information, the output information can be printed on a display screen or operation interface for interacting with the user. In actual applications, after a test case is executed, resources can be released, such as memory, file handles, network connections, etc., or logs can be recorded, such as the execution status of each sub-test process and the calling status of the test tool. In this example, for each sub-test process, the corresponding code copy is first determined according to the test configuration file of the sub-test process, and then each test case under the sub-test process is executed. The perfect process can improve the efficiency of the test and the accuracy of the test results.
[0099] In one example, the testing module 63 is further configured to:
[0100] Displays test information, including the ID of the currently executing test case and the ID of the subtest process to which the test case belongs.
[0101] In this example, when displaying the test information, it can be displayed in the console output or the graphical user interface. In actual applications, the execution code for displaying the test information can be saved in the test configuration file corresponding to the sub-test process. Specifically, the location of the execution code for displaying the test information in the test configuration file can be located before calling the test tool, so that the sub-test processes can be executed in sequence when executed. For example, the displayed test information can be "Test case 1 in sub-test process A". Optionally, the total number of sub-test processes can also be displayed, that is, "Test case 1 in sub-test process A among n sub-test processes". The scheme of this example, by displaying the identification of the currently executing test case and the sub-test process, the tester can understand the test progress and status in real time, improve the transparency of the test process, and facilitate monitoring and management of the test process.
[0102] In one example, the testing module 63 is further configured to:
[0103] Rename the output information. The renamed output information includes the identifier of the current test case.
[0104] In this example, the obtained output information is renamed, and the renamed output information includes the identifier of the current test case. In actual applications, the execution code for renaming the output information can be saved in the test configuration file corresponding to the sub-test process. Specifically, the execution code for renaming the output information is after obtaining the output information of the test tool, so that the sub-test process can be executed in sequence during execution. The solution of this example, by including the identifier of the test case in the output information, can clearly distinguish the output results of different test cases to improve the traceability of the results, and at the same time facilitate the classification and management of files to avoid file name conflicts and confusion.
[0105] In one example, the determination module 62 is further configured to:
[0106] Establishing a data structure including macro switch information of the project to be tested, and determining an index value of each macro switch value in the macro switch information in the data structure;
[0107] An array corresponding to each test combination in all the test combinations is established, wherein the array corresponding to each test combination includes an index value corresponding to the value of each macro switch under the test combination.
[0108] In this example, the data structure including the macro switch information of the project to be tested can be implemented in the form of a file in a table format, a file in a text format, or a database. In the data structure, the index value of each macro switch value is determined. If it is determined based on the macro switch information that there are 3 macro switches A, B, and C, each macro switch has two values, on and off, wherein the index of the on value of each macro switch is 2, and the index of the off value is 3. Further, an array corresponding to each test combination in all test combinations is established, wherein the array corresponding to each test combination includes the index value corresponding to the value of each macro switch under the test combination. For example, the array is in the form of [value of macro switch A, value of macro switch B, value of macro switch C]. One of the test combinations is: A macro switch is on, B macro switch is on, C macro switch is on, then the corresponding array is [2, 2, 2]; another can be: A macro switch is off, B macro switch is on, C macro switch is on, then the corresponding array is [3, 2, 2]. Optionally, the values of the macro switches in the array can also be in disorder, and each value is determined by the macro switch id and the index value. For example, one of the test combinations can be: macro switch A is on, macro switch B is on, and macro switch C is on, then the corresponding array is {[A, 2], [C, 2], [B, 2]}. Exemplarily, when all test combinations are assigned, the arrays corresponding to all test combinations are assigned to each sub-test process. Furthermore, the sub-test process is executed so that the corresponding macro switch information is obtained in the data structure according to the assigned array. The scheme of this example can simplify the data management of the test combination and further improve the test efficiency of the project to be tested by establishing a data structure and an array corresponding to each test combination.
[0109] In the test device of the code engineering provided in this embodiment, the test requirements of the project to be tested, including the identification of multiple sub-test processes, are obtained; according to the code of the project to be tested, a code copy corresponding to each sub-test process is created, and based on the macro switch information of the project to be tested, all the test combinations of the project to be tested are determined; all the test combinations are assigned to determine the test combination corresponding to each sub-test process; according to the code copy and test combination corresponding to each sub-test process, multiple sub-test processes are executed and corresponding output results are obtained to obtain the test results of the project to be tested. The scheme of this example, based on the constructed automated test process, improves the test coverage of the project to be tested through all test combinations, and assigns the corresponding test combination to each sub-test process for testing after considering the test requirements, thereby improving the accuracy of the code engineering test.
[0110] Embodiment 4
[0111] Fig. 9 This is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present application, and the electronic device includes:
[0112] The electronic device includes a processor 291 and a memory 292; it may also include a communication interface 293 and a bus 294. The processor 291, the memory 292, and the communication interface 293 may communicate with each other through the bus 294. The communication interface 293 may be used for information transmission. The processor 291 may call the logic instructions in the memory 292 to execute the above-mentioned example method.
[0113] In addition, the logic instructions in the above-mentioned memory 292 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.
[0114] The memory 292 is a computer-readable storage medium that can be used to store software programs and computer executable programs, such as program instructions / modules corresponding to the methods in the embodiments of the present application. The processor 291 executes functional applications and data processing by running the software programs, instructions, and modules stored in the memory 292, that is, implementing the methods in the above method examples.
[0115] The memory 292 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 292 may include a high-speed random access memory and may also include a non-volatile memory.
[0116] An embodiment of the present application further provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the method in any embodiment.
[0117] An embodiment of the present application also provides a computer program product, including a computer program, which implements the method in any embodiment when the computer program is executed by a processor.
[0118] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0119] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A code engineering testing method, characterized in that: The code project includes a plurality of macro switches, and the method includes: Acquire the test requirements of the project to be tested, and determine the macro switch information of the project to be tested; wherein the test requirements include identifiers of multiple sub-test processes, and the macro switch information includes identifiers of the multiple macro switches and multiple values corresponding to each macro switch; Based on the macro switch information, all test combinations of the project to be tested are determined, wherein each test combination includes the values of the multiple macro switches, and the value combinations of the multiple macro switches under different test combinations are different; according to the code of the project to be tested, a code copy corresponding to each sub-test process is created, and different code copies are distinguished by the identifier of the sub-test process; All the test combinations are allocated to determine the test combination corresponding to each sub-test process; according to the code copy and test combination corresponding to each sub-test process, the multiple sub-test processes are executed and the corresponding output results are obtained to obtain the test results of the project to be tested.
2. The method according to claim 1, characterized in that The method further comprises: Obtaining a test configuration template for the project to be tested, wherein the test configuration template includes a test process placeholder; The identifier of each sub-test process is sequentially brought into the test process placeholder in the test configuration template of the project to be tested to generate a test configuration file corresponding to the sub-test process; wherein the test configuration file includes: the address of the code copy corresponding to the sub-test process, the result storage address of the sub-test process, and the test tool.
3. The method according to claim 2, characterized in that Each sub-test process includes a test case corresponding to each test combination under the sub-test process, and executing the multiple sub-test processes and obtaining corresponding output results according to the code copy and the test combination corresponding to each sub-test process includes: For each sub-test process, according to the code copy and test combination corresponding to the sub-test process, each test case under the sub-test process is executed, and the corresponding output result is obtained.
4. The method according to claim 3, characterized in that For each sub-test process, according to the code copy and test combination corresponding to the sub-test process, each test case under the sub-test process is executed, and the corresponding output result is obtained, including: For each sub-test process, according to the address of the code copy in the test configuration file corresponding to the sub-test process, obtain the code copy corresponding to the sub-test process; For each test case under the sub-test process, according to the test combination corresponding to the test case, the code copy corresponding to the sub-test process is updated; based on the updated code copy, the transfer parameter is determined; the transfer parameter is sent to the test tool recorded in the test configuration file to obtain the output information of the test tool; The output information of each test case under the sub-test process is saved in the result storage address recorded in the test configuration file as the output result of the sub-test process.
5. The method according to claim 4, characterized in that After the code copy corresponding to the sub-test process is updated, the following step is also included: The test information is displayed, wherein the test information includes an identifier of a test case currently being executed and an identifier of a sub-test process to which the test case belongs.
6. The method according to claim 4, characterized in that After sending the transfer parameter to the test tool recorded in the test configuration file and obtaining the output information of the test tool, the method further includes: The output information is renamed, and the renamed output information includes an identifier of the current test case.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Establishing a data structure including the macro switch information of the project to be tested, and determining the index value of each macro switch value in the macro switch information in the data structure; An array corresponding to each test combination in all the test combinations is established, wherein the array corresponding to each test combination includes an index value corresponding to the value of each macro switch under the test combination.
8. A testing device for code engineering, characterized in that: The device comprises: An acquisition module, used to acquire the test requirements of the project to be tested and determine the macro switch information of the project to be tested; wherein the test requirements include identifiers of multiple sub-test processes, and the macro switch information includes identifiers of the multiple macro switches and multiple values corresponding to each macro switch; A determination module is used to determine all test combinations of the project to be tested based on the macro switch information, wherein each test combination includes the values of the multiple macro switches, and the value combinations of the multiple macro switches under different test combinations are different; according to the code of the project to be tested, create a code copy corresponding to each sub-test process, and different code copies are distinguished by the identifier of the sub-test process; The test module is used to distribute all the test combinations and determine the test combination corresponding to each sub-test process; according to the code copy and test combination corresponding to each sub-test process, execute the multiple sub-test processes and obtain the corresponding output results to obtain the test results of the project to be tested.
9. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.
11. A computer program product, characterized in that The method comprises a computer program, which implements the method according to any one of claims 1 to 7 when being executed by a processor.