Software testing method, device and equipment and computer readable storage medium
By automatically generating a set of software test points, the problems of inefficiency and low accuracy caused by traditional manual writing of test points are solved, and efficient and comprehensive software testing is achieved.
Patent Information
- Application Number
- CN202411021252.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-11-22
AI Technical Summary
Traditional software functional testing relies on manual writing of test points, resulting in inefficient testing in large and complex software projects, difficult to control coverage, and susceptible to human factors.
By obtaining key elements based on software requirements documents, generating target test point sets using mapping models, and optimizing test point sets through coverage detection and quality evaluation, automatically generating test point reports to improve testing efficiency and accuracy.
It realizes automated test point generation, improves the efficiency and accuracy of software testing, and reduces the problems of inefficiency and low accuracy caused by manual writing of test points.
Smart Images

Figure CN119003340A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software testing, and in particular to a test point generation method, device and computer-readable storage medium. Background Art
[0002] Software testing technology is an important part of the software development process. It is an activity process that runs through the entire software development life cycle and verifies and confirms software products (including phased products). Its purpose is to find various problems in software products as soon as possible - inconsistencies with user requirements and pre-defined requirements, check bugs in software products, write test reports, and hand them over to developers for modification. The basic goal of software testers is to find errors in software. Traditional software functional testing relies on manually writing test points, which makes test cases very time-consuming in large and complex software projects, resulting in low test efficiency.
[0003] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0004] The main purpose of the present invention is to provide a software testing method, device, equipment and computer-readable storage medium, aiming to solve the problem of low testing efficiency caused by the need to manually write test points during software testing.
[0005] To achieve the above object, the present invention provides a software testing method, which comprises the following steps:
[0006] Obtain key elements based on the requirements document of the software to be tested;
[0007] Inputting the key elements as input information into a mapping model;
[0008] Generate a target test point set according to output information calculated by the mapping model based on the input information;
[0009] The software to be tested is tested according to the target test point set.
[0010] Optionally, the step of generating a target test point set according to the output information calculated by the mapping model based on the input information includes:
[0011] Generate an initial test point set according to the output information;
[0012] After performing coverage detection on the initial test point set, obtaining coverage corresponding to the initial test point set;
[0013] The target test point set is generated according to the coverage and the initial test point set.
[0014] Optionally, after performing coverage detection on the initial test point set, the step of obtaining coverage corresponding to the initial test point set includes:
[0015] Generate a function path corresponding to the software to be tested according to the test information;
[0016] Compare each initial test point in the initial test point set with the functional path coverage detection report to obtain a comparison result;
[0017] The coverage corresponding to the initial test point set is generated according to the comparison result.
[0018] Optionally, the step of generating the target test point set according to the coverage and the initial test point set includes:
[0019] When the coverage corresponding to the initial test point set is greater than or equal to the preset coverage, performing quality evaluation on each initial test point in the initial test point set to determine a quality indicator score corresponding to the initial test point set;
[0020] When the quality indicator score corresponding to the initial test point set is greater than or equal to the preset quality indicator score, the initial test point set is used as the target test point set.
[0021] Optionally, after the step of using the initial test point set as the target test point set when the quality score corresponding to the initial test point is greater than or equal to a preset quality score, the step further includes:
[0022] Generate a test point report according to the target test point set, the test point report including a requirement coverage heat map and a test point classification statistical chart;
[0023] The test point report is displayed.
[0024] Optionally, the step of obtaining test information according to the requirement document of the software to be tested includes:
[0025] Analyze the requirement document using natural language processing technology to obtain key elements corresponding to the requirement document;
[0026] The test information is generated according to the key elements, and the test information includes at least one of a test scenario, a test condition, an expected result, and test data.
[0027] In addition, to achieve the above-mentioned purpose, the present invention also provides a software testing device, which includes a requirement parsing module, a test point generating module, a visualization module and a software testing module:
[0028] A requirement analysis module, which is used to obtain test information based on the requirement document of the software to be tested;
[0029] A test point generation module, the test point generation module includes a mapping model, the mapping model is used to calculate output information according to input information;
[0030] The test point generation module generates a target test point set according to the output information;
[0031] The visualization module is used to generate a test point report according to the target test point set and display the test point report, wherein the test point report includes a requirement coverage heat map and a test point classification statistical chart;
[0032] The software testing module is used to test the software to be tested according to the target test point set.
[0033] Optionally, the test point generating module further includes:
[0034] Coverage detection module: the coverage detection module is used to perform coverage detection on the initial test point set corresponding to the output information, and generate coverage corresponding to the initial test point set;
[0035] An evaluation and optimization module, wherein the evaluation and optimization module device is used to perform quality evaluation on each initial test point in the initial test set and determine a quality indicator score corresponding to the initial test point set.
[0036] In addition, to achieve the above-mentioned purpose, the present invention also provides a software testing device, the software testing device includes the software testing device as described above; the software testing device also includes: a memory, a processor, and a software testing program stored in the memory and executable on the processor, the software testing program implements the steps of the software testing method as described above when executed by the processor. In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, the computer-readable storage medium stores a software testing program, the software testing program implements the steps of the software testing method as described above when executed by the processor.
[0037] A software testing method proposed in an embodiment of the present invention obtains key elements according to the requirement document of the software to be tested, and then inputs the key elements as input information into a mapping model, and generates a target test point set based on the output information obtained by calculation according to the mapping model, and tests the software to be tested according to the target test point set. By automatically generating the target test point set, the software to be tested is tested according to each automatically generated target test point, thereby improving the test point generation efficiency and thus improving the software testing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention;
[0039] Figure 2 A schematic diagram of a flow chart of a first embodiment of a software testing method of the present invention;
[0040] Figure 3 This is a detailed flow chart of step S30 in the first embodiment of the software testing method of the present invention;
[0041] Figure 4 This is a detailed flow chart of step S32 in the first embodiment of the software testing method of the present invention;
[0042] Figure 5 A schematic diagram of a flow chart of a second embodiment of a software testing method of the present invention;
[0043] Figure 6 Schematic diagram of the flow chart of the third embodiment of the software testing method of the present invention.
[0044] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0045] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0046] The main solution of the embodiment of the present invention is: obtain key elements according to the requirement document of the software to be tested; input the key elements as input information into the mapping model; generate a target test point set according to the output information calculated by the mapping model based on the input information; and test the software to be tested according to the target test point set.
[0047] like Figure 1 As shown, Figure 1 It is a schematic diagram of the software test structure of the hardware operating environment involved in the embodiment of the present invention.
[0048] The terminal in the embodiment of the present invention may be a PC, or may be a terminal device such as a smart phone or a tablet computer.
[0049] like Figure 1As shown, the terminal may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. The communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WiFi interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0050] Optionally, the terminal may also include a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, and the like. Among them, sensors include light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display screen according to the brightness of the ambient light, and the proximity sensor may turn off the display screen and / or backlight when the mobile terminal is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile terminal (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; of course, the mobile terminal may also be configured with other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., which will not be repeated here.
[0051] Those skilled in the art will understand that Figure 1 The terminal structure shown in the figure does not constitute a limitation on the terminal, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0052] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a software testing program.
[0053] exist Figure 1In the terminal shown, the network interface 1004 is mainly used to connect to the backend server and perform data communication with the backend server; the user interface 1003 is mainly used to connect to the client (user end) and perform data communication with the client; and the processor 1001 can be used to call the software test program stored in the memory 1005 and perform the following operations:
[0054] Obtain key elements based on the requirements document of the software to be tested;
[0055] Inputting the key elements as input information into a mapping model;
[0056] Generate a target test point set according to output information calculated by the mapping model based on the input information;
[0057] The software to be tested is tested according to the target test point set.
[0058] Further, the processor 1001 may call the software test program stored in the memory 1005, and also perform the following operations:
[0059] Generate an initial test point set according to the output information;
[0060] After performing coverage detection on the initial test point set, obtaining coverage corresponding to the initial test point set;
[0061] The target test point set is generated according to the coverage and the initial test point set.
[0062] Further, the processor 1001 may call the software test program stored in the memory 1005, and also perform the following operations:
[0063] Generate a function path corresponding to the software to be tested according to the test information;
[0064] Compare each initial test point in the initial test point set with the functional path coverage detection report to obtain a comparison result;
[0065] The coverage corresponding to the initial test point set is generated according to the comparison result.
[0066] Further, the processor 1001 may call the software test program stored in the memory 1005, and also perform the following operations:
[0067] When the coverage corresponding to the initial test point set is greater than or equal to the preset coverage, performing quality evaluation on each initial test point in the initial test point set to determine a quality indicator score corresponding to the initial test point set;
[0068] When the quality indicator score corresponding to the initial test point set is greater than or equal to the preset quality indicator score, the initial test point set is used as the target test point set.
[0069] Further, the processor 1001 may call the software test program stored in the memory 1005, and also perform the following operations:
[0070] Generate a test point report according to the target test point set, the test point report including a requirement coverage heat map and a test point classification statistical chart;
[0071] The test point report is displayed.
[0072] Further, the processor 1001 may call the software test program stored in the memory 1005, and also perform the following operations:
[0073] Analyze the requirement document using natural language processing technology to obtain key elements corresponding to the requirement document;
[0074] The test information is generated according to the key elements, and the test information includes at least one of a test scenario, a test condition, an expected result, and test data.
[0075] First embodiment
[0076] Reference Figure 2 A first embodiment of the present invention provides a software testing method, the software testing method comprising:
[0077] Step S10, obtaining test information according to the requirement document of the software to be tested;
[0078] Step S20, inputting the test information as input information into the mapping model;
[0079] Step S30, generating a target test point set according to output information calculated by the mapping model based on the input information;
[0080] Step S40: testing the software to be tested according to the target test point set.
[0081] In the prior art, as the complexity of software systems increases, the traditional method of manually writing test points has problems such as low efficiency, difficult to control coverage, and susceptibility to human factors. To this end, the present invention aims to propose a new solution, combining artificial intelligence technology to intelligently analyze software requirements, automatically derive and continuously optimize test points, so as to ensure that testing activities are efficient, comprehensive and accurate. Therefore, this embodiment proposes a method for automatically generating test points, thereby improving the efficiency of test point generation and the efficiency and accuracy of software testing, thereby solving the problem of low test efficiency and low test accuracy caused by manually writing test points.
[0082] Optionally, it is noted that the present application is not limited to the software to be tested, and the software to be tested may be various software, such as game software, instant messaging software, e-commerce software, office software, compression software, input method software, customer relationship management (CRM) software, etc.
[0083] Optionally, a requirement document of the software to be tested is first obtained, and test information is obtained according to the requirement document. The step of obtaining requirement information according to the requirement document includes:
[0084] Analyze the requirement document using natural language processing technology to obtain analysis results;
[0085] The key elements are generated according to the analysis results.
[0086] Optionally, after obtaining the requirement document, natural language processing technology (Natural Language Processing, NLP) is used to perform in-depth analysis on the requirement document to obtain analysis results, which include functional descriptions, constraints, business rules, etc., and the analysis results are structured and stored in a requirement information database.
[0087] Optionally, after obtaining the analysis result, the key elements are analyzed again, and the key elements are generated according to the analysis result after the second analysis. Optionally, the key elements are analyzed again by further converting the structured analysis result to a language recognizable by the system, and optionally, the format of the key elements is converted to a format recognizable by the system, so as to ensure that the analysis after the second analysis can be understood and executed by the system, thereby ensuring the success rate of software testing.
[0088] Optionally, after obtaining the key elements, the key elements are used as input information and input into a mapping model, so that the mapping model generates output information according to the input information, and the output information is used as an initial target point set. Optionally, a deep learning model is designed and trained to perform a secondary analysis on the key elements, and the analyzed key elements are mapped into executable test scenarios, test conditions, expected results, and necessary test data. Optionally, different test points correspond to different test data. For example, when detecting whether a user has logged in successfully, the corresponding test data may include user account, password, preset personal information fields, etc.; Optionally, the deep learning model may be a recurrent neural network (RNN), a long short-term memory network (LSTM) or a Transformer architecture, which is not limited here. The method of designing and training a deep learning model is to obtain a large amount of training data, mark the training data, and input the marked training data into the deep learning model for iterative training to generate the required deep learning model. The training data includes a demand-test case data set. Generating test information based on the deep learning model can ensure high-precision mapping capabilities, thereby ensuring the accuracy of test point generation.
[0089] Optionally, during actual operation, if the description in the requirement document is "after the user logs into the system, the user's personal information should be able to be viewed in the main interface", the key elements obtained after parsing the requirement document using natural language processing technology and structuring the key elements are:
[0090] Subject: User;
[0091] Action: Log in to the system;
[0092] Subsequent actions: Check personal information;
[0093] Scene: main interface;
[0094] Optionally, the mapping model generates output results according to the key elements, and then uses the output information as the initial test point set, such as:
[0095] Test scenario: simulate user login system;
[0096] Test conditions: The user has successfully logged in;
[0097] Expected result: The main interface displays user personal information;
[0098] Test data: user account, password, preset personal information fields, etc.
[0099] Optionally, after receiving the output information generated by the mapping model based on the input information, in order to improve the accuracy of the test points, this embodiment also considers the correlation between various requirements, thereby ensuring that the test points can cover all possible functional paths and abnormal situations, thereby improving the accuracy of software testing. Figure 3 As shown, the step S30 includes:
[0100] Step S31, generating an initial test point set according to the output information;
[0101] Step S32, after performing coverage detection on the initial test point set, obtaining coverage corresponding to the initial test point set;
[0102] Step S33: generating the target test point set according to the coverage and the initial test point set.
[0103] Optionally, after obtaining the output information, the output information is used as an initial test point set, and the initial test point set includes multiple initial test points; then, each initial test point in the initial test point set is subjected to coverage detection, and the coverage detection is used to detect whether all test points in the initial test point set cover all possible functional paths and abnormal conditions, while also paying attention to the test points generated by cross-functional dependencies and boundary conditions. Optionally, the coverage detection method can be implemented through a graph theory algorithm and / or a state machine model. It can be understood that other algorithms and / or methods that can be used to implement coverage detection of this embodiment also fall within the scope of consideration of this embodiment and are not limited here.
[0104] Alternatively, if Figure 4 As shown, the step S32 includes:
[0105] Step S321, obtaining the function path corresponding to the software to be tested;
[0106] Step S322, comparing each initial test point in the initial test point set with the functional path to obtain a comparison result;
[0107] Step S323: Generate coverage corresponding to the initial test point set according to the comparison result.
[0108] Optionally, this embodiment uses a graph theory algorithm to perform coverage detection and analysis on the initial test point set. Optionally, each functional path corresponding to the software under test is obtained according to the requirement document of the software under test, and at the same time, each functional point or state corresponding to the software under test is obtained according to the functional path, and the functional path is used to represent the transition path from one state to another; then a function dependency graph is generated according to the functional point, state and the functional path. Optionally, the functional path is regarded as an edge of the function dependency graph, and each functional point or state is regarded as a node of the function dependency graph.
[0109] Optionally, each initial test point in the initial test point set is compared with the functional path, and the comparison result is obtained in the following manner: after generating the functional dependency graph, the functional dependency graph is traversed according to each initial test point in the initial test point set, and the comparison result is determined according to the traversal result. It can be understood that each functional path corresponds to a set of operation sequences, and the operation sequences are the required test points. Optionally, the functional dependency graph is traversed by using a depth-first search algorithm and / or a breadth-first search algorithm to determine whether each initial test point in the initial test point set covers all functional paths corresponding to the functional dependency graph. If all functional paths are covered, it is determined that the coverage of the initial test point set is high, and if the initial test point set cannot cover all functional paths, it is determined that the coverage of the initial test point set is low, and the initial test point set needs to be corrected. Optionally, the depth-first algorithm tends to explore the path as deep as possible, while the breadth-first search algorithm traverses all paths in hierarchical order, thereby ensuring the accuracy of the coverage of the test points.
[0110] Optionally, in another embodiment, the present invention can also use a state machine model to obtain the coverage corresponding to the initial test point set. Optionally, the state machine model is suitable for processing stateful applications or complex functions with multiple possible states. The state machine consists of a series of states, each of which is connected by event-triggered transitions.
[0111] Optionally, the coverage corresponding to the initial test point set is detected by using the state machine model as follows: first, a state machine model of the software to be tested is generated, the state machine model includes all possible states, trigger events and transition rules between states; then a state transition matrix is generated according to the state machine model, the state transition matrix records all functional paths that are transferred from one state to another under the action of different trigger events, and the state transition matrix covers all functional paths; optionally, each initial test point in the initial test point set is compared with each functional path corresponding to the state transition matrix to obtain a comparison result, so as to detect whether the initial test point set covers all functional paths, that is, each functional path corresponds to at least one initial test point. Optionally, this embodiment is also implemented by exhaustively enumerating all state transition combinations, or by optimizing the coverage process of the initial test point set through a more intelligent strategy (such as random testing or model-based testing).
[0112] Optionally, when using a state machine model and / or graph theory algorithm to detect the coverage corresponding to the initial test point set, in order to confirm the coverage corresponding to the functional path, abnormal states or error handling paths should also be considered to ensure that the system's operation in the face of unexpected inputs or failures is also fully tested.
[0113] Optionally, after the coverage is generated according to the comparison results, the coverage can be compared with a preset coverage, which can be 100%. When the coverage is lower than the preset coverage, the initial test point set is corrected and the coverage is re-checked to ensure that the coverage corresponding to the latest initial test point set is greater than or equal to the preset coverage.
[0114] Optionally, when the initial test point set is greater than or equal to a preset coverage, the initial test point set is used as a target test point set, and then the software to be tested is automatically tested according to the target test point set.
[0115] In this embodiment, the requirement document is first parsed by natural language processing technology to obtain key elements, and the key elements are stored in a structured manner. The key elements are then mapped according to a mapping model to obtain an initial target initial point set, thereby realizing automatic generation of test points. The test points are then covered using a graph theory algorithm and / or a state machine model to detect whether the generated test points cover all functional paths and abnormal conditions, thereby improving the comprehensiveness and accuracy of the test.
[0116] Second embodiment
[0117] Alternatively, if Figure 5 As shown, step S33 includes:
[0118] Step S331, when the coverage corresponding to the initial test point set is greater than or equal to the preset coverage, performing quality evaluation on each initial test point in the initial test point set to determine a quality index score corresponding to the initial test point set;
[0119] Step S332: when the quality indicator score corresponding to the initial test point set is greater than or equal to a preset quality indicator score, the initial test point set is used as a target test point set.
[0120] Optionally, when it is determined that the coverage corresponding to the initial test point set is greater than or equal to the preset coverage, in order to further ensure that the test point quality meets the requirements, a quality assessment is performed on each of the initial test points to obtain a quality index score for each initial test point, and the initial test point set is dynamically iteratively optimized based on the quality index score to improve the accuracy of software testing.
[0121] Optionally, the manner of performing quality assessment on the initial test points is to assess at least one of effectiveness assessment, redundancy assessment and coverage integrity assessment of the initial test points.
[0122] Optionally, the effectiveness evaluation of the initial test point may be performed by analyzing the execution result of the initial test point, optionally, running the initial test point, observing whether it can trigger the expected result, and whether defects or abnormal behaviors can be found, recording the execution result, and confirming whether the initial test point is effective according to the execution result; it may also be performed by analyzing the defect density of the initial test point, optionally, evaluating the defect number of defects that can be obtained after running the initial test point, thereby calculating the defect number corresponding to the unit initial test point, thereby determining the defect density corresponding to the initial test point, if the defect density corresponding to the initial test point is greater than or equal to the preset defect density, the initial test point is effective; it may also be performed by analyzing the correlation between the initial test point and the demand, the correlation may be characterized as the number of demand points or function points directly or indirectly covered by the initial test point, when the number of demand points or function points directly or indirectly covered by the initial test point is greater than or equal to the preset number, it is determined that the initial point design is effective. Optionally, the effectiveness evaluation of the initial test point includes but is not limited to the above-mentioned methods. Optionally, after performing the effectiveness evaluation, an effectiveness score corresponding to the initial test point set is obtained. The effectiveness score can be obtained through the test point efficiency. The test point is used to measure the efficiency of each test point, that is, the relationship between the test resources invested and the number of defects found. The test point efficiency can be characterized by the average defect density. The test point efficiency at this time can be determined by the ratio of the number of defects found through the test point to the total number of test points, and the ratio is used as the effectiveness score.
[0123] Optionally, the method for performing redundancy evaluation on the initial test points may be to perform similarity analysis on the initial test points, that is, to detect whether there are more than one test point for the same input or operation of the same function point. If there are a preset number of test points for the same function point, the preset number may be 2, then it is determined that the initial points are redundant, and at this time, it is necessary to perform a deduplication operation on the initial test points to reduce the redundancy corresponding to the initial test point set; at this time, the method for performing redundancy evaluation may also be to minimize the coverage set analysis. Optionally, by selecting some initial test points and removing them from the initial test point set, the initial test point set obtained after the removal is subjected to coverage integrity detection, and the coverage integrity detection method is to detect whether the initial test points in the initial test point set can cover all the demand points. If the initial test point set obtained after the movement is subjected to coverage detection, and the corresponding coverage detection result is that the initial test point set can still cover all the demand points, then it is determined that the redundancy of the initial test point set before the removal is too large, and the removed initial test point is a redundant test point, then the redundant test point is removed from the initial test point set, and the initial test point set after the removal is used as the target test point set. Optionally, after performing the redundancy evaluation, a redundancy score is determined, and the redundancy score can be determined by the repeated test point ratio, the repeated test point ratio being equal to the number of repeated test points / the total number of test points, and then the redundancy score is determined according to the score corresponding to the repeated test point ratio. Optionally, the method of performing the redundancy evaluation on the initial test points includes but is not limited to the above method.
[0124] Optionally, the coverage integrity evaluation method for the initial test points can be performed by creating a requirement coverage matrix, wherein the columns in the requirement coverage matrix represent the requirement points corresponding to the software to be tested, and the rows in the requirement coverage matrix represent the initial test points, and whether each of the initial test points covers the corresponding requirement points is determined according to the requirement coverage matrix; Optionally, the coverage integrity evaluation method can also be path coverage analysis, and optionally, the code execution path corresponding to the software to be tested is generated, and then the initial test point is compared with the code execution path to determine whether the initial test point covers all code execution paths, thereby obtaining the coverage integrity evaluation result, and optionally, when detecting whether the initial test point covers the code execution path, it is also necessary to detect whether the initial test point covers the branch path and / or loop path in the code execution path, so as to ensure the accuracy of the coverage integrity evaluation. Optionally, the coverage integrity evaluation method for the initial test points includes but is not limited to the above analysis, which is not limited here. Optionally, after the coverage integrity evaluation, the coverage integrity score corresponding to the initial test point set is obtained, and the coverage integrity score can be determined by the ratio of the number of covered requirement points to the total number of requirement points.
[0125] Optionally, in the process of quality assessment, the quality assessment results obtained by each quality assessment method are quantified to determine the quality assessment score corresponding to the initial test point set. For example, when the number of valid test points is greater than or equal to a preset number, the validity score is 80. When the number of redundant test points is less than or equal to a preset number, the redundancy score is 100. When the initial test point set covers more than 80% of the code execution paths, the coverage completeness score is 80. The validity score, redundancy score and coverage score are weighted to determine the quality indicator score corresponding to the initial test point set. Optionally, this embodiment does not limit the quantization scoring method and the weight addition method.
[0126] Optionally, the quality assessment method for the initial test point set includes but is not limited to the effectiveness assessment, redundancy assessment and coverage integrity assessment mentioned above, and may also include an execution time assessment, through which an execution time score is obtained, and the execution time score can be determined by the average test execution time. Optionally, after determining the average test execution time, the execution time score is determined according to the score corresponding to the average test execution time, and the average test execution time is equal to the ratio of the total test execution time to the total number of test points. The overall test cycle is shortened by evaluating the execution time; it may also include a resource consumption assessment, so as to reduce the hardware resources required for the test, such as CPU, memory and disk space. The resource consumption assessment can be characterized by resource utilization, and the resource utilization = the ratio of actually used resources to the total available resources, and the resource consumption score is determined according to the ratio; optionally, the quality assessment method for the initial test point set can also be a test point diversity assessment, so as to measure whether the initial test points cover various test conditions and scenarios, so as to help discover potential edge cases and abnormal behaviors. Optionally, the test point diversity score can be determined by the ratio of the number of different types of test points to the total number of test points.
[0127] Optionally, when it is determined that the quality indicator score is greater than or equal to a preset quality indicator score, the initial test point set is used as a target test point set, and then software testing is performed on the software to be tested according to the target test point set.
[0128] Optionally, when it is determined that the quality indicator score is less than the preset quality indicator score, the initial test point set is intelligently optimized until the quality indicator score corresponding to the optimized initial test point set is greater than or equal to the preset quality indicator score.
[0129] Optionally, the method of intelligently optimizing the initial test point set may be to optimize the initial test point set by combining fuzzy logic algorithm, genetic algorithm, particle swarm optimization algorithm, simulated annealing algorithm, multi-objective optimization function and other algorithms, balancing the quantity and quality of the test points, so as to ensure that the initial test point set meets the coverage integrity condition and the redundancy condition, thereby ensuring test coverage while avoiding redundant tests, improving accuracy and test efficiency. Optionally, the intelligent optimization of the initial test point set may be dynamic iterative optimization until the optimization standard is reached, that is, the quality index score corresponding to the optimized initial test point set is greater than or equal to the preset quality index score.
[0130] Optionally, this embodiment uses a genetic algorithm as an optimization method for example analysis. Optionally, S1, randomly obtain a group of random initial test point groups as the initial population according to the initial test point set, S2, evaluate the fitness of each random initial test point of the initial population according to a preset optimization function, and the preset optimization function generates the fitness according to the coverage integrity and redundancy of the random initial test point; S3, determine the random initial test point with higher fitness according to the fitness to perform crossover and mutation operations, so as to generate the next generation test point group, S4, perform step S2 based on the next generation test point group until the preset termination condition is met, and the preset termination condition can be that the number of iterations reaches the preset number of iterations, and / or the difference between the fitness corresponding to the last iteration and the fitness corresponding to the previous iteration is less than the preset difference, then the fitness cannot be further improved. Optionally, after the preset termination condition is met, the test point group generated in the last iteration is used as the optimized test point group, and then the target test point set is generated according to the optimized test point group.
[0131] In this embodiment, each initial test point in the initial test point set is evaluated to determine the quality index score corresponding to the initial test point set, and the test points that need to be optimized are intelligently iteratively optimized based on the quality index score, thereby ensuring that the test efficiency and accuracy are improved and the resource utilization is improved during actual testing.
[0132] Third embodiment
[0133] Optionally, based on the above embodiment, Figure 6 As shown, after step S332, the following further includes:
[0134] Step S50, generating a test point report according to the target test point set;
[0135] Step S60: display the test point report.
[0136] Optionally, after the target test point set is generated, in order to allow testers to more intuitively and conveniently adjust the target test point set, the target test point set finally generated can be used to test the software to be tested with higher efficiency and accuracy.
[0137] Optionally, the test point report may include test coverage completeness, which may be reflected in the form of code line coverage, branch coverage, etc.; it may also include defect distribution, which includes the number and specific locations of defects or errors that may be found during the test process; it may also include test point execution status, performance indicators, trend analysis, suggestions, etc., which are not limited here.
[0138] Optionally, the test point report can also be displayed in a graphical form, such as a requirement coverage heat map, to convert the test point report into a corresponding requirement coverage heat map. In the requirement coverage heat map, different colors are used to represent different coverage completeness, such as green for full coverage, yellow for partial coverage, and red for no coverage. Each row or column can correspond to a specific requirement point or functional module, so that testers can see at a glance which requirements have been fully tested and which ones need to be strengthened.
[0139] Optionally, the test point classification statistical report can be displayed by converting the test point report into a corresponding test point classification statistical report, and the test point classification statistical report can be summarized and displayed according to the type or classification of the target test points in the target test point set. For example, it can display the number of target test points by classification such as functional test, performance test, security test, etc., or count by test results (pass, fail, blocked). This kind of chart helps testers understand the comprehensiveness of the test activities and identify potential bottlenecks or problem areas in the test process.
[0140] In this embodiment, each target test point of the target test point set is displayed in the form of a test point report to facilitate testers to confirm the requirement coverage of the target test point set and ensure that all important functions can be fully tested. In addition, testers can also evaluate the test quality based on the test point report and adjust the test points to improve the efficiency of the test.
[0141] In addition, the present invention also provides a software testing device, which includes a requirement parsing module, a test point generating module, a visualization module and a software testing module:
[0142] A requirement analysis module, which is used to obtain test information based on the requirement document of the software to be tested;
[0143] A test point generation module, the test point generation module includes a mapping model, the mapping model is used to calculate output information according to input information;
[0144] The test point generation module generates a target test point set according to the output information;
[0145] The visualization module is used to generate a test point report according to the target test point set and display the test point report, wherein the test point report includes a requirement coverage heat map and a test point classification statistical chart;
[0146] The software testing module is used to test the software to be tested according to the target test point set.
[0147] Optionally, the test point generating module further includes:
[0148] Coverage detection module: the coverage detection module is used to perform coverage detection on the initial test point set corresponding to the output information, and generate coverage corresponding to the initial test point set;
[0149] The evaluation optimization module, the intelligent evaluation device is used to perform quality evaluation on each initial test point in the initial test set, and determine the quality indicator score corresponding to the initial test point set.
[0150] In addition, an embodiment of the present invention further provides a computer-readable storage medium, on which a software testing program is stored. When the software testing program is executed by a processor, the steps of the various embodiments described above are implemented.
[0151] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0152] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0153] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0154] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A software testing method, characterized in that: The software testing method comprises the following steps: Obtain key elements based on the requirements document of the software to be tested; Inputting the key elements as input information into a mapping model; Generate a target test point set according to output information calculated by the mapping model based on the input information; The software to be tested is tested according to the target test point set.
2. The software testing method according to claim 1, characterized in that: The step of generating a target test point set according to the output information calculated by the mapping model based on the input information comprises: Generate an initial test point set according to the output information; After performing coverage detection on the initial test point set, obtaining coverage corresponding to the initial test point set; The target test point set is generated according to the coverage and the initial test point set.
3. The software testing method according to claim 2, characterized in that: After performing coverage detection on the initial test point set, the step of obtaining the coverage corresponding to the initial test point set includes: Obtaining the function path corresponding to the software under test; Compare each initial test point in the initial test point set with the functional path to obtain a comparison result; The coverage corresponding to the initial test point set is generated according to the comparison result.
4. The software testing method according to claim 2, characterized in that: The step of generating the target test point set according to the coverage and the initial test point set comprises: When the coverage corresponding to the initial test point set is greater than or equal to the preset coverage, performing quality evaluation on each initial test point in the initial test point set to determine a quality indicator score corresponding to the initial test point set; When the quality indicator score is greater than or equal to a preset quality indicator score, the initial test point set is used as the target test point set.
5. The software testing method according to claim 4, characterized in that: After the step of using the initial test point set as the target test point set when the quality score corresponding to the initial test point is greater than or equal to the preset quality score, the method further includes: generating a test point report according to the target test point set; The test point report is displayed.
6. The software testing method according to claim 1, characterized in that: The step of obtaining key elements according to the requirement document of the software to be tested includes: Analyze the requirement document using natural language processing technology to obtain analysis results; The key elements are generated according to the analysis results.
7. A software testing device, characterized in that: The software testing device includes a requirement parsing module, a test point generating module, a visualization module and a software testing module: A requirement analysis module, which is used to obtain test information based on the requirement document of the software to be tested; A test point generation module, the test point generation module includes a mapping model, the mapping model is used to calculate output information according to input information; The test point generation module generates a target test point set according to the output information; The visualization module is used to generate a test point report according to the target test point set and display the test point report; The software testing module is used to test the software to be tested according to the target test point set.
8. The software testing device according to claim 8, characterized in that: The test point generation module also includes: Coverage detection module: the coverage detection module is used to perform coverage detection on the initial test point set corresponding to the output information, and generate coverage corresponding to the initial test point set; An evaluation and optimization module, wherein the evaluation and optimization module is used to perform quality evaluation on each initial test point in the initial test set and determine a quality indicator score corresponding to the initial test point set.
9. A software testing device, characterized in that: The software testing device comprises the software testing apparatus according to any one of claims 7 to 8; The software testing device further comprises: a memory, a processor and a software testing program stored in the memory and executable on the processor, wherein the software testing program implements the steps of the software testing method according to any one of claims 1 to 6 when executed by the processor.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a software testing program, and when the software testing program is executed by a processor, the steps of the software testing method according to any one of claims 1 to 6 are implemented.
