Software testing method and device
By generating spatio-temporal maps and shadow client monitoring, it automatically identifies user scenarios and generates test cases, solving the problems of low efficiency and poor accuracy in scenario-based testing of cloud platforms, and achieving efficient and accurate automated testing.
Patent Information
- Application Number
- PCT/CN2023/124446
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-28
- Filing Date
- 2023-10-13
- Publication Date
- 2024-09-06
AI Technical Summary
Existing cloud platforms rely on the experience of testers during scenario testing, resulting in low testing efficiency and poor accuracy. Changes in user scenarios require manual re-analysis and sorting, resulting in long testing cycles and poor applicability.
By obtaining the API call sequence of the cloud platform, a spatio-temporal map is generated, user scenarios are identified, and test cases are automatically generated. The shadow client is used to monitor API calls, eliminate redundant scenarios, and improve test accuracy and efficiency.
It realizes automated user scenario identification and test case generation, improves the accuracy and efficiency of scenario testing, reduces redundant testing, and improves the adaptability and accuracy of testing.
Smart Images

Figure CN2023124446_06092024_PF_FP
Abstract
Description
Software testing method and device
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on February 28, 2023, with application number 202310179118.4 and invention name “A Software Testing Method and Device”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present invention relates to the field of computers, and more particularly to a software testing method and apparatus. Background Art
[0003] With the increasing popularity of cloud service technologies, cloud platforms based on these technologies are becoming increasingly widely used. Due to the massive scale of component services involved in cloud platforms, and the fact that they host users and business applications from diverse industries, the user scenarios on cloud platforms are becoming increasingly complex and constantly changing. Therefore, cloud platforms require scenario-based testing based on these user scenarios.
[0004] Current cloud platforms perform scenario-based testing by requiring testers to analyze user scenarios according to all user processes and write test cases based on different scenario definitions and frameworks. The cloud platform then executes the scenario-based testing based on these test cases. Because test case writing relies heavily on the tester's experience and is highly subjective, it's difficult to quickly and comprehensively obtain scenario-based test results. Furthermore, the variability of test cases written by different people can lead to significant deviations in test results, resulting in low testing efficiency and poor test accuracy.
[0005] At the same time, since user usage scenarios in cloud scenarios are constantly changing, once there are new user usage scenarios or user usage scenarios change, manual re-analysis and sorting are required, resulting in a long testing cycle and poor overall applicability.
[0006] Summary of the Invention
[0007] The embodiments of the present application provide a software method and apparatus for improving the testing efficiency of scenario-based software testing.
[0008] The first aspect of the embodiment of the present application provides a software testing method, which can be executed by a computing device, or by a component of the computing device, such as a processor, chip or chip system of the computing device, or by a logic module or software that can realize all or part of the functions of the computing device. Taking the execution of a computing device as an example, the method provided in the first aspect includes the following steps: the computing device obtains the application program interface API call sequence of the cloud platform, the API call sequence includes the API call records sorted by time in the cloud platform, and the API call records include the API names called by the computing device at different times. The computing device generates a spatiotemporal graph based on the API call sequence, and the spatiotemporal graph includes the call relationship and call time between multiple APIs. The computing device identifies user scenarios based on the spatiotemporal graph, and generates test cases corresponding to different user scenarios. The different user scenarios are different user scenarios after eliminating redundant user scenarios. The computing device uses test cases to perform software testing.
[0009] In the embodiment of the present application, the computing device can analyze the user scenario based on the application program interface API call sequence and generate test cases corresponding to the user scenario, so that the computing device can automatically perform user scenario testing based on the test case, avoiding manual portable test cases, improving the test accuracy of the cloud platform for scenario testing, and also accurately improving the test efficiency of the cloud platform for scenario testing.
[0010] In one possible implementation, a computing device deploys a shadow client on the gateway corresponding to the API. The shadow client monitors the user's API call information on the cloud platform, thereby obtaining the API call sequence. The computing device can also configure the shadow client's monitoring API scope, monitoring cycle, and duration.
[0011] In the embodiment of the present application, the computing device can copy and record the user's API call information through the shadow client, without affecting the user's normal call to the application program interface, avoiding the interruption of the user's call to the application program interface when the computing device obtains the API sequence, and improving the efficiency of obtaining the API sequence.
[0012] In one possible implementation, in the process of a computing device identifying at least one user scenario corresponding to an API call sequence based on a spatiotemporal graph, the computing device extracts a target API call link based on the spatiotemporal graph. The target API call link includes a repeated API call link and an independent API call link. The repeated API call link is a link in the API call link in the spatiotemporal graph whose link similarity is greater than or equal to a threshold. The independent API call link is a link in the API call link in the spatiotemporal graph whose link similarity is less than a threshold. The computing device determines the target user scenario based on the target API call link. The target user scenario is the user scenario after eliminating redundant user scenarios. There is a correspondence between the target user scenario and some sequences in the API call sequence.
[0013] In an embodiment of the present application, the computing device can extract repeated API call links and independent API call links based on the spatiotemporal graph, thereby identifying repeated user scenarios and independent user scenarios, so that the computing device can eliminate repeated user scenarios, avoid testing of redundant user scenarios, and further improve the testing efficiency of scenario-based testing.
[0014] In one possible implementation, when a computing device generates a test case corresponding to at least one user scenario, the computing device transforms the target API call link based on the cloud platform testing framework to generate test scripts corresponding to different user scenarios. The computing device then calls the test scripts to test the different user scenarios. Specifically, the computing device adapts the common library in the cloud platform testing framework based on the interface description, interface parameters, and interface timing of the target API call link, and generates test scripts corresponding to different user scenarios based on the functions in the common library.
[0015] In the embodiment of the present application, the computing device can convert the API call link into test scripts corresponding to different user scenarios based on the cloud platform testing framework, and call the test scripts to automatically perform scenario-based testing, thereby improving the testing efficiency of scenario-based testing.
[0016] In one possible implementation, when a computing device generates a test case corresponding to at least one user scenario, the computing device parses the target API call link based on an artificial intelligence model and generates test case text. The test case text is used to describe the testing requirements for different user scenarios. Artificial intelligence models such as long short-term memory (LSTM) models and recurrent neural network (RNN) models.
[0017] In the embodiment of the present application, the computing device can parse the API call link based on the artificial intelligence model to obtain the test case text, so that the user can perform scenario-based testing based on the test case text, thereby improving the test accuracy of the computing device in performing scenario-based testing.
[0018] In one possible implementation, during the process of software testing based on a test script, the computing device calls the test scripts in different user scenarios to perform software testing and generates test information. The test information includes test execution results and characterization information. The test execution results include success, failure, exception, and blockage. The characterization information is used to describe the user scenario characteristics corresponding to the test execution results.
[0019] In the embodiment of the present application, the computing device can call the test script to perform software testing and generate test information. Since the test information can reflect the user scenario characteristics corresponding to the test execution results, the computing device can further analyze the deep correlation between user scenarios based on the user scenario characteristics, thereby reducing redundant test scenarios.
[0020] In one possible implementation, when a computing device calls test scripts in different user scenarios on a cloud platform to perform software testing, the computing device sets the execution order, execution times, and execution parameters for the test scripts in different user scenarios based on a spatiotemporal graph, and the execution order is, for example, serial or parallel.
[0021] In the embodiment of the present application, the computing device can restore the API call link in the spatiotemporal graph by calling the test script, thereby realizing the testing of real user scenarios, thereby improving the testing accuracy of scenario-based testing.
[0022] In one possible implementation, the computing device performs analysis based on the test information to obtain associations between different user scenarios. The computing device aggregates the different user scenarios based on the associations to generate scenario aggregation results, which are used to reduce redundant user scenario tests.
[0023] In the embodiment of the present application, the computing device can analyze the association relationship between user scenarios based on the test information, and aggregate the user scenarios based on the association relationship, further reducing redundant test scenarios and improving the test efficiency of scenario-based testing of user devices.
[0024] The second aspect of the embodiment of the present application provides a testing device, which includes a transceiver unit and a processing unit. The transceiver unit is used to obtain the application program interface API call sequence of the cloud platform, and the API call sequence includes API call records sorted by time in the cloud platform, and the API call records include the API names called by the computing device at different times. The processing unit is used to generate a spatiotemporal graph based on the API call sequence, and the spatiotemporal graph includes the call relationship and call time between multiple APIs. The processing unit is also used to identify at least one user scenario corresponding to the API call sequence based on the spatiotemporal graph, and generate a test case corresponding to at least one user scenario, and different user scenarios are different user scenarios after eliminating redundant user scenarios. The processing unit is also used to perform software testing based on test cases.
[0025] In one possible implementation, the processing unit is specifically configured to extract a target API call link based on the spatiotemporal graph. The target API call link includes a repeated API call link and an independent API call link. A repeated API call link is a link in the spatiotemporal graph whose link similarity is greater than or equal to a threshold, and an independent API call link is a link in the spatiotemporal graph whose link similarity is less than a threshold. The processing unit is specifically configured to determine a target user scenario based on the target API call link. The target user scenario is the user scenario after redundant user scenarios have been eliminated.
[0026] In one possible implementation, the processing unit is specifically used to transform the target API call link based on the cloud platform testing framework to generate test scripts corresponding to different user scenarios.
[0027] In one possible implementation, the processing unit is specifically used to parse the target API call link based on an artificial intelligence model and generate test case text, which is used to describe the test requirements of different user scenarios.
[0028] In one possible implementation, the processing unit is specifically used to call test scripts in different user scenarios to perform software testing and generate test information, where the test information includes test execution results and characterization information, and the characterization information is used to describe user scenario characteristics corresponding to the test execution results.
[0029] In one possible implementation, the processing unit is further configured to analyze the test information to obtain correlations between different user scenarios. The processing unit is further configured to aggregate the different user scenarios based on the correlations to generate scenario aggregation results, which are used to reduce redundant user scenario testing.
[0030] A third aspect of an embodiment of the present application provides a computing device cluster, which includes one or more computing devices. The computing device includes a processor, which is coupled to a memory. The processor is used to store instructions. When the instructions are executed by the processor, the cloud server executes the method described in the first aspect or any possible implementation method of the first aspect.
[0031] A fourth aspect of the embodiments of the present application provides a computer-readable storage medium having instructions stored thereon. When the instructions are executed, the computer executes the method described in the first aspect or any possible implementation of the first aspect.
[0032] A fifth aspect of the embodiments of the present application provides a computer program product, which includes instructions. When the instructions are executed, the computer implements the method described in the first aspect or any possible implementation method of the first aspect.
[0033] It can be understood that the beneficial effects that can be achieved by any of the computing device clusters, computer-readable media, or computer program products provided above can be referred to the beneficial effects in the corresponding methods, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] FIG1 is a schematic diagram of the architecture of a software testing system provided in an embodiment of the present application;
[0035] FIG2 is a flow chart of a software testing method provided in an embodiment of the present application;
[0036] FIG3 is a schematic diagram of a software testing method provided in an embodiment of the present application;
[0037] FIG4 is a schematic diagram of another software testing method provided in an embodiment of the present application;
[0038] FIG5 is a schematic diagram of another software testing method provided in an embodiment of the present application;
[0039] FIG6 is a schematic diagram of another software testing method provided in an embodiment of the present application;
[0040] FIG7 is a schematic diagram of another software testing method provided in an embodiment of the present application;
[0041] FIG8 is a schematic diagram of another software testing method provided in an embodiment of the present application;
[0042] FIG9 is a schematic diagram of another software testing method provided in an embodiment of the present application;
[0043] FIG10 is a schematic diagram of another software testing method provided in an embodiment of the present application;
[0044] FIG11 is a schematic diagram of a testing device provided in an embodiment of the present application;
[0045] FIG12 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application;
[0046] FIG13 is a schematic diagram of another computing device cluster provided in an embodiment of the present application;
[0047] FIG14 is a schematic diagram of another computing device cluster provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] The embodiments of the present application provide a software testing method and apparatus for improving the testing efficiency of scenario-based testing.
[0049] The terms "first," "second," "third," "fourth," and the like (if any) in the specification and claims of this application and in the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or sequential sequence. It should be understood that the terms used in this manner are interchangeable where appropriate so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having," and any variations thereof, are intended to cover non-exclusive inclusions, e.g., a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0050] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0051] The following describes the software testing method and device provided in the embodiments of the present application with reference to the accompanying drawings.
[0052] Please refer to Figure 1, which is a schematic diagram of the system architecture used in the software testing method provided in an embodiment of the present application. In the example shown in Figure 1, software testing system 100 includes a monitoring module 101, a graph generation module 102, a user scenario extraction module 103, a test case generation module 104, a test case scheduling module 105, and a user scenario association module 106. Test case generation module 104 includes a parsing submodule 1041 and a conversion submodule 1042. The following describes the specific functions of each module in software testing system 100.
[0053] Monitoring module 101 is used to obtain user API call information and obtain an API call sequence, which includes the call time and calling interface information. Monitoring module 101 specifically monitors API call information for all users on the cloud platform by installing a shadow client on the cloud platform's gateway. Monitoring module 101 can use the shadow client to set the monitoring scope and duration.
[0054] The graph generation module 102 is used to generate a spatiotemporal graph based on the application program interface (API) call sequence. The spatiotemporal graph is a two-dimensional coordinate graph. The horizontal axis of the spatiotemporal graph is the call time, and the vertical axis is the name of the called application program interface. The spatiotemporal graph can fully record the user's application program interface call panorama.
[0055] The user scenario extraction module 103 is used to extract user scenarios based on the spatiotemporal graph to obtain one or more user scenarios. Specifically, the user scenario extraction module 103 can analyze the application program interface call links in the spatiotemporal graph to extract the target API call links, which include repeated API call links and independent API call links, and then determine the target user scenario based on the target API call links.
[0056] The user scenario extraction module 103 can also perform similarity matching on local links of API call links in the spatiotemporal graph, and identify local links with link similarity greater than a threshold as repeated API call links. The user scenario extraction module 103 can also identify local links without similar API call links in the spatiotemporal graph as independent API call links, and continue similarity matching in subsequently collected spatiotemporal graphs.
[0057] The test case generation module 104 is used to generate test cases based on the API call links corresponding to the user scenarios. The test cases include test case text and test scripts. The test case generation module 104 includes a parsing submodule 1041 and a conversion submodule 1042. The parsing submodule 1041 is used to parse the API call links corresponding to the user scenarios and generate test case text. The test case text is used to describe the test requirements corresponding to the test user scenarios. The conversion submodule 1042 is used to convert the API call links corresponding to the user scenarios and generate test scripts. The test scripts are used to perform scenario-based testing on the computing device.
[0058] The test case scheduling module 105 is used to schedule test scripts corresponding to different user scenarios on the cloud platform to perform scenario-based testing, so that the monitoring device can monitor the scenario-based testing to obtain test information, which includes test execution results and characterization information.
[0059] The user scenario association module 106 is used to analyze the test information corresponding to different user scenarios, and to associate the user scenarios based on the analysis results, thereby determining the user scenarios with associated relationships. The user scenario association module 106 is also used to aggregate the user scenarios with associated relationships, thereby reducing the number of user scenarios that need to be tested.
[0060] The software testing method provided in the embodiment of the present application is described in detail below with reference to FIG2 .
[0061] Please refer to Figure 2, which is a flowchart of a software testing method provided by an embodiment of the present application. In the example shown in Figure 2, the software testing method provided by an embodiment of the present application includes the following steps:
[0062] 201. Obtain an application program interface (API) call sequence of the cloud platform, where the API call sequence includes application program interface call records in the cloud platform sorted by time.
[0063] The computing device obtains the cloud platform's API call sequence. The API call sequence includes chronologically ordered API call records on the cloud platform, each of which includes the names of the APIs called by the computing device at different times. Specifically, the computing device installs a shadow client at the cloud platform's gateway and uses the shadow client to obtain the call time and API call information for all users on the cloud platform.
[0064] It should be noted that the cloud platform's shadow client can copy and record user API call information without affecting the user's normal API calls. Users can configure the shadow client, including the monitoring API range, monitoring cycle, and duration.
[0065] In the embodiment of the present application, the computing device can copy and record the user's API call information through the shadow client, avoiding the impact of the computing device obtaining the API sequence on the user's call to the application program interface, and improving the efficiency of the computing device obtaining the API sequence.
[0066] Please refer to Figure 3, which is a schematic diagram of obtaining an application program interface call sequence provided by an embodiment of the present application. In the embodiment shown in Figure 3, a computing device installs a shadow client in the API gateway of the cloud platform. The shadow client can monitor and record the API call records of all users of the cloud platform, and classify the API call records according to different users to obtain the API call records of each user. The API call record includes the call time and the called API name. For example, the computing device called API-a at time t1.
[0067] In the example shown in FIG3 , after the computing device obtains each user's API call record, it sorts the API call record according to the API call timestamp to generate an API call sequence. Different users have their own corresponding API call sequences. The API call sequence generated by the computing device can be identified by a set. For example, the API call sequence set S of user 1 is as follows: S = {{A t1}, {A t2}, {A t3}, …}
[0068] 202. Generate a spatiotemporal graph based on the API call sequence, where the spatiotemporal graph includes the call relationships and call times between multiple APIs.
[0069] The computing device generates a spatiotemporal graph based on the API call sequence. The spatiotemporal graph includes the call relationships and call times between multiple APIs. The call relationships between APIs are presented through the API call chain. Specifically, the computing device generates an API call chain based on the call relationship between the application interfaces in the API call sequence. The API call chain constitutes the user's API call spatiotemporal graph. Among them, the horizontal axis of the spatiotemporal graph is the call time, and the vertical axis is the API call information, such as the application interface API name. The spatiotemporal graph can fully record the user's application interface call chain. The computing device stores the spatiotemporal graphs of API calls of different users in the database.
[0070] Please refer to Figure 4, which is a schematic diagram of a spatiotemporal graph provided in an embodiment of the present application. In the example shown in Figure 4, a computing device generates a spatiotemporal graph based on an API call sequence. The horizontal axis of the spatiotemporal graph is the call time, and the vertical axis is the API interface name. The spatiotemporal graph includes the call relationships between different APIs.
[0071] For example, in the example shown in Figure 4, the application interface called by the user device at time t1 is API-a, the application interfaces API-b and API-c called at time t2, and the application interface API-d called at time t3, and there are calling relationships between API-a and API-b, API-c and API-d respectively. Therefore, there are calling links between API-a and API-b, API-c and API-d respectively.
[0072] 203. Identify at least one user scenario corresponding to the API call sequence based on the spatiotemporal graph, and generate a test case corresponding to at least one user scenario.
[0073] After the computing device generates the spatiotemporal graph, it identifies at least one user scenario corresponding to the API call sequence based on the spatiotemporal graph and generates a test case corresponding to at least one user scenario. The test case includes a test case text and a test script. The test case text is used to describe the test requirements for different user scenarios, and the test script is used by the computing device to perform scenario-based testing. The API call sequence can correspond to one or more user scenarios. For example, the first portion of the API call sequence can correspond to a first user scenario, and the second portion of the API call sequence can correspond to a second user scenario. The first user scenario and the second user scenario are different user scenarios.
[0074] In the process of the computing device identifying the user scenario based on the spatiotemporal graph, the computing device extracts the target API call link based on the spatiotemporal graph. The target API call link includes a repeated API call link and an independent API call link. The repeated API call link is a link in the API call link in the spatiotemporal graph whose link similarity is greater than or equal to a threshold. The independent API call link is a link in the API call link in the spatiotemporal graph whose link similarity is less than a threshold. The computing device determines the target user scenario based on the target API call link. The target user scenario is the user scenario after eliminating redundant user scenarios. There is a correspondence between the target user scenario and some sequences in the API call sequence.
[0075] In one possible implementation, the computing device performs similarity matching in the spatiotemporal graph based on the Euclidean distance between local API call links until all local API call links in the spatiotemporal graph are traversed. If no local API call links with a similarity less than a threshold exist in the spatiotemporal graph, the computing device continues matching in subsequent spatiotemporal graphs.
[0076] Please refer to Figure 5, which is a flowchart of a method for user scenario recognition based on a spatiotemporal graph according to an embodiment of the present application. In the example shown in Figure 5, the computing device performs similarity matching on the API call links in the spatiotemporal graph and extracts the target API call links, which include repeated API call links and independent API call links. Specifically, the computing device performs similarity matching on the local links of the API call links in the spatiotemporal graph, determines the local API call links with link similarity greater than or equal to the threshold as repeated API call links, and determines the local API call links with link similarity less than the threshold as independent API call links.
[0077] For example, in the example shown in Figure 5, the computing device performs similarity matching based on the API call links in the spatiotemporal graph and finds that the similarity between local link 1 "API-a→API-b, API-a→API-c→API-e" and local link 2 is 100%, that is, local link 1 appears twice. The computing device then determines that local link 1 is the target API call link and abstracts local link 1 as target user scenario 1.
[0078] For another example, in the example shown in Figure 5, the computing device performs similarity matching based on the API call links in the spatiotemporal graph and finds that local link 3 "API-d→API-c" does not have other API call links with a similarity greater than a threshold, that is, local link 3 does not have a repeated API call link, then the computing device determines that local link 3 is the target call link, and abstracts local link 3 as target user scenario 3.
[0079] In the embodiment of the present application, the computing device can extract repeated API call links based on the spatiotemporal graph, thereby identifying redundant user scenarios, allowing the computing device to reduce redundant user scenarios and improving the testing efficiency of the computing device in scenario-based testing.
[0080] In one possible implementation, a computing device parses the target API call link based on an artificial intelligence model to generate test case text that describes the testing requirements for different user scenarios. Examples of artificial intelligence models include long short-term memory (LSTM) models, recurrent neural network (RNN) models, and hashing algorithm models.
[0081] Specifically, the computing device parses the text information in the target API call link based on an artificial intelligence algorithm. The text information includes interface timing, interface description, and interface parameters, etc. The computing device reorganizes the parsed text information according to the target API call link to generate a test case text corresponding to the user scenario. The test case text is used to describe the scenario-based testing requirements corresponding to the user scenario.
[0082] Please continue to refer to Figure 5. In the example shown in Figure 5, the text information of local link 1 corresponding to target user scenario 1 is as follows: "API-a's interface timing: t1, interface description: Name-a, interface parameters: parameter 1 = value1, parameter 2 = value2. API-b's interface timing: t2, interface description: Name-b, interface parameters: parameter 3 = value1. API-c's interface timing: t2, interface description: Name-c, interface parameters: parameter 4 = value1. API-e's interface timing: t3, interface description: Name-e, interface parameters: parameter 5 = value1." The computing device parses the text information of local link 1 based on the artificial intelligence model to generate test case text.
[0083] Please refer to Figure 6, which is a schematic diagram of a process for generating test case text according to an embodiment of the present application. In the example shown in Figure 6, the computing device parses the text information of the API call link to generate scenario test case text. Specifically, the computing device inputs text information such as the API interface description, API interface parameters, and API interface timing into a long short-term memory (LSTM) model and generates test case text based on the LSTM model.
[0084] In the example shown in FIG6 , the test case text generated by the computing device is as follows: first create a 1U1G virtual machine, then create a private cloud VPC and elastic IP at the same time, and then mount the network.
[0085] In the embodiment of the present application, the computing device can parse the API call link based on artificial intelligence models such as LSTM and obtain the test case text, so that the user can perform scenario-based testing based on the test case text, thereby improving the test accuracy of the computing device in performing scenario-based testing.
[0086] In one possible implementation, a computing device transforms the target API call link based on a cloud platform testing framework to generate test scripts corresponding to different user scenarios. Specifically, the computing device adapts the common library in the cloud platform testing framework based on the interface description, interface parameters, and interface timing of the target API call link. Based on the functions in the common library, the computing device generates test scripts corresponding to different user scenarios. The calling relationships between different test scripts and the target API call link remain consistent.
[0087] Please refer to Figure 7, which is a schematic diagram of generating test case text and test scripts according to an embodiment of the present application. In the example shown in Figure 7, the computing device parses API calls corresponding to different user scenarios to generate test case text, which is used to describe the test requirements corresponding to the user scenarios. The computing device converts the API calls corresponding to different user scenarios to generate test scripts, which are used by the computing device to perform scenario-based testing on the user scenarios.
[0088] For example, in the example shown in FIG7 , the computing device parses the API call link corresponding to the user scenario 1 to obtain the test case text 1, and converts the API call link corresponding to the user scenario 1 to obtain the test script 1.
[0089] Please refer to Figure 8, which is a schematic diagram of a test script provided in an embodiment of the present application. In the example shown in Figure 8, Figure a is a schematic diagram of the code corresponding to the target API call link, and Figure b is a schematic diagram of the converted test script code. The computing device processes the code corresponding to the target API call link based on the authentication, orchestration, and function functions of the cloud platform testing framework, thereby converting the target API call link into a test script.
[0090] 204. Perform software testing based on test cases.
[0091] Computing devices test cases for software testing. Specifically, the computing device invokes test scripts in different user scenarios on the cloud platform based on the spatiotemporal graph to perform software testing and generate test information. The test information includes test execution results and representation information, which describes the user scenario characteristics corresponding to the test execution results.
[0092] In one possible implementation, during the process of software testing using a computing device test case, the computing device may also manually configure the test environment according to the test case text to perform software testing, or the computing device may also modify the test case script according to the test case text to obtain a test case script corresponding to a new user scenario, and the computing device automatically performs software testing according to the modified test case script.
[0093] When a computing device invokes test scripts for different user scenarios on a cloud platform to perform software testing, it sets the execution order, execution count, and execution parameters for each test script based on the spatiotemporal graph. The execution order, for example, is serial or parallel. The computing device uses a monitoring module to obtain the test script execution results, generating test information. This test information includes test execution results and characterization information, such as success, failure, exception, and blockage. Characterization information includes abnormal data at a specific location in the test script execution.
[0094] Please refer to Figure 9, which is a schematic diagram of a software testing method provided in an embodiment of the present application. In the embodiment shown in Figure 9, the computing device determines the execution order, execution count, and execution parameters of test scripts in different user scenarios based on the spatiotemporal graph. For example, the computing device is configured to execute test script 1 at time t1, test script 2 at time t2, and test scripts 4 and 5 in parallel at time t3.
[0095] In the example shown in FIG9 , the computing device obtains test information of the test script through the monitoring module. The test information includes the test execution result and characterization information. For example, in the example shown in FIG9 , the execution result of script 1 is failure, and the characterization information is xx information. The execution result of script 3 is success, and the characterization information is xx information.
[0096] In one possible implementation, the computing device can also analyze the test information to determine the associations between different user scenarios, aggregate the different user scenarios based on the associations, and generate scenario aggregation results. The scenario aggregation results are used to reduce redundant user scenario testing. For example, if the computing device discovers, based on the test information, that multiple scenario test cases frequently fail simultaneously, or frequently encounter similar issues, the computing device can determine that there are associations between the multiple scenarios and aggregate the multiple user scenarios based on an association algorithm.
[0097] Please refer to Figure 10, which is a schematic diagram of user scenario aggregation provided by an embodiment of the present application. In the example shown in Figure 10, the computing device performs data mining and analysis based on the test execution results and characterization information corresponding to different test scripts. For example, the computing device calculates the support and confidence of the test execution results at the same moment, and determines the frequent failure set at that moment based on the support and confidence, wherein the support represents the proportion of the transaction set that contains both conditions and results in the total transaction set, that is, the probability that two test execution results occur at the same time. The confidence represents the proportion of the transaction set that contains both conditions and results in the transaction set that contains conditions, that is, the probability that two test execution results occur at the same time accounts for the probability that one of the test execution results occurs. The computing device aggregates different user scenarios in the frequent failure set to generate a scenario aggregation result.
[0098] In the example shown in Figure 10, the computing device analyzes the association between the test scripts corresponding to different user scenarios based on the test information, determines that there is an association between the script corresponding to scenario 1 and the script corresponding to scenario 2, and the computing device aggregates scenario 1 and scenario 2 to obtain scenario 1-2.
[0099] In the embodiment of the present application, the computing device can analyze the association relationship between different user scenarios based on the test information, and aggregate the user scenarios based on the association relationship, thereby reducing redundant test scenarios and improving the test efficiency of scenario-based testing of user devices.
[0100] It can be seen from the above embodiments that the computing device in the embodiments of the present application can analyze user scenarios based on the application program interface API call sequence, eliminate redundant user scenarios, generate corresponding test cases based on non-redundant user scenarios, and call the test cases for software testing, thereby avoiding the testing of redundant user scenarios and improving the testing efficiency of the cloud platform for scenario-based testing.
[0101] Furthermore, in the embodiments of this application, the computing device can intelligently generate scenario test cases based on the characteristic information of the user's actual usage scenarios, eliminating the need for manual scenario sorting and case writing, and can adaptively update and iterate based on changes in the user's usage scenarios. At the same time, the computing device monitors test information during scheduling and execution, and mines and analyzes the test information for correlation, continuously aggregating user scenarios with related relationships, thereby improving the adaptability, accuracy, and execution efficiency of the overall scenario-based testing.
[0102] The above describes the software testing method provided by the embodiment of the present application. The following describes the testing device provided by the embodiment of the present application.
[0103] Please refer to Figure 11, which is a schematic diagram of the structure of a test device provided in an embodiment of the present application. In the example shown in Figure 11, the test device is used to implement the various steps performed by the computing device in the above embodiments. The test device 1100 includes a transceiver unit 1101 and a processing unit 1102.
[0104] Among them, the transceiver unit 1101 is used to obtain the application program interface API call sequence of the cloud platform. The API call sequence includes API call records sorted by time in the cloud platform. The API call records include the API names called by computing devices at different times. The processing unit 1102 is used to generate a spatiotemporal graph based on the API call sequence. The spatiotemporal graph includes call links of different APIs at different times. The processing unit 1102 is also used to identify the call relationship and call time user scenario between multiple APIs based on the spatiotemporal graph, and generate a test case corresponding to at least one user scenario. The processing unit 1102 is also used to perform software testing based on the test case.
[0105] In one possible implementation, processing unit 1102 is specifically configured to extract a target API call link based on the spatiotemporal graph. The target API call link includes a repeated API call link and an independent API call link. A repeated API call link is a link in the spatiotemporal graph whose link similarity is greater than or equal to a threshold, and an independent API call link is a link in the spatiotemporal graph whose link similarity is less than a threshold. Processing unit 1102 is specifically configured to determine a target user scenario based on the target API call link. The target user scenario is the user scenario after redundant user scenarios have been eliminated.
[0106] In a possible implementation, the processing unit 1102 is specifically configured to transform the target API call link based on a cloud platform testing framework to generate test scripts corresponding to different user scenarios.
[0107] In one possible implementation, the processing unit 1102 is specifically used to parse the target API call link based on an artificial intelligence model and generate a test case text, which is used to describe the test requirements of different user scenarios.
[0108] In one possible implementation, the processing unit 1102 is specifically used to call test scripts in different user scenarios to perform software testing and generate test information, where the test information includes test execution results and characterization information, and the characterization information is used to describe user scenario characteristics corresponding to the test execution results.
[0109] In one possible implementation, the processing unit 1102 is further configured to analyze the test information to obtain correlations between different user scenarios. The processing unit 1102 is further configured to aggregate different user scenarios based on the correlations to generate scenario aggregation results, which are used to reduce redundant user scenario tests.
[0110] It should be understood that the division of units in the above device is merely a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. Moreover, the units in the device can all be implemented in the form of software called through processing elements; or they can all be implemented in the form of hardware; or some units can be implemented in the form of software called through processing elements, and some units can be implemented in the form of hardware. For example, each unit can be a separately established processing element, or it can be integrated into a certain chip of the device. In addition, it can also be stored in the memory in the form of a program, called by a certain processing element of the device and perform the function of the unit. In addition, all or part of these units can be integrated together, or they can be implemented independently. The processing element described here can also be a processor, which can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each unit above can be implemented by the integrated logic circuit of the hardware in the processor element or in the form of software called through the processing element.
[0111] It is worth noting that, for the sake of simplicity, the above method embodiments are expressed as a series of action combinations. However, those skilled in the art should know that the present invention is not limited to the order of the actions described. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required for the present invention.
[0112] Other reasonable step combinations that can be thought of by those skilled in the art based on the above description also fall within the scope of protection of the present invention. Secondly, those skilled in the art should also be familiar with that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the present invention.
[0113] Please refer to Figure 12, which is a schematic diagram of the structure of a computing device provided in an embodiment of the present application. As shown in Figure 12, computing device 1200 includes: a processor 1201, a memory 1202, a communication interface 1203, and a bus 1204. Processor 1201, memory 1202, and communication interface 1203 are coupled via a bus (not labeled in the figure). Memory 1202 stores instructions. When the execution instructions in memory 1202 are executed, computing device 1200 performs the method performed by the computing device in the above method embodiment.
[0114] The computing device 1200 may be one or more integrated circuits configured to implement the above method, such as one or more application specific integrated circuits (ASICs), one or more digital signal processors (DSPs), one or more field programmable gate arrays (FPGAs), or a combination of at least two of these integrated circuit forms. For example, when a unit in the device can be implemented in the form of a processing element scheduler, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call a program. For example, these units may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0115] The processor 1201 may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA), other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.
[0116] Memory 1202 may be volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. Nonvolatile memory may be read-only memory (ROM), programmable ROM (PROM), erasable programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0117] The memory 1202 stores executable program code, and the processor 1201 executes the executable program code to respectively implement the functions of the aforementioned transceiver unit and the processing unit, thereby implementing the aforementioned software testing method. That is, the memory 1202 stores instructions for executing the aforementioned software testing method.
[0118] The communication interface 1203 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 1200 and other devices or a communication network.
[0119] In addition to the data bus, bus 1204 may also include a power bus, a control bus, and a status signal bus. The bus may be a Peripheral Component Interconnect Express (PCIe) bus, an Extended Industry Standard Architecture (EISA) bus, a unified bus (Ubus or UB), a Compute Express Link (CXL), or a Cache Coherent Interconnect for Accelerators (CCIX). Buses can be categorized as address buses, data buses, and control buses.
[0120] Please refer to Figure 13 , which is a schematic diagram of a computing device cluster provided in an embodiment of the present application. As shown in Figure 13 , the computing device cluster 1300 includes at least one computing device 1200 .
[0121] As shown in Figure 13, the computing device cluster 1300 includes at least one computing device 1200. The memory 1202 in one or more computing devices 1200 in the computing device cluster 1300 may store the same instructions for executing the above software testing method.
[0122] In some possible implementations, the memory 1202 of one or more computing devices 1200 in the computing device cluster 1300 may also store partial instructions for executing the above-described software testing method. In other words, the combination of one or more computing devices 1200 can jointly execute the instructions for executing the above-described software testing method.
[0123] It should be noted that the memory 1202 in different computing devices 1200 in the computing device cluster 1300 can store different instructions, each for executing a portion of the functions of the aforementioned testing apparatus. In other words, the instructions stored in the memory 1202 in different computing devices 1200 can implement the functions of one or more modules in the transceiver unit and the processing unit.
[0124] In some possible implementations, one or more computing devices 1200 in the computing device cluster 1300 may be connected via a network, which may be a wide area network or a local area network.
[0125] Please refer to Figure 14, which is a schematic diagram of computer devices in a computer cluster provided by an embodiment of the present application connected via a network. As shown in Figure 14, two computing devices 1200A and 1200B are connected via a network. Specifically, the connection to the network is through a communication interface in each computing device.
[0126] In one possible implementation, the memory of the computing device 1200A stores instructions for executing the functions of the transceiver module, while the memory of the computing device 1200B stores instructions for executing the functions of the processing module.
[0127] It should be understood that the functions of the computing device 1200A shown in Figure 14 may also be completed by multiple computing devices. Similarly, the functions of the computing device 1200B may also be completed by multiple computing devices.
[0128] In another embodiment of the present application, a computer-readable storage medium is provided, in which computer-executable instructions are stored. When the processor of the device executes the computer-executable instructions, the device executes the method executed by the computing device in the above method embodiment.
[0129] In another embodiment of the present application, a computer program product is provided, the computer program product including computer-executable instructions stored in a computer-readable storage medium. When a processor of a device executes the computer-executable instructions, the device performs the method performed by the computing device in the above method embodiment.
[0130] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0131] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0132] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0133] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0134] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
Claims
1. A software testing method, characterized in that: include: Obtaining an application program interface (API) call sequence of the cloud platform, wherein the API call sequence includes API call records in the cloud platform sorted by time, and the API call records include API names called by computing devices at different times; Generate a spatiotemporal graph according to the API call sequence, wherein the spatiotemporal graph includes call relationships and call times between multiple APIs; Identify at least one user scenario corresponding to the API call sequence based on the spatiotemporal graph, and generate at least one test case corresponding to the user scenario; Perform software testing based on the test cases.
2. The method according to claim 1, characterized in that The identifying at least one user scenario corresponding to the API call sequence based on the spatiotemporal graph includes: Extracting a target API call link based on the spatiotemporal graph, the target API call link includes a repeated API call link and an independent API call link, the repeated API call link is a link in the API call link in the spatiotemporal graph whose link similarity is greater than or equal to a threshold, and the independent API call link is a link in the API call link in the spatiotemporal graph whose link similarity is less than the threshold; A target user scenario is determined according to the target API call link, where the target user scenario is the user scenario after redundant user scenarios are eliminated.
3. The method according to claim 2, characterized in that Generating at least one test case corresponding to the user scenario includes: The target API call link is transformed based on the cloud platform testing framework to generate test scripts corresponding to different user scenarios.
4. The method according to claim 2 or 3, characterized in that: Generating at least one test case corresponding to the user scenario includes: The target API call link is parsed based on an artificial intelligence model to generate a test case text, wherein the test case text is used to describe the test requirements of different user scenarios.
5. The method according to any one of claims 1 to 4, characterized in that The software testing based on the test script includes: The test scripts under different user scenarios are called to perform software testing, and test information is generated, wherein the test information includes test execution results and characterization information, and the characterization information is used to describe user scenario characteristics corresponding to the test execution results.
6. The method according to claim 5, characterized in that The method further comprises: Analyze the test information to obtain correlations between different user scenarios; Different user scenarios are aggregated based on the association relationship to generate scenario aggregation results, and the scenario aggregation results are used to reduce redundant user scenario tests.
7. A testing device, characterized in that: include: A transceiver unit, used to obtain an API call sequence of a cloud platform, wherein the API call sequence includes API call records in the cloud platform sorted by time, and the API call records include API names called by computing devices at different times; A processing unit, configured to generate a spatiotemporal graph according to the API call sequence, wherein the spatiotemporal graph includes call relationships and call times between multiple APIs; The processing unit is further used to identify at least one user scenario corresponding to the API call sequence based on the spatiotemporal graph, and generate at least one test case corresponding to the user scenario; The processing unit is also used to perform software testing based on the test case.
8. The device according to claim 7, characterized in that The processing unit is specifically used for: Extracting a target API call link based on the spatiotemporal graph, the target API call link includes a repeated API call link and an independent API call link, the repeated API call link is a link in the API call link in the spatiotemporal graph whose link similarity is greater than or equal to a threshold, and the independent API call link is a link in the API call link in the spatiotemporal graph whose link similarity is less than the threshold; A target user scenario is determined according to the target API call link, where the target user scenario is the user scenario after redundant user scenarios are eliminated.
9. The device according to claim 8, characterized in that The processing unit is specifically used for: The target API call link is transformed based on the cloud platform testing framework to generate test scripts corresponding to different user scenarios.
10. The device according to claim 8 or 9, characterized in that The processing unit is specifically used for: The target API call link is parsed based on an artificial intelligence model to generate a test case text, wherein the test case text is used to describe the test requirements of different user scenarios.
11. The device according to any one of claims 7 to 10, characterized in that The processing unit is specifically used for: The test scripts under different user scenarios are called to perform software testing, and test information is generated, wherein the test information includes test execution results and characterization information, and the characterization information is used to describe user scenario characteristics corresponding to the test execution results.
12. The device according to claim 11, characterized in that The processing unit is also used for: Analyze the test information to obtain correlations between different user scenarios; Different user scenarios are aggregated based on the association relationship to generate scenario aggregation results, and the scenario aggregation results are used to reduce redundant user scenario tests.
13. A computing device cluster, characterized in that: The computer comprises a processor coupled to a memory, wherein the processor is used to store instructions. When the instructions are executed by the processor, the computing device cluster executes the method according to any one of claims 1 to 6.
14. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed, the computer is caused to perform the method according to any one of claims 1 to 6.
15. A computer program product, comprising instructions, characterized in that: When the instructions are executed, the computer implements the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Business processing method and device, storage medium and equipment
CN115018473A
Scene test case generation method and device, equipment and storage medium
CN115391188A
Testing and verifying cloud services using a computational graph
US11429513B1
System and method for automatically creating test cases through a remote client
US7908590B1
Application programming interface (API) testing method and device
WO2022179363A1
Cited By
Interface testing method and related equipment
CN119782168A
