Automation method, system and equipment for embedded code unit testing and medium

Through the method of automated embedded code unit testing, the user configuration interface and SVN collaborative module are used to process test parameters and results, and the problems of cumbersome tests and insufficient results are solved in the existing technology, and an efficient and customized test process is realized. Results analysis.

CN119441058APending Publication Date: 2025-02-14SINO TRUK JINAN POWER CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411742118.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

In the prior art, embedded software code unit testing is complicated, and it is impossible to customize the test requirements, and the test results are not effectively processed, resulting in inefficiency and insufficient information utilization.

Method used

Provide an automated method of embedded code unit testing, obtain test running parameters and test result processing rules through preset user configuration interface, use SVN collaborative module and tbs file to realize customized test and result processing, and assist test with neural network algorithm Code design.

Benefits of technology

Automated unit testing is implemented, shortening test time, improving testing efficiency, able to customize testing requirements according to requirements, and provide valuable information for optimizing code and improving software quality by further processing test results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119441058A_ABST
    Figure CN119441058A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic method, system and equipment for testing an embedded code unit and a medium, mainly relates to the technical field of code testing, and is used for solving the problems that in an existing scheme, manual testing is tedious, customized modification cannot be carried out on code unit testing requirements, and further processing cannot be carried out on a testing result. Comprising the steps of obtaining a server and a tbs file corresponding to test software through a preset user configuration interface; wherein the tbs file at least comprises a test code position, a test operation parameter and a test result processing rule; transmitting a tbs file in the SVN collaboration module to a corresponding server through remote calling, and further calling test software based on a test code position and a test operation parameter in the tbs file to obtain a test result; based on the test result processing rule, the test software further processes the test result, and the test operation parameters and the processed test result are transmitted back to the SVN collaboration module.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of embedded code unit testing, and in particular to an automated method, system, device and medium for embedded code unit testing. Background Art

[0002] For embedded software, unit testing of software code is a tedious and repetitive task. As the complexity of embedded software continues to increase, the execution time of software code unit testing continues to increase. If a lot of time is spent waiting for the test to complete, it will be a huge waste of development time.

[0003] Most of the existing technical solutions isolate testing and development work, allowing developers to focus on development, but the testing work itself still seems repetitive and time-consuming. In addition, a lot of communication time is required between the development and testing teams, which not only affects work efficiency, but also does not fundamentally solve the problem of cumbersome testing. In addition, there are also automated testing platforms in the existing technical solutions, but these platforms lack a special interface for the tbs configuration file for embedded software code unit testing, and thus cannot customize the requirements of code unit testing during the testing process, thereby affecting the flexibility and efficiency of the test. In addition, the existing automated testing platform fails to further process the test results. This makes it difficult for developers to obtain valuable information from the test results for optimizing the code and improving the quality of the software.

[0004] Therefore, there is an urgent need for an automated method, system, device and medium for embedded code unit testing to solve the problems of cumbersome manual testing, inability to customize the requirements of code unit testing, and inability to further process the test results. Summary of the invention

[0005] In view of the above-mentioned deficiencies in the prior art, the present application provides an automated method, system, device and medium for embedded code unit testing to solve the problems of existing solutions: cumbersome manual testing, inability to customize the requirements of code unit testing, and failure to further process the test results.

[0006] In a first aspect, the present application provides an automated method for embedded code unit testing, the method comprising: Generate initial code according to the set input parameters and the set output parameters; transfer the initial test code to the preset adjustment terminal to obtain the test code and the test code location; obtain the server and tbs file corresponding to the test software through the preset user configuration interface; wherein the tbs file at least includes the test code location, test running parameters, and test result processing rules; through remote calling, transfer the tbs file in the SVN (SubVersion‌ open source version control system) collaboration module to the corresponding server, and then call the test software based on the test code location and test running parameters in the tbs file to obtain the test results; based on the test result processing rules, the test software further processes the test results, and returns the test running parameters and the processed test results to the SVN collaboration module.

[0007] The automated method for embedded code unit testing provided in the embodiment of the present application obtains test operation parameters, test result processing rules, etc. from the outside through a preset user configuration interface, that is, the requirements for code unit testing can be customized and modified through test operation parameters; the test results are further processed through test result processing rules. In addition, due to the use of SVN collaborative modules and tbs files, options such as coverage, report type and content can be modified without local software during regression testing. That is, the present application solves the problems of existing solutions: cumbersome manual testing, inability to customize the requirements for code unit testing, and failure to further process test results.

[0008] In one implementation of the present application, there is a preset sample code database, and the preset sample code database stores a number of sample codes and input parameters and output parameters of each preset sample code; generating an initial code according to the set input parameters and the set output parameters specifically includes: According to the set input parameters and the set output parameters, the corresponding sample code is extracted from the preset sample code database as the initial code.

[0009] In one implementation of the present application, generating the initial code according to the set input parameters and the set output parameters specifically includes: The set input parameters and the set output parameters are used as the input of the preset trained neural network algorithm, and the output code obtained is the initial code; wherein, the sample data for training the neural network algorithm is: the historical code within a preset time period and the input data and output data corresponding to the historical code.

[0010] The automated method for embedded code unit testing provided in the embodiment of the present application integrates a fusion neural network algorithm, can assist in the design of test codes, and can shorten the test code design time in the face of increasingly complex embedded software.

[0011] In one implementation of the present application, obtaining the server and tbs file corresponding to the test software through a preset user configuration interface specifically includes: Obtain the preset tbs file in the SVN collaboration module, or obtain the tbs file of the test code through the preset user configuration interface; wherein the test running parameters in the tbs file at least include: test coverage options, test cycle step length, and the test result processing rules at least include: the test result location generated by the test, and the test result type generated.

[0012] In one implementation of the present application, the tbs file in the SVN collaboration module is transferred to the corresponding server through remote calling, and then based on the test code location and test running parameters in the tbs file, the test software is called to obtain the test results, specifically including: When performing code testing, the test code location in the tbs file is read to obtain the test code; the specific progress of the test software running the test code is controlled through the test running parameters in the tbs file.

[0013] In one implementation of the present application, after the test software further processes the test result based on the test result processing rule and transmits the test running parameters and the processed test result back to the SVN collaboration module, the method further includes: Write the test code into a preset Excel table; write the test running parameters and test results into the preset Excel table corresponding to the test code; and generate chart information corresponding to the test running parameters based on the preset chart generation instructions.

[0014] The automated method for embedded code unit testing provided in the embodiment of the present application enables users to obtain information quickly and effectively through preset Excel tables, without taking up too much time on communication. Preset Excel tables and preset charts make important parameters clear at a glance.

[0015] In a second aspect, the present application provides an automated system for embedded code unit testing, the system comprising: The code acquisition module is used to generate the initial code according to the set input parameters and the set output parameters; the initial test code is transmitted to the preset adjustment terminal to obtain the test code and the test code location; the code test module obtains the server and tbs file corresponding to the test software through the preset user configuration interface; wherein the tbs file at least includes the test code location, test running parameters, and test result processing rules; through remote calling, the tbs file in the SVN collaborative module is transmitted to the corresponding server, and then based on the test code location and test running parameters in the tbs file, the test software is called to obtain the test results; the result feedback module is used for the test software to further process the test results based on the test result processing rules, and transmit the test running parameters and the processed test results back to the SVN collaborative module.

[0016] In one implementation of the present application, the code acquisition module includes a code acquisition unit, which is used to use the set input parameters and the set output parameters as the input of a preset trained neural network algorithm, and the output code obtained is the initial code; wherein, the sample data for training the neural network algorithm is: the historical code within a preset time period and the input data and output data corresponding to the historical code.

[0017] In one implementation of the present application, the code testing module includes a file acquisition unit, which is used to obtain the tbs file preset in the SVN collaboration module, or to obtain the tbs file of the test code through a preset user configuration interface; wherein the test running parameters in the tbs file include at least: test coverage options, test cycle step length, and the test result processing rules include at least: the location of the test results generated by the test, and the type of test results generated.

[0018] In a third aspect, the present application provides a non-volatile computer storage medium having computer instructions stored thereon, which, when executed, implement an automated method for testing an embedded code unit as described above.

[0019] Those skilled in the art can understand that the present application has at least the following beneficial effects: The present application proposes an automated method, system, device and medium for embedded code unit testing, which can obtain test operation parameters and test result processing rules from the outside, that is, the requirements of code unit testing can be customized through test operation parameters; and the test results can be further processed through test result processing rules. In addition, due to the use of SVN collaborative modules and tbs files, options such as coverage, report type and content can be modified without local software during regression testing. That is, the present application solves the problems of existing solutions: cumbersome manual testing, inability to customize the requirements of code unit testing, and failure to further process test results.

[0020] In addition, the present application integrates a fusion neural network algorithm, which can assist in the design of test codes and shorten the test code design time in the face of increasingly complex embedded software.

[0021] In addition, this application uses preset Excel tables to enable users to obtain information quickly and effectively without taking up too much time on communication. Preset Excel tables and preset charts make important parameters clear at a glance. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Some embodiments of the present disclosure are described below with reference to the accompanying drawings, in which: Figure 1 This is a flow chart of an automated method for embedded code unit testing provided in an embodiment of the present application.

[0023] Figure 2 It is a schematic diagram of the internal structure of an automated system for embedded code unit testing provided in an embodiment of the present application.

[0024] Figure 3 It is a schematic diagram of the internal structure of an automated device for embedded code unit testing provided in an embodiment of the present application. DETAILED DESCRIPTION

[0025] It should be understood by those skilled in the art that the embodiments described below are only preferred embodiments of the present disclosure, and do not mean that the present disclosure can only be implemented through the preferred embodiments. The preferred embodiments are only used to explain the technical principles of the present disclosure, and are not used to limit the protection scope of the present disclosure. Based on the preferred embodiments provided by the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work should still fall within the protection scope of the present disclosure.

[0026] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0027] The technical solution proposed in the embodiments of the present application is described in detail below with reference to the accompanying drawings.

[0028] The embodiment provides an automated method for embedded code unit testing, such as Figure 1 As shown, the method provided in the embodiment of the present application mainly includes the following steps: Step 110: Generate an initial code according to the set input parameters and the set output parameters; transmit the initial test code to a preset adjustment terminal to obtain a test code and a test code position.

[0029] It should be noted that the input parameters and output parameters are set by those skilled in the art according to actual needs. The scheme for generating the initial code can be to retrieve similar codes from a historical code database, or to automatically generate them according to a trained neural network, or to use an optimization algorithm and a search algorithm to quickly generate the initial code according to the set input parameters and the set output parameters.

[0030] In some embodiments, there is a preset sample code database, and the preset sample code database stores a number of sample codes and output parameters and output parameters of each preset sample code.

[0031] Generate initial code based on the set input parameters and set output parameters, which can be: According to the set input parameters and the set output parameters, the corresponding sample code is extracted from the preset sample code database as the initial code.

[0032] Among them, the initial code is automatically generated according to the trained neural network, which can be specifically: The set input parameters and the set output parameters are used as the input of the preset trained neural network algorithm, and the output code obtained is the initial code; wherein, the sample data for training the neural network algorithm is: the historical code within a preset time period and the input data and output data corresponding to the historical code.

[0033] In addition, the preset adjustment terminal is a modification terminal for professionals.

[0034] It should be noted that auxiliary means are added when designing the above test code (similar codes are retrieved from the historical code database, or automatically generated based on the trained neural network), which reduces the design time of the test code.

[0035] Step 120, obtain the server and tbs file corresponding to the test software through the preset user configuration interface; transfer the tbs file in the SVN collaboration module to the corresponding server through remote calling, and then call the test software based on the test code location and test running parameters in the tbs file to obtain the test results.

[0036] It should be noted that the tbs file at least includes the test code location, test running parameters, and test result processing rules. More specifically, the tbs file is a configuration file exported by the code testing software, and its main content is the test configuration parameters and their values. Its parameters include the relative position of the report generated by this embedded software test, the test coverage option (size or type), the test cycle step, the type of test report generated, etc. By reading the tbs file to drive the embedded software code test, the test can be executed according to the above parameters without opening the GUI interface of the code testing software. In this way, you only need to complete the writing of the value in the user configuration interface of the tbs file corresponding to the test code, and the user configuration interface drives the script to complete the writing and modification of the tbs file, so that you can control the results of this unit test run without opening the test software. The remote call is used to convey the tbs file of the SVN collaboration module to the server where the test software is located, and start the relevant software script to drive the test software to complete the test work.

[0037] In addition, the SVN (SubVersion) collaboration module can complete the transmission of tbs file codes across hosts and servers. As long as they are in the same server network segment, they can obtain tbs files from the SVN repository. It is mainly used to transfer tbs files between the server corresponding to the test software and the current user's host.

[0038] The test running parameters in the tbs file include at least: test coverage options and test cycle step length, and the test result processing rules include at least: the test result location generated by the test and the test result type generated.

[0039] In addition, the preset user configuration interface is used to input parameters, which can include the name of the test, the location of the test code, and the coverage options required by the tbs file, etc. The user configuration interface directly faces the designer, and the values ​​entered in the user configuration interface will be used as parameters to drive the operation of the background system, such as controlling the code transmission into the server, modifying and writing tbs files, and driving tests according to tbs files.

[0040] In the step, the tbs file in the SVN collaborative module is transferred to the corresponding server through remote calling, and then based on the test code location and test running parameters in the tbs file, the test software is called to obtain the test results, which may specifically include: When performing code testing, the test code location in the tbs file is read to obtain the test code; the specific progress of the test software running the test code is controlled through the test running parameters in the tbs file.

[0041] Step 130: Based on the test result processing rules, the test software further processes the test result and transmits the test running parameters and the processed test result back to the SVN collaboration module.

[0042] After this step, the method may further include: Write the test code into a preset Excel table; write the test running parameters and test results into the preset Excel table corresponding to the test code; and generate chart information corresponding to the test running parameters based on the preset chart generation instructions.

[0043] It can be understood by those skilled in the art that this application uses the form of Excel to store the test code, which is highly readable and modifiable. After the test is completed, the test results can be parsed, the required information can be extracted, and written into Excel, so that users can quickly find the abnormal module. At the same time, a test statistics web page dashboard can also be generated, and preset charts (bar charts, etc.) can be used to allow people who are not deeply involved in the project to see it at a glance.

[0044] In addition, feedback is added for each running step. This application can control the test software to generate corresponding log files. Combined with version management, it can help developers find and fix problems in a timely manner.

[0045] In addition, this application Figure 2 An automated system for embedded code unit testing provided by an embodiment of the present application. Figure 2 As shown, the system provided in the embodiment of the present application mainly includes: The code acquisition module 210 is used to generate an initial code according to the set input parameters and the set output parameters; transmit the initial test code to the preset adjustment terminal to obtain the test code and the test code position.

[0046] The code acquisition module 210 includes a code acquisition unit, which is used to use the set input parameters and the set output parameters as the input of the preset trained neural network algorithm, and the output code obtained is the initial code; wherein, the sample data for training the neural network algorithm is: the historical code within a preset time period and the input data and output data corresponding to the historical code.

[0047] The code testing module 220 obtains the server and tbs file corresponding to the test software through a preset user configuration interface; wherein the tbs file includes at least the test code location, test running parameters, and test result processing rules; through remote calls, the tbs file in the SVN collaborative module is transferred to the corresponding server, and then based on the test code location and test running parameters in the tbs file, the test software is called to obtain the test results.

[0048] The code testing module 220 includes a file acquisition unit, which is used to obtain the tbs file preset in the SVN collaboration module, or to obtain the tbs file of the test code through a preset user configuration interface; wherein the test running parameters in the tbs file include at least: test coverage options, test cycle step length, and the test result processing rules include at least: the location of the test results generated by the test, and the type of test results generated.

[0049] The result feedback module 230 is used for the test software to further process the test result based on the test result processing rule, and to return the test running parameters and the processed test result to the SVN collaboration module.

[0050] The above is a method embodiment of the present application. Based on the same inventive concept, the present application embodiment also provides an automated device for embedded code unit testing. Figure 3 As shown, the device includes: a processor; and a memory on which executable codes are stored. When the executable codes are executed, the processor executes an automated method for embedded code unit testing as in the above-mentioned embodiment.

[0051] Specifically, the server generates the initial code according to the set input parameters and the set output parameters; transmits the initial test code to the preset adjustment terminal to obtain the return test code; obtains the server and tbs file corresponding to the test software through the preset user configuration interface; wherein the tbs file includes at least the test code location, test running parameters, and test result processing rules; transmits the tbs file in the SVN collaborative module to the corresponding server through remote calling, and then calls the test software based on the test code location and test running parameters in the tbs file to obtain the test results; based on the test result processing rules, the test software further processes the test results, and transmits the test running parameters and the processed test results back to the SVN collaborative module.

[0052] In addition, an embodiment of the present application further provides a non-volatile computer storage medium on which executable instructions are stored. When the executable instructions are executed, an automated method for embedded code unit testing as described above is implemented.

[0053] So far, the technical solutions of the present disclosure have been described in combination with the above multiple embodiments, but it is easy for those skilled in the art to understand that the protection scope of the present disclosure is not limited to these specific embodiments. Without departing from the technical principles of the present disclosure, those skilled in the art can split and combine the technical solutions in the above-mentioned various embodiments, and can also make equivalent changes or replacements to the relevant technical features. Any changes, equivalent replacements, improvements, etc. made within the technical concept and / or technical principle of the present disclosure will fall within the protection scope of the present disclosure.

Claims

1. An automated method for embedded code unit testing, characterized in that: The method comprises: Generate an initial code according to the set input parameters and the set output parameters; transmit the initial test code to the preset adjustment terminal to obtain a return test code; Obtain the server and tbs file corresponding to the test software through the preset user configuration interface; wherein the tbs file at least includes the test code location, test running parameters, and test result processing rules; transmit the tbs file in the SVN collaboration module to the corresponding server through remote calling, and then call the test software based on the test code location and test running parameters in the tbs file to obtain the test results; Based on the test result processing rules, the test software further processes the test results and sends the test running parameters and processed test results back to the SVN collaboration module.

2. The automated method for embedded code unit testing according to claim 1, characterized in that: There is a preset sample code database, and the preset sample code database stores a number of sample codes and output parameters and output parameters of each preset sample code; Generate initial code based on the set input parameters and set output parameters, including: According to the set input parameters and the set output parameters, the corresponding sample code is extracted from the preset sample code database as the initial code.

3. The automated method for embedded code unit testing according to claim 1, characterized in that: Generate initial code based on the set input parameters and set output parameters, including: The set input parameters and the set output parameters are used as the input of the preset trained neural network algorithm, and the output code obtained is the initial code; wherein, the sample data for training the neural network algorithm is: the historical code within a preset time period and the input data and output data corresponding to the historical code.

4. The automated method for embedded code unit testing according to claim 1, characterized in that: Through remote calling, the tbs file in the SVN collaborative module is transferred to the corresponding server, and then based on the test code location and test running parameters in the tbs file, the test software is called to obtain the test results, including: When performing code testing, read the test code location in the tbs file to obtain the test code; The specific progress of the test software running the test code is controlled through the test running parameters in the tbs file.

5. The automated method for embedded code unit testing according to claim 1, characterized in that: After the test software further processes the test result based on the test result processing rule and transmits the test running parameters and the processed test result back to the SVN collaboration module, the method further includes: Write the test code into the preset Excel table; Write the test running parameters and test results into the preset Excel table corresponding to the test code; And based on the preset chart generation instructions, generate chart information corresponding to the test running parameters.

6. An automated system for embedded code unit testing, characterized in that: The system comprises: The code acquisition module is used to generate an initial code according to the set input parameters and the set output parameters; transmit the initial test code to the preset adjustment terminal to obtain the test code and the test code position; The code testing module obtains the server and tbs file corresponding to the test software through a preset user configuration interface; wherein the tbs file at least includes the test code location, test running parameters, and test result processing rules; through remote calls, the tbs file in the SVN collaboration module is transferred to the corresponding server, and then based on the test code location and test running parameters in the tbs file, the test software is called to obtain the test results; The result feedback module is used to further process the test results based on the test result processing rules and the test software, and return the test running parameters and the processed test results to the SVN collaboration module.

7. The automated system for embedded code unit testing according to claim 6, characterized in that: The code acquisition module includes a code acquisition unit, It is used to use the set input parameters and the set output parameters as the input of the preset trained neural network algorithm, and the output code obtained is the initial code; wherein, the sample data for training the neural network algorithm is: the historical code within a preset time period and the input data and output data corresponding to the historical code.

8. The automated system for embedded code unit testing according to claim 6, characterized in that: The code testing module includes a testing unit, which is used to read the test code position in the tbs file to obtain the test code when performing code testing; and control the specific progress of the test software running the test code through the test running parameters in the tbs file.

9. An automated device for embedded code unit testing, characterized in that: The device comprises: processor; and a memory having executable codes stored thereon, which, when the executable codes are executed, enable the processor to execute an automated method for embedded code unit testing as described in any one of claims 1-5.

10. A non-volatile computer storage medium, characterized in that: Computer instructions are stored thereon, and when the computer instructions are executed, the automated method for testing an embedded code unit as described in any one of claims 1 to 5 is implemented.