Application compatibility test method and device based on test duration
By adopting a test duration method in the intelligent measurement terminal, using the application to test the target runtime of directed graphs and functions combinations, the test instruction sequence is generated, which solves the problem of inefficiency in traditional compatibility testing and achieves more efficient Testing process.
Patent Information
- Application Number
- CN202411382343.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-02-11
AI Technical Summary
In intelligent measurement terminals, with the increase of application types and functional modules, the number of condition combinations required by traditional compatibility testing methods increases dramatically, resulting in inefficient testing.
Using a method based on test duration, by obtaining the directed graph of the application test, simulating the functions in the concurrent execution function combination, determining the target runtime of the function combination, and finding the functional test path with the smallest average target runtime from the directed graph. Generate a sequence of test instructions for compatibility testing.
This method can effectively reduce testing time, optimize compatibility testing process, improve testing efficiency, and avoid omissions or repeated testing function combinations.
Smart Images

Figure CN119415423A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an application compatibility method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] With the continuous development of smart grid business, the measurement terminal, as one of the core components of the power grid measurement system, is also developing towards intelligence and platformization. Among them, the "software platform + application" model is a common solution to achieve intelligence and platformization, but the application needs to undergo strict compatibility testing before being deployed to the smart measurement terminal.
[0003] In traditional solutions, it is usually necessary to test whether there are compatibility issues when functional modules in multiple applications run concurrently under different test conditions, or to pre-screen test scenarios and application running states that are likely to cause compatibility issues, reduce the combination of test conditions, and conduct targeted compatibility testing.
[0004] However, as the types of applications installed in smart measurement terminals increase with the development of new functions, each application is composed of multiple different functional modules, which will lead to a very large number of condition combinations that need to be tested. Using the above traditional solutions for compatibility testing requires a lot of time, resulting in low efficiency of application compatibility testing. Summary of the invention
[0005] Based on this, it is necessary to provide an application compatibility testing method, apparatus, computer equipment, computer-readable storage medium and computer program product based on test time that can improve the efficiency of application compatibility testing in response to the above technical problems.
[0006] In a first aspect, the present application provides an application compatibility testing method based on test duration, comprising:
[0007] Obtain an application test directed graph, wherein each node of the application test directed graph represents a set of function combinations, each of the function combinations is an arrangement and combination of functions between multiple application programs to be tested, and the edges of the directed graph represent transfer directions between the function combinations;
[0008] For each group of function combinations, simulate the concurrent execution of the functions in the function combination to determine the target running time of the function combination, where the target running time includes the running time of the function combination when the number of resource occupation conflicts of the functions in the function combination reaches a preset conflict number threshold;
[0009] Based on the target running time of each of the function combinations, finding a target function test path with the minimum average target running time from the directed graph;
[0010] Generate a test instruction sequence according to the target function test path and the running time of the function combination represented by each node in the target function test path;
[0011] Based on the test instruction sequence, compatibility testing is performed on the plurality of application programs to be tested.
[0012] In one embodiment, the simulating concurrent execution of the functions in the function combination to determine the target running time of the function combination includes:
[0013] Simulating and concurrently executing the functions in the function combination represented by the node multiple times;
[0014] Determine, during each simulation, when the number of resource occupation conflicts of the functions in the function combination reaches a preset conflict number threshold, the initial running time of the node, and obtain multiple initial running times;
[0015] Determining the mean and variance of the runtimes for a plurality of initial runtimes;
[0016] The target runtime is determined according to the runtime mean and variance.
[0017] In one embodiment, each time the concurrent execution of the functions in the function combination represented by the node is simulated, the following steps are performed:
[0018] Obtaining a resource occupancy model for each function in the function combination, the resource occupancy model including a generation time distribution of a resource occupancy request when executing the function, a service time distribution of a server processing each resource occupancy request, and a service policy of the server;
[0019] Based on the generation time distribution, the service time distribution, and the service policy, the concurrent execution of functions in the function combination represented by the node is simulated.
[0020] In one embodiment, the step of searching the target function test path with the minimum average target running time from the directed graph based on the target running time of each of the function combinations includes:
[0021] Taking the starting node in the directed graph as the current node;
[0022] With the goal of minimizing the average target running time of the functional test path, searching for the next node of the current node in the directed graph, and determining the next node found as a new current node;
[0023] Return to the step of searching for the next node of the current node in the directed graph with the goal of minimizing the average target running time of the functional test path, until an end node is found, thereby obtaining a target functional test path.
[0024] In one embodiment, the nodes include tested nodes and untested nodes; and searching for the next node of the current node in the directed graph with the goal of minimizing the average target running time of the functional test path includes:
[0025] According to the edge of the directed graph, searching for a candidate node of the current node in the directed graph;
[0026] In a case where the candidate nodes only include tested nodes, determining a target node among the candidate nodes that minimizes the average target running time as the next node of the current node;
[0027] In the case that the candidate nodes include untested nodes, a target node among the untested nodes that minimizes the average target running time is determined as the next node.
[0028] In one embodiment, generating a test instruction sequence according to the target function test path and the running time of the function combination represented by each node in the target function test path includes:
[0029] Based on the target functional test path, generating a plurality of test instructions, wherein the test instructions correspond one-to-one to the functional combinations represented by the nodes in the functional test path;
[0030] Determining the time intervals of the plurality of test instructions based on the target running time of the functional combination represented by each node;
[0031] A test instruction sequence is determined based on the plurality of test instructions and the time interval.
[0032] In one embodiment, determining the time intervals of the plurality of test instructions based on the target running time of the functional combination represented by each node includes:
[0033] When the target running time of the function combination is less than or equal to the preset running time threshold, the running time is determined as the time interval between the test instruction corresponding to the function combination and the next test instruction;
[0034] When the target running time of the function combination is greater than the preset running time threshold, the preset minimum time interval is determined as the time interval between the test instruction corresponding to the function combination and the next test instruction.
[0035] In one embodiment, the number of the test instruction sequences is multiple groups; and the compatibility test of the application to be tested based on the test instruction sequences includes:
[0036] Based on the multiple groups of the test instruction sequences, compatibility testing is performed on the application to be tested to obtain resource usage of the system when different application to be tested are running concurrently;
[0037] A compatibility test log is generated based on the resource usage.
[0038] In a second aspect, the present application further provides an application compatibility testing device based on test duration, comprising:
[0039] A data acquisition module is used to acquire an application test directed graph, wherein each node of the application test directed graph represents a set of function combinations, each of the function combinations is an arrangement and combination of functions between multiple application programs to be tested, and the edges of the directed graph represent transfer directions between the function combinations;
[0040] A duration determination module, for simulating concurrent execution of functions in each group of function combinations, and determining a target running duration of the function combination, wherein the target running duration includes the target running duration of the function combination when the number of resource occupation conflicts of the functions in the function combination reaches a preset conflict number threshold;
[0041] A path generation module, configured to find a target function test path with a minimum average target running time from the directed graph based on the target running time of each of the function combinations;
[0042] An instruction generation module, used for generating a test instruction sequence according to the target function test path and the running time of the function combination represented by each node in the target function test path;
[0043] A compatibility testing module is used to perform compatibility testing on the plurality of application programs to be tested based on the test instruction sequence.
[0044] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it implements the steps in any of the above-mentioned application compatibility testing method embodiments based on test duration.
[0045] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in any of the above-mentioned application compatibility testing method embodiments based on test duration.
[0046] In a fifth aspect, the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps in any of the above-mentioned application compatibility testing method embodiments based on test duration.
[0047] The above-mentioned application compatibility testing method, device, computer equipment, computer-readable storage medium and computer program product based on test duration are different from traditional schemes. The above-mentioned scheme represents the functional combinations of different application programs to be tested in the form of a directed graph. Even when there are a large number of applications and their functions, subsequent analysis and testing are not likely to omit or repeat the test functional combinations, thereby improving the test efficiency; then, for each group of functional combinations, the process of concurrent execution of the functions in the functional combination and the target running time of the functional combination are simulated, and this is used to represent the resource occupancy of the system when the functional combinations are executed concurrently, so that potential resource occupancy conflicts can be discovered in advance, and then, with the goal of minimizing the average target running time, the target function test path is generated, and the final test instruction sequence is determined, so that the total test time is as small as possible, thereby optimizing the process of application compatibility testing and effectively improving the test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0049] FIG1 is an application environment diagram of an application program compatibility testing method based on test duration in one embodiment;
[0050] Figure 2 A flowchart of an application program compatibility testing method based on test duration in one embodiment;
[0051] Figure 3 A flowchart of an application compatibility testing method based on testing duration in another embodiment;
[0052] Figure 4 A flowchart of an application program compatibility testing method based on testing duration in yet another embodiment;
[0053] Figure 5 A flowchart of an application compatibility testing method based on test duration in a detailed embodiment;
[0054] Figure 6A structural block diagram of an application program compatibility testing device based on test duration in one embodiment;
[0055] FIG. 7 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0057] The application compatibility testing method based on test duration provided in the embodiment of the present application can be applied to the application environment shown in FIG1. The terminal 102 communicates with the server 104 through a network. The data storage system can store data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers.
[0058] Specifically, the staff uploads the application test directed graph to the server 104 through the terminal 102, or the server 104 directly obtains the application test directed graph from the data storage system. Further, for each group of function combinations, the server 104 simulates the concurrent execution of the functions in the function combination, determines the target runtime of the function combination, and then finds the target function test path with the minimum average target runtime from the directed graph based on the target runtime of each function combination, and generates a test instruction sequence based on the target function test path and the runtime of the function combination represented by each node in the target function test path, and finally performs compatibility testing on multiple application programs to be tested based on the test instruction sequence.
[0059] The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices may be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server 104 may be an independent physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides cloud computing services.
[0060] In an exemplary embodiment, Figure 2As shown, a method for testing application compatibility based on test duration is provided, and the method is applied to the server 104 in FIG. 1 as an example for description, including the following steps:
[0061] S100, obtaining an application test directed graph.
[0062] Among them, the application test directed graph is a data structure composed of nodes and edges. Each node of the application test directed graph represents a set of function combinations, and each function combination is an arrangement and combination of functions between multiple applications to be tested. The edge of the application test directed graph represents the transfer direction between the function combinations. For example, if there are nodes 1 and node 2 in the application test directed graph, where the function combination represented by node 1 is {not running, B1}, and the function combination represented by node 2 is {not running, B2}, B1 represents entering the login interface of application B, and B2 represents entering the setting interface of application B. The edge from node 1 to node 2 represents the system transferring from "application A is not running, entering the login interface of application B" to "application A is not running, entering the setting interface of application B".
[0063] Exemplarily, the application test directed graph can be constructed based on the following steps: First, for each application to be tested, the startup, end and calling relationship between all functions of the application to be tested are represented as a directed graph Fi, i=1~I, where I is the number of applications to be tested. Specifically, each function of the application to be tested is taken as a node of the directed graph Fi, and a node indicating that the application to be tested is not running is added to the directed graph Fi. The edge of the directed graph Fi indicates that there is a transfer relationship between the functions represented by the two nodes, and the direction of the edge indicates that the node of a certain function points to the node representing another function to which it can be transferred. Then, the application test directed graph F is initialized as the directed graph of the application to be tested F1, i=2 is initialized, the combination of all node functions in F and Fi is listed, and a new directed graph T is established. Each node in T is a combination of node functions in F and Fi. When all functions in the function combination represented by a node of T can be transferred from the functions in the function combination represented by another node, the two nodes are connected with an edge, and the transfer direction of the function combination represented by the node is indicated. Furthermore, let F=T, i=i+1, list the combinations of all node functions in F and Fi, and construct a new directed graph. The application test directed graph F is updated in this way in a cycle until all functions of the application to be tested are included in the application test directed graph F, and the final application test directed graph is obtained.
[0064] Take two applications A and B to be tested as examples. Application A contains two parallel functions, A1 and A2. The application ends after running A1 or A2. Application B contains two serial functions, B1 and B2. B2 is the next layer function called by B1. The application ends after running B2. Then the function combination between application A and application B is: {A not run, B not run}, {A not run, B1}, {A not run, B2}, {A1, B not run}, {A1, B1}, {A1, B2}, {A2, B not run}, {A2, B1}, {A2, B2}.
[0065] S200, for each group of function combinations, simulate the concurrent execution of functions in the function combination, and determine the target running time of the function combination, the target running time includes the running time of the function combination when the number of resource occupation conflicts of the functions in the function combination reaches a preset conflict number threshold.
[0066] Concurrent execution refers to the simultaneous execution of multiple functions or tasks in a multi-tasking operating system. In this embodiment, it refers to the situation where multiple functions in an application are activated or called in the same time period. Resource occupancy conflict refers to the conflict event that occurs when multiple functions request the same system resources (such as CPU, memory, network bandwidth, etc.) at the same time. For example, if a process in the operating system is using a certain resource, other processes cannot use the resource at this time, that is, a resource occupancy conflict occurs in the operating system.
[0067] Exemplarily, for each function combination in the application test directed graph, simulated concurrent execution is required. That is to say, for each function combination, the system will simultaneously activate all functions in the function combination to test whether resource occupation conflicts will occur when these functions are executed concurrently. During the execution process, the system will monitor the number of conflicts and record the running time of the function combination when the number of resource occupation conflicts reaches the preset conflict number threshold. This running time is the target running time of the function combination. In addition, there may be a situation where the system resources occupied by the functions in a certain function combination do not overlap with each other. In theory, the number of resource occupation conflicts of the function combination during concurrent execution will never reach the preset conflict number threshold, so the target running time of this function combination is set to infinity.
[0068] S300 , based on the target running time of each function combination, find a target function test path with the minimum average target running time from a directed graph.
[0069] The target function test path refers to a path passing through multiple function combination nodes in the application test directed graph, and the compatibility of the application can be tested by the combination order of the nodes in the target function test path.
[0070] The average target runtime refers to the average of the target runtimes of the functional combinations represented by all nodes in the functional test path. The significance of selecting the target functional test path with the smallest average target runtime is that the smaller the average target runtime, the more likely the functional combinations represented by the nodes on the corresponding functional test path are to conflict during concurrent execution. This can help testers screen out those paths that are most likely to affect system performance in actual operation, thereby effectively reducing test time and resource consumption.
[0071] S400 , generating a test instruction sequence according to a target function test path and the running time of a function combination represented by each node in the target function test path.
[0072] Among them, the test instruction sequence refers to a series of instructions used to guide the test system to execute a specific function combination in a predetermined order and time. In the actual test process, the system will concurrently execute the function combination represented by the nodes on the target function test path. Exemplarily, the test instruction sequence may include a command to start a specific function combination, an execution time allocated to each function combination, an instruction to handle resource occupation conflicts, and a command to record execution results, etc., so as to maximize the reproduction of possible compatibility issues between multiple application programs under test and improve test efficiency.
[0073] S500, performing compatibility testing on multiple application programs to be tested based on a test instruction sequence.
[0074] Among them, compatibility testing refers to verifying whether multiple applications under test can run correctly and without conflict in the same software and hardware environment.
[0075] Specifically, during the test, the system will monitor the running status of multiple applications under test, including resource usage, correctness of function execution, execution time, etc. At the same time, the system will also check whether there are resource usage conflicts, function crashes or other abnormal situations. In addition, after the test is completed, the system will generate a test report, which includes the execution results, resource usage, number of conflicts and possible compatibility issues of each function combination, so as to provide a basis for subsequent application optimization and problem repair.
[0076] The above-mentioned application compatibility testing method based on test duration is different from the traditional scheme. The above-mentioned scheme represents the functional combinations of different application programs to be tested in the form of a directed graph. Even when there are a large number of applications and their functions, subsequent analysis and testing are not likely to miss or repeat the test functional combinations, thereby improving the test efficiency; then, for each group of functional combinations, the process of concurrent execution of the functions in the functional combination and the target running time of the functional combination are simulated, and this is used to represent the resource usage of the system when the functional combinations are executed concurrently, so that potential resource usage conflicts can be discovered in advance, and then, with the goal of minimizing the average target running time, the target function test path is generated, and the final test instruction sequence is determined, so that the total test time is as small as possible, the process of application compatibility testing is optimized, and the test efficiency is effectively improved.
[0077] Specifically, multiple simulations and concurrent execution of functions in the function combination can more accurately determine the target runtime and reduce the accidental errors that may occur in a single simulation. Figure 3 As shown, S200 includes:
[0078] S210, multiple simulations are performed concurrently to execute the functions in the function combination represented by the node, and the initial running time of the node is determined when the number of resource occupation conflicts of the functions in the function combination reaches a preset conflict number threshold during each simulation, and multiple initial running times are obtained.
[0079] S220, determining the mean and variance of the running time of the plurality of initial running time, and determining the target running time according to the mean and variance of the running time.
[0080] Among them, the process of multiple simulated concurrent execution refers to repeatedly executing all functions in the function combination concurrently under the same test conditions. During each simulation, the system will monitor the resource occupation conflict in real time, and when the number of resource occupation conflicts reaches the preset conflict number threshold, it will record the running time of the function combination, that is, the initial running time.
[0081] Furthermore, through the above multiple simulations, multiple initial running times can be obtained, and then the average values and variances of the multiple initial running times, i.e., the running time mean and variance, can be determined. According to the calculated running time mean and variance, the target running time of each function combination can be determined. Specifically, the target running time can be based on the running time mean, with the variance as a correction term, so that the target running time can better reflect the resource occupation conflict when the functions in the function combination are executed concurrently.
[0082] In this embodiment, by calculating the mean and variance of the runtimes of multiple initial runtimes, the determined target runtime can effectively and accurately reflect the average performance of the functional combination, and can also take into account possible fluctuations, thereby improving the accuracy and reliability of the test process.
[0083] Continuing from the above embodiments, there are many ways to simulate the concurrent execution of multiple function combinations. In one embodiment, each time a function in a function combination represented by a concurrent execution node is simulated, the following steps are performed: a resource occupancy model of each function in the function combination is obtained, the resource occupancy model includes the generation time distribution of the resource occupancy request when executing the function, the service time distribution of the server processing each resource occupancy request, and the service policy of the server; based on the generation time distribution, the service time distribution, and the service policy, the functions in the function combination represented by the concurrent execution node are simulated.
[0084] Among them, the resource occupancy model is a mathematical model used to describe the demand and usage of system resources for a certain function during execution, including but not limited to the generation time of the resource occupancy request, the service time of the server processing the resource occupancy request, the server's service strategy, etc.
[0085] Specifically, for each function, the occupation of system resources when the function is executed under different test conditions is recorded respectively. The above test conditions include: CPU, memory, hard disk parameters and load device type and quantity, etc. System resources include hard disk, database, system API, input and output ports, upstream and downstream interfaces, etc. The process of modeling the resource occupation of each function under a certain test condition to obtain a resource occupation model can be: using the A / S / C / K / N / D six-tuple model in queuing theory to model, where A is the distribution of arrival requests, S is the distribution of service time, C is the number of servers in the queuing system, K is the maximum length of the queue in the queuing system, N is the total number of requests, and D is the service scheduling policy of the request. For example, the access of a certain function module to a certain system API can be described by a simplified six-tuple model - M / M / 1 model, that is, the time interval between arrival requests is exponentially distributed (M), the service time is exponentially distributed (M), one server (1), infinite waiting queue length, infinite number of requests, first-come-first-served scheduling policy, and exponential distribution is used to fit the time interval between arrival requests and service time of the above API.
[0086] For example, in this embodiment, the generation time distribution of resource occupation requests when executing functions can be exponential distribution, Poisson distribution or other distributions, the service time distribution of the server processing resource occupation requests can also be exponential distribution, Poisson distribution or other distributions, and the service policy of the server can be only one server, unlimited number of queues for resource occupation requests, unlimited queue time, and priority processing of resource occupation requests that arrive first. Finally, based on the resource occupation model of each function, the system can more accurately simulate the resource occupation of the functions in the function combination during actual execution, and well reflect the real operating environment. For example, under certain test conditions, the generation time distribution of resource occupation requests is represented by Poisson distribution, and the time of Poisson distribution is discretized to improve the speed of simulation. When the server is serving a resource occupation request, other resource occupation requests arrive, and there are no free resources to serve them, then a resource occupation conflict occurs.
[0087] In this embodiment, by acquiring and using the resource occupancy model, the system can capture the resource competition and mutual influence between functions, so as to more accurately reflect the resource requirements and system performance of the functional combination in actual operation, thereby improving the test efficiency.
[0088] Following the above embodiment, a method of gradually screening nodes can be adopted to determine the final target function test path. Figure 3 As shown, S300 includes:
[0089] S310, taking the start node in the directed graph as the current node;
[0090] S320, with the goal of minimizing the average target running time of the functional test path, searching for the next node of the current node in the application test directed graph, and determining the next node found as a new current node;
[0091] S330, determine whether the current node is the end node, if not, return to the step of searching for the next node of the current node in the application test directed graph with the goal of minimizing the average target running time of the functional test path, until the end node is found to obtain the target functional test path.
[0092] The start node is the starting point of the functional test path. This node represents the initial set of functional combinations, for example, it represents that all the applications to be tested are not running. The start node is used as the current node to gradually find the optimal path to the end node. Similarly, the end node can also be a node that represents that all the applications to be tested are not running.
[0093] Specifically, starting from the starting node, taking the starting node as the current node, the next node of the current node is determined according to the edge connected to the starting node, where the average target running time can also be expressed in the form of an objective function, and the formula of the objective function is shown as follows:
[0094]
[0095] In the formula, is the objective function, and is the mean and variance of the initial running time when the number of conflicts in system resource occupation of the function combination represented by the i-th node on the function test path reaches the conflict number threshold, P is the number of nodes in the function test path excluding the nodes representing all non-running applications to be tested, is the coefficient of variance, which can be set to 2. After setting the objective function, an optimization algorithm such as a dynamic programming algorithm can be used to select the next node that minimizes the function value of the objective function for the current node, and determine the next node found as the new current node, and repeat the process until the end node is found. For example, the only nodes connected to the current node by an edge are the previous node of the current node and the end node.
[0096] It should be noted that under each test condition, compatibility testing of multiple applications to be tested often requires multiple target test paths. Therefore, after finding a target test path, it is necessary to determine whether the found target test path has been tested or generated (no new nodes compared to other target test paths). If so, the currently found target test path is discarded because the nodes on this path have been used or tested in other paths. If not, the currently found target test path is retained. In this way, the multiple target function test paths finally obtained can include all function combinations as much as possible, while minimizing the repeated function combinations in different target function test paths, thereby improving test efficiency.
[0097] In this embodiment, with the goal of minimizing the average target running time of the functional test path, the next node of the current node is continuously searched, and the global optimum is achieved through local optimum, so that the running time of the target functional test path in the subsequent test process is as short as possible, reducing the time consumption of the test process and improving the test efficiency.
[0098] Continuing from the above embodiments, the application test directed graph usually includes multiple target function test paths, that is, the nodes of the application test directed graph include tested nodes and untested nodes. In one embodiment, S320 includes: according to the edges of the application test directed graph, searching for candidate nodes of the current node in the application test directed graph; when the candidate nodes only include tested nodes, determining the target node among the candidate nodes that minimizes the average target running time as the next node of the current node; when the candidate nodes include untested nodes, determining the target node among the untested nodes that minimizes the average target running time as the next node.
[0099] Among them, the tested node refers to the node that has been included in other target function test paths, and the function combination it represents has been tested in the actual operation process. The untested node refers to the node that has not been included in any target function test path and has not been actually run and tested. The candidate node is the potential next node of the current node, which can be determined based on the edges of the application test directed graph.
[0100] Specifically, the candidate node of the current node refers to the next node that can be directly reached through the edge in the directed graph. According to the edge in the application test directed graph connected to the current node, the candidate node is searched in the application test directed graph. These candidate nodes may be tested nodes or untested nodes. When all the nodes in the candidate nodes are tested nodes, the server will select the node with the smallest average target runtime as the next node among these tested nodes. That is to say, although the candidate nodes have been tested, in order to form the target function test path, these tested nodes still need to be included in the path, so the node with the smallest average target runtime is still selected. When the candidate nodes contain untested nodes, the server will give priority to selecting an untested node in the candidate nodes as the next node, and select the node that can minimize the average target runtime among these untested nodes, so as to cover as many functional combinations as possible to comprehensively evaluate the compatibility of the application to be tested.
[0101] In this embodiment, untested nodes are preferentially selected during the path generation process to cover as many different functional combinations as possible. This allows for a more comprehensive evaluation of the compatibility of the application to be tested, which not only optimizes the average target runtime of the target function test path, but also improves the comprehensiveness and effectiveness of the test. In addition, regardless of whether it is a tested node or an untested node, the node that minimizes the average target runtime is selected as the next node of the current node, further reducing the overall test time.
[0102] In an exemplary embodiment, for each target functional test path, a test instruction may be generated accordingly, thereby generating a test instruction sequence. Figure 4 As shown, S400 includes:
[0103] S410, generating a plurality of test instructions based on the target functional test path, wherein the test instructions correspond one-to-one to the functional combinations represented by the nodes in the target functional test path.
[0104] S420, determining the time intervals of the plurality of test instructions based on the target running time of the functional combination represented by each node.
[0105] S430, determining a test instruction sequence based on the plurality of test instructions and the time interval.
[0106] The test instruction refers to a command or instruction for executing a specific function combination, and the time interval refers to the time difference when executing consecutive test instructions.
[0107] Specifically, the server generates corresponding test instructions based on the previously determined target function test path, and each test instruction corresponds to a node in the target function test path, that is, a set of functional combinations. In the actual test process, the server will execute the test instructions and concurrently execute the functions in the corresponding functional test combination to perform compatibility testing.
[0108] Furthermore, after determining multiple test instructions, it is also necessary to determine the time interval between two adjacent test instructions. For example, based on the target running time of the functional combination represented by each node, calculate the time it takes for the server to execute the current test instruction, and how long it should wait before executing the next test instruction, so that each group of functional combinations can be fully tested, so as not to miss compatibility issues due to too short a test time, and not to spend too much test time on a group of functional combinations, thereby improving test efficiency. Finally, based on multiple test instructions and the time intervals between test instructions, a complete test instruction sequence is generated, which defines the execution order and execution time of each test instruction.
[0109] In this embodiment, by accurately setting the time interval of the test instructions, the server can reduce invalid waiting time and also enable each group of functional combinations to be fully tested, thereby improving the test efficiency and test accuracy.
[0110] Furthermore, considering that the functions in some function combinations have almost no resource occupation conflicts when they are executed concurrently, because the corresponding target running time is infinite, and some function occupation combinations with no serious resource occupation conflicts do not need to spend too much time testing, in order to improve the test efficiency, the time interval between the test instruction corresponding to the above function combination and its next test instruction can be adaptively adjusted. In one embodiment, S420 includes: when the target running time of the function combination is less than or equal to the preset running time threshold, the target running time is determined as the time interval between the test instruction corresponding to the function combination and the next test instruction; when the target running time of the function combination is greater than the preset running time threshold, the preset minimum time interval is determined as the time interval between the test instruction corresponding to the function combination and the next test instruction.
[0111] Among them, the minimum time interval refers to the minimum time interval between two adjacent test instructions that are preset. The preset running threshold can be used to measure the resource occupation conflict when the functions in the function combination are executed concurrently. If the target running time of the function combination is less than or equal to the preset running time threshold, it means that the functions in the function combination are more likely to have resource occupation conflict time when they are executed concurrently. The test time corresponding to this function combination is its target running time to reduce missing compatibility issues.
[0112] On the contrary, if the target runtime of the function combination is greater than the preset runtime threshold, it means that resource occupation conflict is not likely to occur when the functions in the function combination are executed concurrently, which can reduce the time spent on testing this function combination, or even eliminate the need to test this function combination. Therefore, the execution time of the test instruction corresponding to the function combination can be set to the preset minimum time interval, that is, the time interval between the test instruction and the next test instruction is the preset minimum time interval, so as to improve test efficiency.
[0113] In this embodiment, the time interval between test instructions is adjusted. When the target running time of the function combination is short, the time interval between test instructions is arranged to be the target running time, so as to improve the test efficiency as much as possible while ensuring the continuity of the test. When the target running time of the function combination is long, the minimum time interval is used so that the test process does not become too lengthy, thereby achieving efficient compatibility testing.
[0114] Following the above embodiment, after the test instruction sequence is generated, it is necessary to perform a real compatibility test according to the test instruction sequence. In one embodiment, the number of the test instruction sequence is multiple groups, such as Figure 4 As shown, S500 includes:
[0115] S510, performing compatibility testing on the application program to be tested based on multiple groups of test instruction sequences, and obtaining resource usage of the system when different application programs to be tested are running concurrently.
[0116] S520: Generate a compatibility test log according to the resource usage.
[0117] Among them, for multiple applications under test, multiple target function test paths can often be generated, and correspondingly there are multiple sets of test instruction sequences. By executing multiple sets of test instruction sequences separately, it can be verified whether different applications under test can work normally in the same system environment when running concurrently, and whether there will be compatibility issues such as resource usage conflicts and performance degradation.
[0118] During the actual testing process, the compatibility test results can be presented in the form of a compatibility test log. For example, the compatibility test log includes but is not limited to the allocation and usage of system resources when multiple applications under test are executed concurrently, the results of the execution of each set of test instruction sequences, whether there is performance degradation, resource contention, functional abnormality, system crash, and other problems.
[0119] It should be noted that the above-mentioned embodiments are a compatibility test conducted on the application to be tested under a certain test condition. In order to improve the comprehensiveness of the compatibility test results, the resource usage of different functions can be re-modeled for other different test conditions to obtain a resource usage model, and then simulate the concurrent execution of various groups of functional combinations to finally generate a test instruction sequence and a compatibility test report.
[0120] In this embodiment, by executing multiple groups of test instruction sequences, compatibility tests are performed on multiple applications under test, which can comprehensively evaluate the resource usage and mutual impact of different applications under test when running concurrently. The generated compatibility test log can also serve as a basis for developers to optimize application performance and improve system stability.
[0121] In order to make a clearer description of the application program compatibility testing method based on test duration provided by the present application, the following is a specific embodiment and the attached Figure 5 To illustrate, this specific embodiment includes the following steps:
[0122] S501, obtain the application test directed graph, simulate the functions in the function combination represented by the concurrent execution node multiple times, determine the initial running time of the node when the number of resource occupation conflicts of the functions in the function combination reaches a preset conflict number threshold during each simulation, and obtain multiple initial running times.
[0123] S502, determining the mean and variance of the running time of multiple initial running times, and determining the target running time according to the mean and variance of the running time, with the start node in the directed graph as the current node.
[0124] S503, with the goal of minimizing the average target running time of the functional test path, searching for the next node of the current node in the application test directed graph, and determining the next node found as the new current node;
[0125] S504, determine whether the current node is the end node, if not, return to the step of searching for the next node of the current node in the application test directed graph with the goal of minimizing the average target running time of the functional test path, until the end node is found to obtain the target functional test path.
[0126] S505, generating a plurality of test instructions based on the target functional test path, determining the time intervals between the plurality of test instructions based on the target running time of the functional combination represented by each node, and determining a test instruction sequence based on the plurality of test instructions and the time intervals.
[0127] S506, performing compatibility tests on the application programs to be tested based on multiple groups of test instruction sequences, obtaining resource usage of the system when different application programs to be tested are running concurrently, and generating a compatibility test log according to the resource usage.
[0128] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0129] Based on the same inventive concept, the embodiment of the present application also provides a test duration-based application compatibility testing device for implementing the test duration-based application compatibility testing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the one or more test duration-based application compatibility testing device embodiments provided below can refer to the limitations of the test duration-based application compatibility testing method above, and will not be repeated here.
[0130] In an exemplary embodiment, Figure 6 As shown, an application compatibility testing device 600 based on test duration is provided, comprising: a data acquisition module 610, a duration determination module 620, a path generation module 630, an instruction generation module 640, and a compatibility testing module 650, wherein:
[0131] The data acquisition module 610 is used to acquire the application test directed graph, each node of the application test directed graph represents a set of function combinations, each function combination is an arrangement and combination of functions between multiple application programs to be tested, and the edge of the directed graph represents the transfer direction between the function combinations.
[0132] The duration determination module 620 is used to simulate the concurrent execution of functions in each group of function combinations and determine the target running duration of the function combination. The target running duration includes the running duration of the function combination when the number of resource occupation conflicts of the functions in the function combination reaches a preset conflict number threshold.
[0133] The path generation module 630 is used to find a target function test path with the minimum average target running time from the directed graph based on the target running time of each function combination.
[0134] The instruction generation module 640 is used to generate a test instruction sequence according to the target function test path and the running time of the function combination represented by each node in the target function test path.
[0135] The compatibility testing module 650 is used to perform compatibility testing on multiple application programs to be tested based on a test instruction sequence.
[0136] In one embodiment, the duration determination module 620 is used to simulate multiple times the functions in the function combination represented by the concurrent execution node, determine the initial running duration of the node when the number of resource occupation conflicts of the functions in the function combination reaches a preset conflict number threshold during each simulation, obtain multiple initial running durations, determine the running duration mean and variance of the multiple initial running durations, and determine the target running duration based on the running duration mean and variance.
[0137] In one embodiment, the duration determination module 620 is used to obtain a resource occupancy model of each function in the function combination, the resource occupancy model includes the generation time distribution of resource occupancy requests when executing the functions, the service time distribution of the server processing each resource occupancy request, and the service policy of the server. Based on the generation time distribution, service time distribution, and service policy, the functions in the function combination represented by concurrent execution nodes are simulated.
[0138] In one embodiment, the path generation module 630 takes the starting node in the directed graph as the current node, takes minimizing the average target runtime of the functional test path as the goal, searches for the next node of the current node in the application test directed graph, determines the next node found as the new current node, and again executes the step of searching for the next node of the current node in the application test directed graph with the goal of minimizing the average target runtime of the functional test path until the end node is found to obtain the target functional test path.
[0139] In one embodiment, the path generation module 630 is used to search for candidate nodes of the current node in the application test directed graph based on the edges of the application test directed graph. When the candidate nodes include only tested nodes, the target node among the candidate nodes that minimizes the average target runtime is determined as the next node of the current node. When the candidate nodes include untested nodes, the target node among the untested nodes that minimizes the average target runtime is determined as the next node.
[0140] In one embodiment, the instruction generation module 640 is also used to generate multiple test instructions based on the target functional test path, the test instructions correspond one-to-one to the functional combinations represented by the nodes in the target functional test path, and the time intervals between the multiple test instructions are determined based on the target running time of the functional combinations represented by each node, and the test instruction sequence is determined based on the multiple test instructions and the time intervals.
[0141] In one embodiment, the instruction generation module 640 is also used to determine the target running time as the time interval between the test instruction corresponding to the function combination and the next test instruction when the target running time of the function combination is less than or equal to the preset running time threshold; and to determine the preset minimum time interval as the time interval between the test instruction corresponding to the function combination and the next test instruction when the target running time of the function combination is greater than the preset running time threshold.
[0142] In one embodiment, the number of test instruction sequences is multiple groups, and the compatibility test module 650 is also used to perform compatibility testing on the application to be tested based on the multiple groups of test instruction sequences, obtain the resource usage of the system when different application to be tested are running concurrently, and generate a compatibility test log based on the resource usage.
[0143] Each module in the above-mentioned application compatibility testing device based on test duration can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.
[0144] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG7. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as an application test directed graph. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an application compatibility test method based on test duration is implemented.
[0145] Those skilled in the art will understand that the structure shown in FIG. 7 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0146] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps in any of the above-mentioned application compatibility testing method embodiments based on test duration are implemented.
[0147] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in any of the above-mentioned application compatibility testing method embodiments based on test duration are implemented.
[0148] In one embodiment, a computer program product is provided, including a computer program, which, when executed by a processor, implements the steps in any of the above-mentioned application compatibility testing method embodiments based on test duration.
[0149] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0150] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0151] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0152] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. An application compatibility testing method based on test duration, characterized in that: The method comprises: Obtain an application test directed graph, wherein each node of the application test directed graph represents a set of function combinations, each of the function combinations is an arrangement and combination of functions between multiple application programs to be tested, and the edges of the directed graph represent transfer directions between the function combinations; For each group of function combinations, simulate the concurrent execution of the functions in the function combination to determine the target running time of the function combination, where the target running time includes the running time of the function combination when the number of resource occupation conflicts of the functions in the function combination reaches a preset conflict number threshold; Based on the target running time of each of the function combinations, finding a target function test path with the minimum average target running time from the directed graph; Generate a test instruction sequence according to the target function test path and the running time of the function combination represented by each node in the target function test path; Based on the test instruction sequence, compatibility testing is performed on the plurality of application programs to be tested.
2. The method according to claim 1, characterized in that The simulating concurrently executing the functions in the function combination and determining the target running time of the function combination includes: Simulating and concurrently executing the functions in the function combination represented by the node multiple times; Determine, during each simulation, when the number of resource occupation conflicts of the functions in the function combination reaches a preset conflict number threshold, the initial running time of the node, and obtain multiple initial running times; Determining the mean and variance of the runtimes for a plurality of initial runtimes; The target runtime is determined according to the runtime mean and the variance.
3. The method according to claim 2, characterized in that Each time the concurrent execution of the functions in the function combination represented by the node is simulated, the following steps are performed: Obtaining a resource occupancy model for each function in the function combination, the resource occupancy model including a generation time distribution of a resource occupancy request when executing the function, a service time distribution of a server processing each resource occupancy request, and a service policy of the server; Based on the generation time distribution, the service time distribution, and the service policy, the concurrent execution of functions in the function combination represented by the node is simulated.
4. The method according to claim 1, characterized in that The step of searching the target function test path with the minimum average target running time from the directed graph based on the target running time of each of the function combinations includes: Taking the starting node in the directed graph as the current node; With the goal of minimizing the average target running time of the functional test path, searching for the next node of the current node in the directed graph, and determining the next node found as a new current node; Return to the step of searching for the next node of the current node in the directed graph with the goal of minimizing the average target running time of the functional test path, until an end node is found, thereby obtaining a target functional test path.
5. The method according to claim 4, characterized in that The nodes include tested nodes and untested nodes; and the step of searching for the next node of the current node in the directed graph with the goal of minimizing the average target running time of the functional test path includes: According to the edge of the directed graph, searching for a candidate node of the current node in the directed graph; In a case where the candidate nodes only include tested nodes, determining a target node among the candidate nodes that minimizes the average target running time as the next node of the current node; In the case that the candidate nodes include untested nodes, a target node among the untested nodes that minimizes the average target running time is determined as the next node.
6. The method according to any one of claims 1 to 5, characterized in that: The generating a test instruction sequence according to the target function test path and the running time of the function combination represented by each node in the target function test path includes: Based on the target functional test path, generating a plurality of test instructions, wherein the test instructions correspond one-to-one to the functional combinations represented by the nodes in the functional test path; Determining the time intervals of the plurality of test instructions based on the target running time of the functional combination represented by each node; A test instruction sequence is determined based on the plurality of test instructions and the time interval.
7. The method according to claim 6, characterized in that The step of determining the time intervals of the plurality of test instructions based on the target running time of the functional combination represented by each node includes: When the target running time of the function combination is less than or equal to the preset running time threshold, the running time is determined as the time interval between the test instruction corresponding to the function combination and the next test instruction; When the target running time of the function combination is greater than the preset running time threshold, the preset minimum time interval is determined as the time interval between the test instruction corresponding to the function combination and the next test instruction.
8. The method according to any one of claims 1 to 5, characterized in that: The number of the test instruction sequences is a plurality of groups; and the compatibility test of the application to be tested is performed based on the test instruction sequences, including: Based on the multiple groups of the test instruction sequences, compatibility testing is performed on the application to be tested to obtain resource usage of the system when different application to be tested are running concurrently; A compatibility test log is generated based on the resource usage.
9. An application compatibility testing device based on test duration, characterized in that: The device comprises: A data acquisition module is used to acquire an application test directed graph, wherein each node of the application test directed graph represents a set of function combinations, each of the function combinations is an arrangement and combination of functions between multiple application programs to be tested, and the edges of the directed graph represent transfer directions between the function combinations; A duration determination module, for simulating concurrent execution of functions in each group of function combinations, and determining a target running duration of the function combination, wherein the target running duration includes the running duration of the function combination when the number of resource occupation conflicts of the functions in the function combination reaches a preset conflict number threshold; A path generation module, configured to find a target function test path with a minimum average target running time from the directed graph based on the target running time of each of the function combinations; An instruction generation module, used for generating a test instruction sequence according to the target function test path and the running time of the function combination represented by each node in the target function test path; A compatibility testing module is used to perform compatibility testing on the plurality of application programs to be tested based on the test instruction sequence.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.