Automatic test case tracking and checking method and device
By automatically identifying and generating two-way tracking matrix tables, the problem of time-consuming and difficult to intuitively check test cases and requirements tracking in the prior art is solved, and more efficient test design and coverage visualization is achieved.
Patent Information
- Application Number
- CN202311569788.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-22
- Publication Date
- 2025-05-23
AI Technical Summary
Establishing and maintaining a two-way tracking matrix between software test cases and requirements in the prior art is time-consuming and effort-consuming, and it is difficult to intuitively check the coverage of test cases to requirements.
Provides an automatic tracking and inspection method for test cases. By identifying the requirements entry identification number involved in the test case entry identification number, generating and streamlining the two-way tracking matrix table, establishing a detailed tracking matrix to check the test coverage, and displaying uncovered requirements through color markings.
It effectively improves the work efficiency of test designers, simplifies the preparation of test description documents, improves the intuitiveness of visual inspection of test cases' coverage of requirements, and promptly detects defects in test case design.
Smart Images

Figure CN120029896A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a method and a device for automatically tracking and checking a test case. Background Art
[0002] GJB 438B-2009 General Requirements for Military Software Development Documents and GJB / Z 141-2004 Military Software Testing Guidelines require that software testing must test every function specified in the requirements document to achieve 100% coverage of the requirements. The project unique identification number has been used in the requirements and test files to identify each requirement and test case, respectively. In the "Requirements Traceability" section of the test document, the unique identification number should be used to establish a two-way tracking matrix between the software test description and the requirements document to check the coverage of the requirements to verify the adequacy of the test. Currently, the tracking matrix is established manually. When the tester establishes the forward tracking from the software test description to the requirements document, the identification number of each test case item, the section number, the identification number of the involved requirements, and the section number of the involved requirements are extracted from the test description file and written into the forward tracking table. When the tester establishes the reverse tracking from the requirements file to the software test description, the identification number of the requirement item and the section number are extracted from the requirements file, and the identification numbers of all test case items involved in the requirement item identification number and the section number of the corresponding test case item are extracted from the test description file and written into the reverse tracking table. The many-to-many two-way tracking table is not intuitive and clear enough and takes up too much space in the document. Testers merge the content of the two-way tracking table by inputting the chapter number of the document. The disadvantages are: 1. It takes a lot of time and effort to establish a two-way tracking matrix table; 2. From the streamlined table, testers cannot intuitively check the coverage of the written test cases for the requirements. Summary of the invention
[0003] The purpose of the present invention is to solve the problems in the prior art and to provide a novel test case automatic tracking and checking method and device.
[0004] In order to achieve this purpose, the technical solution of the present invention is as follows: a test case automatic tracking and checking method, comprising: Step S1, determining the test case item identification number and chapter number, and storing them in the test case item identification number data dictionary; Step S2, identifying the position row of the requirement item identification number involved in the test case item identification number in the reverse tracing matrix table, and writing the data dictionary information of the current test case item identification number into the corresponding row of the reverse tracing matrix table; Step S3, identifying the elements of each test case entry, including the test case entry chapter number, the test case entry identification number, the requirement identification number, and the requirement chapter number, and writing them into the forward tracking table according to the test case entry chapter number; Step S4, streamline the requirement and test case item identifiers in the traceability matrix table, represent consecutive identifiers in the form of "identifier feature prefix. smallest consecutive number ~ identifier feature prefix. largest consecutive number", and separate non-consecutive identifiers with ","; Step S5, streamline the requirement and test case item chapter numbers in the traceability matrix table, and only retain the non-repeated chapter numbers; Step S6, expand the streamlined requirements from the requirement identifier column of the detailed traceability table, determine the identifier of each requirement item after expansion and its row number in the detailed traceability table, and store them in the requirement item identifier data dictionary; Step S7, establish a reverse detailed traceability matrix, check the test coverage of requirement items, and if there is a requirement without a designed test case, mark the corresponding row with a red background; Step S8, establish a forward detailed traceability matrix, check the requirement filling situation involved in the test cases, and if there is a test case without the filled-in requirements involved, mark the corresponding row with a red background.
[0005] As an optimal solution of the test case automatic traceability inspection method, Step S2 specifically includes: Sub-step S21, obtain requirement data, decompose one or more requirements separated by "," in each row of requirements, and obtain the identifier and its row number of each group of requirements after decomposition; Sub-step S22, obtain requirement data from the test description file, abbreviated as requirement description, and obtain requirement data from the "requirement identifier" column of the reverse traceability table, abbreviated as requirement traceability; Sub-step S23, if the requirement traceability is represented in the form of "~" and the requirement description is within the requirement range before and after "~", write the test case item identifier and test case item chapter number corresponding to the row number where the requirement description is located into the current row where the requirement traceability is located in the reverse traceability table. If the requirement traceability is a single requirement identifier and the requirement description is consistent with the requirement traceability, write the test case item identifier and test case item chapter number corresponding to the row number where the requirement description is located into the current row where the requirement traceability is located in the reverse traceability table. If neither of the above conditions is met, record the current requirement description in a string variable and give an abnormal reminder to the tester in the form of a pop-up warning box.
[0006] As an optimal solution of the test case automatic traceability inspection method, in Step S7, establish a one-to-many detailed traceability matrix table between each requirement item in the requirement item identifier data dictionary and the test case items.
[0007] As an optimal solution of the test case automatic traceability inspection method, in Step S8, establish a one-to-many detailed traceability matrix table between the test case items and the involved requirement items in the test description file.
[0008] The present invention also provides a system for the test case automatic tracking and checking method, which is used to execute the test case automatic tracking and checking method, comprising: A reverse tracing matrix table writing unit is used to traverse the requirement description and requirement tracing, and generate a reverse tracing matrix table with the test case item identification number and chapter number corresponding to the requirement description; A forward tracing matrix table writing unit is used to traverse the test case entry elements and generate a forward tracing matrix table according to the test case entry chapter number; The identification number and chapter number are simplified into simple elements. Continuous item identification numbers are connected with "~", non-continuous item numbers are connected with "、", and duplicate chapter numbers are deleted. The reverse detailed traceability matrix table is written into the unit to establish a reverse detailed traceability matrix and check the test coverage of the requirement items. If there is a requirement without a test case, the row is marked with a red background. Write the forward detailed traceability matrix table into the unit, establish the forward detailed traceability matrix, check the requirements involved in the test case, if there is a test case that does not fill in the requirements involved, mark the row with a red background.
[0009] Compared with the prior art, the beneficial effects of the present invention are at least: effectively improving the work efficiency of test designers. On the test case tracking sheet page, by clicking a button control, a two-way tracking matrix of test cases and requirements can be automatically generated, thereby improving the efficiency of preparing test description documents and enabling subsequent test execution work to be carried out earlier. From the generated detailed tracking matrix, the coverage of test cases for requirements can be intuitively checked to discover design defects in test cases. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 Diagram of the apparatus for automatic tracking inspection of test cases.
[0011] Figure 2 This is an example diagram of a test case in the present invention.
[0012] Figure 3 This is an example diagram of the reverse tracking matrix table in the present invention.
[0013] Figure 4 This is an example diagram of the forward tracking matrix table in the present invention. DETAILED DESCRIPTION
[0014] The present invention is further described in detail below by means of specific embodiments in combination with the accompanying drawings. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention. In addition, the technical features involved in each embodiment of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0015] See also Figure 1 ,The figure shows the test case automatic tracking and checking method, which uses VBA language to identify and extract test case information in the test description Excel file, including the test case item identification number, the test case item chapter number, the involved requirement identification number, and the involved requirement chapter number, and automatically generates a test case two-way tracking matrix table and a detailed two-way tracking matrix table.
[0016] The present invention discloses an embodiment of a test case automatic tracking and checking method, which specifically includes the following steps: Step S1, determine the test case item identification number and chapter number, and store them in the test case item identification number data dictionary. Figure 2 The record contents of the test case table include the test case entry chapter number, the test case entry identification number, the involved requirement chapter number, and the involved requirement identification number. The record contents of the test case entry identification number data dictionary include: test case entry identification number, test case entry chapter number. When recording data, if there is chapter number data in the same row as the test case entry identification number, use the current chapter number. If there is no chapter number data in the same row as the test case entry identification number, use the chapter number corresponding to the previous test case entry identification number.
[0017] Step S2, identify the position row of the requirement identification number related to the test case item identification number in the reverse traceability matrix table, write the data dictionary information of the current test case item identification number into the corresponding row of the reverse traceability matrix table, and separate multiple elements in the form of ",". For an example of the reverse traceability matrix table, see Figure 3 ,The data in the two columns on the left side come from the “Traceability of Requirements” section in the requirements document.
[0018] Step S2 specifically includes: Sub-step S21, obtaining requirement data from the test description file, decomposing the requirement of each cell in the requirement identification number involved in the test case table with ",", and obtaining the identification number and row number of each group of requirements after decomposition; Sub-step S22, obtaining requirement data from the test description file, referred to as requirement (description), and obtaining requirement data from the "requirement identifier" column of the reverse tracking table, referred to as requirement (tracking); Sub-step S23, traverses all requirement (description) data through requirement (tracking) data. If the requirement (tracking) is expressed in the form of "~" and the requirement (description) is in the requirement range before and after "~", write the test case entry identification number data dictionary data corresponding to the row number of the requirement (description) into the row of the current requirement (tracking) in the reverse tracking table. If the requirement (tracking) is a requirement identification number and the requirement (description) is consistent with the requirement (tracking), write the test case entry identification number data dictionary data corresponding to the row number of the requirement (description) into the row of the current requirement (tracking) in the reverse tracking table. If none of the above conditions are met, record the current requirement (description) in a string variable, and pop up a warning box to remind the tester of the abnormality.
[0019] Step S3, identify the elements of each test case entry, including the test case entry chapter number, the test case entry identification number, the involved requirement identification number, and the involved requirement chapter number, and write them into the forward tracing matrix table according to the test case entry chapter number. For example, see Figure 4 . The chapter numbers in the test description file are arranged in order from small to large, and some chapter numbers are omitted. When traversing the test case entries, if the test case entry chapter number remains unchanged, the elements of the test case entry are written in the same row of the forward tracing matrix table, and multiple elements are separated by ",". When the test case chapter number increases, the elements of the test case entry are written in the next row of the forward tracing matrix table, and multiple elements are separated by ",".
[0020] Step S4, simplify the identification numbers of requirements and test case items in the traceability matrix table, connect the continuous identification numbers in the form of "~", and separate the discontinuous identification numbers with ",". Specifically: decompose the identification numbers separated by ",", extract the numbers in each identification number, sort the numbers in ascending order, and simplify the sorted numbers.
[0021] If the numbers are continuously increased by 1 until the numbers stop being continuous and the two numbers before and after are not equal, the identification number is simplified to: identification number characteristic prefix. The first number of the cycle ~ identification number characteristic prefix. The last number of the cycle.
[0022] If the number does not increase by 1 continuously and increases, the identification number is simplified to: historical identification number, identification number characteristic prefix. current number.
[0023] Step S5, simplify the chapter numbers of requirements and test case entries in the traceability matrix table, and only keep non-repeated chapter numbers. Decompose the chapter numbers separated by ",", and store the first chapter number in the string array Key(0). If the chapter number is not equal to the data in the string array Key(), store the chapter number in the array Key(), and simplify the chapter number to: historical chapter number, current chapter number. If the chapter number is equal to a data in the string array Key(), traverse to the next chapter number.
[0024] Step S6, expand the streamlined requirements from the requirement identification number column of the detailed tracking table, determine the identification number of each requirement item after expansion and the row number in the detailed tracking table, and store them in the requirement item identification number data dictionary. If the requirement (tracking) is expressed in the form of "~", the requirement range before and after the "~" is written in sequence into the requirement identification number column of the reverse detailed tracking table, and the current requirement (tracking) identification number and the row number in the detailed tracking table are recorded in the requirement item identification number data dictionary. If the requirement (tracking) is a requirement identification number, write the current requirement (tracking) into the requirement identification number column of the reverse detailed tracking table, and record the current requirement (tracking) identification number and the row number in the detailed tracking table in the requirement item identification number data dictionary.
[0025] Step S7, establish a reverse detailed tracing matrix, check the test coverage of the requirement items, if there is a requirement without a test case, mark the row with a red background. Traverse the requirement (description) identification number, if the requirement (description) identification number exists in the requirement item identification number data dictionary, write the test case item identification number corresponding to the row number of the requirement (description) into the row marked by the current requirement item identification number data dictionary in the reverse tracing table. Check if there are blank cells in the test case item column in the table, mark them with a red background.
[0026] Step S8, establish a forward detailed tracking matrix, check the requirements involved in the test case, if there is a test case that does not fill in the requirements involved, mark the row with a red background. Write the test case item identification number and the required identification number involved in the test description file into the forward detailed tracking table. Check if there are blank cells in the requirement item column in the table, mark them with a red background.
[0027] The present invention also provides a system for the automatic tracking and checking method of test cases, comprising: The reverse tracing matrix table writing unit is used to traverse the requirements (descriptions) and requirements (tracing), and generate a reverse tracing matrix table with the test case item identification number and chapter number corresponding to the requirements (descriptions). If the same element of the requirement (description) in the requirement (tracing) is not found, a warning box will pop up indicating that it is not found. A forward tracing matrix table writing unit is used to traverse the test case entry elements and generate a forward tracing matrix table according to the test case entry chapter number; The identification number and chapter number are simplified into simple elements. Continuous item identification numbers are connected with "~", non-continuous item numbers are connected with "、", and duplicate chapter numbers are deleted. The reverse detailed traceability matrix table is written into the unit to establish a reverse detailed traceability matrix and check the test coverage of the requirement items. If there is a requirement without a test case, the row is marked with a red background. Write the forward detailed traceability matrix table into the unit, establish the forward detailed traceability matrix, check the requirements involved in the test case, if there is a test case that does not fill in the requirements involved, mark the row with a red background.
[0028] The above only expresses the implementation mode of the present invention, and its description is relatively specific and detailed, but it cannot be understood as limiting the scope of the invention patent. It should be pointed out that for ordinary technicians in this field, several modifications and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be based on the attached claims.
Claims
1. Automatic tracking and checking method of test cases, It is characterized in that include: Step S1, determining the test case item identification number and chapter number, and storing them in the test case item identification number data dictionary; Step S2, identifying the position row of the requirement item identification number involved in the test case item identification number in the reverse tracing matrix table, and writing the data dictionary information of the current test case item identification number into the corresponding row of the reverse tracing matrix table; Step S3, identifying the elements of each test case entry, including the test case entry chapter number, the test case entry identification number, the requirement identification number, and the requirement chapter number, and writing them into the forward tracking table according to the test case entry chapter number; Step S4, simplifying the identification numbers of requirements and test case items in the traceability matrix table, expressing continuous identification numbers in the form of "identification number feature prefix.continuous minimum number~identification number feature prefix.continuous maximum number", and separating discontinuous identification numbers with ",". Step S5, simplifying the section numbers of requirements and test case items in the traceability matrix table, and only retaining non-repeated section numbers; Step S6, expanding the simplified requirements from the requirement identification number column of the detailed tracking table, determining the identification number of each requirement item after expansion and the row number in the detailed tracking table, and storing them in the requirement item identification number data dictionary; Step S7, establish a reverse detailed traceability matrix to check the test coverage of the requirement items. If there is a requirement for which no test case is designed, mark the row with a red background; Step S8, establish a forward detailed traceability matrix, check the requirements involved in the test cases, and if there are test cases that do not fill in the requirements involved, mark the row with a red background.
2. The test case automatic tracking and checking method according to claim 1, It is characterized in that Step S2 specifically includes: Sub-step S21, obtaining demand data, decomposing one or more demands separated by "," in each row of demands, and obtaining the identification number and row number of each group of demands after decomposition; Sub-step S22, obtaining requirement data from the test description file, hereinafter referred to as requirement description, and obtaining requirement data from the "requirement identification" column of the reverse tracking table, hereinafter referred to as requirement tracking; In sub-step S23, if the requirement tracking is expressed in the form of "~" and the requirement description is in the requirement range before and after the "~", the test case item identification number and the test case item chapter number corresponding to the line number of the requirement description are written into the current row of the requirement tracking in the reverse tracking table; if the requirement tracking is a requirement identification number and the requirement description is consistent with the requirement tracking, the test case item identification number and the test case item chapter number corresponding to the line number of the requirement description are written into the current row of the requirement tracking in the reverse tracking table. If the above conditions are not met, the current requirement description is recorded in a string variable, and an abnormal reminder is given to the tester in the form of a pop-up warning box.
3. The test case automatic tracking and checking method according to claim 1, It is characterized in that In step S7, a one-to-many detailed traceability matrix table is established for each requirement item and test case item in the requirement item identification number data dictionary.
4. The test case automatic tracking and checking method according to claim 1, It is characterized in that In step S8, a one-to-many detailed traceability matrix table is created for the test case items and the related requirement items in the test description document.
5. A test case automatic tracking and checking method and device, used to execute the test case automatic tracking and checking method according to any one of claims 1 to 4, It is characterized in that include: A reverse tracing matrix table writing unit is used to traverse the requirement description and requirement tracing, and generate a reverse tracing matrix table with the test case item identification number and chapter number corresponding to the requirement description; A forward tracing matrix table writing unit is used to traverse the test case entry elements and generate a forward tracing matrix table according to the test case entry chapter number; The identification number and chapter number are simplified into simple elements. Continuous item identification numbers are connected with "~", non-continuous item numbers are connected with "、", and duplicate chapter numbers are deleted. The reverse detailed traceability matrix table is written into the unit to establish a reverse detailed traceability matrix and check the test coverage of the requirement items. If there is a requirement without a test case, the row is marked with a red background. Write the forward detailed traceability matrix table into the unit, establish the forward detailed traceability matrix, check the requirements involved in the test case, if there is a test case that does not fill in the requirements involved, mark the row with a red background.