Test script generation method, device, storage medium and electronic device

By determining the key and non-critical failure factors in business scenarios in software testing, building a target failure factor combination, and generating test scripts, the problem of excessive number of test scripts in the existing technology is solved and testing efficiency is improved.

CN112905480BActive Publication Date: 2024-12-27TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202110293530.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-19
Publication Date
2024-12-27
Estimated Expiration
2041-03-19

AI Technical Summary

Technical Problem

When faced with multiple failure factors, the existing software testing methods generate too many test scripts, resulting in inefficient testing and taking a lot of time to complete the testing of the software.

Method used

By determining the key and non-critical failure factors in the business scenario, build a target failure factor combination, generate corresponding test scripts, reduce the number of test scripts and improve test efficiency.

Benefits of technology

It effectively reduces the number of generated test scripts, shortens the test time, and improves the efficiency of software testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112905480B_ABST
    Figure CN112905480B_ABST
Patent Text Reader

Abstract

The test script generation method, device, storage medium and electronic device provided in the embodiment of the present application relate to the field of computer technology. The test script generation method provided in the embodiment of the present application respectively obtains multiple fault factors corresponding to multiple business scenarios, and the business scenarios include at least one main business scenario, and each business scenario corresponds to multiple fault factors. The critical fault factors and target non-critical fault factors can be determined from the fault factors corresponding to the main business scenarios. According to the critical fault factors corresponding to the main business scenarios and the target non-critical fault factors, the target fault factor combination can be determined. Compared with the related art, the number of combinations of fault factors can be reduced, and the corresponding test scripts can be generated according to the test case combinations corresponding to the target fault factor combinations. The number of generated test scripts can also be reduced, and fewer test scripts can be used for testing. At the same time, the time used for testing can be reduced, and the test efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a test script generation method, device, storage medium and electronic device. Background Art

[0002] Software testing is an important means to ensure and improve software quality. As people's requirements for computer software functions become higher and higher, its structure becomes more and more complex, and the factors affecting software quality become more and more numerous. These factors can cause various software failures, and each failure can be called a failure factor. The commonly used method is to cover these failure factors 100% and obtain all corresponding failure factor combinations.

[0003] Although the above method can fully cover the problem, when the number of fault factors is large, the number of fault factor combinations obtained will also be large, and it takes a lot of time to test the software one by one according to the test scripts generated corresponding to all fault factor combinations.

[0004] For example, there are three test machines, each with 13 fault factors. If all fault factor combinations are calculated, 2197 fault factor combinations can be obtained, and 2197 test scripts can be generated accordingly. And it usually takes 2 minutes to test the software according to one test script. It takes 4394 minutes to test the software one by one according to 2197 test scripts, which means that it takes nearly 3 days to complete the software testing. Summary of the invention

[0005] In order to solve the technical problems existing in the related art, the embodiments of the present application provide a test script generation method, device, storage medium and electronic device, which can reduce the number of generated test scripts and improve the test efficiency of software testing.

[0006] To achieve the above purpose, the technical solution of the embodiment of the present application is implemented as follows:

[0007] In a first aspect, an embodiment of the present application provides a test script generation method, the method comprising:

[0008] Obtaining fault factors corresponding to a plurality of business scenarios respectively; the plurality of business scenarios include at least one main business scenario, and each business scenario corresponds to a plurality of fault factors; each fault factor represents a fault occurring in a corresponding business scenario;

[0009] Determine the critical failure factor and the non-critical failure factor among the failure factors corresponding to the main business scenario, and select the target non-critical failure factor from the non-critical failure factors;

[0010] Determine a target set; the target set includes a plurality of target fault factor combinations, each target fault factor combination includes at least the following: at least one critical fault factor, and at least one target non-critical fault factor;

[0011] According to the test case combination corresponding to each target fault factor combination in the target set, corresponding test scripts are generated respectively; wherein, the test case combination corresponding to each target fault factor combination is obtained according to the preset test case corresponding to each fault factor in the corresponding target fault factor combination.

[0012] In a second aspect, an embodiment of the present application further provides a test script generating device, the device comprising:

[0013] A fault factor acquisition unit, used to respectively acquire fault factors corresponding to a plurality of business scenarios; the plurality of business scenarios include at least one main business scenario, and each business scenario corresponds to a plurality of fault factors; each fault factor represents a kind of fault occurring in the corresponding business scenario;

[0014] A fault factor selection unit, configured to determine a critical fault factor and a non-critical fault factor from the fault factors corresponding to the main service scenario, and select a target non-critical fault factor from the non-critical fault factors;

[0015] A target set determination unit, configured to determine a target set; the target set includes a plurality of target fault factor combinations, each of which includes at least the following: at least one critical fault factor and at least one target non-critical fault factor;

[0016] A test script generation unit is used to generate corresponding test scripts according to the test case combination corresponding to each target fault factor combination in the target set; wherein the test case combination corresponding to each target fault factor combination is obtained according to the preset test case corresponding to each fault factor in the corresponding target fault factor combination.

[0017] In an optional embodiment, the fault factor selection unit is specifically used to:

[0018] Determine the number of occurrences of each failure factor corresponding to the main business scenario within a set time;

[0019] According to the values ​​of the number of occurrences, various failure factors corresponding to the main business scenario are sorted;

[0020] According to the sorting result, a set number of failure factors are selected from the multiple failure factors corresponding to the main business scenario as key failure factors;

[0021] Among the multiple fault factors, other fault factors except the critical fault factor are regarded as non-critical fault factors.

[0022] In an optional embodiment, the multiple business scenarios further include at least one secondary business scenario; each target failure factor combination further includes at least one secondary business failure factor; the secondary business failure factor is determined from the failure factors corresponding to the secondary business scenario; the target set determination unit is specifically used to:

[0023] Determine a first set according to the key failure factors corresponding to the main business scenario; the first set includes multiple first failure factor combinations, each of which includes at least one key failure factor;

[0024] Determine a second set according to the target non-critical failure factor corresponding to the primary business scenario and the secondary business failure factor corresponding to the secondary business scenario; the second set includes multiple second failure factor combinations, each second failure factor combination includes at least one target non-critical failure factor and at least one secondary business failure factor;

[0025] Combining each first fault factor combination in the first set with each second fault factor combination in the second set, respectively, to obtain a plurality of target fault factor combinations;

[0026] A target set is obtained according to the multiple target fault factor combinations.

[0027] In an optional embodiment, the main business scenario includes a first main business scenario and at least one second main business scenario; and the target set determination unit is further configured to:

[0028] Combining each key failure factor corresponding to the first main business scenario with each key failure factor corresponding to the at least one second main business scenario to obtain a plurality of first failure factor combinations;

[0029] A first set is obtained according to the plurality of first failure factor combinations.

[0030] In an optional embodiment, the main business scenario includes a first main business scenario and at least one second main business scenario; and the target set determination unit is further configured to:

[0031] Combining each target non-critical failure factor corresponding to the first main business scenario with each target non-critical failure factor corresponding to the at least one second main business scenario and each secondary business failure factor corresponding to the secondary business scenario to obtain a plurality of second failure factor combinations;

[0032] Selecting some second fault factor combinations from the plurality of second fault factor combinations as target second fault factor combinations;

[0033] A second set is obtained according to the target second fault factor combination.

[0034] In an optional embodiment, the target set determination unit is further configured to:

[0035] generating an initial second set according to the plurality of second fault factor combinations;

[0036] Combining each two fault factors included in each second fault factor combination respectively to obtain a plurality of pairwise fault factor combinations;

[0037] For each second fault factor combination in the initial second set, the following operations are performed respectively: one of the second fault factor combinations is used as a fault factor combination to be compared, and the other second fault factor combinations in the second fault factor combinations except the fault factor combination to be compared are used as candidate fault factor combinations; each pairwise fault factor combination in the fault factor combination to be compared is compared with each pairwise fault factor combination in the target candidate fault factor combination, and the target candidate fault factor combination is one of the candidate fault factor combinations; if there is a pairwise fault factor combination in the target candidate fault factor combination that is the same as the fault factor combination to be compared, the target candidate fault factor combination is deleted from the initial second set;

[0038] The remaining second fault factor combinations in the initial second set are used as target second fault factor combinations.

[0039] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the test script generation method of the first aspect is implemented.

[0040] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the computer program is executed by the processor, the processor implements the test script generation method of the first aspect.

[0041] The test script generation method, device, storage medium and electronic device provided in the embodiment of the present application respectively obtain multiple fault factors corresponding to multiple business scenarios, and the business scenarios include at least one main business scenario, each business scenario corresponds to multiple fault factors, and the critical fault factors and target non-critical fault factors can be determined from the fault factors corresponding to the main business scenarios, and the target fault factor combination can be determined according to the critical fault factors corresponding to the main business scenarios and the target non-critical fault factors corresponding to the main business scenarios. Compared with the related art, the number of combinations of fault factors can be reduced, and the corresponding test script can be generated according to the test case combination composed of the test cases corresponding to the fault factors contained in the target fault factor combination, and the number of generated test scripts can also be reduced, and the software can be tested with fewer test scripts, and the time used for testing can be reduced, and the test efficiency can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments 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 drawings can be obtained based on these drawings without paying creative labor.

[0043] Figure 1 An application scenario diagram of a test script generation method provided in an embodiment of the present application;

[0044] Figure 2 A flowchart of a test script generation method provided in an embodiment of the present application;

[0045] Figure 3 A flowchart of another test script generation method provided in an embodiment of the present application;

[0046] Figure 4 A schematic diagram of a failure factor corresponding to a business scenario provided in an embodiment of the present application;

[0047] Figure 5 A schematic diagram of failure factors corresponding to another business scenario provided in an embodiment of the present application;

[0048] Figure 6 A schematic diagram of a target set provided in an embodiment of the present application;

[0049] Figure 7 A schematic diagram of a test case corresponding to a fault factor provided in an embodiment of the present application;

[0050] Figure 8 A schematic diagram of a test case corresponding to another fault factor provided in an embodiment of the present application;

[0051] Fig. 9 A schematic diagram of a test script generation template provided in an embodiment of the present application;

[0052] Fig.10 A schematic diagram of a test script generation process provided in an embodiment of the present application;

[0053] Fig.11 A structural block diagram of a test script generating device provided in an embodiment of the present application;

[0054] Fig.12 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0056] It should be noted that the terms "including" and "having" and their variations involved in the documents of this application are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0057] Some of the terms used in the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.

[0058] (1) Combination testing: It can also be called integration testing or subsystem testing. It usually adopts two testing methods: top-down testing and bottom-up testing. Combination testing can abstract the system under test or the module of the system under test into a system affected by multiple factors, and use fewer test cases while ensuring the error detection rate.

[0059] (2) Fault injection: This is a reliability verification technique that injects specific faults into the system under test and observes the behavior of the system when the fault exists.

[0060] (3) Event management system: It can record various events that occur in the live network, such as live network failures and online business system curve jitter.

[0061] The word “exemplary” is used hereinafter to mean “serving as an example, example, or illustration.” Any embodiment described as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0062] The terms "first" and "second" in this document are used for descriptive purposes only and should not be understood as explicitly or implicitly indicating relative importance or implicitly indicating the number of technical features indicated. Therefore, features defined as "first" and "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of this application, unless otherwise specified, "plurality" means two or more.

[0063] In order to better understand the technical solutions provided in the embodiments of the present application, the following briefly introduces the application scenarios to which the technical solutions provided in the embodiments of the present application are applicable. It should be noted that the application scenarios introduced below are only used to illustrate the embodiments of the present application and are not limited thereto. In specific implementation, the technical solutions provided in the embodiments of the present application can be flexibly applied according to actual needs.

[0064] The test script generation method provided in the embodiment of the present application can be applied to Figure 1 See the application scenario shown in Figure 1 As shown, the application scenario includes multiple terminal devices 11 and servers 12. The terminal devices 11 and the servers 12 can be connected and transmit data via a wired connection or a wireless connection. For example, the terminal devices 11 and the servers 12 can be connected via a data cable or via a wired network; the terminal devices 11 and the servers 12 can also be connected via a radio frequency module, a WiFi module or a wireless network.

[0065] Among them, the terminal device 11 can be a computer, a notebook, a PDA (Personal Digital Assistant), a tablet computer, etc. The server 12 can be a server or a server cluster or a cloud computing center composed of several servers, or a virtualization platform, or a personal computer, a large or medium-sized computer, or a computer cluster, etc. According to the implementation needs, the application scenario in the embodiment of the present application can have any number of terminal devices and servers. This application does not make special restrictions on this. The test script generation method provided in the embodiment of the present application can be executed by the server 12, and can also be executed by the terminal device 11 and the server 12 in collaboration.

[0066] For example, a certain application development organization is provided with a server 12 for generating test scripts. Each laboratory within the development organization is provided with a terminal device 11. The user 10 can set multiple fault factors for multiple business scenarios of the software system in the terminal device 11 of his laboratory, and transmit the multiple fault factors corresponding to the multiple business scenarios to the server 12. After receiving the fault factors corresponding to the multiple business scenarios, the server 12 can first determine the critical fault factors and non-critical fault factors from the fault factors corresponding to the main business scenario according to the main business scenario and the secondary business scenario included in the multiple business scenarios, and select the target non-critical fault factors from the non-critical fault factors, and then determine the target set according to the critical fault factors corresponding to the main business scenario and the target non-critical fault factors corresponding to the main business scenario, and finally generate corresponding test scripts according to the test case combination corresponding to each target fault factor combination in the target set, and the test case combination corresponding to each target fault factor combination is obtained according to the preset test case corresponding to each fault factor in the target fault factor combination. After generating the test script, the server 12 can test the multiple business scenarios of the software system in the terminal device 11 respectively.

[0067] To further illustrate the technical solution provided by the embodiment of the present application, this is described in detail below in conjunction with the accompanying drawings and specific implementation methods. Although the embodiment of the present application provides the method operation steps as shown in the following embodiments or drawings, more or fewer operation steps may be included in the method based on routine or no creative labor. In the steps where there is no necessary causal relationship logically, the execution order of these steps is not limited to the execution order provided by the embodiment of the present application. The method may be executed in the order of the method shown in the embodiment or drawings or in parallel during the actual processing process or when the device is executed.

[0068] Figure 2 A flowchart of a test script generation method provided by an embodiment of the present application is shown. The method can be Figure 1 The server 12 in the embodiment may also be executed by the terminal device 11 or other electronic devices. For example, the following uses a computer for generating a test script as the execution subject to illustrate the specific implementation process of the test script generation method of the embodiment of the present application. Figure 2 As shown, the test script generation method includes the following steps:

[0069] Step S201, respectively obtain failure factors corresponding to a plurality of business scenarios.

[0070] According to the different criticality of multiple business scenarios to the software system, the business scenarios can be divided into primary business scenarios and secondary business scenarios. Each business scenario corresponds to multiple fault factors, and each fault factor can represent a fault that occurs in the corresponding business scenario. For example, a computer software system contains three business scenarios, namely business scenario A, business scenario B and business scenario C, where business scenario A and business scenario B are primary business scenarios, business scenario C is a secondary business scenario, and business scenario A, business scenario B and business scenario C all have three fault factors, namely fault factor a, fault factor b and fault factor c, respectively. Then fault factor a can represent that fault a occurs in business scenario A.

[0071] Multiple failure factors corresponding to multiple business scenarios obtained in this application can be saved on the blockchain.

[0072] Step S202: determining critical failure factors and non-critical failure factors among the failure factors corresponding to the main business scenario, and selecting target non-critical failure factors from the non-critical failure factors.

[0073] The number of occurrences of each fault factor corresponding to the main business scenario within a set time can be determined respectively, and the fault factors corresponding to the main business scenario can be sorted according to the value of the number of occurrences, and then according to the sorting result, a set number of fault factors are selected from the multiple fault factors corresponding to the main business scenario as key fault factors, and the other fault factors except the key fault factors in the multiple fault factors are regarded as non-key fault factors. For example, the main business scenario A corresponds to 5 fault factors, namely, fault factor a, fault factor b, fault factor c, fault factor d and fault factor e. Within one year, fault factor a occurs 10 times, fault factor b occurs 4 times, fault factor c occurs 7 times, fault factor d occurs 5 times, and fault factor e occurs 8 times. The 3 fault factors with the larger number of occurrences can be selected as key fault factors, that is, fault factor a, fault factor c and fault factor e can be selected as key fault factors, and fault factor b and fault factor d are non-key fault factors.

[0074] When determining the critical failure factors and non-critical failure factors from the failure factors corresponding to the main business scenario, the probability of each failure factor occurring in the main business scenario can also be determined based on personal experience to determine the critical failure factors corresponding to the main business scenario and the non-critical failure factors corresponding to the main business scenario. This application does not limit the method for determining the critical failure factors corresponding to the main business scenario and the non-critical failure factors corresponding to the main business scenario from the failure factors corresponding to the main business scenario, and different determination methods can be used according to different situations or business requirements.

[0075] After determining the critical failure factors and non-critical failure factors corresponding to the main business scenario, a set number of failure factors can be randomly selected from the non-critical failure factors corresponding to the main business scenario as target non-critical failure factors corresponding to the main business scenario.

[0076] Step S203, determining the target set.

[0077] A set number of failure factors can be randomly selected from the failure factors corresponding to the secondary business scenario as the secondary business failure factors corresponding to the secondary business scenario, and then a target set is determined according to the critical failure factors corresponding to the primary business scenario, the non-critical failure factors corresponding to the primary business scenario, and the secondary business failure factors corresponding to the secondary business scenario. The target set includes multiple target failure factor combinations, and each target failure factor combination may include at least one critical failure factor, at least one target non-critical failure factor, and at least one secondary business failure factor.

[0078] Specifically, the main business scenario may include a first main business scenario and at least one second main business scenario. Each key failure factor corresponding to the first main business scenario is combined with each key failure factor corresponding to at least one second main business scenario to obtain multiple first failure factor combinations, and a first set is obtained based on the multiple first failure factor combinations. For example, the main business scenarios include a first main business scenario A, a second main business scenario B, and a second main business scenario C. Assuming that the first main business scenario A contains critical failure factor a and critical failure factor b, the second main business scenario B contains critical failure factor a and critical failure factor b, and the second main business scenario C contains critical failure factor a and critical failure factor b, then the critical failure factor a and critical failure factor b corresponding to the first main business scenario A are combined with the critical failure factor a and critical failure factor b corresponding to the second main business scenario B and the critical failure factor a and critical failure factor b corresponding to the second main business scenario C, respectively, to obtain the first failure factor combination (a, a, a), the first failure factor combination (a, a, b), the first failure factor combination (a, b, a), the first failure factor combination (a, b, b), the first failure factor combination (b, a, a), the first failure factor combination (b, a, b), the first failure factor combination (b, b, a), and the first failure factor combination (b, b, b). A first set can be obtained based on the multiple first fault factor combinations, that is, the first set may include a first fault factor combination (a, a, a), a first fault factor combination (a, a, b), a first fault factor combination (a, b, a), a first fault factor combination (a, b, b), a first fault factor combination (b, a, a), a first fault factor combination (b, a, b), a first fault factor combination (b, b, a) and a first fault factor combination (b, b, b).

[0079] Each target non-critical fault factor corresponding to the first main business scenario is combined with each target non-critical fault factor corresponding to at least one second main business scenario and each secondary business fault factor corresponding to the secondary business scenario to obtain a plurality of second fault factor combinations. An initial second set can be generated based on the plurality of second fault factor combinations, and then each two fault factors contained in each second fault factor combination are combined to obtain a plurality of pairwise fault factor combinations. For each second fault factor combination in the initial second set, the following operations can be performed respectively: one second fault factor combination in each second fault factor combination is used as a fault factor combination to be compared, and other second fault factor combinations in each second fault factor combination except the fault factor combination to be compared are used as candidate fault factor combinations, and then each pairwise fault factor combination in the fault factor combination to be compared is compared with each pairwise fault factor combination in the target candidate fault factor combination, and the target candidate fault factor combination is one of the candidate fault factor combinations, and if there is a pairwise fault factor combination in the target candidate fault factor combination that is the same as the fault factor combination to be compared, the target candidate fault factor combination is deleted from the initial second set. The remaining second fault factor combinations in the initial second set may be used as target second fault factor combinations, and the second set may be obtained according to the target second fault factor combinations.

[0080] For example, it is assumed that the first main business scenario X corresponds to the target non-critical failure factor X1 and the target non-critical failure factor X2, the second main business scenario Y corresponds to the target non-critical failure factor Y1 and the target non-critical failure factor Y2, and the secondary business scenario Z corresponds to the secondary business failure factor Z1 and the secondary business failure factor Z2. The target non-critical failure factor X1 and the target non-critical failure factor X2 corresponding to the first main business scenario X are combined with the target non-critical failure factor Y1 and the target non-critical failure factor Y2 corresponding to the second main business scenario Y, and the secondary business failure factor Z1 and the secondary business failure factor Z2 corresponding to the secondary business scenario Z, respectively, to obtain 8 second failure factor combinations as shown in Table 1:

[0081] Table 1

[0082]

[0083]

[0084] The initial second set can be first obtained according to the 8 second fault factor combinations, and then the pairwise fault factor combinations (X2, Y2), (X2, Z2), (Y2, Z2) contained in the second fault factor combination 8 are compared with the pairwise fault factor combinations (X2, Y2), (X2, Z1), (Y2, Z1) contained in the second fault factor combination 7, respectively. It can be found that the pairwise fault factor combinations (X2, Y2) contained in the second fault factor combination 8 are the same as the pairwise fault factor combinations (X2, Y2) contained in the second fault factor combination 7, then the second fault factor combination 8 can be deleted from the initial second set. At this time, the initial second set includes 7 second fault factor combinations, namely, second fault factor combination 1, second fault factor combination 2, second fault factor combination 3, second fault factor combination 4, second fault factor combination 5, second fault factor combination 6 and second fault factor combination 7. Then, the pairwise fault factor combinations (X2, Y2), (X2, Z1), (Y2, Z1) contained in the second fault factor combination 7 can be compared with the pairwise fault factor combinations (X2, Y1), (X2, Z2), (Y1, Z2) contained in the second fault factor combination 6. It can be found that the pairwise fault factor combinations contained in the second fault factor combination 7 are different from the pairwise fault factor combinations contained in the second fault factor combination 6. Then, both the second fault factor combination 6 and the second fault factor combination 7 should be retained in the initial second set. At this time, the initial second set still contains 7 second fault factor combinations. By continuing in this way, the target second fault factor combination shown in Table 2 can be obtained:

[0085] Table 2

[0086] Serial number X Y Z 1 X1 Y1 Z1 4 X1 Y2 Z2 6 X2 Y1 Z2 7 X2 Y2 Z1

[0087] A second set can be obtained according to the target second fault factor combination, and the second set includes second fault factor combination 1, second fault factor combination 4, second fault factor combination 6 and second fault factor combination 7.

[0088] After obtaining the first set and the second set, each first fault factor combination in the first set can be combined with each second fault factor combination in the second set to obtain multiple target fault factor combinations, and then the target set is obtained based on the multiple target fault factor combinations.

[0089] In a possible embodiment, the business scenario may include a main business scenario and at least one secondary business scenario. Among the multiple fault factors corresponding to the main business scenario, after determining the critical fault factors and non-critical fault factors, and selecting the target non-critical fault factors from the non-critical fault factors, the multiple critical fault factors corresponding to the main business scenario can be used as multiple first fault factor combinations, and a first set is obtained based on the multiple first fault factor combinations. The target non-critical fault factors corresponding to the main business scenario are respectively combined with the secondary business fault factors corresponding to at least one business scenario to obtain multiple second fault factor combinations, and some second fault factor combinations are selected from the multiple second fault factor combinations as target second fault factor combinations, and a second set is obtained based on the multiple target second fault factor combinations. Finally, a target set is obtained based on the first set and the second set.

[0090] Step S204, generating corresponding test scripts according to the test case combinations corresponding to each target failure factor combination in the target set.

[0091] Since each fault factor corresponds to a preset test case, the test case combination corresponding to each target fault factor combination can be obtained according to the preset test case corresponding to each fault factor contained in each target fault factor combination. After obtaining the target set, the corresponding test scripts can be generated according to the test case combination corresponding to each target fault factor combination in the target set. For example, the target set includes a target fault factor combination A and a target fault factor combination B, the target fault factor combination A includes fault factor a, fault factor b and fault factor c, and is presented in the order of fault factor a, fault factor b and fault factor c, and the target fault factor combination B includes fault factor a, fault factor b and fault factor c, and is presented in the order of fault factor a, fault factor c and fault factor b. Then, according to the test cases corresponding to fault factor a, fault factor b and fault factor c respectively, the test cases corresponding to fault factor a, fault factor b and fault factor c can be combined in the order of test cases corresponding to fault factor a, test cases corresponding to fault factor b and test cases corresponding to fault factor c to obtain the test case combination corresponding to the target fault factor combination A, and the test cases corresponding to fault factor a, fault factor c and test cases corresponding to fault factor b can be combined in the order of test cases corresponding to fault factor a, test cases corresponding to fault factor c and test cases corresponding to fault factor b to obtain the test case combination corresponding to the target fault factor combination B. After obtaining the test case combination corresponding to the target fault factor combination A and the test case combination corresponding to the target fault factor combination B, corresponding test scripts can be generated according to the test case combination corresponding to the target fault factor combination A and the test case combination corresponding to the target fault factor combination B.

[0092] The test script generation method provided in the embodiment of the present application obtains multiple fault factors corresponding to multiple business scenarios respectively, and the business scenarios include at least one main business scenario, and each business scenario corresponds to multiple fault factors. The critical fault factors and the target non-critical fault factors can be determined from the fault factors corresponding to the main business scenarios, and the target fault factor combination can be determined according to the critical fault factors corresponding to the main business scenarios and the target non-critical fault factors corresponding to the main business scenarios. Compared with the related art, the number of combinations of fault factors can be reduced, and the corresponding test script can be generated according to the test case combination composed of the test cases corresponding to the fault factors included in the target fault factor combination, and the number of generated test scripts can also be reduced, and the software can be tested using fewer test scripts, and the time used for testing can be reduced, and the test efficiency can be improved.

[0093] Figure 3 The detailed implementation process of the test script generation method proposed in this application is shown as follows: Figure 3 As shown, the following steps may be included:

[0094] Step S301, respectively obtain failure factors corresponding to a plurality of business scenarios.

[0095] The business scenario may include at least one primary business scenario and at least one secondary business scenario, and each business scenario corresponds to a plurality of fault factors, and each fault factor represents a fault occurring in the corresponding business scenario.

[0096] Step S302: determining critical failure factors and non-critical failure factors among the failure factors corresponding to the main business scenario.

[0097] The number of occurrences of each fault factor corresponding to the main business scenario within a set time can be determined respectively, and then the fault factors corresponding to the main business scenario can be sorted according to the value of the number of occurrences, and then according to the sorting result, a set number of fault factors can be selected from the multiple fault factors corresponding to the main business scenario as the key fault factors corresponding to the main business scenario. Among the multiple fault factors corresponding to the main business scenario, the other fault factors except the key fault factors can be used as the non-key fault factors corresponding to the main business scenario.

[0098] Step S303: Select a target non-critical failure factor corresponding to the main business scenario from the non-critical failure factors corresponding to the main business scenario.

[0099] From the multiple non-critical failure factors corresponding to the main business scenario, a set number of non-critical failure factors are randomly selected as target non-critical failure factors corresponding to the main business scenario.

[0100] Step S304: Determine a secondary service failure factor corresponding to the secondary service scenario from the failure factors corresponding to the secondary service scenario.

[0101] A set number of failure factors are randomly selected from a plurality of failure factors corresponding to the secondary business scenario as the secondary business failure factors corresponding to the secondary business scenario.

[0102] Step S305: determine a first set according to key failure factors corresponding to the main business scenario.

[0103] The main business scenario may include a first main business scenario and at least one second main business scenario. The key failure factors corresponding to the first main business scenario can be combined with the key failure factors corresponding to at least one second main business scenario to obtain multiple first failure factor combinations. Based on the multiple first failure factor combinations, a first set can be obtained.

[0104] Step S306: determine an initial second set according to the target non-critical failure factor corresponding to the primary business scenario and the secondary business failure factor corresponding to the secondary business scenario.

[0105] By combining each target non-critical failure factor corresponding to the first main business scenario with each target non-critical failure factor corresponding to at least one second main business scenario and each secondary business failure factor corresponding to at least one secondary business scenario, multiple second failure factor combinations can be obtained. Based on the multiple second failure factor combinations, an initial second set can be obtained.

[0106] Step S307: Select some second fault factor combinations from the multiple second fault factor combinations included in the initial second set as target second fault factor combinations.

[0107] By combining each two fault factors included in each second fault factor combination, a plurality of pairwise fault factor combinations can be obtained. For each second fault factor combination in the initial second set, the following operations are performed: one second fault factor combination in each second fault factor combination is used as a fault factor combination to be compared, and other second fault factor combinations in each second fault factor combination except the fault factor combination to be compared are used as candidate fault factor combinations. Each pairwise fault factor combination in the fault factor combination to be compared is compared with each pairwise fault factor combination in the target candidate fault factor combination. The target candidate fault factor combination can be one of the candidate fault factor combinations. If the target candidate fault factor combination contains the same pairwise fault factor combination as the fault factor combination to be compared, the target candidate fault factor combination is deleted from the initial second set. The remaining second fault factor combinations in the initial second set can be used as the target second fault factor combination.

[0108] Step S308: Obtain a second set according to a plurality of target second fault factor combinations.

[0109] Step S309: determine a target set according to the first set and the second set.

[0110] Each first fault factor combination in the first set is combined with each second fault factor combination in the second set to obtain a plurality of target fault factor combinations, and a target set is obtained according to the plurality of target fault factor combinations.

[0111] Step S310, generating corresponding test scripts according to the test case combinations corresponding to each target failure factor combination in the target set.

[0112] The test case combination corresponding to each target fault factor combination is obtained according to the preset test case corresponding to each fault factor in the corresponding target fault factor combination. According to the test case combination corresponding to each target fault factor combination in the target set, corresponding test scripts can be generated respectively.

[0113] The test script generation method provided in the embodiment of the present application first determines the critical fault factors and non-critical fault factors, so that the target fault factor combination can be obtained by using the combined test modeling method, which greatly reduces the number of combinations of fault factors, and the obtained target fault factor combination can theoretically guarantee the coverage of 73% of faults existing in all business scenarios. The test script generation method provided in the embodiment of the present application is very suitable for projects with multiple business scenarios and multiple fault factors. Within a limited test time, by first screening and processing multiple fault factors corresponding to the business scenario, the target fault factor combination generated by the screened fault factors can not only enrich the fault factor combination test scenario, but also use the test script generated accordingly according to the target fault factor combination for testing, which can improve the test efficiency and improve the test quality.

[0114] The following uses a specific application scenario to further explain the above embodiment in detail:

[0115] Assume that a computer software system contains three business scenarios, business scenario stark_agent, business scenario stark_processor and business scenario stark_db. Fault injection technology can be used to set multiple faults for each business scenario, that is, the business scenario stark_agent corresponds to 13 fault factors, the business scenario stark_processor corresponds to 13 fault factors, and the business scenario stark_db corresponds to 11 fault factors. The fault factors corresponding to each business scenario can be as follows Figure 4As shown in the figure, the business scenario stark_agent corresponds to the fault factors cpu_load, disk_burn_read, disk_burn_write, disk_burn_read_write, disk_full, network_delay, network_loss, processor_kill, processor_stop, network_corrupt, network_drop, network_duplicate and network_reorder, and the business scenario stark_processor corresponds to the fault factors cpu_load, disk_burn_read, disk_burn_write, disk_burn_read_write, di sk_full, network_delay, network_loss, processor_kill, processor_stop, network_corrupt, network_drop, network_duplicate and network_reorder. The business scenario stark_db corresponds to the failure factors cpu_load, disk_burn_read, disk_burn_write, disk_burn_read_write, disk_full, network_delay, network_loss, network_corrupt, network_drop, network_duplicate and network_reorder.

[0116] In addition, the faults represented by each fault factor can be specifically shown in Table 3:

[0117] Table 3

[0118]

[0119]

[0120] After obtaining multiple fault factors corresponding to each business scenario, a combined test model can be made for the business scenario. That is, since the business scenarios stark_agent and stark_processor are more critical to the software system, the business scenarios stark_agent and stark_processor can be used as the main business scenarios, and the business scenario stark_db can be used as the secondary business scenario. All the existing network events in the event management system in the past two years whose responsible parties belong to the component development group or the component test group can be counted, and the bugs caused by the fault factors can be analyzed. The four most common fault factors can be used as the key fault factors. In this way, it can be determined that the key fault factors corresponding to the business scenario stark_agent are cpu_load, disk_burn_read_write, network_delay and disk_full, and the key fault factors corresponding to the business scenario stark_processor are cpu_load, disk_burn_read_write, network_delay and disk_full. The non-critical failure factors corresponding to the business scenarios stark_agent and stark_processor include disk_burn_read, disk_burn_write, network_loss, processor_kill, processor_stop, network_corrupt, network_drop, network_duplicate, and network_reorder.

[0121] From the non-critical failure factors, two failure factors can be randomly selected as the target non-critical failure factors. For example, network_duplicate and network_reorder can be selected as the target non-critical failure factors. All failure factors corresponding to the business scenario stark_db can be used as the secondary business failure factors corresponding to the business scenario stark_db, and the following can be obtained: Figure 5 Failure factors shown. Figure 5 In stark_agent: cpu_load, disk_burn_read_write, network_delay, disk_full represent the four key failure factors corresponding to the business scenario stark_agent. Figure 5 stark_agent_b:network_duplicate,network_reorder in the business scenario stark_agent corresponds to the two target non-critical failure factors, Figure 5In the stark_processor: cpu_load, disk_burn_read_write, network_delay, disk_full represent the four key failure factors corresponding to the stark_processor in the business scenario. Figure 5 stark_processor_b:network_duplicate,network_reorder in the business scenario stark_processor indicates the two target non-critical failure factors corresponding to the business scenario, Figure 5 In stark_db: cpu_load, disk_burn_read, disk_burn_write, disk_burn_read_write, disk_full, network_delay, network_loss, network_corrupt, network_drop, network_duplicate, network_reorder represent the 11 secondary business failure factors corresponding to the business scenario stark_db. Figure 5 {stark_agent, stark_processor}@2 in the formula indicates that all combinations of the four key failure factors corresponding to the business scenario stark_agent and the business scenario stark_processor must be covered.

[0122] Pairwise Independent Combinatorial Testing (PICT) can be used to Figure 5Specifically, the key failure factors cpu_load, disk_burn_read_write, network_delay, and disk_full corresponding to the business scenario stark_agent can be combined with the key failure factors cpu_load, disk_burn_read_write, network_delay, and disk_full corresponding to the business scenario stark_processor, respectively, to obtain 16 first failure factor combinations, namely, the first failure factor combination (cpu_load, cpu_load), the first failure factor combination (cpu_load, disk_burn_read_write), the first failure factor combination (cpu_load, network_delay), the first failure factor combination (cpu_load, disk_full), the first failure factor combination (disk_burn_read_write, cpu_load), the first failure factor combination (disk_burn_read_write, d isk_burn_read_write), the first fault factor combination (disk_burn_read_write, network_delay), the first fault factor combination (disk_burn_read_write, disk_full), the first fault factor combination (network_delay, cpu_load), the first fault factor combination (network_delay, disk_burn_read_write), the first fault factor combination (network_delay, network_delay), the first fault factor combination (network_delay, disk_full), the first fault factor combination (disk_full, cpu_load), the first fault factor combination (disk_full, disk_burn_read_write), the first fault factor combination (disk_full, network_delay) and the first fault factor combination (disk_full, disk_full).

[0123] According to the first fault factor combination, the first set can be obtained, that is, the first set includes the 16 first fault factor combinations. The target non-critical fault factors network_duplicate and network_reorder corresponding to the business scenario stark_agent and the target non-critical fault factors network_duplicate and network_reorder corresponding to the business scenario stark_processor, as well as the secondary business fault factors cpu_load, disk_burn_read, disk_burn_write, disk_burn_read_write, disk_full, network_delay, network_loss, network_corrupt, network_drop, network_duplicate and network_reorder corresponding to the business scenario stark_db can be combined respectively to obtain 44 second fault factor combinations, and the initial second set can be obtained according to the 44 second fault factor combinations. The PICT tool can be used to delete some second fault factor combinations from the initial second set, and the remaining second fault factor combinations are used as the target second fault factor combinations, and the target second fault factor combinations obtained can be 11. According to the 11 target second fault factor combinations, the second set can be obtained.

[0124] By combining the 16 first fault factor combinations included in the first set with the 11 second fault factor combinations included in the second set, 176 target fault factor combinations can be obtained. Some of the 176 target fault factor combinations can be as follows: Figure 6 As shown, Figure 6 Each row starting from row 2 in represents a target fault factor combination. According to the 176 target fault factor combinations, a target set can be obtained, which can also be called stark_test.csv.

[0125] Each failure factor corresponds to a test case, such as Figure 7 The following are the test cases corresponding to the fault factor cpu_load: Figure 8 The following is a test case corresponding to the fault factor disk_burn_read_write. According to the test cases corresponding to each fault factor contained in the target fault factor combination, the test case combination corresponding to each target fault factor combination can be determined first, and then Fig. 9 The test script generation template shown generates corresponding test scripts by combining the test cases corresponding to each target failure factor combination in the target set.

[0126] In one embodiment, the following can be done: Fig.10 The process shown is based on Fig. 9 The test script generation template in the program automatically generates test scripts and tests the corresponding business scenarios based on the generated test scripts.

[0127] Step S1001, initialization.

[0128] You can count the number of network connections of each process in the test system, modify the ssid in the configuration file, preheat the test data, and complete the initialization operation of the test system.

[0129] Step S1002, clearing logs.

[0130] Before testing, clean up the historical test stub logs in the test system.

[0131] Step S1003, sending a test request.

[0132] The test system sends a test request to the corresponding service, requesting the test process to be carried out.

[0133] Step S1004, generate a test script and perform a test.

[0134] The test system can read stark_test.csv, and generate corresponding test scripts for each test case combination corresponding to each target failure factor combination contained in stark_test.csv according to the test script generation template, and test the corresponding business scenario according to the generated test script.

[0135] Step S1005, check the log.

[0136] During the test process, you can check the test stub logs generated in the test system, including failure and success logs.

[0137] Step S1006, checking the program running status.

[0138] Check whether there is a change in the number of connections in the program, whether the pid in the program has changed, and whether there is a core file in the program.

[0139] Step S1007, exception capture.

[0140] If an exception occurs in the program, an exception will be thrown.

[0141] Step S1008, email notification.

[0142] Whether the program execution fails or succeeds, the program execution personnel will be notified of the program execution results via email.

[0143] In addition to the above application scenarios, the test script generation method provided in the embodiment of the present application can also be applied to the following application scenarios:

[0144] Suppose there is a machine which includes 4 components. The 4 components can be used as 4 business scenarios. That is, the machine includes 4 business scenarios, namely, business scenario A, business scenario B, business scenario C and business scenario D. Each business scenario includes 3 failure factors, namely, failure factor a, failure factor b and failure factor c.

[0145] Since business scenarios A and B correspond to important parts of the machine, business scenarios A and B can be used as the main business scenarios, and business scenarios C and D can be used as secondary business scenarios. Since failure factor a occurs the most times within half a year, failure factor a can be used as the key failure factor corresponding to business scenarios A and B, and failure factor b and failure factor c can be used as non-critical failure factors corresponding to business scenarios A and B, and failure factor c can be randomly selected from the non-critical failure factors as the target non-critical failure factor corresponding to business scenarios A and B. And failure factor b and failure factor c can be randomly selected from the failure factors corresponding to the secondary business scenarios as the secondary business failure factors corresponding to business scenarios C and D.

[0146] The first failure factor combination (a, a) can be obtained by combining the critical failure factor a corresponding to business scenario A with the critical failure factor a corresponding to business scenario B. The target non-critical failure factor c corresponding to business scenario A is combined with the target non-critical failure factor c corresponding to business scenario B, the secondary business failure factor b and secondary business failure factor c corresponding to business scenario C, and the secondary business failure factor b and secondary business failure factor c corresponding to business scenario D, respectively, to obtain the second failure factor combinations (c, c, b, b), (c, c, b, c), (c, c, c, b), and (c, c, c, c). Since the pairwise fault factor combinations (c, c) contained in the second fault factor combination (c, c, c, c) are the same as the pairwise fault factor combinations (c, c) contained in the second fault factor combination (c, c, c, b), the second fault factor combination (c, c, c, c) can be deleted. Continuing in this way, the second fault factor combinations (c, c, b, c) and (c, c, c, b) can be deleted, and the remaining second fault factor combination (c, c, b, b) is the target second fault factor combination.

[0147] The first fault factor combination (a, a) is combined with the target second fault factor combination (c, c, b, b) to obtain the target fault factor combination (a, a, c, c, b, b). According to the test cases corresponding to the fault factors included in the target fault factor combination (a, a, c, c, b, b), the test case combination corresponding to the target fault factor combination (a, a, c, c, b, b) can be obtained, and a test script is generated according to the test case combination. The corresponding components in the machine can be tested through the generated test script.

[0148] and Figure 2 The test script generation method shown is based on the same inventive concept, and a test script generation device is also provided in the embodiment of the present application, and the test script generation device can be deployed in a server or a terminal device. Since the device is a device corresponding to the test script generation method of the present application, and the principle of solving the problem by the device is similar to that of the method, the implementation of the device can refer to the implementation of the above method, and the repeated parts will not be repeated.

[0149] Fig.11 A schematic diagram of the structure of a test script generating device provided in an embodiment of the present application is shown. Fig.11 As shown, the test script generating device includes a fault factor acquiring unit 1101, a fault factor selecting unit 1102, a target set determining unit 1103 and a test script generating unit 1104.

[0150] The fault factor acquisition unit 1101 is used to respectively acquire fault factors corresponding to multiple business scenarios; the multiple business scenarios include at least one main business scenario, and each business scenario corresponds to multiple fault factors; each fault factor represents a fault occurring in the corresponding business scenario;

[0151] A fault factor selection unit 1102 is used to determine critical fault factors and non-critical fault factors among the fault factors corresponding to the main business scenario, and select a target non-critical fault factor from the non-critical fault factors;

[0152] The target set determination unit 1103 is used to determine a target set; the target set includes multiple target fault factor combinations, each target fault factor combination includes at least the following: at least one critical fault factor, and at least one target non-critical fault factor;

[0153] The test script generation unit 1104 is used to generate corresponding test scripts according to the test case combination corresponding to each target fault factor combination in the target set; wherein the test case combination corresponding to each target fault factor combination is obtained according to the preset test case corresponding to each fault factor in the corresponding target fault factor combination.

[0154] In an optional embodiment, the fault factor selection unit 1102 is specifically configured to:

[0155] Determine the number of occurrences of each failure factor corresponding to the main business scenario within a set time;

[0156] Sort the failure factors corresponding to the main business scenarios according to the number of occurrences;

[0157] According to the sorting result, a set number of failure factors are selected from multiple failure factors corresponding to the main business scenario as key failure factors;

[0158] Among multiple fault factors, other fault factors except the critical fault factor are regarded as non-critical fault factors.

[0159] In an optional embodiment, the multiple business scenarios further include at least one secondary business scenario; each target failure factor combination further includes at least one secondary business failure factor; the secondary business failure factor is determined from the failure factors corresponding to the secondary business scenario; the target set determination unit 1103 is specifically used to:

[0160] Determine a first set according to the key failure factors corresponding to the main business scenario; the first set includes multiple first failure factor combinations, and each first failure factor combination includes at least one key failure factor;

[0161] Determine a second set according to the target non-critical failure factor corresponding to the primary business scenario and the secondary business failure factor corresponding to the secondary business scenario; the second set includes multiple second failure factor combinations, each second failure factor combination includes at least one target non-critical failure factor and at least one secondary business failure factor;

[0162] Combining each first fault factor combination in the first set with each second fault factor combination in the second set, respectively, to obtain a plurality of target fault factor combinations;

[0163] According to the combination of multiple target fault factors, a target set is obtained.

[0164] In an optional embodiment, the main business scenario includes a first main business scenario and at least one second main business scenario; the target set determination unit 1103 is further configured to:

[0165] Combining each key failure factor corresponding to the first main business scenario with each key failure factor corresponding to at least one second main business scenario to obtain a plurality of first failure factor combinations;

[0166] A first set is obtained according to a plurality of first fault factor combinations.

[0167] In an optional embodiment, the main business scenario includes a first main business scenario and at least one second main business scenario; the target set determination unit 1103 is further configured to:

[0168] Combining each target non-critical failure factor corresponding to the first main business scenario with each target non-critical failure factor corresponding to at least one second main business scenario and each secondary business failure factor corresponding to the secondary business scenario to obtain a plurality of second failure factor combinations;

[0169] Selecting some second fault factor combinations from a plurality of second fault factor combinations as target second fault factor combinations;

[0170] According to the target second fault factor combination, a second set is obtained.

[0171] In an optional embodiment, the target set determination unit 1103 is further configured to:

[0172] Generate an initial second set according to a plurality of second fault factor combinations;

[0173] Combining each two fault factors included in each second fault factor combination respectively to obtain a plurality of pairwise fault factor combinations;

[0174] For each second fault factor combination in the initial second set, the following operations are performed respectively: one second fault factor combination in each second fault factor combination is used as the fault factor combination to be compared, and the other second fault factor combinations in each second fault factor combination except the fault factor combination to be compared are used as candidate fault factor combinations; each pairwise fault factor combination in the fault factor combination to be compared is compared with each pairwise fault factor combination in the target candidate fault factor combination, and the target candidate fault factor combination is one of the candidate fault factor combinations; if there is a pairwise fault factor combination in the target candidate fault factor combination that is the same as the fault factor combination to be compared, then the target candidate fault factor combination is deleted from the initial second set;

[0175] The remaining second fault factor combinations in the initial second set are used as target second fault factor combinations.

[0176] Based on the same inventive concept as the above method embodiment and device embodiment, an electronic device is also provided in the embodiment of the present application. The electronic device may be a server, such as Figure 1 In this embodiment, the structure of the electronic device can be as follows: Fig.12 As shown, it includes a memory 1201 , a communication module 1203 and one or more processors 1202 .

[0177] The memory 1201 is used to store computer programs executed by the processor 1202. The memory 1201 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and programs required for running the instant messaging function, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.

[0178] The memory 1201 may be a volatile memory, such as a random-access memory (RAM); the memory 1901 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), or the memory 1201 is any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 1201 may be a combination of the above memories.

[0179] The processor 1202 may include one or more central processing units (CPU) or a digital processing unit, etc. The processor 1202 is used to implement the above test script generation method when calling the computer program stored in the memory 1201 .

[0180] The communication module 1203 is used to communicate with the terminal device and other electronic devices. If the electronic device is a server, the server can receive multiple fault factors corresponding to multiple business scenarios sent by the terminal device through the communication module 1203.

[0181] The specific connection medium between the memory 1201, the communication module 1203 and the processor 1202 is not limited in the embodiment of the present application. Fig.12 In the embodiment, the memory 1201 and the processor 1202 are connected via a bus 1204. The bus 1204 is connected to the processor 1202 via a bus 1204. Fig.12 The connections between other components are shown in bold lines, and are not intended to be limiting. Bus 1204 can be divided into address bus, data bus, control bus, etc. For ease of representation, Fig.12 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0182] In another embodiment, the electronic device may also be a tablet computer, a desktop computer, a laptop computer, etc.

[0183] According to one aspect of the present application, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. The processor of a computer device reads the computer instructions from a computer-readable storage medium, and the processor executes the computer instructions so that the computer device executes the test script generation method in the above embodiment. The program product can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0184] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.

Claims

1. A test script generation method, characterized in that: The method comprises: Obtaining failure factors corresponding to a plurality of business scenarios respectively; the plurality of business scenarios include at least one primary business scenario and at least one secondary business scenario, each business scenario corresponds to a plurality of failure factors; each failure factor represents a failure occurring in a corresponding business scenario; Determine the critical failure factor and the non-critical failure factor among the failure factors corresponding to the main business scenario, and select the target non-critical failure factor from the non-critical failure factors; Determine a target set; the target set includes a plurality of target fault factor combinations, each target fault factor combination includes at least the following: at least one critical fault factor, and at least one target non-critical fault factor; According to the test case combination corresponding to each target fault factor combination in the target set, corresponding test scripts are generated respectively; wherein, the test case combination corresponding to each target fault factor combination is obtained according to the preset test case corresponding to each fault factor in the corresponding target fault factor combination.

2. The method according to claim 1, characterized in that Determining the critical failure factors and the non-critical failure factors among the failure factors corresponding to the main business scenario includes: Determine the number of occurrences of each failure factor corresponding to the main business scenario within a set time; According to the values ​​of the number of occurrences, various failure factors corresponding to the main business scenario are sorted; According to the sorting result, a set number of failure factors are selected from the multiple failure factors corresponding to the main business scenario as key failure factors; Among the multiple fault factors, other fault factors except the critical fault factor are regarded as non-critical fault factors.

3. The method according to claim 1, characterized in that Each target failure factor combination further includes at least one secondary service failure factor; the secondary service failure factor is determined from the failure factors corresponding to the secondary service scenario; Then the determining of the target set includes: Determine a first set according to the key failure factors corresponding to the main business scenario; the first set includes multiple first failure factor combinations, each of which includes at least one key failure factor; Determine a second set according to the target non-critical failure factor corresponding to the primary business scenario and the secondary business failure factor corresponding to the secondary business scenario; the second set includes multiple second failure factor combinations, each second failure factor combination includes at least one target non-critical failure factor and at least one secondary business failure factor; Combining each first fault factor combination in the first set with each second fault factor combination in the second set, respectively, to obtain a plurality of target fault factor combinations; A target set is obtained according to the multiple target fault factor combinations.

4. The method according to claim 3, characterized in that: The main business scenario includes a first main business scenario and at least one second main business scenario; Then, determining the first set according to the key failure factors corresponding to the main business scenario includes: Combining each key failure factor corresponding to the first main business scenario with each key failure factor corresponding to the at least one second main business scenario to obtain a plurality of first failure factor combinations; A first set is obtained according to the plurality of first failure factor combinations.

5. The method according to claim 3, characterized in that: The main business scenario includes a first main business scenario and at least one second main business scenario; Then, determining the second set according to the target non-critical failure factor corresponding to the primary business scenario and the secondary business failure factor corresponding to the secondary business scenario includes: Combining each target non-critical failure factor corresponding to the first main business scenario with each target non-critical failure factor corresponding to the at least one second main business scenario and each secondary business failure factor corresponding to the secondary business scenario to obtain a plurality of second failure factor combinations; Selecting some second fault factor combinations from the plurality of second fault factor combinations as target second fault factor combinations; A second set is obtained according to the target second fault factor combination.

6. The method according to claim 5, characterized in that The step of selecting some second fault factor combinations from the plurality of second fault factor combinations as target second fault factor combinations comprises: generating an initial second set according to the plurality of second fault factor combinations; Combining each two fault factors included in each second fault factor combination respectively to obtain a plurality of pairwise fault factor combinations; For each second fault factor combination in the initial second set, the following operations are performed respectively: taking one of the second fault factor combinations as a fault factor combination to be compared, and taking other second fault factor combinations of the second fault factor combinations except the fault factor combination to be compared as candidate fault factor combinations; Compare each pairwise fault factor combination in the fault factor combination to be compared with each pairwise fault factor combination in the target candidate fault factor combination, wherein the target candidate fault factor combination is one of the candidate fault factor combinations; If there are any two fault factor combinations in the target candidate fault factor combinations that are the same as the fault factor combinations to be compared, deleting the target candidate fault factor combinations from the initial second set; The remaining second fault factor combinations in the initial second set are used as target second fault factor combinations.

7. A test script generating device, characterized in that: include: A fault factor acquisition unit, used to respectively acquire fault factors corresponding to multiple business scenarios; The multiple business scenarios include at least one primary business scenario and at least one secondary business scenario, and each business scenario corresponds to multiple failure factors; Each failure factor represents a failure that occurs in the corresponding business scenario; A fault factor selection unit, configured to determine a critical fault factor and a non-critical fault factor from the fault factors corresponding to the main service scenario, and select a target non-critical fault factor from the non-critical fault factors; A target set determination unit, configured to determine a target set; the target set includes a plurality of target fault factor combinations, each of which includes at least the following: at least one critical fault factor and at least one target non-critical fault factor; A test script generation unit is used to generate corresponding test scripts according to the test case combination corresponding to each target fault factor combination in the target set; wherein the test case combination corresponding to each target fault factor combination is obtained according to the preset test case corresponding to each fault factor in the corresponding target fault factor combination.

8. The device according to claim 7, characterized in that The fault factor selection unit is specifically used for: Determine the number of occurrences of each failure factor corresponding to the main business scenario within a set time; According to the values ​​of the number of occurrences, various failure factors corresponding to the main business scenario are sorted; According to the sorting result, a set number of failure factors are selected from the multiple failure factors corresponding to the main business scenario as key failure factors; Among the multiple fault factors, other fault factors except the critical fault factor are regarded as non-critical fault factors.

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

10. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the computer program is executed by the processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Fault injection method and device, electronic equipment and storage medium

    CN111651353A

  • Software testing method and system, storage medium and computer equipment

    CN111858371A

  • System using a unique marker with each software code-block

    US20110191754A1

  • Software component placement on execution platforms

    US20130080996A1

  • Scenarios based fault injection

    US20180285239A1