Interface testing method and device, electronic equipment and storage medium
By comparing the logs and business scenario tree structure data of the online environment and the test environment, determining the test sufficiency and automating the interface test, the problem of inconsistent testing environment and online environment business scenarios in complex business scenarios is solved, and the testing efficiency and accuracy.
Patent Information
- Application Number
- CN202411733290.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-02-11
AI Technical Summary
In complex business scenarios, existing interface automation testing methods are difficult to ensure the consistency of the business scenarios between the test environment and the online environment, resulting in the failure of the test plan.
By obtaining online environment logs, test environment logs and business scenario tree structure data, comparing the two to determine the test sufficiency, determining the set of business scenarios to be tested based on the sufficiency, and performing interface testing based on the set and business scenario tree structure data, Generate test information.
Ensure that the business scenarios executed in the test environment are consistent with the business scenarios executed in the online environment, and improve the efficiency and accuracy of interface automation testing in complex business scenarios.
Smart Images

Figure CN119415402A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer system software testing, and in particular to an interface testing method, an interface testing device, an electronic device and a storage medium. Background Art
[0002] Interface automation testing is the process of automatically executing interface testing through software. Its purpose is to verify whether the interaction between components in the software system is feasible. Interface automation can effectively improve testing efficiency and provide assurance for the quality of the interface. Common interface automation testing methods include unit testing, integration testing, end-to-end testing, and contract testing. End-to-end testing simulates real user scenarios and can discover things that users may encounter during use. During the development process, developers, faced with complex business scenarios, will first develop the dependent business scenarios and then develop the business scenarios themselves. These business scenarios need to be manually arranged to make a qualified test plan, which can be used for stability testing in the test environment or online environment. Once the business scenario is disrupted, the test plan may not be usable, which leads to inconsistencies between the test environment and the online environment. Summary of the invention
[0003] In view of the above problems, embodiments of the present invention are proposed to provide an interface testing method, an interface testing device, an electronic device and a storage medium that overcome the above problems or at least partially solve the above problems.
[0004] In order to solve the above problems, in a first aspect of the invention, an embodiment of the present invention discloses an interface testing method, comprising:
[0005] Obtain online environment logs, test environment logs, and business scenario tree structure data;
[0006] Comparing the online environment log with the test environment log to determine the test adequacy;
[0007] Determining a set of business scenarios to be tested based on the test adequacy;
[0008] Interface testing is performed according to the set of business scenarios to be tested and the business scenario tree structure data to generate test information.
[0009] Optionally, the method further comprises:
[0010] Get the business scenario model of the interface to be tested;
[0011] Parsing the business scenario model to generate a business scenario field set;
[0012] Determining business scenario dependencies based on the business scenario field set;
[0013] The business scenario tree structure data is generated based on the business scenario dependency relationship.
[0014] Optionally, the step of comparing the online environment log and the test environment log to determine the test adequacy includes:
[0015] Parse the online environment log to determine a set of running business scenarios;
[0016] Parsing the test environment log to determine a set of executed business scenarios;
[0017] The running business scenario set and the executed business scenario set are compared to determine the test adequacy.
[0018] Optionally, the step of comparing the set of running business scenarios with the set of executed business scenarios to determine the test adequacy includes:
[0019] Calculating the intersection of the running business scenario set and the executed business scenario set;
[0020] The ratio of the intersection to the set of running business scenarios is determined as the test adequacy.
[0021] Optionally, the step of determining a set of business scenarios to be tested based on the test adequacy includes:
[0022] In response to the test adequacy being 1, determining that the set of business scenarios to be tested is an empty set;
[0023] In response to the test sufficiency not being 1, determining that the set of business scenarios to be tested is the complement of the intersection with respect to the set of running business scenarios.
[0024] Optionally, the step of performing interface testing according to the set of business scenarios to be tested and the business scenario tree structure data and generating test information comprises:
[0025] Determine whether the business scenario set to be tested is an empty set;
[0026] In response to the set of business scenarios to be tested being an empty set, generating test information;
[0027] In response to the set of business scenarios to be tested not being an empty set, acquiring a target business scenario to be tested from the set of business scenarios to be tested;
[0028] Based on the business scenario dependency, determining an associated business scenario to be tested that is associated with the target business scenario to be tested;
[0029] Testing is performed based on the target business scenario to be tested and the associated business scenario to be tested.
[0030] Optionally, the step of performing interface testing according to the set of business scenarios to be tested and the business scenario tree structure data and generating test information further includes:
[0031] The target business scenario to be tested and the associated business scenario to be tested are used to update the business scenario set to be tested, and the updated business scenario set to be tested is used to perform the step of determining whether the business scenario set to be tested is an empty set until the business scenario set to be tested is an empty set.
[0032] In a second aspect of the present invention, an embodiment of the present invention discloses an interface testing device, comprising:
[0033] The first acquisition module is used to obtain online environment logs, test environment logs and business scenario tree structure data;
[0034] A comparison module, used to compare the online environment log and the test environment log to determine the test adequacy;
[0035] A determination module, used to determine a set of business scenarios to be tested based on the test adequacy;
[0036] The testing module is used to perform interface testing based on the business scenario set to be tested and the business scenario tree structure data to generate test information.
[0037] According to a third aspect of the present invention, an embodiment of the present invention discloses an electronic device, comprising a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the steps of the interface testing method as described above when executed by the processor.
[0038] In a fourth aspect of the present invention, an embodiment of the present invention discloses a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the interface testing method described above are implemented.
[0039] The embodiments of the present invention include the following advantages:
[0040] The embodiment of the present invention obtains online environment logs, test environment logs and business scenario structure tree data; compares the online environment logs and the test environment logs to determine the test adequacy; determines a set of business scenarios to be tested based on the test adequacy; performs interface testing based on the set of business scenarios to be tested and the business scenario tree structure data to generate test information. By calculating the test adequacy of the test environment based on the online environment, and then automatically performing interface testing based on the test adequacy until the test is comprehensive, the business scenarios executed in the test environment and the business scenarios executed in the online environment can be effectively ensured to be consistent, thereby improving and making up for the deficiencies of the interface automation testing method in complex business scenarios in current software testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 is a flowchart of steps of an interface testing method embodiment of the present invention;
[0042] Figure 2 is a flowchart of another interface testing method embodiment of the present invention;
[0043] Figure 3 It is a node schematic diagram of the business scenario tree structure data of the present invention;
[0044] Figure 4 It is a schematic diagram of the test flow of the present invention;
[0045] Figure 5 is a flowchart of an example of an interface testing method of the present invention;
[0046] Figure 6 is a structural block diagram of an embodiment of an interface testing device of the present invention;
[0047] Figure 7 is a structural block diagram of an electronic device provided by an embodiment of the present invention;
[0048] Figure 8 It is a structural block diagram of a storage medium provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0049] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0050] Reference Figure 1 , shows a flowchart of the steps of an interface testing method embodiment of the present invention, and the interface testing method may specifically include the following steps:
[0051] Step 101, obtaining online environment logs, test environment logs and business scenario tree structure data;
[0052] In an embodiment of the present invention, an online environment log, a test environment log, and a business scenario tree structure data can be obtained. The online environment log is an operation log of the online environment. The test environment log is an operation log of the test environment. The data type and format of the online environment log and the test environment log can be the same, or there can be certain differences. The business scenario tree structure data stores the relationship between different business scenarios.
[0053] Step 102, comparing the online environment log and the test environment log to determine the test adequacy;
[0054] Compare the online environment logs with the test environment logs to determine the degree of match between the business scenarios tested in the current test environment and the business scenarios in the actual operation of the online environment, and determine the adequacy of the test.
[0055] Step 103, determining a set of business scenarios to be tested based on the test adequacy;
[0056] A set of untested business scenarios is determined based on the corresponding test adequacy.
[0057] Step 104: Perform interface testing based on the set of business scenarios to be tested and the business scenario tree structure data to generate test information.
[0058] The business scenarios to be tested and the business scenario tree structure data are used to determine the business scenarios to be tested and the corresponding test sequence. Interface testing is performed on the interface to generate test information. Various vulnerabilities and other defects found in the test are recorded through the test information.
[0059] The embodiment of the present invention obtains the online environment log, the test environment log and the business scenario tree structure data; compares the online environment log and the test environment log to determine the test adequacy; determines the set of business scenarios to be tested based on the test adequacy; performs interface testing based on the set of business scenarios to be tested and the business scenario tree structure data to generate test information. By calculating the test adequacy of the test environment based on the online environment, and then automatically performing interface testing based on the test adequacy until the test is comprehensive, the business scenarios executed in the test environment and the business scenarios executed in the online environment can be effectively ensured to be consistent, thereby improving and making up for the deficiencies of the interface automation testing method in complex business scenarios in current software testing.
[0060] Reference Figure 2 , shows a flow chart of steps of another interface testing method embodiment of the present invention, the interface testing method may specifically include the following steps:
[0061] Step 201, obtaining a business scenario model of the interface to be tested;
[0062] Before testing an interface, a business scenario model of the interface to be tested may be obtained. The business scenario model is a mathematical model of a business scenario in an online environment, and includes a set of fields that can determine the business scenario and dependencies between business scenarios.
[0063] Step 202, parsing the business scenario model to generate a business scenario field set;
[0064] The business scenario model can be parsed, the business scenario fields contained in the business scenario model can be read from the business scenario model, and the business scenario fields can be merged to obtain a business scenario field set.
[0065] For example, select the software system server interface A as the object to be tested, define the business scenario model, and analyze all the parameters of interface A, including url, url parameters, load parameters, request method and other parameters, and select the field set that can determine different business scenarios. For example, if parameters A1, A2, and A3 can determine all business scenarios of the interface, then the business scenario field set of interface A is X. A =A1*A2*A3.
[0066] Step 203, determining business scenario dependencies based on the business scenario field set;
[0067] Considering that there may be dependencies between business scenarios, such as business scenarios Depends on business scenario and business scenarios Business scenario Can be expressed Business Scenario Indicates the i-th business scenario in interface A.
[0068] Based on the business scenario associations corresponding to the various business scenario fields in the business scenario field set, the business scenario dependencies are determined.
[0069] Step 204, generating the business scenario tree structure data based on the business scenario dependency relationship;
[0070] Using a tree structure data storage structure such as a binary tree, the business scenario is taken as a node, and the business scenario dependency relationship is taken as an edge, which is written into the corresponding tree structure to generate business scenario tree structure data. The business scenario tree structure data facilitates the search for business scenario dependencies when the business scenario is automatically executed, and can also be used to verify the integrity of the business scenario.
[0071] like Figure 3As shown, business scenario A depends on business scenarios B and C, while business scenario B depends on business scenarios D, E, and F, and business scenario C depends on business scenario G. Based on the tree structure describing the dependency relationship between business scenarios, the correctness or completeness of the business scenarios can be effectively checked, which provides a guarantee for the successful execution of the business scenarios to a certain extent. When a business scenario is an independent scenario, the root node and the leaf node in the dependency graph of the business scenario are the same node; when a business scenario depends on other business scenarios, by judging that all the leaf nodes in the relationship tree between the business scenarios are independent business scenarios, it means that the description of the business scenario is complete. If there is a dependent business scenario in the leaf node, it means that the business scenario is incomplete. Even if the use case scenario is executed, it will result in execution failure.
[0072] Step 205, obtaining online environment logs, test environment logs and business scenario tree structure data;
[0073] When testing, you can obtain online environment logs, test environment logs, and business scenario tree structure data from the storage space of the interface to be tested or a third-party database.
[0074] Step 206, comparing the online environment log and the test environment log to determine the test adequacy;
[0075] Compare the business scenarios in the online environment log with those in the test environment log to determine the adequacy of the test.
[0076] In an optional embodiment of the present invention, the step of comparing the online environment log and the test environment log to determine the test adequacy includes:
[0077] Sub-step S2061, parsing the online environment log to determine the set of running business scenarios; parsing the test environment log to determine the set of executed business scenarios;
[0078] For the calculation of test adequacy, the content of the online environment log can be parsed first, the running business scenarios can be counted, and a running business scenario set can be generated. That is, the running business scenario set is a business scenario set running in the online environment.
[0079] The content of the test environment log may also be parsed, and the business scenarios that have been tested may be counted to generate a set of executed business scenarios, that is, the set of executed business scenarios is a set of business scenarios that have been tested in the test environment.
[0080] Sub-step S2062, comparing the running business scenario set with the executed business scenario set to determine the test adequacy.
[0081] Compare the differences in business scenarios between the set of running business scenarios and the set of executed business scenarios to determine the adequacy of the test.
[0082] Specifically, the step of comparing the running business scenario set with the executed business scenario set to determine the test adequacy includes: calculating the intersection of the running business scenario set and the executed business scenario set; and determining the ratio of the intersection to the running business scenario set as the test adequacy.
[0083] In practical applications, the union of the running business scenario set and the executed business scenario set can be calculated, and the business scenarios that have been tested in the running business scenario set can be determined through the intersection. The ratio of the intersection to the running business scenario set can be determined as the test adequacy. When the test adequacy is 1, all scenarios in the running business scenario set have been tested. When the test adequacy is less than 1, there are still untested business scenarios in the running business scenario set.
[0084] Step 207, determining a set of business scenarios to be tested based on the test adequacy;
[0085] The set of business scenarios to be tested can be determined based on the degree of test adequacy.
[0086] Specifically, the step of determining the set of business scenarios to be tested based on the test adequacy includes: in response to the test adequacy being 1, determining that the set of business scenarios to be tested is an empty set; in response to the test adequacy not being 1, determining that the set of business scenarios to be tested is the complement of the intersection with respect to the set of running business scenarios.
[0087] When the test adequacy is 1, all scenarios have been tested and there is no business scenario that needs to be tested. In response to the test adequacy being 1, it can be determined that the set of business scenarios to be tested is an empty set.
[0088] When the test adequacy is not 1, there are still untested business scenarios. In response to the test adequacy not being 1, the complement of the intersection of the running business scenario set and the executed business scenario set for the running business scenario set can be determined. The business scenarios included in the complement are used as elements in the business scenario set to be tested.
[0089] Step 208: Perform interface testing based on the business scenario set to be tested and the business scenario tree structure data to generate test information.
[0090] After obtaining the set of business scenarios to be tested, the scenarios in the set of business scenarios to be tested are obtained, and the interface to be tested is tested in combination with the dependency relationship of the business scenarios in the business scenario tree structure data to generate test information.
[0091] In an optional embodiment of the present invention, the step of performing interface testing according to the set of business scenarios to be tested and the business scenario tree structure data and generating test information comprises:
[0092] Sub-step S2081, determining whether the business scenario set to be tested is an empty set;
[0093] It can be determined whether the service scenario set to be tested is an empty set. The embodiment of the present invention does not specifically limit the method for determining an empty set.
[0094] Sub-step S2082, in response to the set of business scenarios to be tested being an empty set, generating test information;
[0095] When the set of business scenarios to be tested is an empty set, it means that the testing of all business scenarios has been completed. In response to the set of business scenarios to be tested being an empty set, the vulnerabilities in the testing process can be recorded to generate test information.
[0096] Sub-step S2083, in response to the set of business scenarios to be tested being not an empty set, obtaining a target business scenario to be tested from the set of business scenarios to be tested;
[0097] When the set of business scenarios to be tested is not an empty set, the test needs to be continued. In response to the set of business scenarios to be tested being not an empty set, any business scenario can be obtained from the set of business scenarios to be tested as a target business scenario to be tested.
[0098] Sub-step S2084, determining, based on the business scenario dependency, an associated business scenario to be tested that is associated with the target business scenario to be tested;
[0099] Based on the business scenario dependency, in the set of business scenarios to be tested, the business scenarios associated with the target business scenario to be tested are determined as the associated business scenarios to be tested.
[0100] Sub-step S2085: performing a test based on the target business scenario to be tested and the associated business scenario to be tested.
[0101] The target business scenario to be tested and the associated business scenario to be tested are tested on the interface to be tested based on the dependency relationship.
[0102] Sub-step S2086, using the target business scenario to be tested and the associated business scenario to be tested to update the set of business scenarios to be tested, and using the updated set of business scenarios to be tested to perform the step of determining whether the set of business scenarios to be tested is an empty set, until the set of business scenarios to be tested is an empty set.
[0103] After the interface to be tested is tested using the target business scenario to be tested and the associated business scenario to be tested, the set of business scenarios to be tested may be updated using the target business scenario to be tested and the associated business scenario to be tested to further reduce the business scenarios in the set of business scenarios to be tested.
[0104] The updated set of business scenarios to be tested is further judged to determine whether it is an empty set, and then the cycle test is performed again until the set of business scenarios to be tested is an empty set, that is, all business scenarios have completed the test.
[0105] For example, see Figure 4 When executing the business scenario set Q, first determine whether the scenario set Q is empty. If it is empty, the test environment stops executing; if it is not empty, randomly select a business scenario Qi from Q to execute; if the business scenario Qi is an independent business scenario, directly execute Qi and then update the business scenario set Q; if it is a dependent business scenario, search for Qi's dependent business scenarios in turn based on the business scenario dependency tree until the independent business scenario in the dependent business scenario is found, execute all independent business scenarios of the dependent business scenario, and then recursively execute the upper-level dependent business scenario until Qi is executed and the business scenario set Q is updated.
[0106] The embodiment of the present invention can effectively ensure the integrity of the business scenario by using a tree to store the dependency relationship between various business scenarios, and provide a certain degree of guarantee for the successful execution of the business scenario; by connecting ES to the online environment and the test environment, its powerful analysis and search functions can obtain the business scenario set executed by the online environment and the test environment, and then obtain the test sufficiency; by executing the unexecuted business scenario set through the automation module, and then updating the executed business scenario set in the test environment, it provides a certain guarantee for the business scenario that the test environment executes the same as the online environment, which plays an important role in integration testing, version iteration, bug discovery, etc. It can effectively make up for the shortcomings of the current complex use case scenario interface automation testing method.
[0107] In order to make the embodiments of the present invention clear to those skilled in the art, refer to Figure 5 , the following is an example:
[0108] Select the software system server interface as the object to be tested, define the business scenario model, and determine the interface test business scenario set by analyzing all the parameters of the interface.
[0109] Determine the set of business scenarios to be executed in the production environment.
[0110] Connect the interface of the software to be tested to the ES search engine. Through the powerful cleaning and analysis capabilities of ES, obtain the business scenario sets P and T executed by the online environment and the test environment in a single time period respectively. Take the intersection of P and T to get M, and the test adequacy of the business scenarios in the test environment is M / P.
[0111] Based on the calculation of test adequacy, if the test adequacy is 1, it indicates that the test environment executes the same business scenarios as the online environment. During the test cycle, the test environment can stop executing the business scenario test of test interface A. If the test adequacy is not 1, it indicates that the business scenarios executed by the test environment are not as rich as those of the online environment. The business scenario set Q that is not executed by the test environment is obtained by taking the complement of M and P, and then Q is automatically tested in the test environment. Specifically, if the set of unexecuted business scenarios is not empty, randomly select a business scenario a and determine whether the business scenario is an independent business scenario. If a is an independent business scenario, directly execute it and then update the set of unexecuted business scenarios; if a is a dependent business scenario, find all the independent business scenarios that a depends on based on the business scenario dependency tree and execute these independent business scenarios, and then recursively execute the dependent scenarios of the independent business scenarios in turn until the set of unexecuted business scenarios is updated after business scenario a is executed. When the unexecuted business scenarios are empty, stop executing, and then update the set of use cases executed in the test environment. Again, calculate the test adequacy of the test environment through the set of business scenarios executed in the online environment and the test environment, and repeat the cycle until the interface test is stopped when the test adequacy is 1.
[0112] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0113] Reference Figure 6 , shows a structural block diagram of an interface testing device embodiment of the present invention, and the interface testing device may specifically include the following modules:
[0114] The first acquisition module 601 is used to acquire online environment logs, test environment logs and business scenario tree structure data;
[0115] A comparison module 602 is used to compare the online environment log and the test environment log to determine the test adequacy;
[0116] A determination module 603 is used to determine a set of business scenarios to be tested based on the test adequacy;
[0117] The testing module 604 is used to perform interface testing according to the set of business scenarios to be tested and the business scenario tree structure data, and generate test information.
[0118] In an optional embodiment of the present invention, the device further comprises:
[0119] The second acquisition module is used to acquire the business scenario model of the interface to be tested;
[0120] A parsing module, used to parse the business scenario model and generate a business scenario field set;
[0121] A determination module, used to determine business scenario dependencies based on the business scenario field set;
[0122] A writing module is used to generate the business scenario tree structure data based on the business scenario dependency relationship.
[0123] In an optional embodiment of the present invention, the comparison module 602 includes:
[0124] A first parsing submodule is used to parse the online environment log and determine a set of running business scenarios;
[0125] A second parsing submodule is used to parse the test environment log to determine a set of executed business scenarios;
[0126] The comparison submodule is used to compare the running business scenario set with the executed business scenario set to determine the test adequacy.
[0127] In an optional embodiment of the present invention, the comparison submodule includes:
[0128] A calculation unit, used to calculate the intersection of the running business scenario set and the executed business scenario set;
[0129] A determination unit is used to determine a ratio of the intersection to the set of running business scenarios as a test adequacy.
[0130] In an optional embodiment of the present invention, the determining module 603 includes:
[0131] An empty set module, configured to determine, in response to the test sufficiency being 1, that the set of business scenarios to be tested is an empty set;
[0132] A complement module is used for determining, in response to the test sufficiency not being 1, that the set of business scenarios to be tested is the complement of the intersection with respect to the set of running business scenarios.
[0133] In an optional embodiment of the present invention, the testing module 604 includes:
[0134] A judgment submodule, used to judge whether the business scenario set to be tested is an empty set;
[0135] A first response submodule, configured to generate test information in response to the set of business scenarios to be tested being an empty set;
[0136] A second response submodule, configured to obtain a target business scenario to be tested from the business scenario set to be tested in response to the business scenario set to be tested not being an empty set;
[0137] An association submodule, used to determine, based on the business scenario dependency, an associated business scenario to be tested that is associated with the target business scenario to be tested;
[0138] The testing submodule is used to perform testing based on the target business scenario to be tested and the associated business scenario to be tested.
[0139] In an optional embodiment of the present invention, the testing module 604 further includes:
[0140] A continuous module is used to update the set of business scenarios to be tested by using the target business scenario to be tested and the associated business scenario to be tested, and to use the updated set of business scenarios to be tested to perform the step of determining whether the set of business scenarios to be tested is an empty set until the set of business scenarios to be tested is an empty set.
[0141] The embodiment of the present invention obtains the online environment log, the test environment log and the business scenario tree structure data; compares the online environment log and the test environment log to determine the test adequacy; determines the set of business scenarios to be tested based on the test adequacy; performs interface testing based on the set of business scenarios to be tested and the business scenario tree structure data to generate test information. By calculating the test adequacy of the test environment based on the online environment, and then automatically performing interface testing based on the test adequacy until the test is comprehensive, the business scenarios executed in the test environment and the business scenarios executed in the online environment can be effectively ensured to be consistent, thereby improving and making up for the deficiencies of the interface automation testing method in complex business scenarios in current software testing.
[0142] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0143] Reference Figure 7 , an embodiment of the present invention further provides an electronic device, including:
[0144] A processor 701 and a storage medium 702, wherein the storage medium 702 stores a computer program executable by the processor 701, and when the electronic device is running, the processor 701 executes the computer program to perform the interface testing method as described in any one of the embodiments of the present invention.
[0145] The interface testing method comprises:
[0146] Obtain online environment logs, test environment logs, and business scenario tree structure data;
[0147] Comparing the online environment log with the test environment log to determine the test adequacy;
[0148] Determining a set of business scenarios to be tested based on the test adequacy;
[0149] Interface testing is performed according to the set of business scenarios to be tested and the business scenario tree structure data to generate test information.
[0150] Optionally, the method further comprises:
[0151] Get the business scenario model of the interface to be tested;
[0152] Parsing the business scenario model to generate a business scenario field set;
[0153] Determining business scenario dependencies based on the business scenario field set;
[0154] The business scenario tree structure data is generated based on the business scenario dependency relationship.
[0155] Optionally, the step of comparing the online environment log and the test environment log to determine the test adequacy includes:
[0156] Parse the online environment log to determine a set of running business scenarios;
[0157] Parsing the test environment log to determine a set of executed business scenarios;
[0158] The running business scenario set and the executed business scenario set are compared to determine the test adequacy.
[0159] Optionally, the step of comparing the set of running business scenarios with the set of executed business scenarios to determine the test adequacy includes:
[0160] Calculating the intersection of the running business scenario set and the executed business scenario set;
[0161] The ratio of the intersection to the set of running business scenarios is determined as the test adequacy.
[0162] Optionally, the step of determining a set of business scenarios to be tested based on the test adequacy includes:
[0163] In response to the test adequacy being 1, determining that the set of business scenarios to be tested is an empty set;
[0164] In response to the test sufficiency not being 1, determining that the set of business scenarios to be tested is the complement of the intersection with respect to the set of running business scenarios.
[0165] Optionally, the step of performing interface testing according to the set of business scenarios to be tested and the business scenario tree structure data and generating test information comprises:
[0166] Determine whether the business scenario set to be tested is an empty set;
[0167] In response to the set of business scenarios to be tested being an empty set, generating test information;
[0168] In response to the set of business scenarios to be tested not being an empty set, acquiring a target business scenario to be tested from the set of business scenarios to be tested;
[0169] Based on the business scenario dependency, determining an associated business scenario to be tested that is associated with the target business scenario to be tested;
[0170] Testing is performed based on the target business scenario to be tested and the associated business scenario to be tested.
[0171] Optionally, the step of performing interface testing according to the set of business scenarios to be tested and the business scenario tree structure data and generating test information further includes:
[0172] The target business scenario to be tested and the associated business scenario to be tested are used to update the business scenario set to be tested, and the updated business scenario set to be tested is used to perform the step of determining whether the business scenario set to be tested is an empty set until the business scenario set to be tested is an empty set.
[0173] The embodiment of the present invention obtains the online environment log, the test environment log and the business scenario tree structure data; compares the online environment log and the test environment log to determine the test adequacy; determines the set of business scenarios to be tested based on the test adequacy; performs interface testing based on the set of business scenarios to be tested and the business scenario tree structure data to generate test information. By calculating the test adequacy of the test environment based on the online environment, and then automatically performing interface testing based on the test adequacy until the test is comprehensive, the business scenarios executed in the test environment and the business scenarios executed in the online environment can be effectively ensured to be consistent, thereby improving and making up for the deficiencies of the interface automation testing method in complex business scenarios in current software testing.
[0174] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the processor.
[0175] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0176] Reference Figure 8 The embodiment of the present invention further provides a computer-readable storage medium 801, on which a computer program is stored. When the computer program is executed by a processor, the interface testing method as described in any one of the embodiments of the present invention is executed.
[0177] The interface testing method comprises:
[0178] Obtain online environment logs, test environment logs, and business scenario tree structure data;
[0179] Comparing the online environment log with the test environment log to determine the test adequacy;
[0180] Determining a set of business scenarios to be tested based on the test adequacy;
[0181] Interface testing is performed according to the set of business scenarios to be tested and the business scenario tree structure data to generate test information.
[0182] Optionally, the method further comprises:
[0183] Get the business scenario model of the interface to be tested;
[0184] Parsing the business scenario model to generate a business scenario field set;
[0185] Determining business scenario dependencies based on the business scenario field set;
[0186] The business scenario tree structure data is generated based on the business scenario dependency relationship.
[0187] Optionally, the step of comparing the online environment log and the test environment log to determine the test adequacy includes:
[0188] Parse the online environment log to determine a set of running business scenarios;
[0189] Parsing the test environment log to determine a set of executed business scenarios;
[0190] The running business scenario set and the executed business scenario set are compared to determine the test adequacy.
[0191] Optionally, the step of comparing the set of running business scenarios with the set of executed business scenarios to determine the test adequacy includes:
[0192] Calculating the intersection of the running business scenario set and the executed business scenario set;
[0193] The ratio of the intersection to the set of running business scenarios is determined as the test adequacy.
[0194] Optionally, the step of determining a set of business scenarios to be tested based on the test adequacy includes:
[0195] In response to the test adequacy being 1, determining that the set of business scenarios to be tested is an empty set;
[0196] In response to the test sufficiency not being 1, determining that the set of business scenarios to be tested is the complement of the intersection with respect to the set of running business scenarios.
[0197] Optionally, the step of performing interface testing according to the set of business scenarios to be tested and the business scenario tree structure data and generating test information comprises:
[0198] Determine whether the business scenario set to be tested is an empty set;
[0199] In response to the set of business scenarios to be tested being an empty set, generating test information;
[0200] In response to the set of business scenarios to be tested not being an empty set, acquiring a target business scenario to be tested from the set of business scenarios to be tested;
[0201] Based on the business scenario dependency, determining an associated business scenario to be tested that is associated with the target business scenario to be tested;
[0202] Testing is performed based on the target business scenario to be tested and the associated business scenario to be tested.
[0203] Optionally, the step of performing interface testing according to the set of business scenarios to be tested and the business scenario tree structure data and generating test information further includes:
[0204] The target business scenario to be tested and the associated business scenario to be tested are used to update the business scenario set to be tested, and the updated business scenario set to be tested is used to perform the step of determining whether the business scenario set to be tested is an empty set until the business scenario set to be tested is an empty set.
[0205] The embodiment of the present invention obtains the online environment log, the test environment log and the business scenario tree structure data; compares the online environment log and the test environment log to determine the test adequacy; determines the set of business scenarios to be tested based on the test adequacy; performs interface testing based on the set of business scenarios to be tested and the business scenario tree structure data to generate test information. By calculating the test adequacy of the test environment based on the online environment, and then automatically performing interface testing based on the test adequacy until the test is comprehensive, the business scenarios executed in the test environment and the business scenarios executed in the online environment can be effectively ensured to be consistent, thereby improving and making up for the deficiencies of the interface automation testing method in complex business scenarios in current software testing.
[0206] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0207] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0208] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0209] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0210] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0211] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0212] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0213] The above is a detailed introduction to an interface testing method, an interface testing device, an electronic device and a storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. An interface testing method, characterized in that: include: Obtain online environment logs, test environment logs, and business scenario tree structure data; Comparing the online environment log with the test environment log to determine the test adequacy; Determining a set of business scenarios to be tested based on the test adequacy; Interface testing is performed according to the set of business scenarios to be tested and the business scenario tree structure data to generate test information.
2. The method according to claim 1, characterized in that The method further comprises: Get the business scenario model of the interface to be tested; Parsing the business scenario model to generate a business scenario field set; Determining business scenario dependencies based on the business scenario field set; The business scenario tree structure data is generated based on the business scenario dependency relationship.
3. The method according to claim 2, characterized in that The step of comparing the online environment log and the test environment log to determine the test adequacy includes: Parse the online environment log to determine a set of running business scenarios; Parsing the test environment log to determine a set of executed business scenarios; The running business scenario set and the executed business scenario set are compared to determine the test adequacy.
4. The method according to claim 3, characterized in that: The step of comparing the running business scenario set with the executed business scenario set to determine the test adequacy comprises: Calculating the intersection of the running business scenario set and the executed business scenario set; The ratio of the intersection to the set of running business scenarios is determined as the test adequacy.
5. The method according to claim 3, characterized in that: The step of determining a set of business scenarios to be tested based on the test adequacy comprises: In response to the test adequacy being 1, determining that the set of business scenarios to be tested is an empty set; In response to the test sufficiency not being 1, determining that the set of business scenarios to be tested is the complement of the intersection with respect to the set of running business scenarios.
6. The method according to claim 1, characterized in that The step of performing interface testing according to the set of business scenarios to be tested and the business scenario tree structure data and generating test information comprises: Determine whether the business scenario set to be tested is an empty set; In response to the set of business scenarios to be tested being an empty set, generating test information; In response to the set of business scenarios to be tested not being an empty set, acquiring a target business scenario to be tested from the set of business scenarios to be tested; Based on the business scenario dependency, determining an associated business scenario to be tested that is associated with the target business scenario to be tested; Testing is performed based on the target business scenario to be tested and the associated business scenario to be tested.
7. The method according to claim 6, characterized in that The step of performing interface testing according to the set of business scenarios to be tested and the business scenario tree structure data and generating test information further comprises: The target business scenario to be tested and the associated business scenario to be tested are used to update the business scenario set to be tested, and the updated business scenario set to be tested is used to perform the step of determining whether the business scenario set to be tested is an empty set until the business scenario set to be tested is an empty set.
8. An interface testing device, characterized in that: include: The first acquisition module is used to obtain online environment logs, test environment logs and business scenario tree structure data; A comparison module, used to compare the online environment log and the test environment log to determine the test adequacy; A determination module, used to determine a set of business scenarios to be tested based on the test adequacy; The testing module is used to perform interface testing based on the business scenario set to be tested and the business scenario tree structure data to generate test information.
9. An electronic device, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the steps of the memory allocation method according to any one of claims 1 to 7 when executed by the processor.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the memory allocation step according to any one of claims 1 to 7 is implemented.