Method, system and device for testing software by using artificial intelligence and storage medium
By automatically generating test cases and testing, the inefficiency problem caused by the reliance on personal experience in the existing technology is solved, and the efficiency of software testing is improved.
Patent Information
- Application Number
- CN202411571400.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-02-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, test cases rely on personal experience, and the efficiency and execution of generated test cases are low, resulting in low overall efficiency of software testing.
By obtaining the functional parameters, interface parameters and application scenario data of the tested software, input them into the preset test case generation model, and automatically generate complete test cases, and test the software based on these test cases to generate test results and reports.
The automatic generation of test cases is realized, which greatly improves the efficiency and execution of generating test cases, thereby improving the overall efficiency of software testing.
Smart Images

Figure CN119415434A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer software technology, and in particular to a method, system, device and storage medium for testing software using artificial intelligence. Background Art
[0002] At present, software testing originated from the development of the software industry. With the increase in software complexity, the human resources used in software projects have continued to rise, and software testing has gradually become an independent and crucial link in software engineering. In the software life cycle, testing activities include unit testing, integration testing, system testing, and regression testing. With the popularity of agile development and rapid iteration, test-driven development (TDD), continuous integration (CI), and robustness testing are increasingly valued. In order to ensure software quality, test cases have shifted from manual execution to scripting, and automated testing has gradually become the mainstream. In the existing technology, test case design relies on personal experience, the executability of test cases is low, and the test reports are relatively rough.
[0003] In summary, in the prior art, test cases rely on personal experience, and the efficiency and execution of test case generation are low, resulting in low overall efficiency of software testing. Summary of the invention
[0004] The present invention provides a method, system, device and storage medium for testing software using artificial intelligence to solve the problem that test cases rely on personal experience, the efficiency of generating test cases and the execution power are low, thereby improving the overall efficiency of software testing.
[0005] In a first aspect, in order to solve the above technical problems, the present invention provides a method for testing software using artificial intelligence, comprising: Obtain the functional parameters, interface parameters and application scenario data of the software under test; Inputting the function parameters, the interface parameters and the application scenario data into a preset test case generation model to obtain a complete test case; Testing the tested software according to the complete test case to obtain a test result; Evaluate the test results according to a set evaluation strategy to obtain an evaluation result; Based on the evaluation results, the test execution process is recorded and a test report is generated.
[0006] In an optional implementation manner, the function parameters, the interface parameters and the application scenario data are input into a preset test case generation model to obtain a complete test case, including: Performing an extraction operation according to the function parameter, the interface parameter and the application scenario data to obtain an input parameter influencing factor; Generate different initial test cases based on the multiple input parameter influencing factors of each test interface based on the preset test case generation model; A coverage interval is set using a normal distribution or a uniform distribution, and a value of each of the initial test cases is randomly generated from the coverage interval; The initial test cases are combined and sorted according to the values to form a complete test case.
[0007] In an optional implementation, the adopting normal distribution or uniform distribution to set the coverage interval, and randomly generating a value of each of the initial test cases from the coverage interval, includes: According to the input parameter influencing factor, determine the value range of each input parameter influencing factor, select normal distribution or uniform distribution to set the coverage interval, and generate the value of the initial test case; The value of the initial test case is calculated by the following formula: ; in, It is The value of the initial test case, Indicates The impact factor of each entry, represents the number of impact factors, is the value of each influencing factor.
[0008] In an optional implementation manner, testing the tested software according to the complete test case to obtain a test result includes: According to the complete test case, read the data request in the complete test case, assemble it into an HTTP request message, send the request to the software under test and receive the response message of the software under test; According to the response message, the parameter data in the response message is parsed to obtain a parsing result; According to the analysis result, the test result is analyzed to obtain the test result; The test results include interface test pass, interface test failure, influencing factor abnormality, interface test pass and test conclusion.
[0009] In an optional implementation manner, evaluating the test result according to a set evaluation strategy to obtain an evaluation result includes: When, among all the data, each data has a test result within the first specified interval and a corresponding influencing factor within the second specified interval, it is determined that the evaluation result is normal; When, among all the data, each data has a test result within the third specified interval, but the corresponding influencing factor is not within the second specified interval, determining that the evaluation result is an abnormality of the influencing factor; When, among all the data, each data has a test result that is not within the specified range, and the corresponding influencing factor is within the second specified interval, the evaluation result is determined to be an interface abnormality; When, among all the data, each data has a test result that is not within the third specified interval, and the corresponding influencing factor is not within the second specified interval, it is determined that the evaluation result is that the interface and the influencing factor are abnormal.
[0010] In an optional implementation, the set evaluation strategy includes: When the value of the initial test case In the first specified interval and corresponds to The input factor is in the second specified range Within , determining that the evaluation result is normal; When the value of the initial test case In the third specified interval But corresponding to The input factor is not in the second specified range When the evaluation result is within , it is determined that the evaluation result is an abnormality of the influencing factor; When the value of the initial test case Not within the prescribed range But corresponding to The input factor is in the second specified range When the evaluation result is within , determining that the interface is abnormal; When the value of the initial test case Not in the third specified area and corresponds to The input factor is not in the second specified range When the evaluation result is within , it is determined that the interface and the impact factor are abnormal; in, represents the input impact factor, Indicates The impact factor of each entry, is the set standard deviation.
[0011] In an optional implementation, recording the test execution process and generating a test report according to the evaluation result includes: According to the evaluation results, record the test execution process, including recording the order of test execution, execution status, output result data, and abnormal data; A test report is generated based on the recorded test execution process, including the test results, test time, test efficiency, test quality and test conclusions.
[0012] In a second aspect, the present invention provides a system for testing software using artificial intelligence, comprising: Parameter acquisition module, used to obtain the function parameters, interface parameters and application scenario data of the tested software; A test case generation module, used to input the function parameters, the interface parameters and the application scenario data into a preset test case generation model to obtain a complete test case; A result test module is used to test the tested software according to the complete test case to obtain the test result; A result evaluation module is used to evaluate the test result according to a set evaluation strategy to obtain an evaluation result; The test report module is used to record the test execution process and generate a test report.
[0013] In a third aspect, the present invention further provides an electronic device comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, the method of using artificial intelligence to test software as described above is implemented.
[0014] In a fourth aspect, the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned methods of using artificial intelligence to test software.
[0015] Compared with the prior art, the present invention has the following beneficial effects: The present invention discloses a method for testing software using artificial intelligence, which executes tests and generates test results according to automatically generated test cases, then evaluates the test results, gives evaluation results, and generates test reports, including obtaining function parameters, interface parameters, and application scenario data of the tested software; inputting the function parameters, the interface parameters, and the application scenario data into a preset test case generation model to obtain a complete test case; testing the tested software according to the complete test case to obtain test results; evaluating the test results according to a set evaluation strategy to obtain evaluation results; and recording the test execution process according to the evaluation results to generate a test report. The automatic generation of test cases is realized, the efficiency and execution of generating test cases are greatly improved, and the overall efficiency of software testing is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 It is a flowchart of a method for testing software using artificial intelligence provided by a first embodiment of the present invention; Figure 2 It is a schematic diagram of the system structure of the artificial intelligence testing software provided by the second embodiment of the present invention. DETAILED DESCRIPTION
[0017] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0018] At present, software testing originated from the development of the software industry. With the increase in software complexity, the human resources used in software projects have continued to rise, and software testing has gradually become an independent and crucial link in software engineering. In the software life cycle, testing activities include unit testing, integration testing, system testing, and regression testing. With the popularity of agile development and rapid iteration, test-driven development (TDD), continuous integration (CI), and robustness testing are increasingly valued. In order to ensure software quality, test cases have shifted from manual execution to scripting, and automated testing has gradually become the mainstream. In the existing technology, test case design relies on personal experience, the executability of test cases is low, and the test reports are relatively rough.
[0019] In one prior art, since test cases rely on personal experience, the efficiency and execution of test case generation are low, resulting in low overall efficiency of software testing.
[0020] To solve the above problems, refer to Figure 1 The first embodiment of the present invention provides a method for testing software using artificial intelligence, comprising the following steps: S11, obtaining function parameters, interface parameters and application scenario data of the tested software; S12, inputting the function parameters, the interface parameters and the application scenario data into a preset test case generation model to obtain a complete test case; S13, testing the tested software according to the complete test case to obtain a test result; S14, evaluating the test result according to a set evaluation strategy to obtain an evaluation result; S15, recording the test execution process and generating a test report according to the evaluation result.
[0021] The present invention discloses a method for testing software using artificial intelligence, which executes tests and generates test results according to automatically generated test cases, then evaluates the test results, gives evaluation results, and generates test reports, including obtaining function parameters, interface parameters, and application scenario data of the tested software; inputting the function parameters, the interface parameters, and the application scenario data into a preset test case generation model to obtain a complete test case; testing the tested software according to the complete test case to obtain test results; evaluating the test results according to a set evaluation strategy to obtain evaluation results; and recording the test execution process according to the evaluation results to generate a test report. The automatic generation of test cases is realized, the efficiency and execution of generating test cases are greatly improved, and the overall efficiency of software testing is improved.
[0022] In step S11, it is necessary to obtain the function parameters, interface parameters and application scenario data of the software under test, and the function parameters, interface parameters and application scenario data of the software under test are obtained by reading a configuration file or a database.
[0023] Among them, functional parameters include: business function parameters, management function parameters and extended function parameters; interface parameters include: interface description parameters, interface request address, request parameters, response parameters and result parameters; application scenario data include: system environment parameters, software topology structure, database type.
[0024] It should be noted that the functional parameters of the tested software usually refer to the characteristics and behaviors exhibited by the software when performing its designed functions. It can be obtained by consulting user documentation and product descriptions or by using LoadRunner, Jmeter performance testing tools to simulate the use of the software in different scenarios and collect performance data such as response time, processing time, and throughput. The use of functional parameters requires designing specific test cases and establishing an appropriate test environment based on the requirements and specification documents, and performing functional testing and performance testing according to the designed test cases.
[0025] The interface parameters of the tested software usually refer to the data passed in the software interface. These parameters can be request parameters, response parameters or interface configuration parameters. The API document is the most direct source for obtaining interface parameter information, or you can use Postman or JMeter interface testing tools to simulate requests and responses to obtain interface parameters. Before using the interface parameters, you can understand the role and meaning of each interface parameter by reading the API document or code comments, and then use appropriate tools or programming languages to build HTTP requests and send the built requests to the tested software interface through programming or using tools such as Postman, Curl, and JMeter to check whether the response data of the interface meets expectations and verify the security of the interface parameters.
[0026] The application scenario data of the tested software usually refers to the data used to verify the software functions and performance in a specific application scenario. These data can be data that simulates user behavior, input data for specific operations, and log data generated when the system is running. Test data can be generated through automated tools. These tools can generate large amounts of diverse data based on predefined rules or algorithms to meet the needs of different test scenarios, or use synthetic data generation tools to create application scenario data that is very similar to real-world data. These data can be used to simulate various test scenarios while protecting data privacy; based on the application scenario data, design detailed test cases and prepare corresponding test data according to the test cases. After executing the test, verify whether the behavior of the software meets expectations.
[0027] In step S12, the function parameters, the interface parameters and the application scenario data are input into a preset test case generation model to obtain a complete test case.
[0028] Performing an extraction operation according to the function parameter, the interface parameter and the application scenario data to obtain an input parameter influencing factor; Generate different initial test cases based on the multiple input parameter influencing factors of each test interface based on the preset test case generation model; A coverage interval is set using a normal distribution or a uniform distribution, and a value of each of the initial test cases is randomly generated from the coverage interval; The initial test cases are combined and sorted according to the values to form a complete test case.
[0029] It should be noted that the preset test case generation model refers to a set of predefined rules, algorithms or frameworks for automatically or semi-automatically generating test cases. This model is usually based on software requirements, design, code structure or specific testing strategies. The following are some optional test case generation models and how to obtain them: Model-Based Testing (MBT) uses formal language to describe the expected behavior of the system. Its acquisition methods include: using MBT tools such as UModel, MagicDraw, Enterprise Architect to create and execute test models.
[0030] Equivalence class partitioning model: The input data is divided into equivalence classes, and the values in each class are considered equivalent. Equivalence classes can be manually defined based on requirement documents and business rules.
[0031] Boundary value analysis model: Select the boundary of each equivalence class as test data, and determine the key boundary value by analyzing business logic and data restrictions.
[0032] The preset test case generation model can automatically generate test cases and reduce the time of manually writing test cases, thereby improving the efficiency of the testing process; the preset test case generation model is usually based on comprehensive requirements analysis and design understanding, which helps to ensure that the generated test cases can cover all functional points and business scenarios.
[0033] Input parameter influencing factors usually refer to those input parameters that can affect the function or performance of the software. These input parameters can be user input data, settings in configuration files, and environment variable parameters. By analyzing the software's requirements document and understanding the software's functional and performance requirements, we can determine which input parameters may affect the behavior of the software, or by consulting the software's design documents, including API documents, system architecture diagrams, etc., to understand how different components interact and which parameters play a key role in these interactions, and then determine the input parameter influencing factors. When designing and generating test cases, consider all possible input parameter influencing factors, including normal values, boundary values, abnormal values, and error values, and divide the input parameter influencing factors into different equivalence classes, and design test cases for each equivalence class. By building different usage scenarios, analyze the behavior of the input parameter influencing factors in these scenarios. In security testing, input parameter influencing factors can be used to test the software's ability to handle malicious inputs, such as SQL injection and cross-site scripting attacks.
[0034] In software testing, using normally distributed or uniformly distributed input factors can help simulate data coverage in different scenarios. The coverage intervals of these distributions can be obtained and set by the following methods: The normal distribution, also known as the Gaussian distribution, is a continuous probability distribution that has a bell-shaped graph and is symmetrical about the mean. In a normal distribution, the distribution of data can be described by the mean (μ) and the standard deviation (σ). The coverage interval usually refers to the probability that the data falls within a certain interval. For example, in a normal distribution, about 68% of the data falls within one standard deviation of the mean, 95% of the data falls within two standard deviations, and 99.7% of the data falls within three standard deviations. To obtain the coverage interval of a normal distribution, you can use statistical software or programming libraries, such as Python's SciPy library, to generate random numbers that meet a specific mean and standard deviation, and then calculate the distribution of these data. Using the normal distribution, you can predict the probability that data falls within a certain interval. In software testing, you can use the characteristics of the normal distribution to design test cases.
[0035] Uniform distribution is also a continuous probability distribution in which all values have an equal probability of appearing in a given interval. The parameters of the uniform distribution are the minimum (a) and maximum (b) values of the interval. For a uniform distribution, the coverage interval usually refers to the entire interval [a, b], because the probability of any point being selected in this interval is the same. The coverage interval of a uniform distribution can be obtained and set by simply defining the upper and lower limits of the interval and then generating random numbers that fall within this interval. In a uniform distribution, each possible output has the same probability of being selected, which helps ensure that the test case or data analysis covers all possible situations. Since each value has the same probability of being selected, the uniform distribution helps reduce the bias in the analysis results caused by data selection bias.
[0036] Furthermore, the adopting of normal distribution or uniform distribution to set the coverage interval and randomly generating the value of each of the initial test cases from the coverage interval includes: According to the input parameter influencing factor, determine the value range of each input parameter influencing factor, select normal distribution or uniform distribution to set the coverage interval, and generate the value of the initial test case; In one implementation, the value of the initial test case is calculated by the following formula: ; in, It is The value of the initial test case, Indicates The impact factor of each entry, represents the number of impact factors, is the value of each influencing factor.
[0037] It should be noted that the value of the initial test case Usually refers to the The input values of a test case or test data are selected according to the test case design method to verify the specific functions or paths of the software under test. The values of the initial test case can be obtained by the following method: : Equivalence class division: All possible values of the initial test case are divided into several equivalence classes. The data in each equivalence class is functionally equivalent, and a representative value is selected from each equivalence class as the value of the initial test case; Boundary value analysis: select the boundary value of the initial test case as the value of the initial test case; Random generation: In scenarios where a large number of initial test case values are required, a random number generator can be used to generate the initial test case values.
[0038] Initial test case value Helped define the scope and boundaries of the test, ensuring that the test covers all important input scenarios. , it is possible to verify that the software can correctly handle the expected input, thereby ensuring the correct implementation of the functionality.
[0039] In step S13, the tested software is tested according to the complete test case to obtain a test result.
[0040] According to the complete test case, read the data request in the complete test case, assemble it into an HTTP request message, send the request to the software under test and receive the response message of the software under test; According to the response message, the parameter data in the response message is parsed to obtain a parsing result; According to the analysis result, the test result is analyzed to obtain the test result; The test results include interface test pass, interface test failure, influencing factor abnormality, interface test pass and test conclusion.
[0041] It should be noted that an HTTP request message is a request message sent by a client, such as a browser, to a server. It complies with the HTTP protocol specification. An HTTP request message usually contains the following parts: Request line: includes HTTP method, such as GET, POST, PUT, DELETE, requested resource path URL, and HTTP protocol version; Request header: contains client environment information, request body size and type, client-supported encodings, and language preferences; Blank line: A blank line between the request header and the request body indicates the end of the request header; Request body: Usually used for POST and PUT requests, contains the data to be sent to the server.
[0042] Manually send HTTP requests by using command-line tools such as curl or wget, and display request messages and responses or use proxy servers such as Burp Suite, Fiddler, and Wireshark to capture HTTP request and response messages on the network. HTTP request messages are the basis of communication between clients and servers, allowing clients to clearly express their needs to the server and receive appropriate responses.
[0043] In step S14, the test result is evaluated according to the set evaluation strategy to obtain an evaluation result;.
[0044] When, among all the data, each data has a test result within the first specified interval and a corresponding influencing factor within the second specified interval, it is determined that the evaluation result is normal; When, among all the data, each data has a test result within the third specified interval, but the corresponding influencing factor is not within the second specified interval, determining that the evaluation result is an abnormality of the influencing factor; When, among all the data, each data has a test result that is not within the specified range, and the corresponding influencing factor is within the second specified interval, the evaluation result is determined to be an interface abnormality; When, among all the data, each data has a test result that is not within the third specified interval, and the corresponding influencing factor is not within the second specified interval, it is determined that the evaluation result is that the interface and the influencing factor are abnormal.
[0045] It should be noted that the first specified interval is , the second specified interval is , the third specified interval is , the specified scope specifically refers to .in, It is The value of the initial test case, is the value of each influencing factor, In software testing, setting a specified interval for test data can ensure that test cases can cover all important input scenarios, improve the comprehensiveness and effectiveness of the test, and thus ensure the accuracy and reliability of the results.
[0046] Standard Deviation It is an important concept in statistics. It is used to measure the degree of dispersion of a set of data, that is, the degree of deviation between the data value and its average value (mean). Specifically, the standard deviation is defined as the square root of the arithmetic mean (i.e., variance) of the squared deviations of all data values from their mean. Quantifies the variability or dispersion of the data; a smaller standard deviation means that the data points are more closely distributed around the mean, while a larger standard deviation means that the data points are more spread out around the mean.
[0047] Furthermore, the set evaluation strategy includes: When the value of the initial test case In the first specified interval and corresponds to The input factor is in the second specified range Within , determining that the evaluation result is normal; When the value of the initial test case In the third specified interval But corresponding to The input factor is not in the second specified range When the evaluation result is within , it is determined that the evaluation result is an abnormality of the influencing factor; When the value of the initial test case Not within the prescribed range But corresponding to The input factor is in the second specified range When the evaluation result is within , determining that the interface is abnormal; When the value of the initial test case Not in the third specified area and corresponds to The input factor is not in the second specified range When the evaluation result is within , it is determined that the interface and the impact factor are abnormal; in, represents the input impact factor, Indicates The impact factor of each entry, is the set standard deviation.
[0048] It should be noted that when the value of the initial test case In the first specified interval According to the empirical rule of normal distribution, the value of this initial test case is Covers 99.7% of the data around the mean; and corresponds to The input factor is in the second specified range When the input parameter influence factor is within , according to the empirical rule of normal distribution, it covers 68% of the data near the mean. The two specified intervals cover most of the possible values of the data. Therefore, testing within the two specified intervals can cover normal usage with a high probability, so that the evaluation result can be determined to be normal. When the value of the initial test case In the third specified interval According to the empirical rule of normal distribution, the value of this initial test case is It covers 99.7% of the data around the mean, which is a normal value; but it corresponds to The input factor is not in the second specified range According to the empirical rule of normal distribution, this indicates that the value of the input factor deviates from its normal statistical range, which means that the input factor Not within the normal range, which indicates that other factors may not have changed significantly, and any abnormalities are more likely to be caused by the input factors. caused by, thereby determining that the evaluation result is an abnormality of the influencing factor; When the value of the initial test case Not within the prescribed range This shows that The value exceeds interval, which is usually considered an outlier, but corresponds to The input factor is in the second specified range According to the empirical rule of normal distribution, the input impact factor covers 68% of the data near the mean, which means that the input impact factor Within normal range. The value of is abnormal, but the impact factor Within the normal range, this may indicate that the interface's response to certain input values is unstable or unpredictable, which may be due to an implementation problem of the interface or improper handling of certain boundary conditions, so the evaluation result is determined to be an interface anomaly; When the value of the initial test case Not in the third specified area According to the empirical rule of normal distribution, 99.7% of the data should fall within In the interval, if If it exceeds this interval, it is considered an outlier; The input factor is not in the second specified range This indicates that the value of the input impact factor has also deviated from its normal statistical range. The value of is abnormal, which may indicate that the interface responds unstable or unpredictably to certain input values, which may be due to interface implementation problems or improper handling of certain boundary conditions; input parameter influencing factors The value of is not within the normal range, which may indicate that there is a problem with the influencing factor itself, or that the test environment does not meet expectations, so it is determined that the evaluation result is that the interface and influencing factor are abnormal.
[0049] Standard Deviation It is an important concept in statistics. It is used to measure the degree of dispersion of a set of data, that is, the degree of deviation between the data value and its average value (mean). Specifically, the standard deviation is defined as the square root of the arithmetic mean (i.e., variance) of the squared deviations of all data values from their mean. The standard deviation can be calculated by the following steps: : S141. Calculate the average value (mean) of all data; S142. For each data value, calculate its difference (deviation) from the average value, and square the difference; S143. Calculate the average value of these square differences, i.e., the variance; S144. Calculate the square root of the variance to get the standard deviation .
[0050] Standard Deviation Quantifies the variability or dispersion of the data. A smaller standard deviation means that the data points are more closely distributed around the mean, while a larger standard deviation means that the data points are more dispersed around the mean. In a normal distribution, the standard deviation It also depends on the percentage distribution of the data. For example, about 68% of the data fall within one standard deviation of the mean. Within the range, about 95% of the data falls within two standard deviations About 99.7% of the data falls within three standard deviations. Inside.
[0051] In step S15, the test execution process is recorded and a test report is generated according to the evaluation result.
[0052] According to the evaluation results, record the test execution process, including recording the order of test execution, execution status, output result data, and abnormal data; A test report is generated based on the recorded test execution process, including the test results, test time, test efficiency, test quality and test conclusions.
[0053] It should be noted that according to the evaluation results, the purpose of recording the test execution process is to ensure the transparency and traceability of the test activities, and also to learn and improve from the test. The recorded content includes but is not limited to the order of test execution, execution status, output result data and abnormal data. Recording the test execution process can provide a clear view of the test progress and status, helping to understand the details of the test; recording the test execution process can provide insights into system performance and help identify performance bottlenecks.
[0054] Generate a test report based on the test execution process. Summarize all relevant test data, including the execution order, execution status, output result data and abnormal data of the test cases; analyze the test data through the generated test report to determine the pass rate, failure rate, number of failed test cases, performance indicators of key functions, etc. The test report records the test execution process in detail, including the execution status of the test cases, defects found, test environment and test data, etc. The test report also provides quantitative measurement of software quality to help evaluate whether the software meets the predetermined quality standards.
[0055] The following describes the working process of the present invention using a common scenario as an example. Figure 1 Schematic diagram of the working scenario of the method.
[0056] In the public security video surveillance system application of the smart city project, the functional parameters, interface parameters and application scenario data of the tested business are obtained; the functional parameters, the interface parameters and the application scenario data are input into a preset test case generation model to obtain a complete test case; the tested business is tested according to the complete test case to obtain a test result; the test result is evaluated according to a set evaluation strategy to obtain an evaluation result; according to the evaluation result, the test execution process is recorded and a test report is generated.
[0057] In summary, the present invention discloses a method for testing software using artificial intelligence, which executes tests and generates test results according to automatically generated test cases, then evaluates the test results, gives evaluation results, and generates a test report, including obtaining functional parameters, interface parameters, and application scenario data of the tested software; inputting the functional parameters, the interface parameters, and the application scenario data into a preset test case generation model to obtain a complete test case; testing the tested software according to the complete test case to obtain test results; evaluating the test results according to a set evaluation strategy to obtain evaluation results; and recording the test execution process according to the evaluation results to generate a test report. The automatic generation of test cases is realized, which greatly improves the efficiency and execution of generating test cases, and improves the overall efficiency of software testing.
[0058] Reference Figure 2 The second embodiment of the present invention provides a system for testing software using artificial intelligence, comprising: Parameter acquisition module, used to obtain the function parameters, interface parameters and application scenario data of the tested software; A test case generation module, used to input the function parameters, the interface parameters and the application scenario data into a preset test case generation model to obtain a complete test case; A result test module is used to test the tested software according to the complete test case to obtain the test result; A result evaluation module is used to evaluate the test result according to a set evaluation strategy to obtain an evaluation result; The test report module is used to record the test execution process and generate a test report.
[0059] Preferably, the evaluation result also includes: When, among all the data, there is a test result that is not within the first specified interval, and the corresponding one or more influencing factors are not within the second specified interval, and in the second execution, this test result is still not within the first specified interval, and the corresponding influencing factors are within the second specified interval, it is determined that the evaluation result is an interface problem; When, among all the data, there is a test result that is not within the third specified interval, and the corresponding one or more influencing factors are not within the second specified interval, in the second execution, the test result is within the third specified interval, and it is determined that the evaluation result is an interface problem and the influencing factor has a relationship; When, among all the data, two or more of the test results are not within the third specified interval, and the corresponding influencing factors are within the second specified interval, the evaluation result is determined to be an abnormality of the influencing factor.
[0060] It should be noted that the first specified interval is , the second specified interval is , the third specified interval is .in, It is The value of the initial test case, is the value of each influencing factor, In software testing, setting a specified interval for test data can ensure that test cases can cover all important input scenarios, improve the comprehensiveness and effectiveness of the test, and thus ensure the accuracy and reliability of the results.
[0061] Standard Deviation It is an important concept in statistics. It is used to measure the degree of dispersion of a set of data, that is, the degree of deviation between the data value and its average value (mean). Specifically, the standard deviation is defined as the square root of the arithmetic mean (i.e., variance) of the squared deviations of all data values from their mean. Quantifies the variability or dispersion of the data; a smaller standard deviation means that the data points are more closely distributed around the mean, while a larger standard deviation means that the data points are more spread out around the mean.
[0062] It should be noted that a system using artificial intelligence testing software provided in an embodiment of the present invention is used to execute all the process steps of a method using artificial intelligence testing software in the above embodiment. The working principles and beneficial effects of the two correspond one to one, and thus will not be described in detail.
[0063] The embodiment of the present invention also provides an electronic device. The electronic device includes: a processor, a memory, and a computer program stored in the memory and executable on the processor, such as a data processing terminal program. When the processor executes the computer program, the steps in the above-mentioned method embodiments of using artificial intelligence testing software are implemented, such as Figure 1 Alternatively, when the processor executes the computer program, the functions of the modules / units in the above-mentioned device embodiments are realized, such as the result evaluation module.
[0064] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of implementing specific functions, which are used to describe the execution process of the computer program in the electronic device.
[0065] The electronic device may be a computing device such as a desktop computer, a notebook, a PDA, and a smart tablet. The electronic device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that the above components are merely examples of electronic devices and do not constitute a limitation on the electronic device. The electronic device may include more or fewer components than the above components, or a combination of certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.
[0066] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the electronic device, and uses various interfaces and lines to connect various parts of the entire electronic device.
[0067] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the electronic device by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0068] Wherein, if the module / unit integrated in the electronic device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0069] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.
[0070] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for testing software using artificial intelligence, characterized in that: Executed by a computer, including: Obtain the functional parameters, interface parameters and application scenario data of the software under test; Inputting the function parameters, the interface parameters and the application scenario data into a preset test case generation model to obtain a complete test case; Testing the tested software according to the complete test case to obtain a test result; Evaluate the test results according to a set evaluation strategy to obtain an evaluation result; Based on the evaluation results, the test execution process is recorded and a test report is generated.
2. The method for testing software using artificial intelligence according to claim 1, characterized in that: The function parameters, the interface parameters and the application scenario data are input into a preset test case generation model to obtain a complete test case, including: Performing an extraction operation according to the function parameter, the interface parameter and the application scenario data to obtain an input parameter influencing factor; Generate different initial test cases based on the multiple input parameter influencing factors of each test interface based on the preset test case generation model; A coverage interval is set using a normal distribution or a uniform distribution, and a value of each of the initial test cases is randomly generated from the coverage interval; The initial test cases are combined and sorted according to the values to form a complete test case.
3. The method for testing software using artificial intelligence according to claim 2, characterized in that: The adopting normal distribution or uniform distribution to set the coverage interval, and randomly generating a value of each of the initial test cases from the coverage interval, comprises: According to the input parameter influencing factor, determine the value range of each input parameter influencing factor, select normal distribution or uniform distribution to set the coverage interval, and generate the value of the initial test case; The value of the initial test case is calculated by the following formula: ; in, It is The value of the initial test case, Indicates The impact factor of each entry, represents the number of impact factors, is the value of each influencing factor.
4. The method for testing software using artificial intelligence according to claim 1, characterized in that: The step of testing the tested software according to the complete test case to obtain a test result includes: According to the complete test case, read the data request in the complete test case, assemble it into an HTTP request message, send the request to the software under test and receive the response message of the software under test; According to the response message, the parameter data in the response message is parsed to obtain a parsing result; According to the analysis result, the test result is analyzed to obtain the test result; The test results include interface test pass, interface test failure, influencing factor abnormality, interface test pass and test conclusion.
5. The method for testing software using artificial intelligence according to claim 1, characterized in that: The test result is evaluated according to the set evaluation strategy to obtain the evaluation result, including: When, among all the data, each data has a test result within the first specified interval and a corresponding influencing factor within the second specified interval, it is determined that the evaluation result is normal; When, among all the data, each data has a test result within the third specified interval, but the corresponding influencing factor is not within the second specified interval, determining that the evaluation result is an abnormality of the influencing factor; When, among all the data, each data has a test result that is not within the specified range, and the corresponding influencing factor is within the second specified interval, the evaluation result is determined to be an interface abnormality; When, among all the data, each data has a test result that is not within the third specified interval, and the corresponding influencing factor is not within the second specified interval, it is determined that the evaluation result is that the interface and the influencing factor are abnormal.
6. The method for testing software using artificial intelligence according to claim 1, characterized in that: The step of recording the test execution process and generating a test report based on the evaluation results includes: According to the evaluation results, record the test execution process, including recording the order of test execution, execution status, output result data, and abnormal data; A test report is generated based on the recorded test execution process, including the test results, test time, test efficiency, test quality and test conclusions.
7. The method for testing software using artificial intelligence according to claim 5, characterized in that: The evaluation strategy set includes: When the value of the initial test case In the first specified interval and corresponds to The input factor is in the second specified range Within , determining that the evaluation result is normal; When the value of the initial test case In the third specified interval But corresponding to The input impact factor is not in the second specified range When the evaluation result is within , it is determined that the evaluation result is an abnormality of the influencing factor; When the value of the initial test case Not within the prescribed range But corresponding to The input factor is in the second specified range When the evaluation result is within , determining that the interface is abnormal; When the value of the initial test case Not in the third specified area and corresponds to The input impact factor is not in the second specified range When the evaluation result is within , it is determined that the interface and the impact factor are abnormal; in, Indicates the input impact factor, Indicates The impact factor of each entry, is the set standard deviation.
8. A system for testing software using artificial intelligence, characterized in that: include: Parameter acquisition module, used to obtain the function parameters, interface parameters and application scenario data of the tested software; A test case generation module, used to input the function parameters, the interface parameters and the application scenario data into a preset test case generation model to obtain a complete test case; A result test module is used to test the tested software according to the complete test case to obtain the test result; A result evaluation module is used to evaluate the test result according to a set evaluation strategy to obtain an evaluation result; The test report module is used to record the test execution process and generate a test report.
9. An electronic device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, the method for testing software using artificial intelligence as described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the method for testing software using artificial intelligence as described in any one of claims 1 to 7.