Test case generation method and device, computer equipment and storage medium
By comparing the scope of software modifications, matching and automatically generating test cases, quality problems caused by unclear test scope are solved, testing efficiency and accuracy are improved, testing costs are reduced, and test coverage is ensured.
Patent Information
- Application Number
- CN202410898547.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2024-10-11
AI Technical Summary
During the software testing process, R&D, design and testing personnel do not have a clear understanding of the scope of modifications, resulting in omissions in the testing scope and software product quality problems. In addition, test case design takes a large amount of time and has subjective deviations, making it impossible to guarantee coverage of test scenarios. .
By comparing the software modification scope, clarify the test scope, match and automatically generate test cases, update the knowledge base, use feature word matching and weight calculation to optimize use case selection, prevent business process errors caused by modification changes, and classify new ones in the knowledge base Generated test cases.
It reduces test case design time, improves test accuracy and efficiency, reduces test costs, effectively controls test scope, and reduces quality problems caused by unclear test scope.
Smart Images

Figure CN118760600A_ABST
Abstract
Description
Technical Field
[0001] The invention discloses a method, an apparatus, a computer device and a storage medium, and relates to the technical field of software testing, in particular to a test case generation method, an apparatus, a computer device and a storage medium. Background Art
[0002] Under the background of enterprise digital transformation, software technology has developed rapidly. As the gatekeeper of software quality, software testing plays a vital role. At present, the mobility of software technicians is relatively high. There are scenarios where some R&D and design personnel are not clear about the impact of code modification, and testers are not clear about the test scope. As a result, after the test case review, there will still be software product quality problems due to insufficient understanding of the test scope. At the same time, in the testing phase, test case design accounts for about 30% of the testing phase, and there are subjective deviations, and it is impossible to guarantee whether the test scenarios are fully covered. Summary of the invention
[0003] In view of the problems of the prior art, the present invention provides a test case generation method, device, computer equipment and storage medium to solve the quality problems caused by omissions in the test scope due to the unclear understanding of the modification scope by R&D, design and testing personnel, reduce the test case design time and perform accurate testing, thereby providing customers with efficient services and high-quality products.
[0004] The specific scheme proposed by the present invention is:
[0005] The present invention provides a test case generation method, comprising:
[0006] Step 1: Compare the software modification scope and clarify the software test scope: Compare the test environment of the new patch and the test environment of the unupdated new patch, clarify the patch modification points, extract the business process, function points and special R&D design notes according to the patch modification points, and obtain the software test scope;
[0007] Step 2: Matching test cases: Search the knowledge base for business process test cases, function point test cases, and special test cases according to the scope of this software test to obtain matching results;
[0008] Step 3: Automatically generate test cases: Based on the matching results, test cases are generated in the order of business process, function point, and project.
[0009] Step 4: Update the knowledge base: Classify the newly generated test cases into business processes, functions, and special test cases according to the corresponding categories to complete the knowledge base update.
[0010] Furthermore, in step 2 of the test case generation method, characteristic words of the test scope are obtained according to the scope of this software test, and test cases of business processes, test cases of functional points and special test cases are matched in sequence according to the characteristic words, and the matching weight of each characteristic word is calculated, and the test case with the highest matching degree is selected based on the weight.
[0011] Furthermore, in the test case generation method described in step 1, if the scope of this software test only modifies the function points and does not involve business processes and projects, then the specific function points belonging to which business are specifically marked in the function point annotations.
[0012] In step 2, only the test cases of the functional points are searched according to the scope of this software test to obtain matching results. At the same time, the forward and reverse business process verification of the business process corresponding to the functional points is added to prevent business process errors caused by modifications.
[0013] Furthermore, in the step 4 of the test case generation method, when there is a new test requirement for the software, it is determined whether there is a newly generated test case. If so, the newly generated test case is classified into the business process, function, and special test case according to the corresponding classification.
[0014] When there is a software quality incident, determine whether there are newly generated test cases. If so, classify the newly generated test cases into business processes, functions, and special test cases according to the corresponding categories.
[0015] When missing test points are found daily, it is determined whether there are newly generated test cases. If so, the newly generated test cases are classified into business processes, functions, and special test cases according to the corresponding categories.
[0016] The present invention also provides a test case generation device, including a test scope management module, a matching search module, a case generation module and a knowledge base update module.
[0017] The test scope management module compares the software modification scope and clarifies the software test scope: compares the test environment of the new patch and the test environment of the unupdated new patch, clarifies the patch modification points, extracts the business process, function points and special R&D design notes based on the patch modification points, and obtains the software test scope;
[0018] Matching search module matches test cases: Searches for business process test cases, function point test cases and special test cases in the knowledge base according to the scope of this software test to obtain matching results;
[0019] The use case generation module automatically generates test cases: based on the matching results, the generated test cases are displayed in the order of business process, function point, and project;
[0020] The knowledge base update module updates the knowledge base: the newly generated test cases are classified into business processes, functions, and special test cases according to the corresponding categories to complete the knowledge base update.
[0021] Furthermore, the matching search module of the test case generation device obtains feature words of the test scope according to the software test scope, matches the test cases of the business process, the test cases of the functional points and the test cases of the special items in turn according to the feature words, calculates the matching weight of each feature word, and selects the test case with the highest matching degree based on the weight.
[0022] Furthermore, if the software test scope obtained by the test scope management module of the test case generation device only modifies the function points and does not involve business processes and projects, the specific function points belonging to which business are specifically marked in the function point annotations.
[0023] The matching search module searches only for test cases of functional points according to the scope of this software test to obtain matching results. At the same time, it adds forward and reverse business process verification of the business process corresponding to the functional points to prevent business process errors caused by modifications.
[0024] Furthermore, in the test case generation device, when there is a new test requirement for the software, the knowledge base update module determines whether there is a newly generated test case. If so, the newly generated test case is classified into business process, function, and special test case according to the corresponding classification.
[0025] When there is a software quality incident, the knowledge base update module determines whether there are newly generated test cases. If so, the newly generated test cases are classified into business processes, functions, and special test cases according to the corresponding categories.
[0026] When missing test points are found daily, the knowledge base update module determines whether there are newly generated test cases. If so, the newly generated test cases are classified into business processes, functions, and special test cases according to the corresponding categories.
[0027] The present invention also provides a computer device for generating test cases, comprising: at least one memory and at least one processor;
[0028] The at least one memory is used to store a machine-readable program;
[0029] The at least one processor is used to call the machine-readable program to execute the test case generation method.
[0030] The present invention also provides a storage medium, wherein the computer-readable medium stores computer instructions, and when the computer instructions are executed by a processor, the processor executes the test case generation method.
[0031] The benefits of the present invention are:
[0032] By comparing files before and after the update patch, the impact scope of this file system modification can be obtained, and then the newly added detailed test cases can be associated based on the modification scope. With the participation of design, R&D, and testing personnel, the explicit knowledge accumulated by the organization can be used to save testing time, reduce testing costs, effectively control the testing scope, and reduce the testing effect caused by quality problems due to unclear testing scope. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 It is a schematic flow chart of the method of the present invention.
[0034] Figure 2 It is a schematic diagram of the specific composition of the knowledge base. DETAILED DESCRIPTION
[0035] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.
[0036] Example 1
[0037] The present invention provides a test case generation method, comprising:
[0038] Step 1: Compare the software modification scope and clarify the software test scope: Compare the test environment of the new patch and the test environment of the unupdated new patch, clarify the patch modification points, extract the business process, function points and special R&D design notes according to the patch modification points, and obtain the software test scope;
[0039] Step 2: Match test cases: Search the knowledge base for business process test cases, function point test cases, and special test cases based on the scope of this software test to obtain matching results.
[0040] According to the scope of this software test, the characteristic words of the test scope are obtained, and the test cases of the business process, the test cases of the functional points and the special test cases are matched in turn according to the characteristic words, and the matching weight of each characteristic word is calculated, and the test case with the highest matching degree is selected according to the weight.
[0041] Step 3: Automatically generate test cases: Based on the matching results, test cases are generated in the order of business process, function points, and projects.
[0042] Step 4: Update the knowledge base: Classify the newly generated test cases into business processes, functions, and special test cases according to the corresponding categories to complete the knowledge base update.
[0043] Combination Figure 2 ,The specific composition of the knowledge base,The knowledge base mainly includes new knowledge and old knowledge. The old knowledge mainly refers to the original test cases, and the new knowledge mainly refers to the newly generated test cases. When there are new test requirements for the software, it is determined whether there are newly generated test cases. If so, the newly generated test cases are classified into business processes, functions, and special test cases according to the corresponding categories.
[0044] When there is a software quality incident, determine whether there are newly generated test cases. If so, classify the newly generated test cases into business processes, functions, and special test cases according to the corresponding categories.
[0045] When missing test points are found daily, it is determined whether there are newly generated test cases. If so, the newly generated test cases are classified into business processes, functions, and special test cases according to the corresponding categories.
[0046] Example 2
[0047] Based on Example 1, in step 1 of the method of the present invention, if the scope of this software test only modifies the function points and does not involve business processes and projects, then the specific function points belonging to which business are specifically marked in the function point annotations,
[0048] In step 2, only the test cases of the functional points are searched according to the scope of this software test to obtain matching results. At the same time, the forward and reverse business process verification of the business process corresponding to the functional points is added to prevent business process errors caused by modifications.
[0049] Example 3
[0050] The present invention also provides a test case generation device, including a test scope management module, a matching search module, a case generation module and a knowledge base update module.
[0051] The test scope management module compares the software modification scope and clarifies the software test scope: compares the test environment of the new patch and the test environment of the unupdated new patch, clarifies the patch modification points, extracts the business process, function points and special R&D design notes based on the patch modification points, and obtains the software test scope;
[0052] Matching search module matches test cases: Searches for business process test cases, function point test cases and special test cases in the knowledge base according to the scope of this software test to obtain matching results;
[0053] The use case generation module automatically generates test cases: based on the matching results, the generated test cases are displayed in the order of business process, function point, and project;
[0054] The knowledge base update module updates the knowledge base: the newly generated test cases are classified into business processes, functions, and special test cases according to the corresponding categories to complete the knowledge base update.
[0055] As the information interaction and execution process between the modules in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention, the specific contents can be found in the description of the embodiment of the method of the present invention and will not be repeated here.
[0056] Similarly, the device of the present invention obtains the impact scope of the current file system modification by comparing the files before and after the patch is updated, and then associates the newly added detailed test cases based on the modification scope. Through the participation of design, R&D, and testing personnel, the explicit knowledge accumulated by the organization is utilized to save testing time, reduce testing costs, effectively control the testing scope, and reduce the testing effect caused by quality problems due to unclear testing scope.
[0057] Example 4
[0058] The present invention also provides a computer device for generating test cases, comprising: at least one memory and at least one processor;
[0059] The at least one memory is used to store a machine-readable program;
[0060] The at least one processor is used to call the machine-readable program to execute the test case generation method.
[0061] The information interaction of the processor in the above-mentioned computer device, the execution process of the readable program, etc., are based on the same concept as the embodiment of the method of the present invention. The specific contents can be found in the description of the embodiment of the method of the present invention, and will not be repeated here.
[0062] Similarly, the computer device of the present invention obtains the impact scope of the current file system modification by comparing the files before and after the patch is updated, and then associates the newly added detailed test cases based on the modification scope. Through the participation of design, R&D, and testing personnel, the explicit knowledge accumulated by the organization is utilized to save testing time, reduce testing costs, effectively control the testing scope, and reduce the testing effect caused by quality problems due to unclear testing scope.
[0063] Example 5
[0064] The present invention also provides a storage medium, wherein the computer-readable medium stores computer instructions, and when the computer instructions are executed by a processor, the processor executes the test case generation method. Specifically, a system or device equipped with a storage medium can be provided, wherein the storage medium stores software program codes for implementing the functions of any of the above embodiments, and enables a computer (or CPU or MPU) of the system or device to read and execute the program codes stored in the storage medium.
[0065] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.
[0066] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer by a communication network.
[0067] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.
[0068] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or written to a memory provided in an expansion unit connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or the expansion unit is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.
[0069] It should be noted that not all steps and modules in the above-mentioned processes and device structures are necessary, and some steps or modules can be ignored according to actual needs. The execution order of each step is not fixed and can be adjusted as needed. The system structure described in the above-mentioned embodiments can be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or some components in multiple independent devices may be implemented together.
[0070] The above-described embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or changes made by those skilled in the art based on the present invention are within the protection scope of the present invention. The protection scope of the present invention shall be subject to the claims.
Claims
1. A test case generation method, Its characteristics are include: Step 1: Compare the software modification scope and clarify the software test scope: Compare the test environment of the new patch and the test environment of the unupdated new patch, clarify the patch modification points, extract the business process, function points and special R&D design notes according to the patch modification points, and obtain the software test scope; Step 2: Matching test cases: Search the knowledge base for business process test cases, function point test cases, and special test cases according to the scope of this software test to obtain matching results; Step 3: Automatically generate test cases: Based on the matching results, test cases are generated in the order of business process, function point, and project. Step 4: Update the knowledge base: Classify the newly generated test cases into business processes, functions, and special test cases according to the corresponding categories to complete the knowledge base update.
2. A test case generation method according to claim 1, Its characteristics are In step 2, based on the scope of this software test, the feature words of the test scope are obtained, and the test cases of the business process, the test cases of the functional points and the special test cases are matched in turn according to the feature words, and the matching weight of each feature word is calculated. The test case with the highest matching degree is selected based on the weight.
3. A test case generation method according to claim 1, Its characteristics are In step 1, if the scope of this software test only modifies the function points and does not involve business processes and projects, the specific function points belonging to which business should be marked in the function point annotation. In step 2, only the test cases of the functional points are searched according to the scope of this software test to obtain matching results. At the same time, the forward and reverse business process verification of the business process corresponding to the functional points is added to prevent business process errors caused by modifications.
4. A test case generation method according to claim 1, Its characteristics are In step 4, when there is a new test requirement for the software, it is determined whether there are newly generated test cases. If so, the newly generated test cases are classified into business processes, functions, and special test cases according to the corresponding categories. When there is a software quality incident, determine whether there are newly generated test cases. If so, classify the newly generated test cases into business processes, functions, and special test cases according to the corresponding categories. When missing test points are found daily, it is determined whether there are newly generated test cases. If so, the newly generated test cases are classified into business processes, functions, and special test cases according to the corresponding categories.
5. A test case generating device, Its characteristics are Including test scope management module, matching search module, use case generation module and knowledge base update module, The test scope management module compares the software modification scope and clarifies the software test scope: compares the test environment of the new patch and the test environment of the unupdated new patch, clarifies the patch modification points, extracts the business process, function points and special R&D design notes based on the patch modification points, and obtains the software test scope; Matching search module matches test cases: Searches for business process test cases, function point test cases and special test cases in the knowledge base according to the scope of this software test to obtain matching results; The use case generation module automatically generates test cases: based on the matching results, the generated test cases are displayed in the order of business process, function point, and project; The knowledge base update module updates the knowledge base: the newly generated test cases are classified into business processes, functions, and special test cases according to the corresponding categories to complete the knowledge base update.
6. A test case generating device according to claim 5, Its characteristics are The matching search module obtains the feature words of the test scope according to the scope of this software test, matches the test cases of the business process, the test cases of the functional points and the test cases of the special projects in turn according to the feature words, calculates the matching weight of each feature word, and selects the test cases with the highest matching degree based on the weight.
7. A test case generating device according to claim 5, Its characteristic is the test If the software test scope obtained by the scope management module only modifies the function points and does not involve business processes and projects, the specific function points belonging to which business should be marked in the function point annotations. The matching search module searches only for test cases of functional points according to the scope of this software test to obtain matching results. At the same time, it adds forward and reverse business process verification of the business process corresponding to the functional points to prevent business process errors caused by modifications.
8. A test case generating device according to claim 5, Its characteristics are When there is a new test requirement for the software, the knowledge base update module determines whether there is a newly generated test case. If so, the newly generated test case is classified into business process, function, and special test cases according to the corresponding classification. When there is a software quality incident, the knowledge base update module determines whether there are newly generated test cases. If so, the newly generated test cases are classified into business processes, functions, and special test cases according to the corresponding categories. When missing test points are found daily, the knowledge base update module determines whether there are newly generated test cases. If so, the newly generated test cases are classified into business processes, functions, and special test cases according to the corresponding categories.
9. A computer device for generating test cases, Its characteristics are include: at least one memory and at least one processor; The at least one memory is used to store a machine-readable program; The at least one processor is used to call the machine-readable program to execute a test case generation method as described in any one of claims 1 to 4.
10. A storage medium, Its characteristics are The computer-readable medium stores computer instructions, and when the computer instructions are executed by a processor, the processor executes a test case generation method according to any one of claims 1 to 4.
