CN-116257426-B - Test association method, device, electronic equipment and storage medium
Abstract
The application provides a test association method, a test association device, electronic equipment and a storage medium. The method comprises the steps of obtaining a test result of an automatic test script by executing an automatic test script file, updating a hash set based on the test result, wherein the hash set comprises hash data corresponding to a plurality of automatic test scripts, a key of each hash data is a script name of the corresponding automatic test script, and a value represents the test result of the corresponding automatic test script. And inquiring the hash set for each functional test case in the functional test case file to obtain first hash data with keys consistent with names of the functional test cases, and updating test identifiers of the functional test cases in the functional test case file according to the values of the first hash data. The application establishes the association between the automatic test script and the functional test case by adopting the same name, realizes the automatic update of the execution result of the functional test case, saves time and labor and improves the test efficiency.
Inventors
- Shen Yumiao
- ZHANG WENJIA
Assignees
- 中国联合网络通信集团有限公司
- 联通支付有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20211210
Claims (8)
- 1. A test association method is characterized in that, Acquiring a functional test case file and an automatic test script file, wherein the functional test case file comprises a plurality of functional test cases, and the automatic test script file comprises a plurality of automatic test scripts; Executing the test according to the automatic test script file to obtain test results of the plurality of automatic test scripts; updating a hash set based on test results of the plurality of automatic test scripts, wherein the hash set comprises hash data corresponding to the plurality of automatic test scripts, a key of each hash data is a script name of the corresponding automatic test script, and a value represents the test result of the corresponding automatic test script; Inquiring the hash set for each functional test case in the functional test case file to obtain first hash data with keys consistent with names of the functional test cases, and updating test identifiers of the functional test cases in the functional test case file according to the values of the first hash data, wherein different test identifiers represent different test results; The updating the hash set based on the test results of the plurality of automated test scripts comprises: if the hash data of which the key is the name of the automatic test script does not exist in the current hash set, adding the hash data corresponding to the automatic test script into the hash set; if the hash data corresponding to the automatic test script exists in the current hash set, updating the value of the hash data corresponding to the automatic test script according to the current value of the hash data and the test result of the automatic test script; The method comprises the steps of inquiring the hash set aiming at each function test case in the function test case file, wherein the file type of the function test case file comprises a thinking guide diagram format and/or a list, acquiring names of leaf nodes in the function test case file when the file type of the function test case file is the thinking guide diagram format, inquiring the hash set based on the names of the leaf nodes, and acquiring contents of each row under the test case name list in the function test case file when the file type of the function test case file is the list, and inquiring the hash set based on the contents of each row.
- 2. The method of claim 1, wherein the test results include one of pass, fail, and partially pass, and wherein updating the value of the hash data corresponding to the automated test script based on the current value of the hash data and the test results of the automated test script comprises: if the current value of the hash data is consistent with the test result of the automatic test script, or the test result represented by the current value of the hash data is partially passed, the value of the hash data is not modified; and if the test result of the current value representation of the hash data is not partially passed and the test result of the current value representation of the hash data is inconsistent with the test result of the automatic test script, modifying the value of the hash data, wherein the modified value representation is partially passed.
- 3. The method of claim 1, wherein performing a test from the automation test script file to obtain test results for the plurality of automation test scripts comprises: determining the types of the plurality of automated test scripts in the automated test script file; And executing corresponding running commands according to the types of the plurality of automatic test scripts to obtain test results of the automatic test scripts.
- 4. A test association apparatus, the apparatus comprising: The system comprises an acquisition module, a function test case file and an automation test script file, wherein the function test case file comprises a plurality of function test cases, and the automation test script file comprises a plurality of automation test scripts; The processing module is used for executing the test according to the automatic test script file to obtain test results of the plurality of automatic test scripts; the processing module is further used for updating a hash set based on the test results of the plurality of automatic test scripts, wherein the hash set comprises hash data corresponding to the plurality of automatic test scripts, keys of each hash data are script names of the corresponding automatic test scripts, and the values represent the test results of the corresponding automatic test scripts; The processing module is further configured to query the hash set for each functional test case in the functional test case file, obtain first hash data whose key is consistent with a name of the functional test case, and update a test identifier of the functional test case in the functional test case file according to a value of the first hash data, where different test identifiers represent different test results; The processing module is specifically configured to execute, for each automated test script, the following process, if hash data whose key is the name of the automated test script does not exist in the current hash set, adding hash data corresponding to the automated test script in the hash set; if the hash data corresponding to the automatic test script exists in the current hash set, updating the value of the hash data corresponding to the automatic test script according to the current value of the hash data and the test result of the automatic test script; The processing module is further specifically configured to obtain names of leaf nodes in the function test case file and query the hash set based on the names of the leaf nodes when the file type of the function test case file is in the mind map format, and obtain contents of each row under the test case name list in the function test case file and query the hash set based on the contents of each row when the file type of the function test case file is in the list.
- 5. The apparatus of claim 4, wherein the test results include one of pass, fail, and partially pass, and wherein updating the value of the hash data corresponding to the automated test script based on the current value of the hash data and the test results of the automated test script comprises: if the current value of the hash data is consistent with the test result of the automatic test script, or the test result represented by the current value of the hash data is partially passed, the value of the hash data is not modified; and if the test result of the current value representation of the hash data is not partially passed and the test result of the current value representation of the hash data is inconsistent with the test result of the automatic test script, modifying the value of the hash data, wherein the modified value representation is partially passed.
- 6. The device according to claim 4, wherein the processing module performs a test according to the automation test script file to obtain test results of the plurality of automation test scripts, and specifically comprises: determining the types of the plurality of automated test scripts in the automated test script file; And executing corresponding running commands according to the types of the plurality of automatic test scripts to obtain test results of the automatic test scripts.
- 7. An electronic device is characterized by comprising a memory and a processor; a memory for storing the processor-executable instructions; Wherein the processor is configured to perform the method of any one of claims 1-3 in accordance with the executable instructions.
- 8. A computer readable storage medium having stored therein computer executable instructions which when executed by a processor are adapted to carry out the method of any of claims 1-3.
Description
Test association method, device, electronic equipment and storage medium Technical Field The present application relates to the field of testing technologies, and in particular, to a test association method, a device, an electronic apparatus, and a storage medium. Background With the development of software engineering technology, the structure and logic of the software are more and more complex, and the scale of the software is more and more huge. In order to verify the quality of the software, the possibility of defects in the software is reduced, and the software needs to be tested. Software testing can be categorized into manual testing and automated testing by test means. In the test work, after receiving the requirement, a tester writes the functional test cases for carding thought and case review, and then uniformly writes all the automatable cases into an automation script, and in the subsequent test work, the automation cases are directly executed by the automation script, and the manual execution test of the automation cases is not realized until the execution of all the functional test cases is completed, namely the test is completed. After the automatic test of the case is completed, the tester needs to manually update the execution result of the corresponding functional test case according to the automatic test result to be successful or failed. However, the above solution of manually synchronizing test results has the problem of low time and effort consumption. Disclosure of Invention The application provides a test association method, a test association device, electronic equipment and a storage medium, which are used for solving the problem of low time and labor consumption efficiency in the process of synchronizing an automatic test result and a functional test case execution result. The method comprises the steps of obtaining a functional test case file and an automatic test script file, wherein the functional test case file comprises a plurality of functional test cases, the automatic test script file comprises a plurality of automatic test scripts, executing tests according to the automatic test script file to obtain test results of the plurality of automatic test scripts, updating a hash set based on the test results of the plurality of automatic test scripts, wherein the hash set comprises hash data corresponding to the plurality of automatic test scripts, keys of each hash data are script names of the corresponding automatic test scripts, values represent the test results of the corresponding automatic test scripts, inquiring the hash set for each functional test case in the functional test case file to obtain first hash data, the keys of the first hash data are consistent with the names of the functional test cases, and updating test identifiers of the functional test cases in the functional test case file according to the values of the first hash data, wherein different test identifiers represent different test results. According to the application, the automatic test script and the functional test case are named as the same name, so that the association between the test result of the automatic test script and the execution result of the functional test case is established, the automatic update of the execution result of the functional test case is realized, the time and the labor are saved, the test efficiency is improved, and the accuracy is also improved. Further, based on test results of a plurality of automated test scripts, updating the hash set comprises, for each automated test script, executing the following processing of adding hash data corresponding to the automated test script in the hash set if hash data whose key is the name of the automated test script does not exist in the current hash set, and updating the value of the hash data corresponding to the automated test script according to the value of the current hash data and the test result of the automated test script if hash data corresponding to the automated test script exists in the current hash set. The above illustrates the manner in which the hash data in the hash set is stored and updated. Further, the test results comprise one of passing, failing and partially passing, and updating the value of the hash data corresponding to the automated test script according to the current value of the hash data and the test result of the automated test script, wherein the method comprises the steps of not modifying the value of the hash data if the current value of the hash data is consistent with the test result of the automated test script or the test result represented by the current value of the hash data is partially passing, and modifying the value of the hash data if the test result represented by the current value of the hash data is not partially passing and the current value of the hash data is inconsistent with the test result of the automated test script, wherein the modified value represents partially passing