CN-121996562-A - Software testing method and device, storage medium and electronic device
Abstract
The application discloses a software testing method, a device, a storage medium and an electronic device, and relates to the technical field of software testing, wherein the software testing method comprises the steps of obtaining a requirement document and interface definition information of a target software function from a knowledge base; generating test information according to the requirement document and the interface definition information, wherein the test information comprises a test case and an automatic test script, the automatic test script is used for executing the test case, executing the automatic test script in a test environment to test the target software function to obtain test data, and determining a test result of the target software function according to the test data and the test case. By adopting the technical scheme, the problem of how to improve the software testing efficiency is solved.
Inventors
- Ou Luyao
- LIU LITING
- ZONG FEIFEI
- CUI XIUYUAN
- YANG GUOLONG
Assignees
- 青岛巨商汇网络科技有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20260212
Claims (10)
- 1. A method of testing software, comprising: Acquiring a requirement document and interface definition information of a target software function from a knowledge base; generating test information according to the requirement document and the interface definition information, wherein the test information comprises a test case and an automatic test script, and the automatic test script is used for executing the test case; Executing the automatic test script in a test environment to test the target software function to obtain test data; and determining the test result of the target software function according to the test data and the test case.
- 2. The software testing method of claim 1, wherein prior to retrieving the requirements document and interface definition information for the target software function from the knowledge base, the method further comprises: carrying out structural analysis on the data of different data sources to obtain structural data; Determining a retrieval index of the structured data according to a software function corresponding to the structured data; carrying out semantic segmentation processing on the structured data to obtain a plurality of data blocks; and labeling metadata of the plurality of data blocks to obtain labeled data blocks, and constructing the knowledge base according to the labeled data blocks.
- 3. The software testing method of claim 1, wherein generating test information from the requirements document and the interface definition information comprises: determining a target prompt word template corresponding to the type of the target software function from a prompt word template library; determining first supplementary content according to the interface definition information, determining second supplementary content according to the requirement document, and supplementing the target prompt word template according to the first supplementary content and the second supplementary content to obtain a target prompt word, wherein the first supplementary content is used for determining a test interface, the second supplementary content is used for determining a test requirement corresponding to the test interface, and the target prompt word is used for indicating a large language model to generate a test case and an automatic test script which meet the test requirement aiming at the test interface; and acquiring the test case and the automatic test script generated by the large language model according to the target prompt word.
- 4. The software testing method of claim 1, wherein generating test information from the requirements document and the interface definition information comprises: Determining a requirement to be tested according to the requirement document; regenerating the test case under the condition that the test case does not completely cover the requirement to be tested; And under the condition that the test case completely covers the requirement to be tested, generating the automatic test script according to the interface definition information and the test case.
- 5. The software testing method according to claim 1, wherein determining the test result of the target software function based on the test data and the test case comprises: acquiring preset test data of the target software function from the test case; Under the condition that the preset test data are consistent with the test data, determining that the test result is passing; and under the condition that the preset test data are inconsistent with the test data, determining that the test result is not passed.
- 6. The software testing method of claim 1, wherein the method further comprises: in the case that the target software comprises an intelligent language interaction module, testing the intelligent language interaction module by the following method: acquiring an evaluation data set input by a target object, wherein the evaluation data set comprises input problems and expected output contents; Testing the intelligent language interaction module according to the input problems in the evaluation data set to obtain output contents of the intelligent language interaction module aiming at the input problems; And obtaining a language interaction test result generated by the large language model according to the evaluation data set, the evaluation rule prompt word and the output content, wherein the evaluation rule prompt word is used for indicating the large language model to score the output content according to a preset evaluation rule.
- 7. The software testing method according to claim 6, wherein obtaining the language interaction test result generated by the large language model according to the evaluation data set, the evaluation rule prompt and the output content comprises: Determining scores of the output contents calculated under the preset evaluation rules according to comparison results of expected output contents and the output contents in the evaluation data set to obtain score values of multiple dimensions, wherein the preset evaluation rules comprise scoring standards of the multiple dimensions; And under the condition that the grading value of each dimension is larger than a first preset grading value and the sum value of the grading values of the dimensions is larger than a second preset grading value, determining that the test result of the intelligent language interaction module is passing.
- 8. A software testing apparatus, comprising: The acquisition module is used for acquiring the requirement document and interface definition information of the target software function from the knowledge base; the generation module is used for generating test information according to the requirement document and the interface definition information, wherein the test information comprises a test case and an automatic test script, and the automatic test script is used for executing the test case; The test module is used for executing the automatic test script in a test environment to test the target software function so as to obtain test data; and the determining module is used for determining the test result of the target software function according to the test data and the test case.
- 9. A computer readable storage medium, characterized in that the computer readable storage medium comprises a stored program, wherein the program when run performs the method of any of the preceding claims 1 to 7.
- 10. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method according to any of the claims 1 to 7 by means of the computer program.
Description
Software testing method and device, storage medium and electronic device Technical Field The present application relates to the field of software testing technologies, and in particular, to a software testing method and apparatus, a storage medium, and an electronic device. Background At present, in the field of software testing, traditional function test cases are mainly written manually, and test cases are manually written after software requirements are analyzed through test engineers according to self experience. The method is low in efficiency, and use cases written by different engineers are uneven in quality, so that scene coverage rate is difficult to ensure, and the software development requirement of quick iteration cannot be met. In the aspect of development of the interface test script, the prior art requires a tester to have stronger programming capability and related technical knowledge, and the interface test script is realized by manually writing codes. The method has the advantages that the dependence of the test work on technicians is extremely high, participation of non-technicians in a team is limited, and the automatic test coverage rate of the interface is difficult to improve. Therefore, there is a problem in the related art how to improve the software testing efficiency. Aiming at the problem of how to improve the software testing efficiency in the related art, no effective solution has been proposed yet. Disclosure of Invention The embodiment of the application provides a software testing method, a device, a storage medium and an electronic device, which are used for at least solving the problem of how to improve the software testing efficiency in the related technology. According to one embodiment of the application, a software testing method is provided, which comprises the steps of obtaining a requirement document and interface definition information of a target software function from a knowledge base, generating testing information according to the requirement document and the interface definition information, wherein the testing information comprises a testing case and an automatic testing script, the automatic testing script is used for executing the testing case, executing the automatic testing script in a testing environment to test the target software function to obtain testing data, and determining a testing result of the target software function according to the testing data and the testing case. In an exemplary embodiment, before the requirement document and the interface definition information of the target software function are acquired from the knowledge base, the method further comprises the steps of carrying out structural analysis on data of different data sources to obtain structural data, determining a retrieval index of the structural data according to the software function corresponding to the structural data, carrying out semantic segmentation processing on the structural data to obtain a plurality of data blocks, carrying out metadata annotation on the plurality of data blocks to obtain an annotation data block, and constructing the knowledge base according to the annotation data block. In an exemplary embodiment, test information is generated according to the requirement document and the interface definition information, the test information comprises a target prompt word template corresponding to the type of the target software function is determined from a prompt word template library, first supplementary content is determined according to the interface definition information, second supplementary content is determined according to the requirement document, the target prompt word template is supplemented according to the first supplementary content and the second supplementary content, a target prompt word is obtained, the first supplementary content is used for determining a test interface, the second supplementary content is used for determining a test requirement corresponding to the test interface, the target prompt word is used for indicating a large language model to generate a test case and an automatic test script which meet the test requirement aiming at the test interface, and the large language model is obtained according to the test case and the automatic test script generated by the target prompt word. In an exemplary embodiment, generating test information according to the requirement document and the interface definition information comprises determining a requirement to be tested according to the requirement document, regenerating the test case when the test case is determined to not completely cover the requirement to be tested, and generating the automatic test script according to the interface definition information and the test case when the test case is determined to completely cover the requirement to be tested. In an exemplary embodiment, determining the test result of the target software function according to the test data and the t