Software testing method and device, computer equipment, readable storage medium and program product

By obtaining and analyzing the historical test data of the target software, predicting potential defects and generating test scripts, the problem of inaccurate manual testing is solved, and the high accuracy and reliability of software testing is achieved.

CN119441041APending Publication Date: 2025-02-14BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411522226.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

Existing software testing mainly relies on manual labor and is greatly affected by human factors. Especially for inexperienced test beginners, it is difficult for them to conduct accurate testing, which affects the accuracy of software testing.

Method used

By obtaining historical test data of the target software, predicting potential defects, generating test scripts, and running test scripts in an adaptive test environment to improve the accuracy and reliability of the test.

Benefits of technology

It effectively improves the accuracy and reliability of software testing, overcomes the technical defects of inaccurate manual testing, and ensures the completeness and accuracy of test results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119441041A_ABST
    Figure CN119441041A_ABST
Patent Text Reader

Abstract

The invention relates to a software testing method and device, computer equipment, a readable storage medium and a program product, and relates to the technical field of software testing. The method comprises the steps of obtaining historical test data of target software in response to a test instruction for the target software; performing potential defect prediction on the target software according to the historical test data to obtain potential defect information of the target software; generating a test script of the target software based on the potential defect information and a test requirement indicated by the test instruction; the test script comprises a judgment condition for a test environment; screening out a target test environment matched with the judgment condition from the candidate test environments according to the judgment condition; and running the test script in the target test environment to obtain a test result of the target software. By adopting the method, the software testing accuracy can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of software testing, and in particular to a software testing method, apparatus, computer equipment, readable storage medium and program product. Background Art

[0002] Software testing is a process of identifying the correctness, completeness, security, and quality of software by comparing the actual output with the expected output.

[0003] At present, software testing mainly relies on manual testing and recording the test results. However, this method is greatly affected by human factors, especially for inexperienced testers, it is often difficult to conduct accurate testing, thus affecting the accuracy of software testing. Summary of the invention

[0004] Based on this, it is necessary to provide a software testing method, apparatus, computer equipment, computer-readable storage medium and computer program product that can improve the accuracy of software testing in response to the above technical problems.

[0005] In a first aspect, the present application provides a software testing method, comprising: in response to a test instruction for a target software, obtaining historical test data of the target software; predicting potential defects of the target software based on the historical test data to obtain potential defect information of the target software; generating a test script for the target software based on the potential defect information and the test requirements indicated by the test instruction; the test script includes a judgment condition for the test environment; based on the judgment condition, screening out a target test environment that matches the judgment condition from each candidate test environment; and running the test script in the target test environment to obtain a test result of the target software.

[0006] In one of the embodiments, potential defects of target software are predicted based on historical test data to obtain potential defect information of the target software, including: performing data preprocessing on the acquired historical test data to obtain target test data; performing feature extraction on the target test data to obtain target features of the target test data; using a defect prediction model, based on the target features, potential defects of the target software are predicted to obtain potential defect information of the target software; the potential defect information includes the potential defect location and potential defect type of the target software.

[0007] In one of the embodiments, a test script for the target software is generated based on the potential defect information and the test requirements indicated by the test instructions, including: configuring test resources for the target software based on the impact degree of the potential defect information to obtain the test resources for the target software; obtaining the test requirements indicated by the test instructions, and generating a test script for the target software based on the test resources and the test requirements.

[0008] In one of the embodiments, the process of building a candidate test environment includes: for different types of test systems, respectively obtaining the system information of each test system; building a test environment based on the test requirements indicated by the test instructions and the system information to obtain a candidate test environment that is compatible with each test system.

[0009] In one of the embodiments, in response to a test instruction for the target software, historical test data of the target software is obtained, including: in response to the test instruction for the target software, the running state of the target software is obtained; when the running state indicates that the target software is in a stable running state, a functional integrity test is performed on the target software to obtain a functional integrity test result of the target software; when the functional integrity test result indicates that the function of the target software is complete, the historical test data of the target software is obtained.

[0010] In one of the embodiments, the method further includes: performing performance analysis on the target software according to the test results of the target software to obtain the performance analysis results of the target software; when the performance analysis results are inconsistent with the expected results, updating the test script according to the test results.

[0011] On the second aspect, the present application also provides a software testing device, including: a historical data acquisition module, used to obtain historical test data of the target software in response to test instructions for the target software; a potential defect prediction module, used to predict potential defects of the target software based on the historical test data, and obtain potential defect information of the target software; a test script generation module, used to generate a test script for the target software based on the potential defect information and the test requirements indicated by the test instructions; the test script includes judgment conditions for the test environment; a test environment matching module, used to screen out a target test environment that matches the judgment conditions from each candidate test environment based on the judgment conditions; a software testing module, used to run the test script in the target test environment to obtain the test results of the target software.

[0012] On the third aspect, the present application also provides a computer device, including a memory and a processor, the memory storing a computer program, and the processor implementing the following steps when executing the computer program: in response to a test instruction for the target software, obtaining historical test data of the target software; predicting potential defects of the target software based on the historical test data to obtain potential defect information of the target software; generating a test script for the target software based on the potential defect information and the test requirements indicated by the test instruction; the test script including a judgment condition for the test environment; based on the judgment condition, screening out a target test environment that matches the judgment condition from each candidate test environment; running the test script in the target test environment to obtain the test result of the target software.

[0013] In a fourth aspect, the present application also provides a computer-readable storage medium having a computer program stored thereon, which implements the following steps when executed by a processor: in response to a test instruction for the target software, obtain historical test data of the target software; predict potential defects of the target software based on the historical test data to obtain potential defect information of the target software; generate a test script for the target software based on the potential defect information and the test requirements indicated by the test instruction; the test script includes a judgment condition for the test environment; based on the judgment condition, screen out a target test environment that matches the judgment condition from each candidate test environment; and run the test script in the target test environment to obtain the test result of the target software.

[0014] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the following steps when executed by a processor: in response to a test instruction for the target software, obtain historical test data of the target software; predict potential defects of the target software based on the historical test data to obtain potential defect information of the target software; generate a test script for the target software based on the potential defect information and the test requirements indicated by the test instruction; the test script includes a judgment condition for the test environment; based on the judgment condition, screen out a target test environment that matches the judgment condition from each candidate test environment; run the test script in the target test environment to obtain the test result of the target software.

[0015] The software testing method, device, computer equipment, computer-readable storage medium and computer program product described above, in response to a test instruction for the target software, first obtain the historical test data of the target software to predict potential defects of the target software, thereby obtaining the potential defect information of the target software. Then, based on the potential defect information and the test requirements indicated by the test instruction, a test script for the target software is generated, which improves the accuracy and reliability of the test script and lays a data foundation for subsequent software testing. Since the test script includes judgment conditions for the test environment, the target test environment that matches the judgment conditions can be screened out in each candidate test environment according to the judgment conditions, thereby achieving the purpose of running the test script under different test environments. In other words, the test script can adapt to different types of test environments, further improve the accuracy and reliability of software testing, and then obtain more accurate and reliable test results. Therefore, the present application can overcome the technical defects of inaccurate software testing caused by manual testing at present, and effectively improve the accuracy and reliability of software testing. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0017] FIG1 is an application environment diagram of a software testing method in one embodiment;

[0018] FIG2 is a schematic diagram of a flow chart of a software testing method in one embodiment;

[0019] FIG3 is a schematic diagram of a process of potential defect prediction in one embodiment;

[0020] FIG4 is a schematic diagram of a flow chart of test script generation in one embodiment;

[0021] FIG5 is a schematic diagram of a process of setting up a test environment in one embodiment;

[0022] FIG6 is a schematic diagram of a software detection process in one embodiment;

[0023] FIG7 is a schematic diagram of a flow chart of test result analysis in one embodiment;

[0024] FIG8 is a schematic diagram of a flow chart of a software testing method in a specific embodiment;

[0025] FIG9 is a block diagram of a software testing device in one embodiment;

[0026] FIG. 10 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0028] The software testing method provided in the embodiment of the present application can be applied in the application environment shown in Figure 1. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. In response to the test instructions of the terminal 102 for the target software, the server 104 first obtains the historical test data of the target software, so as to predict the potential defects of the target software according to the historical test data, and obtain the potential defect information of the target software. Then, based on the potential defect information and the test requirements indicated by the test instructions, a test script for the target software is generated. The test script includes judgment conditions for the test environment, so according to the judgment conditions, the target test environment that matches the judgment conditions can be screened out in each candidate test environment. Finally, the test script is run in the target test environment to obtain the test results of the target software. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers and Internet of Things devices. The server 104 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.

[0029] In an exemplary embodiment, as shown in FIG. 2 , a software testing method is provided, which is described by taking the method applied to the server 104 in FIG. 1 as an example, and includes the following steps:

[0030] Step S202 , in response to a test instruction for the target software, obtaining historical test data of the target software.

[0031] The target software may refer to the software to be tested. The test instruction may refer to the instruction to test the target software. The historical test data may refer to the test records of the target software during previous tests, which may include but are not limited to historical test results, historical test time, historical test scenarios, etc.

[0032] Exemplarily, when the server receives a test instruction for the target software initiated by the terminal, it may first obtain the test records of the target software during previous tests, so as to facilitate subsequent prediction of potential defects of the target software.

[0033] In one example, historical test data of the target software can be directly obtained by querying a background database of a software testing system to which the server belongs.

[0034] In one example, after receiving the test instruction for the target software, the server may obtain the historical test data of the target software if the target software meets the test conditions. The test conditions may include the running state conditions and the functional integrity conditions of the target software.

[0035] Step S204: predict potential defects of the target software based on historical test data to obtain potential defect information of the target software.

[0036] Among them, potential defect prediction refers to the process of predicting potential defects of the target software. It is understandable that potential defects can refer to problems existing in the target software that may cause operating errors. These defects may not appear immediately when the software is running, but may be triggered under certain conditions such as a certain operation, data input or a certain system environment. Potential defect information may include but is not limited to potential defect location and potential defect type.

[0037] Exemplarily, after acquiring the historical test data of the target software, the server can further predict the potential defects of the target software based on the historical test data, thereby obtaining the potential defect location and potential defect type of the target software for subsequent writing of test scripts to improve the quality of the test scripts.

[0038] In one example, the server may predict potential defects of the target software based on a pre-established defect prediction model, thereby further improving the accuracy and efficiency of defect prediction.

[0039] Step S206, generating a test script for the target software based on the potential defect information and the test requirements indicated by the test instructions; the test script includes judgment conditions for the test environment.

[0040] Among them, the test requirements may refer to the demand information for testing the target software, which may include but are not limited to test indicators such as response time, throughput, number of concurrent users, test time, test scope, etc. The test script may refer to the instructions or codes corresponding to the test actions. The judgment condition is used to screen the environment for software testing. It can be understood that in actual applications, the target software can run on various types of operating systems. Therefore, in order to ensure the compatibility of the target software, in this embodiment, corresponding test environments will be created for various operating systems, that is, test systems, so that the target software can be tested in various test environments to improve the integrity and accuracy of the test results.

[0041] For example, after predicting the potential defect information of the target software, the server can create a script based on the potential defect information and the test requirements of the target software, thereby obtaining a test script for the target software. The test script will contain judgment conditions for the test environment, and the judgment conditions can be adjusted to match different test environments, so that the target software can be tested in different test environments.

[0042] Step S208: According to the judgment condition, a target test environment matching the judgment condition is screened out from among the candidate test environments.

[0043] Among them, the candidate test environment refers to each pre-created test environment, each test environment can correspond to a test system, and the test system can be understood as the operating system of the target software in actual application, such as Windows, Linux, Unix, etc. The target test environment refers to the test environment that matches the current judgment condition.

[0044] Exemplarily, the server selects a target test environment that matches the judgment condition from among various pre-created candidate test environments based on the judgment condition in the test script. For example, assuming that the judgment condition is test environment = A, it means that software testing needs to be performed under test environment A at present. At this time, the server can select test environment A as the target test environment from among various candidate test environments. It should be noted that the judgment condition can be updated and adjusted at any time. For example, after completing the software test under test environment A, the server can automatically change the judgment condition and update it to test environment = B, and then test the target software again under test environment B. Of course, in actual applications, the change of the test environment can also be determined according to the test requirements, that is, according to the test requirements, it is determined which test environments need to be tested in this round of software testing, and the server can perform software testing in these test environments one by one.

[0045] Step S210, running the test script in the target test environment to obtain the test result of the target software.

[0046] The test result may refer to the software test result of the target software, which may include but is not limited to response time, CPU (Central Processing Unit) utilization, memory occupancy, test resource usage information, etc.

[0047] Exemplarily, after the server selects the target test environment, it can run the test script in the target test environment. After the test script is completed, the server can obtain the test results of the target software.

[0048] In this embodiment, in response to the test instruction for the target software, the server first obtains the historical test data of the target software to predict the potential defects of the target software, thereby obtaining the potential defect information of the target software. Then, based on the potential defect information and the test requirements indicated by the test instruction, a test script for the target software is generated, which improves the accuracy and reliability of the test script and lays a data foundation for subsequent software testing. Since the test script includes judgment conditions for the test environment, the target test environment that matches the judgment conditions can be screened out from each candidate test environment according to the judgment conditions, thereby achieving the purpose of running the test script under different test environments. In other words, the test script can adapt to different types of test environments, further improve the accuracy and reliability of software testing, and then obtain more accurate and reliable test results. Therefore, this embodiment can overcome the technical defects of inaccurate software testing caused by manual testing at present, and effectively improve the accuracy and reliability of software testing.

[0049] In an exemplary embodiment, as shown in FIG3 , potential defects of the target software are predicted based on historical test data to obtain potential defect information of the target software, including:

[0050] Step S302: preprocess the acquired historical test data to obtain target test data.

[0051] Among them, data preprocessing may refer to the process of preprocessing historical test data, and preprocessing may include but is not limited to data cleaning and data normalization. Data cleaning may refer to the removal of abnormal data in historical test data, and data normalization may refer to the unified and standardized processing of the data format of historical test data. Target test data may refer to the data obtained after preprocessing the historical test data.

[0052] Exemplarily, after acquiring the historical test data, the server may perform data cleaning and data normalization on the historical test data to ensure the instructions of the historical test data, thereby obtaining target test data.

[0053] Step S304: extract features from the target test data to obtain target features of the target test data.

[0054] Feature extraction can be understood as extracting useful features from target test data. The target feature is the extracted feature.

[0055] Exemplarily, after the server completes preprocessing of the historical test data, it can perform feature extraction on the target test data to obtain target features that are useful for subsequent model predictions, while removing irrelevant or redundant features.

[0056] In one example, the principal component analysis method can be used for feature extraction. The principal component analysis method mainly maps the original data to a new coordinate system through linear transformation so that the mapped data has the largest variance, thereby describing the characteristics of the data. Of course, in practical applications, other feature extraction methods can also be used.

[0057] Step S306 , predicting potential defects of the target software based on the target features through the defect prediction model, and obtaining potential defect information of the target software; the potential defect information includes the potential defect location and potential defect type of the target software.

[0058] The defect prediction model may refer to a pre-trained mathematical model for predicting potential defects in software. The potential defect location may refer to the location of the potential defect, such as the memory of the target software. The potential defect type may refer to the type of the potential defect, such as a memory defect.

[0059] Exemplarily, the server inputs the extracted target features into a pre-trained defect prediction model to predict potential defects of the target software, thereby obtaining the location of the potential defects of the target software and the type of the potential defects.

[0060] In one example, the defect prediction model can be, but is not limited to, any one of a logistic regression model, a support vector machine model, a decision tree model, etc. Among them, logistic regression is a nonlinear classification method, which is obtained by introducing a logistic function (or sigmoid function) on the basis of a linear regression model. The support vector machine model is a powerful classifier that distinguishes data points of different categories by finding an optimal hyperplane to perform classification. The decision tree model is also a classification method that classifies whether the software has defects by learning simple rules from the data.

[0061] In one example, the server may pre-train the pre-trained model based on sample test data of the sample software until the number of iterations is reached, thereby obtaining a defect prediction model. The pre-trained model may be understood as the initial state of the defect prediction model.

[0062] In this embodiment, by using a defect prediction model, potential defects of the target software are predicted, thereby obtaining potential defect information of the target software, improving the accuracy of the potential defect information, thereby improving the accuracy of the test script, and further improving the accuracy of the entire software test.

[0063] In an exemplary embodiment, as shown in FIG4 , generating a test script of the target software based on the potential defect information and the test requirements indicated by the test instructions includes:

[0064] Step S402: Based on the impact degree of the potential defect information, test resources are configured for the target software to obtain test resources for the target software.

[0065] Among them, the degree of impact can be understood as the degree of impact of potential defect information on the operation of the target software. The greater the degree of impact, the more test resources can be allocated to test the potential defect location. Test resources may refer to the resources required for the software testing process, including but not limited to application servers, middleware servers, databases and other resources. The application server is a program that provides business logic to the client. The middleware server refers to the software or hardware component located between the client (such as a browser, mobile app, etc.) and the server, which is used to process and manage client requests and server responses. A database refers to a container for storing various data generated during the software testing process.

[0066] For example, after the server obtains the potential defect information of the target software, it can analyze the impact of the potential defect information on the operation of the target software. If the impact is greater, the server can allocate more test resources to the potential defect location to conduct more comprehensive testing at the potential defect location and improve the accuracy of software testing. For other test points except the potential defect location, appropriate test resources can be allocated according to actual conditions.

[0067] Step S404, obtaining the test requirements indicated by the test instructions, and generating a test script for the target software based on the test resources and the test requirements.

[0068] Exemplarily, the server extracts the test requirements for the target software from the test instructions, and then creates a script according to the test requirements and test resources to obtain a test script for the target software.

[0069] In this embodiment, resources are allocated to the target software according to the impact of potential defect information, thereby improving the accuracy of resource allocation, thereby improving the accuracy of test scripts generated according to test resources and test requirements, and further improving the accuracy of the entire software test.

[0070] In an exemplary embodiment, as shown in FIG5 , the process of building a candidate test environment includes:

[0071] Step S502: for different types of test systems, obtain system information of each test system respectively.

[0072] The test system may refer to the operating system of the target software in actual application, such as Windows, Linux, Unix, etc. The system information may refer to the system configuration information of the test system, including but not limited to communication protocol, memory configuration, data storage configuration, etc.

[0073] For example, in order to improve the compatibility of software testing, the server first obtains the system configuration information of each test system for different types of test systems, so as to facilitate the subsequent construction of the test environment.

[0074] Step S504: Based on the test requirements indicated by the test instructions and the information of each system, a test environment is constructed to obtain a candidate test environment that is compatible with each test system.

[0075] Exemplarily, after the server obtains the system information of each test system, it can build a candidate test environment corresponding to each test system according to the test requirements and the system information, that is, install the system information of each test system on the test resources corresponding to the test requirements.

[0076] In this embodiment, by installing corresponding test environments for different types of test systems, the reliability and accuracy of the test environment are improved, thereby improving the integrity and reliability of software testing.

[0077] In an exemplary embodiment, as shown in FIG6 , in response to a test instruction for the target software, obtaining historical test data of the target software includes:

[0078] Step S602: In response to a test instruction for the target software, obtain the running status of the target software.

[0079] The running status refers to the running status of the target software, which may include stable running and unstable running.

[0080] Exemplarily, when the server receives a test instruction for the target software, it needs to first determine whether the target software meets the test conditions. First, the server can obtain the running status of the target software to determine whether the target software meets the running status conditions.

[0081] Step S604: when the running state indicates that the target software is in a stable running state, a functional integrity test is performed on the target software to obtain a functional integrity test result of the target software.

[0082] Among them, the functional integrity test results are used to characterize the integrity of the software functions of the target software.

[0083] Exemplarily, when the server determines that the target software is in a stable operating state, it means that the target software meets the operating state condition. At this time, it is possible to further detect whether the software functions of the target software are complete, and the detection process may include detecting whether the target software has the required functions and whether these functions can work normally. If the target software does not have the required functions or the functions cannot work normally, it means that the functions of the target software are incomplete, and it is determined that the target software does not meet the test conditions.

[0084] Step S606, when the function integrity test result indicates that the function of the target software is complete, the historical test data of the target software is obtained.

[0085] Exemplarily, when the target software has the required functions and the functions can work normally, it means that the functions of the target software are complete, and the target software is judged to meet the test conditions, and the server can obtain the historical test data of the target software.

[0086] In this embodiment, the running status and functional integrity of the target software are detected to determine whether the target software meets the test conditions, thereby improving the efficiency and accuracy of software testing.

[0087] In an exemplary embodiment, as shown in FIG7 , the method further includes:

[0088] Step S702: Perform performance analysis on the target software according to the test result of the target software to obtain the performance analysis result of the target software.

[0089] The performance analysis may refer to the process of analyzing the software performance of the target software. The performance analysis result may be used to characterize the performance status of the target software.

[0090] Exemplarily, after obtaining the test results of the target software, the server may analyze the performance status of the target software based on these test results, thereby obtaining a performance analysis result of the target software. The performance analysis result may be generated in the form of a performance analysis report.

[0091] In one example, you can use performance analysis tools, such as Xcode Instruments, PerfDog, Android Profiler, etc. to perform in-depth analysis of the CPU, memory, network, etc. of the target software based on the test data. Among them, Xcode Instruments is a powerful and flexible performance analysis and testing tool that can detect performance issues in memory leaks, CPU occupancy, network requests, etc. PerfDog is a performance testing and analysis tool platform that provides a wealth of test indicators. Android Profiler is a powerful performance analysis tool provided by Android Studio to help monitor and optimize the performance of Android applications.

[0092] Step S704: when the performance analysis result is inconsistent with the expected result, update the test script according to the test result.

[0093] The expected result may refer to the expected result for the performance analysis.

[0094] Exemplarily, after obtaining the performance analysis results of the target software, the server can compare them with the expected results. If the performance analysis results are inconsistent with the expected results, the test script can be updated and optimized based on the test results, and the target software can be tested again using the updated and optimized test script.

[0095] In this embodiment, the performance of the target software is analyzed to evaluate the performance of the target software, and when the performance analysis result of the target software is inconsistent with the expected result, the test script is updated to improve the reliability and accuracy of the software test.

[0096] In a specific embodiment, as shown in FIG8 , the specific process of the software testing method includes: the terminal can create a test requirement for the target software, and send a test instruction carrying the test requirement to the server. The server enters the automatic execution test process, and first obtains the running state of the target software. When the target software is in a stable running state, the target software is tested for functional integrity. When the function of the target software is complete, the historical test data of the target software is obtained. The acquired historical test data is subjected to data preprocessing and feature extraction to obtain the target features of the target test data. Through the defect prediction model, based on the target features, the target software is predicted for potential defects, and the potential defect information of the target software is obtained, including the potential defect location and potential defect type of the target software. Based on the impact of the potential defect information, the target software is configured with test resources to obtain the test resources of the target software, and the test resources include resources such as application servers, middleware servers, and databases. Based on the test resources and test requirements, the server generates a test script for the target software, and the test script includes judgment conditions for the test environment. For different types of test systems, the system information of each test system is obtained respectively. Based on the test requirements and system information indicated by the test instructions, the test environment is built to obtain candidate test environments that are compatible with each test system. According to the judgment conditions, the target test environment that matches the judgment conditions is screened out from each candidate test environment. The test script is run in the target test environment to obtain the test results of the target software and upload the test log. Finally, according to the test results of the target software, the performance analysis of the target software is performed to obtain the performance analysis results of the target software, and a test report of the target software is generated accordingly. If the performance analysis results are inconsistent with the expected results, the test script is updated according to the test results.

[0097] In this embodiment, in response to the test instruction for the target software, the server first obtains the historical test data of the target software to predict the potential defects of the target software, thereby obtaining the potential defect information of the target software. Then, based on the potential defect information and the test requirements indicated by the test instruction, a test script for the target software is generated, which improves the accuracy and reliability of the test script and lays a data foundation for subsequent software testing. Since the test script includes judgment conditions for the test environment, the target test environment that matches the judgment conditions can be screened out from each candidate test environment according to the judgment conditions, thereby achieving the purpose of running the test script under different test environments. In other words, the test script can adapt to different types of test environments, further improve the accuracy and reliability of software testing, and then obtain more accurate and reliable test results. Therefore, this embodiment can overcome the technical defects of inaccurate software testing caused by manual testing at present, and effectively improve the accuracy and reliability of software testing.

[0098] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0099] Based on the same inventive concept, the embodiment of the present application also provides a software testing device for implementing the software testing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more software testing device embodiments provided below can refer to the limitations on the software testing method above, and will not be repeated here.

[0100] In an exemplary embodiment, as shown in FIG9 , a software testing device is provided, including: a historical data acquisition module 902, for acquiring historical test data of the target software in response to a test instruction for the target software; a potential defect prediction module 904, for predicting potential defects of the target software based on the historical test data, and obtaining potential defect information of the target software; a test script generation module 906, for generating a test script for the target software based on the potential defect information and the test requirements indicated by the test instruction; the test script includes a judgment condition for the test environment; a test environment matching module 908, for screening out a target test environment that matches the judgment condition from among various candidate test environments according to the judgment condition; and a software testing module 910, for running the test script in the target test environment to obtain the test result of the target software.

[0101] In one of the embodiments, the potential defect prediction module 904 is also used to: perform data preprocessing on the acquired historical test data to obtain target test data; perform feature extraction on the target test data to obtain target features of the target test data; use a defect prediction model to predict potential defects on the target software based on the target features to obtain potential defect information of the target software; the potential defect information includes the potential defect location and potential defect type of the target software.

[0102] In one of the embodiments, the test script generation module 906 is also used to: configure test resources for the target software based on the impact of the potential defect information to obtain the test resources of the target software; obtain the test requirements indicated by the test instructions, and generate a test script for the target software based on the test resources and the test requirements.

[0103] In one of the embodiments, the device is also used to: obtain system information of each test system for different types of test systems; build a test environment based on the test requirements indicated by the test instructions and the system information to obtain a candidate test environment that is compatible with each test system.

[0104] In one of the embodiments, the historical data acquisition module 902 is also used to: obtain the running status of the target software in response to the test instructions for the target software; when the running status indicates that the target software is in a stable running state, perform a functional integrity test on the target software to obtain the functional integrity test result of the target software; when the functional integrity test result indicates that the function of the target software is complete, obtain the historical test data of the target software.

[0105] In one of the embodiments, the device is also used to: perform performance analysis on the target software according to the test results of the target software to obtain the performance analysis results of the target software; when the performance analysis results are inconsistent with the expected results, update the test script according to the test results.

[0106] Each module in the above software testing device can be implemented in whole or in part by software, hardware and their combination. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.

[0107] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG10. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store software test data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a software testing method is implemented.

[0108] Those skilled in the art will understand that the structure shown in FIG. 10 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0109] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: in response to a test instruction for a target software, historical test data of the target software is obtained; based on the historical test data, potential defects of the target software are predicted to obtain potential defect information of the target software; based on the potential defect information and the test requirements indicated by the test instruction, a test script of the target software is generated; the test script includes a judgment condition for the test environment; based on the judgment condition, a target test environment that matches the judgment condition is screened out from each candidate test environment; and the test script is run in the target test environment to obtain a test result of the target software.

[0110] In one embodiment, when the processor executes the computer program, the following steps are also implemented: preprocessing the acquired historical test data to obtain target test data; extracting features from the target test data to obtain target features of the target test data; predicting potential defects of the target software based on the target features through a defect prediction model to obtain potential defect information of the target software; the potential defect information includes the potential defect location and potential defect type of the target software.

[0111] In one embodiment, when the processor executes the computer program, the following steps are also implemented: based on the impact degree of the potential defect information, test resources are configured for the target software to obtain the test resources of the target software; the test requirements indicated by the test instructions are obtained, and based on the test resources and the test requirements, a test script for the target software is generated.

[0112] In one embodiment, when the processor executes the computer program, the following steps are also implemented: for different types of test systems, the system information of each test system is obtained respectively; based on the test requirements indicated by the test instructions and the system information, a test environment is built to obtain a candidate test environment that is compatible with each test system.

[0113] In one embodiment, when the processor executes the computer program, the following steps are also implemented: in response to a test instruction for the target software, the running state of the target software is obtained; when the running state indicates that the target software is in a stable running state, a functional integrity test is performed on the target software to obtain a functional integrity test result of the target software; when the functional integrity test result indicates that the function of the target software is complete, historical test data of the target software is obtained.

[0114] In one embodiment, when the processor executes the computer program, the following steps are also implemented: based on the test results of the target software, a performance analysis is performed on the target software to obtain a performance analysis result of the target software; when the performance analysis result is inconsistent with the expected result, the test script is updated based on the test result.

[0115] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: in response to a test instruction for a target software, historical test data of the target software is obtained; based on the historical test data, potential defects of the target software are predicted to obtain potential defect information of the target software; based on the potential defect information and the test requirements indicated by the test instruction, a test script for the target software is generated; the test script includes a judgment condition for the test environment; based on the judgment condition, a target test environment that matches the judgment condition is screened out from each candidate test environment; and the test script is run in the target test environment to obtain a test result of the target software.

[0116] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: preprocessing the acquired historical test data to obtain target test data; extracting features from the target test data to obtain target features of the target test data; predicting potential defects of the target software based on the target features through a defect prediction model to obtain potential defect information of the target software; the potential defect information includes the potential defect location and potential defect type of the target software.

[0117] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: based on the impact degree of the potential defect information, test resources are configured for the target software to obtain the test resources of the target software; the test requirements indicated by the test instructions are obtained, and based on the test resources and the test requirements, a test script for the target software is generated.

[0118] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for different types of test systems, the system information of each test system is obtained respectively; based on the test requirements indicated by the test instructions and the system information, a test environment is built to obtain a candidate test environment that is compatible with each test system.

[0119] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: in response to a test instruction for the target software, the running state of the target software is obtained; when the running state indicates that the target software is in a stable running state, a functional integrity test is performed on the target software to obtain a functional integrity test result of the target software; when the functional integrity test result indicates that the function of the target software is complete, historical test data of the target software is obtained.

[0120] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: based on the test results of the target software, performance analysis is performed on the target software to obtain performance analysis results of the target software; when the performance analysis results are inconsistent with expected results, the test script is updated based on the test results.

[0121] In one embodiment, a computer program product is provided, including a computer program, which implements the following steps when executed by a processor: in response to a test instruction for a target software, historical test data of the target software is obtained; based on the historical test data, potential defects of the target software are predicted to obtain potential defect information of the target software; based on the potential defect information and the test requirements indicated by the test instruction, a test script for the target software is generated; the test script includes a judgment condition for the test environment; based on the judgment condition, a target test environment that matches the judgment condition is screened out from each candidate test environment; and the test script is run in the target test environment to obtain a test result of the target software.

[0122] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: preprocessing the acquired historical test data to obtain target test data; extracting features from the target test data to obtain target features of the target test data; predicting potential defects of the target software based on the target features through a defect prediction model to obtain potential defect information of the target software; the potential defect information includes the potential defect location and potential defect type of the target software.

[0123] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: based on the impact degree of the potential defect information, test resources are configured for the target software to obtain the test resources of the target software; the test requirements indicated by the test instructions are obtained, and based on the test resources and the test requirements, a test script for the target software is generated.

[0124] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for different types of test systems, the system information of each test system is obtained respectively; based on the test requirements indicated by the test instructions and the system information, a test environment is built to obtain a candidate test environment that is compatible with each test system.

[0125] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: in response to a test instruction for the target software, the running state of the target software is obtained; when the running state indicates that the target software is in a stable running state, a functional integrity test is performed on the target software to obtain a functional integrity test result of the target software; when the functional integrity test result indicates that the function of the target software is complete, historical test data of the target software is obtained.

[0126] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: based on the test results of the target software, performance analysis is performed on the target software to obtain performance analysis results of the target software; when the performance analysis results are inconsistent with expected results, the test script is updated based on the test results.

[0127] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0128] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0129] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0130] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A software testing method, characterized in that: The method comprises: In response to a test instruction for the target software, acquiring historical test data of the target software; Predicting potential defects of the target software according to the historical test data to obtain potential defect information of the target software; Generate a test script for the target software based on the potential defect information and the test requirements indicated by the test instructions; the test script includes a judgment condition for a test environment; According to the judgment condition, a target test environment matching the judgment condition is screened out from among the candidate test environments; The test script is run in the target test environment to obtain the test result of the target software.

2. The method according to claim 1, characterized in that The step of predicting potential defects of the target software according to the historical test data to obtain potential defect information of the target software includes: Performing data preprocessing on the acquired historical test data to obtain target test data; Performing feature extraction on the target test data to obtain target features of the target test data; By using a defect prediction model, based on the target features, potential defects of the target software are predicted to obtain potential defect information of the target software; the potential defect information includes the potential defect location and potential defect type of the target software.

3. The method according to claim 1, characterized in that The step of generating a test script for the target software based on the potential defect information and the test requirements indicated by the test instructions includes: Based on the impact degree of the potential defect information, test resources are configured for the target software to obtain test resources for the target software; The test requirement indicated by the test instruction is obtained, and a test script of the target software is generated based on the test resources and the test requirement.

4. The method according to claim 1, characterized in that: The process of building the candidate test environment includes: For different types of test systems, respectively obtain system information of each of the test systems; Based on the test requirements indicated by the test instructions and the system information, a test environment is constructed to obtain a candidate test environment that is compatible with each of the test systems.

5. The method according to claim 1, characterized in that The step of obtaining historical test data of the target software in response to a test instruction for the target software includes: In response to a test instruction for the target software, obtaining the running status of the target software; When the running state indicates that the target software is in a stable running state, performing a functional integrity test on the target software to obtain a functional integrity test result of the target software; When the functional integrity test result indicates that the functions of the target software are complete, historical test data of the target software is obtained.

6. The method according to claim 1, characterized in that The method further comprises: According to the test result of the target software, the performance analysis of the target software is performed to obtain the performance analysis result of the target software; When the performance analysis result is inconsistent with the expected result, the test script is updated according to the test result.

7. A software testing device, characterized in that: The device comprises: A historical data acquisition module, used for acquiring historical test data of the target software in response to a test instruction for the target software; A potential defect prediction module is used to predict potential defects of the target software according to the historical test data to obtain potential defect information of the target software; A test script generation module, used to generate a test script for the target software based on the potential defect information and the test requirements indicated by the test instructions; the test script includes a judgment condition for a test environment; A test environment matching module, used to screen out a target test environment that matches the judgment condition from among the candidate test environments according to the judgment condition; The software testing module is used to run the test script in the target testing environment to obtain the test result of the target software.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.