Software test case test method and system
By constructing a correlation ranking sequence of test cases, the problem of low test case ranking accuracy caused by manual experience in the existing technology is solved, a more efficient and accurate test case ranking is achieved, and the efficiency of regression testing is improved.
Patent Information
- Application Number
- CN202410506121.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-25
- Publication Date
- 2024-08-23
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing test case prioritization process relies on manual experience, resulting in low ranking accuracy and reducing the efficiency and accuracy of test case prioritization.
By obtaining the requirement description and content description in the test task, establish a data set and build an index to form a related data set, calculate the relevance ranking sequence of test cases, and determine the priority ranking sequence based on the relevance and priority factors to improve the quality of test cases. Sorting accuracy and efficiency.
It improves the accuracy and efficiency of test case sorting, ensures the priority execution of optimal test cases, and improves the efficiency of regression testing.
Smart Images

Figure CN118535457A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of software technology, and in particular relates to a testing method and system for software test cases. Background Art
[0002] In the process of software development, as product functions continue to increase and iterate, the size of the test case set also continues to increase, resulting in an increasing cost of regression testing. Due to the priority of test resources, all test cases cannot be executed. In order to improve the efficiency of regression testing, it is necessary to specify regression test logic that better meets the requirements of regression testing, and process the relevance and priority of test cases according to the established test objectives to determine the order and logic of executing the test, so that the optimal test cases can be executed first.
[0003] In the existing test case priority sorting process, manual experience is generally used for setting, which leads to low accuracy of test case sorting and reduces the accuracy of test case priority sorting. Summary of the invention
[0004] The present invention provides a software test case testing method and system, which are used to improve the accuracy of test case sequencing and improve the efficiency of test case sequencing.
[0005] A first aspect of the present invention provides a method for testing a software test case, comprising the following steps:
[0006] S1. Acquire a test task, extract a requirement description and a content description in the test task, and respectively establish a corresponding first data set and a second data set according to the requirement description and the content description;
[0007] S2. Establishing a first index between the first data set and the second data set;
[0008] S3, obtaining a first database, wherein the first database includes at least a plurality of test cases in historical test tasks marked with requirement descriptions, and filtering a requirement test case set from the requirement descriptions in the first data set;
[0009] S4. Obtain a second database, wherein the second database includes a plurality of test cases marked with content descriptions, and filter out a content test case set from the content descriptions of the second data set;
[0010] S5, forming a data set associated with the requirement description and the content description, wherein the associated data set forms a plurality of test case pairs based on the first index, each of the test case pairs including at least one content test case and one requirement test case;
[0011] S6, constructing a target test set, wherein the target test set includes a plurality of test case pairs determined according to the first index, obtaining a relevance between each test case in the target test set and the test task, and obtaining a relevance ranking sequence of the target test set;
[0012] S7, deleting test case pairs whose relevance is below the relevance threshold in the relevance sorting sequence;
[0013] S8. Setting a priority factor to obtain a priority sorting sequence of the test case pairs in the relevance sorting sequence.
[0014] Furthermore, when extracting the requirement description and content description of the test task, the following steps are performed:
[0015] Using natural semantic processing to obtain text key words in the test task, and constructing a text time series set according to the positions of the text key words in the test task;
[0016] The part-of-speech meanings of the text key words are determined from the text time series set, and the text key words are classified into content descriptions and demand descriptions according to the part-of-speech meanings to construct the first data set and the second data set.
[0017] Furthermore, when constructing the text time series set, an extended text set is also constructed, including the following steps:
[0018] Taking any specified text keyword segmentation as the expansion point, expand to the adjacent text position in the test task with the preset interval of bytes, and each expansion is expanded by square or sum.
[0019] After the extended text set is obtained, adjacent key words of the key word of the question text are retrieved from the extended text set, and an index is written into the corresponding index position in the first data set and the second data set.
[0020] Furthermore, the first index is set to a value written when any content description or requirement description is written to an associated description within the set extended text set.
[0021] Furthermore, the relevance between the content description and the requirement description is calculated by the following formula:
[0022]
[0023] in,
[0024] K j is the correlation between the 1st to xth test case pairs in the specified first database and the content description and / or requirement description in the test task;
[0025] Adx is the relevance ratio of the content description of the xth test case pair to all test cases in the first database;
[0026] B dx is the relevance ratio of the requirement description of the x-th test case pair to all test cases in the second database;
[0027] j is the total number of first index values in the first index that are identical to any content description and / or requirement description included in the test case pair in x;
[0028] x is the position of the content description and requirement description included in the x-th test case pair in the text sequence set;
[0029] i is the unit expansion value of any content description and / or requirement description included in the text sequence set of the xth test case pair,
[0030] n is the number of unit expansions.
[0031] A second aspect of the present invention provides a testing system for software test cases, comprising:
[0032] An acquisition module, configured to acquire test tasks;
[0033] A classification module is configured to store a neural network model, classify text keywords in the test task into content descriptions and requirement descriptions, and separate the content descriptions and the requirement descriptions to construct corresponding data sets;
[0034] A relevance ranking module is configured to extract test case pairs from a specified database according to the content description, and sort the test case pairs to obtain a relevance ranking sequence
[0035] The priority sorting module is configured to obtain a priority sorting sequence after filtering the relevance sorting sequence from a specified database according to the content description and the requirement description.
[0036] According to a third aspect of the present invention, there is provided an electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a testing method for a software test case is implemented.
[0037] A fourth aspect of the present invention provides a storage medium, which, when the computer program is executed by a processor, is suitable for implementing a testing method for a software test case.
[0038] The present invention has the following advantages over the prior art:
[0039] The present invention obtains test requirements from test tasks, uses any text information in the test requirements as an index to retrieve relevant test cases in a software test case set, sorts the test cases according to relevance, and then determines the final test sequence through priority screening, thereby improving the accuracy of test case sorting and also improving the efficiency of test case sorting. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 is a schematic diagram of a system provided by the present invention;
[0041] Figure 2 It is a schematic diagram of an electronic device provided by the present invention. DETAILED DESCRIPTION
[0042] In order to be able to understand the features and technical contents of the embodiments of the present disclosure in more detail, the implementation of the embodiments of the present disclosure is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present disclosure. In the following technical description, for the convenience of explanation, a full understanding of the disclosed embodiments is provided through multiple details. However, one or more embodiments can still be implemented without these details. In other cases, to simplify the drawings, well-known structures and devices can be simplified for display.
[0043] Embodiment 1
[0044] According to a first aspect of the present disclosure, a method for testing a software test case is provided, comprising the following steps:
[0045] S1. Acquire a test task, extract a requirement description and a content description in the test task, and respectively establish a corresponding first data set and a second data set according to the requirement description and the content description;
[0046] S2. Establishing a first index between the first data set and the second data set;
[0047] S3, obtaining a first database, wherein the first database includes at least a plurality of test cases in historical test tasks marked with requirement descriptions, and filtering a requirement test case set from the requirement descriptions in the first data set;
[0048] S4. Obtain a second database, wherein the second database includes a plurality of test cases marked with content descriptions, and filter out a content test case set from the content descriptions of the second data set;
[0049] S5, forming a data set associated with the requirement description and the content description, wherein the associated data set forms a plurality of test case pairs based on the first index, each of the test case pairs including at least one content test case and one requirement test case;
[0050] S6, constructing a target test set, wherein the target test set includes a plurality of test case pairs determined according to the first index, obtaining a relevance between each test case in the target test set and the test task, and obtaining a relevance ranking sequence of the target test set;
[0051] S7, deleting test case pairs whose relevance is below the relevance threshold in the relevance sorting sequence;
[0052] S8, setting a priority factor to obtain a priority ranking sequence of the test case pairs in the relevance ranking sequence;
[0053] S9. Execute the test and update the requirement description to S1 according to the relevance of the requirement description until the accuracy of the requirement reaches the preset value.
[0054] Furthermore, when extracting the requirement description and content description of the test task, the following steps are performed:
[0055] Using natural semantic processing to obtain text key words in the test task, and constructing a text time series set according to the positions of the text key words in the test task;
[0056] The part-of-speech meanings of the text key words are determined from the text time series set, and the text key words are classified into content descriptions and demand descriptions according to the part-of-speech meanings to construct the first data set and the second data set.
[0057] Furthermore, when constructing the text time series set, an extended text set is also constructed, including the following steps:
[0058] Taking any specified text keyword segmentation as the expansion point, expand to the adjacent text position in the test task with the preset interval of bytes, and each expansion is expanded by square or sum.
[0059] After the extended text set is obtained, adjacent key words of the key word of the question text are retrieved from the extended text set, and an index is written into the corresponding index position in the first data set and the second data set.
[0060] Further, the first index is set to a value written by any content description or requirement description when it is in the set extended text set range. Correspondingly, an associated data set of the requirement description and the content description is formed in S5, and the associated data set forms a plurality of test case pairs based on the first index, that is, the same number of test case pairs are constructed from the specified first database and the second database according to the total amount of types of the first index.
[0061] Furthermore, the relevance between the content description and the requirement description is calculated by the following formula:
[0062]
[0063] in,
[0064] K j is the correlation between the 1st to xth test case pairs in the specified first database and the content description and / or requirement description in the test task;
[0065] A dx is the relevance ratio of the content description of the xth test case pair to all test cases in the first database,
[0066] B dx is the relevance ratio of the requirement description of the x-th test case pair to all test cases in the second database;
[0067] j is the total number of first index values in the first index that are identical to any content description and / or requirement description included in the test case pair in x;
[0068] x is the position of the content description and requirement description included in the x-th test case pair in the text sequence set;
[0069] i is the unit expansion value of any content description and / or requirement description included in the text sequence set of the xth test case pair,
[0070] n is the number of unit expansions.
[0071] When calculating a separate requirement description in the embodiment of the present disclosure, the formula is expressed as:
[0072]
[0073] When calculating a separate content description in the embodiment of the present disclosure, the formula is expressed as:
[0074]
[0075] It should also be noted that the correlation calculated in the embodiment of the present disclosure is the correlation of the paragraphs in the time-series text set, rather than the correlation of a certain specified value. Of course, the correlation of the test case pair at a certain position can also be calculated. In this case, the formula is expressed as:
[0076]
[0077] To indicate the relevance when the xth test case pair is no longer expanded
[0078] It should be noted that in the embodiment of the present disclosure, the priority sorting sequence is determined by obtaining a relevance threshold based on the position of the description with the highest relative degree corresponding to the requirement description and the test case pair in the time-series text set. That is, when generating the priority sequence, the positions of the same requirement descriptions in the obtained test case pairs in the time-series text set are sorted, and then this part of the test case pairs is sorted according to the relevance of the requirement descriptions.
[0079] The second aspect of the present invention, as Figure 1 As shown, a testing system for a software test case is provided, comprising:
[0080] An acquisition module, configured to acquire test tasks;
[0081] A classification module is configured to store a neural network model, classify text keywords in the test task into content descriptions and requirement descriptions, and separate the content descriptions and the requirement descriptions to construct corresponding data sets;
[0082] A relevance ranking module is configured to extract test case pairs from a specified database according to the content description, and sort the test case pairs to obtain a relevance ranking sequence
[0083] The priority sorting module is configured to obtain a priority sorting sequence after filtering the relevance sorting sequence from a specified database according to the content description and the requirement description.
[0084] Embodiment 2
[0085] Combination Figure 2 As shown, an embodiment of the present disclosure provides an electronic device, including a processor (processor) 30 and a memory (memory) 31.
[0086] Optionally, the device may further include a communication interface (CommunicationInterface) 32 and a bus 33. The processor 30, the communication interface 32, and the memory 31 may communicate with each other through the bus 33. The communication interface 32 may be used for information transmission. The processor 30 may call the logic instructions in the memory 31 to execute the test method of the software test case of the above embodiment.
[0087] An embodiment of the present disclosure provides a storage medium storing computer executable instructions, wherein the computer executable instructions are configured to execute the testing method of the above-mentioned software test case.
[0088] The above-mentioned storage medium may be a transient computer-readable storage medium or a non-transient computer-readable storage medium. Non-transient storage media include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes, and may also be a transient storage medium.
[0089] The above description and accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent possible changes only. Unless explicitly required, separate components and functions are optional, and the order of operation may vary. The parts and features of some embodiments may be included in or replace the parts and features of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and claims, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of listings containing one or more associated ones. In addition, when used in the present application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of stated features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical elements in the process, method or device comprising the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the various embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.
Claims
1. A testing method for a software test case, characterized in that: The steps include: S1. Acquire a test task, extract a requirement description and a content description in the test task, and respectively establish a corresponding first data set and a second data set according to the requirement description and the content description; S2. Establishing a first index between the first data set and the second data set; S3, obtaining a first database, wherein the first database includes at least a plurality of test cases in historical test tasks marked with requirement descriptions, and filtering a requirement test case set from the requirement descriptions in the first data set; S4. Obtain a second database, wherein the second database includes a plurality of test cases marked with content descriptions, and filter out a content test case set from the content descriptions of the second data set; S5, forming a data set associated with the requirement description and the content description, wherein the associated data set forms a plurality of test case pairs based on the first index, each of the test case pairs including at least one content test case and one requirement test case; S6, constructing a target test set, wherein the target test set includes a plurality of test case pairs determined according to the first index, obtaining a relevance between each test case in the target test set and the test task, and obtaining a relevance ranking sequence of the target test set; S7, deleting test case pairs whose relevance is below the relevance threshold in the relevance sorting sequence; S8. Obtain a priority sorting sequence of the test case pairs in the relevance sorting sequence, and execute the test.
2. The software test case testing method according to claim 1, characterized in that: When extracting the requirement description and content description of the test task, perform the following steps: Using natural semantic processing to obtain text key words in the test task, and constructing a text time series set according to the positions of the text key words in the test task; The part-of-speech meanings of the text key words are determined from the text time series set, and the text key words are classified into content descriptions and demand descriptions according to the part-of-speech meanings to construct the first data set and the second data set.
3. The software test case testing method according to claim 2, characterized in that: When constructing the text time series set, an extended text set is also constructed, including the following steps: Taking any specified text keyword segmentation as the expansion point, expand to the adjacent text position in the test task with the preset interval of bytes, and each expansion is expanded by square or sum. After the extended text set is obtained, adjacent key words of the key word of the question text are retrieved from the extended text set, and an index is written into the corresponding index position in the first data set and the second data set.
4. The software test case testing method according to claim 1, characterized in that: The first index is set to a value written when any content description or requirement description is written to an associated description within the set extended text set.
5. The software test case testing method according to claim 4, characterized in that: The relevance between the content description and the requirement description is calculated by the following formula: in, K j is the correlation between the 1st to xth test case pairs in the specified first database and the content description and / or requirement description in the test task; A dx is the relevance ratio of the content description of the xth test case pair to all test cases in the first database; B dx is the relevance ratio of the requirement description of the x-th test case pair to all test cases in the second database; j is the total number of first index values in the first index that are identical to any content description and / or requirement description included in the test case pair in x; x is the position of the content description and requirement description included in the x-th test case pair in the text sequence set; i is the unit expansion value of any content description and / or requirement description included in the text sequence set of the xth test case pair, n is the number of unit expansions.
6. A testing system for software test cases, characterized in that: include: An acquisition module, configured to acquire test tasks; A classification module is configured to store a neural network model, classify text keywords in the test task into content descriptions and requirement descriptions, and separate the content descriptions and the requirement descriptions to construct corresponding data sets; A relevance ranking module is configured to extract test case pairs from a specified database according to the content description, and to sort the test case pairs to obtain a relevance ranking sequence; The priority sorting module is configured to obtain a priority sorting sequence after filtering the relevance sorting sequence from a specified database according to the content description and the requirement description.
7. An electronic device, characterized in that The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the program, the testing method of the software test case as described in any one of claims 1 to 6 is implemented.
8. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it is suitable for implementing the testing method of the software test case as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Regression test case recommendation method and device, equipment and medium
CN115422095A
Test case arrangement method and device, electronic equipment and storage medium
CN117093498A
Test case recommendation method based on semantic index relation
CN117591624A
Touchless testing platform
US20190196948A1
