CN-115904962-B - Automatic test method, platform, equipment and storage medium
Abstract
The invention discloses an automatic test method, an automatic test device, automatic test equipment and a storage medium, wherein the method comprises the following steps of obtaining at least one to-be-tested use case; acquiring an automation script, generating a pytest file corresponding to an application to be tested based on the automation script, executing pytest files to obtain an actual execution result, asserting an expected result and the actual execution result to obtain a test result, and generating a graphical test report according to the test result. The invention can quickly generate the test report and feed back the test result, and the test result can be more easily understood by the testers, so that the invention is simpler than the prior art and is a simple automatic test framework.
Inventors
- LIU JINGLEI
- LIN CHEN
- LI GUIBIN
- CHEN QINGHUA
Assignees
- 杭州云合智网技术有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20221114
Claims (8)
- 1. An automated testing method, comprising the steps of: Acquiring at least one to-be-tested case; Acquiring an automatic script and generating pytest files corresponding to an application to be tested based on the automatic script, wherein the method comprises the steps of calling cmake to compile the application to be tested to generate an executable file, calling the executable file in the automatic script and then transmitting jinja template to generate pytest files corresponding to the gtest file, wherein the automatic script is a python script, and the pytest files correspond to the gtest file names; executing pytest files to obtain an actual execution result; asserting an expected result and an actual execution result to obtain a test result; And generating a graphical test report according to the test result.
- 2. The automated test method of claim 1, further comprising: building a test environment, wherein the building of the test environment specifically comprises the following steps: installing Python3.8; Installing an automation script, allure tools and jinja templates; And verifying the installed program.
- 3. The automated test method of claim 1, wherein the execution results comprise execution success and execution failure, wherein the expected results and the actual execution results are asserted, the success of the assertion marks the passing of the test case, and the failure of the assertion marks the failure of the test case.
- 4. The automated test method of claim 1, wherein different test results are marked by different colors in a graphical test report, and wherein the test report comprises test passing rate, pytest output print information during the file test, historical test results.
- 5. The automated test method of claim 1, further comprising: The patterned test report is sent to the specified address.
- 6. The automated testing method of claim 1, further comprising, after obtaining an automation script and generating pytest files corresponding to the application under test based on the automation script: Automatically counting the number of pytest files generated; The test result also includes the test case start test time and the test duration.
- 7. An automated test platform, comprising: The test case management module is used for acquiring at least one test case to be tested; The test case processing module is used for acquiring an automatic script and generating pytest files corresponding to the to-be-tested cases based on the automatic script, wherein the method comprises the steps of calling cmake to compile the to-be-tested cases to generate executable files, wherein the to-be-tested cases are gtest files, calling the executable files in the automatic script, and then transmitting the executable files into jinja templates to generate pytest files corresponding to the gtest files, wherein the automatic script is a python script, and the pytest files correspond to the gtest file names; the execution module is used for executing pytest files to obtain an actual execution result; the assertion module is used for asserting the expected result and the actual execution result to obtain a test result; and the test report module is used for generating a graphical test report according to the test result.
- 8. An automated test apparatus comprising a memory and a processor, the memory having stored therein a computer program executable by the processor to implement the automated test method of any of claims 1 to 6.
Description
Automatic test method, platform, equipment and storage medium Technical Field The embodiment of the invention relates to the technical field of software testing, in particular to an automatic testing method, a platform, equipment and a storage medium. Background With the development of computer software technology, the iterative release speed of functions of a software system is faster and faster, the release period of versions is shorter and shorter, the system is more and more complex, the quality of the software is gradually valued by users, and the software test is more important as a way for guaranteeing the quality of the software. In the process of chip development, the functions of the software are tested, so that whether the code functions meet the requirements of users can be confirmed, the software quality can be improved, the software safety can be ensured, and the software development cost and business risk can be reduced. The inventor finds that at least the following problems exist when the SDK test is performed at present, that in the prior art, a tester needs to manually perform a plurality of tests and summarize data, the test process becomes complex and takes much time, when the SDK is tested, a gtest unit test framework is often used, but when the gtest test code function is used, the output result can only be displayed on a terminal, the history result cannot be visually and visually checked by an issuer, and the history result is difficult to check by a client. Disclosure of Invention The invention aims to provide an automatic test method, a platform, equipment and a storage medium, and aims to solve the technical problems that test results of a gtest code in the prior art cannot be displayed intuitively and historical test results cannot be reserved. In order to achieve the above object, the present invention provides an automated testing method, comprising the steps of: Acquiring at least one to-be-tested case; Acquiring an automation script, and generating pytest files corresponding to the application to be tested based on the automation script; executing pytest files to obtain an actual execution result; asserting an expected result and an actual execution result to obtain a test result; And generating a graphical test report according to the test result. Preferably, the method further comprises: Building a test environment; the construction test environment specifically comprises: installing Python 3.8; Installing an automation script, allure tools and jinja templates; And verifying the installed program. Preferably, an automation script is obtained, and a pytest file corresponding to an application to be tested is generated based on the automation script, which specifically includes: Calling cmake to compile an instance to be tested, and generating an executable file, wherein the instance to be tested is a gtest file; and calling the executable file in an automation script, and then transmitting jinja templates to generate pytest files corresponding to the gtest file, wherein the automation script is pytihon script, and the pytest files correspond to the gtest file names. Preferably, the execution results comprise execution success and execution failure, the expected result and the actual execution result are asserted, the success of the assertion marks the passing of the test case, and the failure of the assertion marks the failure of the test case. Preferably, different test results are marked by different colors in the graphical test report, and the test report comprises the test passing rate, the output printing information in the pytest file test process and the historical test result. Preferably, the graphical test report is sent to the specified address. Preferably, after acquiring the automation script and generating pytest files corresponding to the application to be tested based on the automation script, the method further comprises: Automatically counting the number of pytest files generated; The test result also includes the test case start test time and the test duration. The embodiment of the invention also provides an automatic test platform, which comprises: The test case management module is used for acquiring at least one test case to be tested; the test case processing module is used for acquiring an automation script and generating pytest files corresponding to the to-be-tested application cases based on the automation script; the execution module is used for executing pytest files to obtain an actual execution result; the assertion module is used for asserting the expected result and the actual execution result to obtain a test result; and the test report module is used for generating a graphical test report according to the test result. The embodiment of the invention also provides automatic test equipment, which comprises a memory and a processor, wherein the memory stores a computer program, and the computer program can be executed by the processor to real