Disclosure of Invention
The application solves the problems that the priority ordering of the test cases in the prior art is usually dependent on manual experience and subjective judgment, and the importance of the test cases is difficult to objectively quantify, so that the allocation of test resources is not optimized, realizes the multi-dimensional grading ordering of the test cases, optimizes the allocation of the test resources, remarkably improves the test efficiency, reduces the risk of neglecting important defects in the test process, and ensures that the quality and timeliness of test results are ensured under the condition of limited time and resources.
The application provides a software testing method based on AIGC models, which comprises the following steps of determining functional modules of software, constructing a scoring matrix based on the functional modules, wherein the scoring matrix comprises three dimensions of a utilization rate, a fault risk and a return value, constructing functional requirements of the software, inputting the functional requirements of the software into the AIGC models to obtain test cases and functional modules called by the test cases, classifying the test cases into a plurality of types FM according to the number of the called functional modules, and sequencing according to the sequence of the number of the functional modules from less to most to obtain a sequence FM, wherein the sequence FM is: Wherein, the method comprises the steps of, wherein, The method comprises the steps of representing the class FM of an nth test case, calculating the score of each test case in each class FM based on a functional module and a functional module scoring matrix called by each test case, sequentially executing each class FM according to the sequence FM by utilizing an automatic test framework, sequentially executing the test cases according to the sequence from high score to low score in the process of executing each class FM, and generating a test result until all the test cases are executed or the test cannot be completed within a specified time.
Further, constructing the utilization ratio dimension of the function modules in the scoring matrix comprises the following steps of calculating the similarity between the software and the same type of software, taking a plurality of the same type of software with the highest similarity as similar software, obtaining comment data of the similar software, extracting keywords from the comment data by using a natural language processing technology, matching the extracted keywords with the function modules, counting the keywords in each function module to obtain the number of the keywords in each module, and calculating the utilization ratio U of each function module, wherein the utilization ratio U is as follows: wherein F represents the number of keywords in the functional module, and T represents the total number of keywords.
Further, the matching of the extracted keywords with the function modules comprises the steps of decomposing the function modules into sub-functions with finer granularity, distributing a unique identifier for each sub-function, judging and calculating the association degree of each sub-function and the keywords by using a semantic similarity algorithm, and matching the keywords with association degrees larger than a specified value with the sub-functions.
Further, constructing the fault risk dimension of the scoring matrix functional module includes evaluating the complexity of each functional module and the degree of association of each functional module with other functional modules.
Further, the complexity includes the number of lines of code, scoring of business logic complexity, and the number of external services or libraries relied upon.
Further, the association degree comprises the number of times that the function module directly calls other function modules, the frequency of data exchange or interaction between the function module and the other function modules, and the relation and the dependency degree between the function module and the other function modules.
Further, constructing the return value dimension of the scoring matrix functional module includes calculating a return value R, where the return value R is: where C represents complexity.
Further, in the process of executing the test cases in the current category FM, the score of each test case in the next category FM is calculated based on the sequence FM.
In a second aspect, the application provides a software testing system, which adopts the software testing method based on AIGC model in the first aspect, and comprises a module dividing and scoring construction module, a test case generation module, a test case classification module and a test case execution module.
The system comprises a module dividing and grading construction module, a test case generation module, a test case classification module and a sequence FM, wherein the module dividing and grading construction module is used for determining functional modules of software and constructing a grading matrix based on the functional modules, the grading matrix comprises three dimensions of utilization rate, importance and fault risk, the test case generation module is used for constructing functional requirements of the software and inputting the functional requirements of the software into a AIGC model to obtain test cases and functional modules called by the test cases, the test case classification module is used for dividing the test cases into a plurality of categories FM according to the number of called functional modules and sequencing the test cases according to the sequence from less to most of the number of the functional modules to obtain the sequence FM, and the sequence FM is: Wherein, the method comprises the steps of, wherein, The test case execution module is used for calculating the score of each test case in each class FM based on the functional module and the functional module scoring matrix called by each test case, and sequentially executing each class FM according to the sequence FM by utilizing an automatic test framework, sequentially executing the test cases according to the sequence from high to low in the process of executing each class FM, and generating a test result until all the test cases are executed or the test cannot be completed within a specified time.
In a third aspect, the present application provides a software testing apparatus comprising a memory and a processor;
the memory is used for storing a computer program, and the processor is used for realizing the steps of the software testing method based on AIGC model according to the first aspect when executing the computer program.
The technical scheme provided by the application has at least the following technical effects or advantages:
Because the scoring matrix based on the functional module is constructed, and the test cases are automatically generated by combining AIGC models, the priority ordering of the test cases in the prior art is effectively solved because the factors such as the utilization rate, the fault risk and the return value of the functional module are considered, the priority ordering of the test cases is ensured to be executed preferentially, the problem that the test resource allocation is not optimized enough because the importance of the test cases is difficult to objectively quantify is solved, the multi-dimensional scoring ordering of the test cases is realized, the allocation of the test resources is optimized, the test efficiency is obviously improved, the risk of neglecting important defects in the test process is reduced, and the quality and timeliness of the test results are ensured under the condition of limited time and resources.
Detailed Description
According to the application, the scoring matrix based on the functional module is constructed, the test cases are automatically generated by combining the AIGC model, the factors such as the utilization rate, the fault risk and the return value of the functional module are considered, the priority execution of the key test cases is ensured, the multi-dimensional scoring ordering of the test cases is realized, the allocation of test resources is optimized, the test efficiency is obviously improved, the risk of neglecting important defects in the test process is reduced, and the quality and timeliness of the test results are ensured under the condition of limited time and resources.
In order to better understand the above technical solutions, the following detailed description will refer to the accompanying drawings and specific embodiments.
Example 1
A method of software testing based on AIGC models, comprising the steps of:
S100, determining a functional module of software, and constructing a scoring matrix based on the functional module, wherein the scoring matrix comprises three dimensions of utilization rate, fault risk and return value.
The scoring matrix comprises three key dimensions of the utilization rate, the fault risk and the return value, and the dimensions comprehensively consider the utilization frequency, the potential risk and the service value of the software functional modules, so that the importance and the test priority of each functional module can be effectively evaluated. The utilization rate is obtained by analyzing comment data of similar software, the fault risk is determined by evaluating the complexity and the association degree of the functional module, and the return value is the ratio of the utilization rate to the complexity.
The construction of the scoring matrix can be adjusted according to different project requirements. For example, in a more security-oriented software system, the risk of failure dimension in the scoring matrix may be given a higher weight or introduce more security-related evaluation metrics, such as vulnerability density or historical failure records. For more complex software systems, the dimension of the scoring matrix may be increased, covering more evaluation metrics such as response time, system load, etc., to more fully evaluate the importance of the functional module.
Each dimension in the scoring matrix can be adapted to different test requirements by dynamically adjusting the parameter settings. For example, for short cycle test items, the complexity of test case generation can be reduced to cover the core function modules faster, while for long cycle items, the test depth can be increased, ensuring higher coverage.
S200, building functional requirements of the software, and inputting the functional requirements of the software into a AIGC model to obtain the test case and the functional module called by the test case.
And collecting the functional requirements of the software, arranging and standardizing the collected functional requirements, removing redundant information, and ensuring the definition and consistency of input data. AIGC (artificial intelligence generation content) model can automatically generate test cases meeting functional requirements through machine learning and natural language processing technology, for example, models such as GPT, BERT and the like can be adopted to convert the tidied functional requirements into formats which can be understood by the models, such as vector representation, word embedding (Word Embedding) or other coding modes can be used, the models generate corresponding test cases based on the input functional requirements by using the learned knowledge of the models, the generated test cases are tidied into structured formats, and in actual test, the generation capacity of AIGC models can be further optimized according to the validity and coverage rate of the test cases generated by feedback of test results.
S300, classifying test cases into a plurality of types FM according to the number of calling functional modules, and sequencing according to the sequence of the number of the functional modules from less to more to obtain a sequence FM, wherein the sequence FM is as follows: Wherein, the method comprises the steps of, wherein, Representing the class fm of the nth test case.
A software system is assumed to include a function module A for user login, a function module B for user registration, a function module C for viewing user information, a function module D for modifying user information, a function module E for deleting user account, test cases of various types including test case 1 for testing only user login and calling the function module A, test case 2 for testing user login and registration, calling the function modules A and B, test case 3 for testing user login, viewing user information and modifying user information and calling the function modules A, C and D, test case 4 for testing user login, viewing user information, modifying user information and deleting user account, and calling the function modules B, C, D and E, test case 5 for testing user login, registering, viewing user information, modifying user information and deleting user account, and test cases A, B, C, D and E, respectively, test cases 1-test case 5 are classified as-Starting the test from the test cases involving a single functional module and gradually increasing the number of functional modules involved, the problem can be more easily identified and located, and potential defects can be found and repaired in time, thereby improving the quality of the final product, helping the testers to better understand the functions and interrelationships of each module, and reducing the error probability caused by complexity.
S400, calculating the score of each test case in each category FM based on the function module and the function module scoring matrix called by each test case, sequentially executing each category FM according to the sequence FM by utilizing an automatic test framework, sequentially executing the test cases according to the sequence from high to low in the process of executing each category FM, and generating a test result until all the test cases are executed or the test cannot be completed within the specified time.
The test cases automatically generated through the AIGC model can be combined with the scoring matrix of the functional modules, so that the execution sequence of the test cases is ensured to be arranged in an optimized mode, namely, the test cases with higher scores are preferentially executed, and in the process of executing the test, each test case is sequentially executed through an automatic test framework and a test result is generated, so that the automatic execution can be continuously performed until all the test cases are executed or the specified test time limit is reached.
The AIGC model is used for automatically generating the test cases, so that the speed and coverage rate of the test cases are greatly improved, and the time and the error possibility of manually designing the test cases are reduced. The introduction of the scoring matrix ensures that the priority ordering of the test cases is more reasonable, so that the test resources can be concentrated on the functional modules with high risk and high value, the overall efficiency of the test is improved, the dependence on manual testers is reduced through the automatic and intelligent test case generation and execution, and the labor cost is reduced. In addition, the use of an automatic test framework reduces the repeated labor of the test, optimizes the utilization of test resources through intelligent sequencing and scheduling, further reduces the test cost, and through the application of a AIGC model, the test cases can be automatically generated according to the functional requirements, the omission or redundancy problems possibly caused by manually writing the test cases are reduced, the rationality of the test priority is ensured through multi-dimensional evaluation in a scoring matrix, so that the test cases with high priority can find potential problems as early as possible, the test flow is optimized, and the overall efficiency of the test is improved. The test personnel only need to input functional requirements, the system can automatically generate and sequence test cases and sequentially execute the test cases according to the priority, and the convenient operation mode reduces the threshold of the test, so that even the test personnel with insufficient experience can efficiently complete the test task.
In S110, constructing a utilization ratio dimension of a function module in a scoring matrix, wherein the step S111 is to calculate the similarity between software and the same type of software, take a plurality of the same type of software with the highest similarity as similar software, the step S112 is to acquire comment data of the similar software, extract keywords from the comment data by using a natural language processing technology, the step S113 is to match the extracted keywords with the function module, the step S114 is to count the keywords in each function module to obtain the number of the keywords in each module, and the step S115 is to calculate the utilization ratio U of each function module, wherein the utilization ratio U is as follows: wherein F represents the number of keywords in the functional module, and T represents the total number of keywords.
The utilization ratio dimension of the functional module in the scoring matrix is determined by comparing and analyzing the functional module of the software with similar software, and the most similar software can be screened out by calculating the similarity of the software to be tested and the similar software, such as cosine similarity, jaccard similarity coefficient and other similarity algorithms, so as to ensure that the screened software has higher similarity with the software to be tested in function. The keywords generally reflect the use and focus of the user on the specific functional modules of the software, and the NLP technology can identify high-frequency words or phrases related to the functional modules from a large amount of comment data, so that the use of each functional module by the user is revealed. And establishing a mapping relation between each functional module and the keywords to determine the number of the keywords of each functional module, and dividing the number of the keywords in each functional module by the total number of the keywords to reflect the use condition of each functional module so as to calculate the use rate of each functional module.
The method has the advantages that the high-frequency keywords related to the functional modules are extracted through analysis of the user comments of similar software, the functional modules with higher actual use frequency of the user can be accurately identified, and the fact that test resources can be preferentially concentrated on the key modules is ensured, so that the coverage rate and efficiency of testing are improved, potential problems can be better captured especially under the condition that test time or resources are limited, valuable information can be automatically extracted from a large number of comment data through a natural language processing technology, time and cost of manual analysis and screening are reduced, a large amount of text data are efficiently processed, and a test team can rapidly acquire the use rate data of each functional module, so that a test plan is formulated more accurately, and resource waste is avoided.
In S113, matching the extracted keywords with the function modules comprises the following steps of S1131, decomposing the function modules into sub-functions with finer granularity, distributing a unique identifier for each sub-function, S1132, judging and calculating the association degree of each sub-function and the keywords by using a semantic similarity algorithm, and S1133, matching the keywords with the association degree larger than a specified value with the sub-functions.
The complex functional modules are divided into small units which are easier to manage and analyze, so that the matching process of keywords and functions is more accurate, and each sub-function is endowed with a unique identifier so as to ensure accurate positioning and identification in the subsequent matching and analyzing processes. The semantic similarity algorithm is a key technology in natural language processing and can evaluate semantic similarity between keywords and sub-function descriptions. Common semantic similarity algorithms include cosine similarity based on word vector models, path distance method based on semantic networks, and the like. By calculating the semantic similarity, the system can judge which sub-function a certain keyword has higher relevance to. The appointed value is usually a preset similarity threshold value, and only when the semantic similarity of the keywords and the subfunctions exceeds the threshold value, the keywords and the subfunctions are considered to be matched, so that noise data can be effectively filtered, and the accuracy and the reliability of a matching result are ensured.
In S100, constructing fault risk dimensions of the scoring matrix functional modules comprises evaluating complexity of each functional module and association degree of each functional module with other functional modules, wherein the complexity comprises number of code lines, scoring of business logic complexity and number of dependent external services or libraries, and the association degree comprises number of times that the functional modules directly call the other functional modules, frequency of data exchange or interaction between the functional modules and the other functional modules and relationship and dependency degree between the functional modules and the other functional modules.
For complexity assessment, by analyzing the number of code lines per functional module, the complexity of the business logic, and the number of external services or libraries relied upon, these factors collectively reflect the internal complexity of the functional module. The number of code lines is an intuitive complexity measure, and the more the number of code lines, the higher the complexity of the module in general, and the larger the number of codes may mean more logical branches, process flows and potential error points. The complexity of the business logic is related to the complexity of conditional branches and loop structures in the module, the more the logic is complex, the more potential loopholes and error points are, the number and complexity of the conditional branches, loop structures and decision points in the module can be measured by adopting a loop complexity (Cyclomatic Complexity) or Halstead complexity measure, the more the business logic is complex, the more the difficulty of testing is, and therefore, the complexity score can effectively reflect the potential risks of the module. The more the modules are dependent on external services or libraries, the more susceptible their stability is to external factors. For example, if a module relies on multiple external APIs or third party libraries, variations or unavailability of these external dependencies can cause the module to fail, and evaluating the number of external dependencies can help the test team identify high risk modules.
The association degree can be quantified through the times of directly calling other modules by the functional modules, the data exchange frequency among the functional modules, and the dependency relationship and compactness among the modules, so that the interaction complexity and the dependency degree of the functional modules in the whole system can be reflected, and the high-risk area which is likely to cause faults can be accurately and preferentially captured through double evaluation of the internal complexity and the external relevance of the functional modules, thereby improving the pertinence and the effectiveness of the test and guaranteeing the stability and the reliability of the system.
In addition to the number of code lines, business logic complexity scores, and external dependency numbers, other complexity metrics may be introduced. For example, the repetition rate of the code or the degree of modularity of the code may be used to evaluate the complexity. For large projects, the number of code lines and logic complexity can be combined to form a weighted comprehensive scoring system, so that the overall complexity of the module can be reflected more accurately, and for small projects, the scoring mechanism can be simplified, and only the most critical complexity index is focused on to complete the evaluation rapidly. Different code analysis tools and algorithms may be used to calculate the complexity. For example, static code analysis tools may be used to automatically detect complex structures in code and generate detailed complexity reports. For logic complexity, more advanced analysis techniques, such as control flow graph analysis or data flow analysis, can be used to more fully understand the potential complexity in the code, and weights of different complexity indexes can be flexibly set to adapt to different test requirements.
In S100, constructing the return value dimension of the scoring matrix functional module includes calculating a return value R: where C represents complexity.
The report value reflects the relation between the use frequency of the functional modules and the implementation complexity of the functional modules, under the condition of limited resources, the functional modules with high use frequency and lower implementation complexity are preferentially tested, the use rate reflects the use condition of each functional module, the report value is calculated by the ratio of the use rate to the complexity, and the functional modules with higher cost performance, namely the modules with high use rate and lower complexity, can be effectively identified, and generally have larger influence on user experience but are relatively simple to implement, so that under the condition of limited testing resources, the modules can be preferentially tested to ensure the quality of core functions, and the part with the largest influence on the user experience in a system can be covered in a shorter time, thereby improving the overall efficiency of the test and the performance of the system.
Besides the utilization rate and complexity as calculation factors of the return value, other key indexes can be introduced, for example, user feedback scores or user satisfaction data can be used as supplements of the utilization rate, or maintenance cost, failure rate and the like can be used as supplements of the complexity, and the service value of the module can be more comprehensively reflected by introducing more dimension data.
The real-time updating and feedback mechanism can be introduced, so that the calculation result of the return value can be dynamically adjusted in the test process, for example, the use rate and the complexity of the functional module are updated in real time by monitoring the user operation log and the system operation data, and the test strategy can be optimized and adjusted at any time, so that the method can be better adapted to the rapid change of the system.
In the scoring matrix of S100, for the item of special interest in stability, a weight coefficient may be introduced to make the complexity occupy a larger proportion in the calculation of the return value, and for the item of emphasized user experience, the weight of the usage rate may be increased to ensure that the module used at high frequency obtains more test resources.
In S400, in executing the test cases in the current category FM, the score of each test case in the next category FM is calculated based on the sequence FM.
When executing the test cases of the current class fm, the system can re-evaluate the scores of the next class of test cases according to the real-time test results and the latest system state, and generates the scores of each test case in the next class fm as far as possible before the test cases of the current class fm are completed, so that the test operation of each test case in the next class fm can be carried out immediately after the test cases of the current class fm are completed, and the test efficiency is ensured.
Example two
The embodiment provides a software testing system, which adopts a AIGC model-based software testing method in the embodiment I, and comprises a module dividing and scoring construction module, a test case generation module, a test case classification module and a test case execution module.
The system comprises a module dividing and grading construction module, a test case generation module, a test case classification module and a sequence FM, wherein the module dividing and grading construction module is used for determining functional modules of software and constructing a grading matrix based on the functional modules, the grading matrix comprises three dimensions of utilization rate, importance and fault risk, the test case generation module is used for constructing functional requirements of the software and inputting the functional requirements of the software into a AIGC model to obtain test cases and functional modules called by the test cases, the test case classification module is used for dividing the test cases into a plurality of types FM according to the number of called functional modules and sequencing according to the sequence from less to most of the number of the functional modules to obtain the sequence FM, and the sequence FM is: Wherein, the method comprises the steps of, wherein, The system comprises a test case execution module, an automatic test frame, a test case scoring module and a test case scoring module, wherein the test case execution module is used for calculating the score of each test case in each test case type FM based on a functional module and a functional module scoring matrix called by each test case, and sequentially executing each test case type FM according to a sequence FM by utilizing the automatic test frame, sequentially executing the test cases according to the sequence from high score to low score in the process of executing each test case type FM, and generating a test result until all the test cases are executed or the test cannot be completed within a specified time.
This embodiment has all the advantages of the AIGC model-based software testing method in embodiment one, and is capable of automatically implementing all the steps of the AIGC model-based software testing method.
Example III
The embodiment provides a software testing device, which comprises a memory and a processor, wherein the memory is used for storing a computer program, and the processor is used for realizing the steps of the software testing method based on the AIGC model in the first embodiment when the computer program is executed.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks. While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the invention.