Application program testing method, device, computer equipment and storage medium
By obtaining and updating the state migration model of the application, using the first test method to determine the page jump relationship and switching to the second test method, the problem of inefficient application testing in the prior art is solved, and an efficient testing process and reasonable resource utilization are achieved.
Patent Information
- Application Number
- CN202110484278.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-30
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2041-04-30
AI Technical Summary
During the software testing process, it is difficult for the prior art to conduct efficient testing of applications, resulting in inefficient testing.
By obtaining the current state migration model of the target application, responding to the client's pathfinding request, the page jump relationship is determined using the first test method, and the status migration model is updated. When the scale information reaches the preset condition, switch to the second test method to continue testing.
It realizes the rational use of application testing methods, improves testing efficiency, ensures the rationality of resource utilization, and can convert testing methods according to preset conditions to meet test needs of different scales.
Smart Images

Figure CN115269365B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of software testing, and in particular to an application testing method, apparatus, computer equipment and storage medium. Background Art
[0002] Software testing is the process of running or measuring a software system using manual or automatic means. For example, testing the corresponding operations of controls in each page of an application by traversing the application. The purpose is to verify whether it meets the specified requirements or to find out the difference between the expected results and the actual results. As the number of software tests required for applications increases, how to conduct software testing efficiently has become an urgent problem to be solved. Summary of the invention
[0003] The embodiments of the present disclosure at least provide an application testing method, apparatus, computer device, and storage medium.
[0004] In a first aspect, an embodiment of the present disclosure provides an application testing method, including:
[0005] Obtaining a current state transition model of a target application; wherein the current state transition model is used to characterize the page states and page state transition information of pages that have been tested in the target application, and the state transition information is used to characterize operations performed by jumping between pages;
[0006] In response to a path-finding request of a target client, determine, using a first test method based on a current state migration model, a second page to be jumped to from a first page currently tested by the target client;
[0007] updating the current state transition model based on the second page to obtain an updated state transition model;
[0008] When the scale information of the updated state transition model reaches the preset condition, the second test method is used to determine the third page to which the second page is to jump based on the updated state transition model, and the test is performed from the third page. The scale information is used to characterize the amount of information recorded in the state transition model.
[0009] In a possible implementation, the preset condition includes a first quantity threshold of the page states recorded in the state transition model;
[0010] The method further includes: when the number of page states recorded in the updated state transition model is greater than the first number threshold, determining that the scale information of the updated state transition model reaches a preset condition.
[0011] In a possible implementation manner, the preset condition includes a jump time-consuming threshold;
[0012] Then the method further includes: determining, based on the scale information of the updated state transition model and the updated state transition model, calculating the jump time from the second page to the next target page by using a first test method;
[0013] When the jump time is greater than the jump time threshold, it is determined that the scale information of the updated state transition model reaches a preset condition.
[0014] In a possible implementation manner, the preset condition includes a link length threshold;
[0015] Then the method further includes: based on the scale information of the updated state transition model and the updated state transition model, using a first test method to determine a plurality of candidate operation paths and corresponding lengths for transitioning from the second page to a next target page;
[0016] Taking a candidate operation path whose length is greater than the link length threshold as a target path;
[0017] When it is determined that the number of continuously generated target paths is greater than a preset second number threshold based on the generation time of the target path, it is determined that the scale information of the updated state transition model reaches a preset condition.
[0018] In a possible implementation manner, the preset condition includes a first revenue convergence value;
[0019] Then the method further includes: based on the scale information of the updated state transition model and the updated state transition model, using a first test method to calculate a first jump revenue value of jumping from the second page to a next target page, and all first jump revenue values before jumping to the second page;
[0020] Based on the generation time of each first jump benefit value, when the first jump benefit value approaches the first benefit convergence value, it is determined that the scale information of the updated state transition model reaches a preset condition.
[0021] In a possible implementation manner, the preset condition includes a second revenue convergence value;
[0022] Then the method further includes: based on the scale information of the updated state transition model and the updated state transition model, using a second test method to calculate a second jump revenue value of jumping from the second page to the next target page, and all second jump revenue values before jumping to the second page;
[0023] Based on the generation time of each second jump benefit value, when the second jump benefit value approaches the second benefit convergence value, it is determined that the scale information of the updated state transition model reaches a preset condition.
[0024] In a possible implementation, the determining, using the first test mode based on the current state migration model, the second page to be jumped to by the first page currently tested by the target client includes:
[0025] Based on the page states and state transition information of the tested pages in the current state transition model, determining the remaining test values of a plurality of second pages having a jump relationship of a preset level with the first page currently tested by the target client;
[0026] Based on the remaining test value, a second page to which the currently tested first page is to be jumped is selected from the plurality of second pages.
[0027] In a possible implementation manner, the page state of the second page includes attribute information of the second page;
[0028] Determining remaining test values of the plurality of second pages includes:
[0029] Based on the attribute information of the second page, clustering the functional components on which no operation is performed in the second page to obtain a plurality of functional component sets, and determining a linear abstract weight of each of the functional component sets;
[0030] For each set of functional components, determining the number of functional components in the set of functional components;
[0031] Determine the test value of the functional component set based on the number of functional components in the functional component set, the operation type weight corresponding to each operation corresponding to the functional component set, the component type weight corresponding to the functional component set, and the linear abstract weight of the functional component set;
[0032] Based on the test value of each of the functional component sets, a remaining test value of the second page is determined.
[0033] In a possible implementation manner, after determining the second page to be jumped to from the first page currently tested by the target client, the method further includes:
[0034] Determine a target operation path for jumping from the first page to the second page;
[0035] The target operation path is sent to the target client, so that the target client jumps from the first page to the second page based on the target operation path.
[0036] In a possible implementation manner, the determining, using the second test mode and based on the updated state transition model, the third page to which the second page is to jump includes:
[0037] determining a plurality of candidate operations for the second page;
[0038] For each candidate operation, a jump benefit value corresponding to the candidate operation is calculated; the jump benefit value refers to the benefit value brought by executing multiple steps of operations starting from executing the candidate operation; the benefit value is used to represent the contribution value of the multiple steps of operations to the test coverage growth rate of the page function;
[0039] Based on the number of times the candidate operations have been executed and the jump benefit value respectively corresponding to the candidate operations, a target operation is selected from the candidate operations, and the third page is determined based on the second page and the target operation.
[0040] In a possible implementation manner, after determining the plurality of candidate operations and before calculating, for each candidate operation, a jump benefit value corresponding to the candidate operation, the method further includes:
[0041] When it is determined that there is at least one candidate operation that has not been performed among the plurality of candidate operations of the second page, a target operation is selected from the at least one candidate operation that has not been performed.
[0042] In a possible implementation manner, for each candidate operation, calculating the jump benefit value corresponding to the candidate operation includes:
[0043] Based on the page element attribute information after executing each of the n operations, n reward values corresponding to the candidate operation are determined; the n reward values include the i-th reward value obtained after executing the i-th operation, wherein the first operation is the candidate operation; i is a positive integer from 1 to n; the reward value is used to represent the initial contribution value of each operation to the test coverage growth rate of the page function;
[0044] Based on the n reward values, the jump benefit value is calculated using a second test method.
[0045] In a possible implementation, the page state of the page includes a state of the page; and
[0046] The selecting a target operation from the multiple candidate operations based on the number of times the multiple candidate operations have been executed and the jump benefit value respectively includes:
[0047] For each candidate operation among the multiple candidate operations, based on the jump benefit value corresponding to the candidate operation and the number of visits corresponding to the current state of the second page, determine a first visit reward value corresponding to the candidate operation;
[0048] Determine a second access reward value corresponding to the candidate operation based on the number of times the candidate operation has been executed, the number of times the current state has been accessed, and a preset balance coefficient;
[0049] Taking the sum of the first visit reward value and the second visit reward value as the total visit reward value of the candidate operation;
[0050] A candidate operation with the largest corresponding total visit reward value is selected from the multiple candidate operations as the target operation.
[0051] In a second aspect, an embodiment of the present disclosure further provides an application testing device, including:
[0052] An acquisition module, used to acquire a current state transition model of a target application; wherein the current state transition model is used to characterize the page states and page state transition information of pages that have been tested in the target application, and the state transition information is used to characterize operations performed by jumping between pages;
[0053] A first determination module is used to respond to a path-finding request of a target client, and determine a second page to be jumped to from a first page currently tested by the target client based on a current state migration model by using a first test method;
[0054] An updating module, configured to update the current state transition model based on the second page to obtain an updated state transition model;
[0055] The second determination module is used to determine the third page to which the second page is to jump based on the updated state transition model using a second testing method when the scale information of the updated state transition model reaches a preset condition, and to perform testing from the third page, wherein the scale information is used to characterize the amount of information recorded in the state transition model.
[0056] In a possible implementation, the preset condition includes a first quantity threshold of page states recorded in the state transition model, and the device further includes:
[0057] The third determination module is used to determine that the scale information of the updated state transition model reaches a preset condition when the number of page states recorded in the updated state transition model is greater than the first number threshold.
[0058] In a possible implementation manner, the preset condition includes a jump time-consuming threshold;
[0059] The third determination module is used to determine the jump time taken to calculate the jump from the second page to the next target page using the first test method based on the scale information of the updated state transition model and the updated state transition model;
[0060] When the jump time is greater than the jump time threshold, it is determined that the scale information of the updated state transition model reaches a preset condition.
[0061] In a possible implementation manner, the preset condition includes a link length threshold;
[0062] The third determination module is used to determine multiple candidate operation paths and corresponding lengths of transitioning from the second page to the next target page by using the first test method based on the scale information of the updated state transition model and the updated state transition model;
[0063] Taking a candidate operation path whose length is greater than the link length threshold as a target path;
[0064] When it is determined that the number of continuously generated target paths is greater than a preset second number threshold based on the generation time of the target path, it is determined that the scale information of the updated state transition model reaches a preset condition.
[0065] In a possible implementation manner, the preset condition includes a first revenue convergence value;
[0066] The third determination module is used to calculate the first jump revenue value of jumping from the second page to the next target page and all first jump revenue values before jumping to the second page by using the first test method based on the scale information of the updated state transition model and the updated state transition model;
[0067] Based on the generation time of each first jump benefit value, when the first jump benefit value approaches the first benefit convergence value, it is determined that the scale information of the updated state transition model reaches a preset condition.
[0068] In a possible implementation manner, the preset condition includes a second revenue convergence value;
[0069] The third determination module is used to calculate the second jump revenue value of jumping from the second page to the next target page and all second jump revenue values before jumping to the second page by using a second test method based on the scale information of the updated state transition model and the updated state transition model;
[0070] Based on the generation time of each second jump benefit value, when the second jump benefit value approaches the second benefit convergence value, it is determined that the scale information of the updated state transition model reaches a preset condition.
[0071] In a possible implementation manner, the first determination module is used to determine the remaining test values of a plurality of second pages having a jump relationship of a preset level with the first page currently tested by the target client based on the page state and state transition information of the tested pages in the current state transition model;
[0072] Based on the remaining test value, a second page to which the currently tested first page is to be jumped is selected from the plurality of second pages.
[0073] In a possible implementation manner, the page state of the second page includes attribute information of the second page;
[0074] The first determination module is used to cluster the functional components that have not performed operations in the second page based on the attribute information of the second page to obtain multiple functional component sets, and determine the linear abstract weight of each of the functional component sets;
[0075] For each functional component set, determining the number of functional components in the functional component set;
[0076] Determine the test value of the functional component set based on the number of functional components in the functional component set, the operation type weight corresponding to each operation corresponding to the functional component set, the component type weight corresponding to the functional component set, and the linear abstract weight of the functional component set;
[0077] Based on the test value of each of the functional component sets, a remaining test value of the second page is determined.
[0078] In a possible implementation manner, the first determination module is further configured to determine a target operation path for jumping from the first page to the second page after determining the second page to which the first page currently tested by the target client is to jump;
[0079] The target operation path is sent to the target client, so that the target client jumps from the first page to the second page based on the target operation path.
[0080] In a possible implementation manner, the second determining module is used to determine a plurality of candidate operations for the second page;
[0081] For each candidate operation, a jump benefit value corresponding to the candidate operation is calculated; the jump benefit value refers to the benefit value brought by executing multiple steps of operations starting from executing the candidate operation; the benefit value is used to represent the contribution value of the multiple steps of operations to the test coverage growth rate of the page function;
[0082] Based on the number of times the candidate operations have been executed and the jump benefit value respectively corresponding to the candidate operations, a target operation is selected from the candidate operations, and the third page is determined based on the second page and the target operation.
[0083] In a possible implementation, the second determination module is further used to, after determining the multiple candidate operations, and before calculating the jump benefit value corresponding to each candidate operation, when it is determined that there is at least one unexecuted candidate operation among the multiple candidate operations of the second page, select a target operation from the at least one unexecuted candidate operation.
[0084] In a possible implementation, the second determination module is used to determine n reward values corresponding to the candidate operation based on the page element attribute information after executing each of the n operations; the n reward values include the i-th reward value obtained after executing the i-th operation, where the first operation is the candidate operation; i is a positive integer from 1 to n; the reward value is used to represent the initial contribution value of each operation to the test coverage growth rate of the page function;
[0085] Based on the n reward values, the jump benefit value is calculated using a second test method.
[0086] In a possible implementation, the page state of the page includes a state of the page; and
[0087] The second determining module is used to determine, for each candidate operation among the multiple candidate operations, a first access reward value corresponding to the candidate operation based on the jump benefit value corresponding to the candidate operation and the number of visits corresponding to the current state of the second page;
[0088] Determine a second access reward value corresponding to the candidate operation based on the number of times the candidate operation has been executed, the number of times the current state has been accessed, and a preset balance coefficient;
[0089] Taking the sum of the first visit reward value and the second visit reward value as the total visit reward value of the candidate operation;
[0090] A candidate operation with the largest corresponding total visit reward value is selected from the multiple candidate operations as the target operation.
[0091] In a third aspect, an optional implementation of the present disclosure further provides a computer device, a processor, and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory, and when the machine-readable instructions are executed by the processor, the machine-readable instructions perform the steps of the above-mentioned first aspect, or any possible implementation of the first aspect.
[0092] In a fourth aspect, an optional implementation of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the steps of the above-mentioned first aspect, or any possible implementation of the first aspect are executed.
[0093] For a description of the effects of the above-mentioned application testing apparatus, computer device, and computer-readable storage medium, please refer to the description of the above-mentioned application testing method, which will not be repeated here.
[0094] The method, apparatus, computer device and storage medium for application testing provided by the embodiments of the present disclosure determine whether the scale information of the updated state transition model meets preset conditions based on the state transition model updated when the application is tested using the first test method. When it is determined that the preset conditions are met, the application is tested using the second test method, thereby achieving reasonable use of each application testing method, improving testing efficiency, and ensuring reasonable resource utilization by converting the test method according to preset conditions.
[0095] Furthermore, the application testing method provided by the embodiment of the present disclosure can also select a page (the first page or the second page) with greater testing value based on the state transition model, such as a page with more corresponding unexecuted operations, and start testing from this page, thereby improving the effectiveness of the testing process and further improving the efficiency of the test.
[0096] Furthermore, the application testing method provided by the embodiment of the present disclosure can also select an operation with a larger jump benefit value and a smaller number of executions as the target operation based on the jump benefit value and the number of executions corresponding to each candidate operation, thereby reducing invalid operations and repeated operations during the testing of the current test page, increasing the value return of each test, and improving the testing speed and efficiency.
[0097] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0098] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.
[0099] Figure 1 A flowchart of an application testing method provided by an embodiment of the present disclosure is shown;
[0100] Figure 2 A schematic diagram of a state migration model in an application testing method provided by an embodiment of the present disclosure is shown;
[0101] Figure 3 A schematic diagram of an application testing device provided by an embodiment of the present disclosure is shown;
[0102] Figure 4 A schematic diagram of the structure of a computer device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0103] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure is not intended to limit the scope of the present disclosure claimed for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0104] In addition, the terms "first", "second", etc. in the description and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein.
[0105] The "multiple or several" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.
[0106] According to research, software testing is the process of running or measuring a software system using manual or automatic means. For example, by traversing the application, the corresponding operations of the controls in each page are tested to verify whether it meets the specified requirements or to find out the difference between the expected results and the actual results. As the number of software tests required for applications increases, how to conduct software testing efficiently has become an urgent problem to be solved.
[0107] Based on the above research, the present disclosure provides an application testing method, apparatus, computer device and storage medium. Based on the state transition model updated when the application is tested using a first test method, it is determined whether the scale information of the updated state transition model meets the preset conditions. When it is determined that the preset conditions are met, the application is tested using a second test method, thereby achieving the rational use of each application testing method, improving the testing efficiency, and ensuring the rationality of resource utilization by converting the test method according to the preset conditions.
[0108] The defects existing in the above solutions are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the present disclosure for the above problems below should be the contributions made by the inventor to the present disclosure during the disclosure process.
[0109] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0110] To facilitate understanding of this embodiment, an application testing method disclosed in the embodiment of the present disclosure is first introduced in detail. The execution subject of the application testing method provided in the embodiment of the present disclosure is generally a computer device with certain computing capabilities, and the computer device includes, for example: a terminal device or a server or other processing device, and the terminal device can be a user equipment (User Equipment, UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (Personal Digital Assistant, PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. In some possible implementations, the application testing method can be implemented by a processor calling a computer-readable instruction stored in a memory.
[0111] The following describes the application program testing method provided by the embodiment of the present disclosure by taking a computer device as an example of an execution subject.
[0112] like Figure 1 As shown, it is a flowchart of an application testing method provided by an embodiment of the present disclosure, which may include the following steps:
[0113] S101: Obtain a current state migration model of a target application.
[0114] The current state transition model is used to characterize the page states of the pages that have been tested in the target application and the state transition information of the pages, and the state transition information is used to characterize the operations performed by jumping between pages.
[0115] In specific implementation, the server can generate a state transition model of the target application in this test. The state transition model can include nodes representing the set of functional components corresponding to the page, and connection edges representing the jump operations between pages in this test. The nodes can include the page state of the corresponding page, and the connection edges can include the state transition information of the page.
[0116] The page state of a page may include the attribute information of the functional components in the page and the state of the page. The state of the page may be the current state of the page. The attribute information of the functional components may include the identity and type of the functional components, the attribute information of the operations corresponding to the functional components, the tree structure of the functional components, and may also include the tested code in the page during this test, the tested code in the page during the last test, the tested operations in the page, etc. The state transition information is used to characterize the operations performed by jumping between pages. The start and end nodes of the state transition may be characterized by the direction of the connecting edge, and the identity, type, and other information of the operation may be stored inside the connecting edge.
[0117] Here, this test of the target application can refer to the software test of the target application. During this test, when testing a page, the server can select one or a series of operations that have not been executed. The target client receives the operation selected by the server and executes it to test the current page, and jumps to other pages under the influence of the executed operation, and then repeatedly selects the unexecuted operation. After meeting the pathfinding conditions, the target client can send a pathfinding request to the server. After receiving the pathfinding request, the server can allocate an operation path to the client based on the current state migration model.
[0118] The path-finding condition may be that the number of nodes included in the scale information in the state transition model is greater than a preset threshold.
[0119] During this test, after accessing a page, the target client can obtain the tree structure of the functional components of the page and send it to the server. After receiving the attribute structure sent by the target client, the server can convert the tree structure into a node in the state transition model. A node can include at least one tree structure, corresponding to a page, and generate a connection edge containing state transition information based on the operation performed when accessing the page. In the state transition model, a page corresponds to only one node, and the operation of jumping between pages corresponds to a connection edge.
[0120] S102: responding to a path-finding request of a target client, determining a second page to be jumped to from a first page currently tested by the target client by using a first testing method based on a current state migration model.
[0121] The first page may be the page currently tested during the test of the target application, for example, it may be a page corresponding to any node in the state transition model, or it may be a page tested in this test when the preset conditions are met. After the pathfinding conditions are met in this test, the test may be started directly from the current page, or a page may be selected from the pages tested in this test as the first page.
[0122] In one embodiment, regarding the method of determining the second page, it is first necessary to use the first testing method to determine the remaining test value of multiple second pages that have a preset level of jump relationship with the first page currently tested by the target client based on the determined first page and the page state and state transition information of the page tested in the current state transition model obtained, and then filter out the second page from the multiple second pages based on the remaining test value.
[0123] In a specific implementation, for the first page, multiple second pages having a jump relationship of a preset level between the first pages can be determined based on the node corresponding to the first page in the state transition model, wherein the jump relationship of the preset level can refer to the number of operations required to jump from the first page to the second page being a preset value. For example, the preset level can be set to 0-5, and a page that requires 5 or less operations from the first page can be determined as the second page.
[0124] After determining the second page, since the state migration model is generated based on the test results of this test and can reflect the test effect of this test, the second page with high remaining test value for the target application of this test can be screened out from the second page based on the state and state migration information of the corresponding node in the state migration model of the second page.
[0125] Among them, the remaining test value is a value that can characterize the number of operations or codes that have not been tested in the page. In the software testing process, all operations in a page will not be tested at one time. Usually only one or several operations are performed in a page. Therefore, the tested page may still include a large number of untested operations or codes. In a page, the more untested operations or codes there are, the higher its remaining test value. In one embodiment, the remaining test value of each second page can be determined according to the attribute information of the second page included in the page state of the second page, and the page with the highest remaining test value is selected as the target page. In specific implementation, the server responds to the pathfinding request of the target client, first clusters the functional components with unexecuted operations in the second page according to the attribute information in the page state of the second page, and obtains multiple functional component sets, each of which corresponds to a type. Exemplarily, clustering can be performed according to the identity identification, classification, and operation type corresponding to the functional component of the functional component, and the linear abstract weight of the functional component set is determined according to the clustering result. In a page, the more unexecuted operations there are, the higher the remaining test value.
[0126] After determining the linear abstract weight, the number of functional components in the functional component set can be determined, and then the operation type weight corresponding to each functional component in the functional component set and the component type weight of the functional components in the functional component set can be determined.
[0127] Then, the test value of the functional component set is determined based on the number of functional components in the functional component set, the operation type weight corresponding to each operation corresponding to the functional component set, the component type weight corresponding to the functional component set, and the linear abstract weight of the functional component set.
[0128] Finally, the test value of each functional component set is summed to obtain the remaining test value of the second page. The operation type weight is the weight corresponding to the type of operation of the functional component in the functional component set. Since the functional component can have multiple types of operation, the operation type weight may also be multiple.
[0129] Exemplarily, the remaining test value may be determined by the following formula:
[0130] f(s)=sum(f(w)×n×wt×(at0+at1+at…))
[0131] Among them, f(s) represents the remaining test value, f(w) represents the linear abstract weight, n represents the number of functional components in the functional component set, wt represents the component type weight corresponding to the functional component set, and ati represents the operation type weight corresponding to the operation corresponding to the i-th functional component set.
[0132] Exemplarily, the component type weight can be assigned after taking the normalized value according to the category name of the functional component. For example, if the category name of a functional component is "view", the weight assigned after the normalization value can be "2"; the operation type weight can be assigned according to the type. For example, the weight of the "long press, click" operation can be "3", and the weight of the "input, delete" operation can be "2".
[0133] In addition, after determining the second page to which the first page currently tested by the target client is to jump, the server also needs to determine the target operation path for jumping from the first page to the second page, and then send the target operation path to the target client so that the target client jumps from the first page to the second page based on the target operation path.
[0134] In specific implementation, since the state transition information includes the operation corresponding to the page jump, there is a page jump relationship. The server can use a pathfinding algorithm to determine multiple candidate operation paths for jumping from the first page to the target page according to the page jump relationship included in the state transition information of each page between the first page and the second page. Exemplarily, the pathfinding algorithm can be an A* algorithm. After determining the candidate operation paths, the candidate operation path with the least number of required operations can be used as the target operation path for jumping from the first page to the second page.
[0135] After determining the target operation path, each operation in the target operation path can be written into the operation stack in order, and the stack can be sent to the target client. Based on the received target operation path, the client can jump to the second page according to the target operation path and start testing from the second page. Since the remaining test value of the second page is the highest, the client can maximize the test benefits by starting the test from the second page, reducing the probability of invalid testing, thereby making the test process more efficient.
[0136] Reference Figure 2 , which is a schematic diagram of a state migration model in an application testing method provided in an embodiment of the present disclosure. Figure 2 It includes nodes A, B, C, D, E, connecting edges ac, bc, da, ec, aa, be, cb, and de. Node A is the first page, and after calculation, node E is the second page, and the operation path is ac-cb-be.
[0137] S103: updating the current state transition model based on the second page to obtain an updated state transition model.
[0138] In this step, the current state transition model can be updated based on the page status and state transition information of other pages collected by the target client during the test to obtain an updated state transition model, wherein the updated state transition model includes more nodes and is closer to the target application, and the updated state transition model is used to find the third page.
[0139] Furthermore, the updated state transition model can be shared by multiple clients, and the updated state transition model will be updated every time a client performs a test.
[0140] When multiple clients are testing simultaneously, if the second pages of two clients are the same, the second page of one of the clients can be modified to the page with the second highest remaining test value to prevent conflicts between different clients.
[0141] S104: When the scale information of the updated state transition model reaches a preset condition, a third page to which the second page is to jump is determined based on the updated state transition model using a second test method, and a test is performed from the third page.
[0142] Among them, scale information is used to characterize the amount of information recorded in the state transition model.
[0143] In this step, the server can determine the corresponding scale information based on the updated state transition model, and then compare the determined scale information with the preset conditions to determine whether to change the test mode of this test from the first test mode to the second test mode. In specific implementation, the process of determining whether to change the test mode of this test to the second test mode is different according to different preset conditions. For example, the following five methods may be included:
[0144] The first method: when the preset conditions include a first number threshold of the page states recorded in the state migration model, based on the collected page states and state migration information of other pages included in the updated state migration model and the page states and state migration information of all pages included in the original current state migration model, the number of page states recorded in the updated state migration model can be determined, and then it is determined whether the determined number of page states is greater than the first number threshold. If so, it means that the traversal scale of the application has reached the limit of the test capability corresponding to the first test method. If this method is continued for testing, the test efficiency will be reduced, affecting the test time. Therefore, the second test method suitable for a larger scale can be used to continue this test.
[0145] The second method: when the preset conditions include a jump time threshold, based on the scale information of the updated state transition model and the state transition information in the updated state transition model, the first test method can be used to determine a candidate page with the largest remaining test value among multiple candidate pages having a jump relationship with the second page, and the page is used as the next target page of the second page. Further, based on the state transition information between the second page and the corresponding next target page, the jump time from the current second page to the next target page of the updated state transition model is calculated using the first test method, and it is determined whether the jump time is greater than the jump time threshold. If so, it means that the traversal scale of the application has reached the limit of the test capability corresponding to the first test method. If the test is continued using this method, the test efficiency will be reduced, affecting the test time. Therefore, the second test method suitable for a larger scale can be used to continue the test. Among them, the candidate page can be a third page, and the next target page of the second page is the final third page selected from multiple third pages.
[0146] The third method: when the preset conditions include a link length threshold, based on the scale information of the updated state transition model and the state transition information in the updated state transition model, the first test method can be used to determine a candidate page with the largest remaining test value among multiple candidate pages having a jump relationship with the second page, and the page is used as the next target page of the second page. Further, based on the state transition information between the second page and the corresponding next target page, the first test method can be used to determine multiple candidate operation paths between the second page and the next target page and their corresponding lengths, and then determine whether the length of each candidate operation path is greater than the link length threshold. If so, the candidate operation path is used as the target path, and then based on the generation time of each target path, it is determined that the number of continuously generated target paths is greater than the preset second number threshold, which means that the traversal scale of the application has reached the limit of the test capability corresponding to the first test method. Continuing to use this method for testing will reduce the test efficiency and affect the test time. Therefore, the second test method suitable for a larger scale can be used to continue this test.
[0147] The fourth method: when the preset conditions include the first benefit convergence value, based on the scale information of the updated state transition model and the state transition information in the updated state transition model, the first test method can be used to determine the next target page of the second page and the first jump benefit value of the second page jumping to the target page, and based on all the first jump benefit values of jumping to the second page calculated before using the first test method and the first jump benefit values of the second page and the next target page determined by the first test method, as well as the generation time of each first jump benefit value, it is judged whether each first jump benefit value tends to the first benefit convergence value. If so, it means that the traversal scale of the application has reached the limit of the test capability corresponding to the first test method. Continuing to use this method for testing will reduce the test efficiency and affect the test time. Therefore, the second test method suitable for a larger scale can be used to continue this test.
[0148] The fifth method: When the preset conditions include a second benefit convergence value, it should be noted that the second benefit convergence value is determined based on the second test method. In specific implementation, when each page is tested using the first test method, the server also uses the second test method to calculate the jump benefit value corresponding to each page. Further, based on the scale information of the updated state transition model and the state transition information in the updated state transition model, the second test method can be used to calculate the next target page of the second page and the first jump benefit value of the second page jumping to the target page, and according to all the second jump benefit values of jumping to the second page calculated before using the second test method and the second jump benefit values of the second page and the next target page determined using the second test method, as well as the generation time of each second jump benefit value, it is determined whether each second jump benefit value tends to the second benefit convergence value. If so, it means that the traversal scale of the application program has reached the limit of the test capability corresponding to the first test method. Continuing to use this method for testing will reduce the test efficiency and affect the test time. Therefore, the second test method suitable for a larger scale can be used to continue this test.
[0149] It should be noted that the setting of preset conditions and their corresponding judgment methods are not limited to the above five methods, but can also be set to other forms according to user needs; it can also be any combination of the above five methods, which is not limited in the embodiments of the present disclosure.
[0150] Based on this, when it is determined that the scale information of the updated state transition model reaches the preset condition, the second test method is used to determine the third page to which the second page is to jump based on the updated state transition model, and the test is continued from the third page.
[0151] In one embodiment, regarding the method of determining the third page, it is first necessary to determine at least one functional component included in the second page based on the updated state transition model, and the multiple candidate operations corresponding to the second page can be determined based on the state of each functional component in the second page; the multiple candidate operations can be operations performed on each functional component in the second page, which can include click operations, sliding operations, long press operations, etc.
[0152] In specific implementation, during the application testing process, since each page can be abstracted as a node (state), each node has multiple corresponding candidate operations, and the candidate operation to be performed in the next test is determined according to the state of the current test page; for example, the second page contains 3 operable functional components, namely functional component 1, functional component 2, and functional component 3; during the testing process, after clicking functional component 1 in the second page, the node of the second page corresponding to the node A is determined, and it can be determined that the candidate operations under the node of the second page (i.e., node A) may include long pressing functional component 1, clicking functional component 2, long pressing functional component 2, clicking functional component 3, long pressing functional component 3, etc.
[0153] In specific implementation, after multiple candidate operations under the node of the second page are determined, the target operation can be selected from the multiple candidate operations by calculating the jump benefit value corresponding to each candidate operation and the number of executions corresponding to each candidate operation.
[0154] In an optional implementation, when there is at least one unexecuted operation among the multiple candidate operations on the second page, a target operation is selected from the at least one unexecuted operation, and the target operation is used as the operation to be executed in the next test.
[0155] Exemplarily, if the candidate operations under the node of the second page include long press function component 1, click function component 2, long press function component 2, click function component 3, long press function component 3, and the operation of clicking function component 2 is an operation that has not been tested during the test process (i.e., the operation of clicking function component 2 is an unexecuted operation), then the target operation can be: click function component 2; if the candidate operations under the node of the second page include long press function component 1, click function component 2, long press function component 2, click function component 3, long press function component 3, and the operations of clicking function component 2 and clicking function component 3 are operations that have not been tested during the test process (i.e., the operations of clicking function component 2 and clicking function component 3 are unexecuted operations), then one of the above two untested operations is randomly selected as the target operation. Based on this, the third page to which the second page needs to jump can be determined according to the target operation determined in each step and the second page.
[0156] In one embodiment, for each candidate operation, the jump benefit value corresponding to the candidate operation is calculated. The jump benefit value refers to the benefit value brought by executing multiple steps of operation starting from the execution of the candidate operation. The benefit value here is used to characterize the contribution value of the multiple steps of operation to the test coverage growth rate of the page function; when more page functions are tested after executing multiple steps of operation, the contribution value to the test coverage growth rate of the page function is high (i.e., the benefit value is high); when fewer page functions are tested after executing multiple steps of operation, the contribution value to the test coverage growth rate of the page function is low (i.e., the benefit value is low).
[0157] In specific implementation, the n-step SARSA algorithm in the second test method can be used to calculate the jump benefit value brought by executing multiple steps of operations starting from the execution of the candidate operation, as described in detail as follows:
[0158] Based on the page element attribute information after executing each of the n steps of operation, n reward values corresponding to the candidate operation are determined; based on the n reward values, a jump benefit value is calculated using a second test method.
[0159] The return value is used to represent the initial contribution value of each step of operation to the test coverage growth rate of the page function. The initial contribution value can be understood as the profit value before the jump profit value is iteratively updated based on the second test method.
[0160] Among them, the n reward values include the i-th reward value obtained after executing the i-th operation, where the first operation is a candidate operation; i is a positive integer from 1 to n. The page element attribute information may include whether a new page component appears after executing the i-th operation, whether a new node appears after executing the i-th operation, whether there is a new operation after executing the i-th operation, and the number of times the i-th operation has been executed.
[0161] Here, whether a new page component appears after executing the i-th operation can indicate whether a new page is jumped to after executing the i-th operation during the test process; whether a new node appears after executing the i-th operation can indicate whether a new state appears on the second page after executing the i-th operation during the test process; whether a new operation exists after executing the i-th operation can indicate whether a new operation is generated after executing the i-th operation during the test process.
[0162] Here, when new page components, new states, and new operations appear after executing the i-th step, and the fewer times the i-th step is executed, the greater the reward value; when no new page components, new nodes, and no new operations appear after executing the i-th step, and the more times the i-th step is executed, the smaller the reward value.
[0163] Exemplarily, when a new page component appears after executing the i-th operation, no new node appears, and no new operation occurs after executing the i-th operation, the return value is 100; when no new page component appears after executing the i-th operation, a new node appears, and no new operation occurs after executing the i-th operation, the return value is 100; when no new page component appears after executing the i-th operation, no new state appears, and a new operation occurs after executing the i-th operation, the return value is 100; when no new page component appears after executing the i-th operation, no new node appears, and no new operation occurs after executing the i-th operation, the return value is -100.
[0164] During specific implementation, the second testing method can be used to determine the jump benefit value corresponding to each candidate operation based on the n reward values corresponding to each candidate operation. The specific description is as follows: using the second testing method, based on the n reward values calculated above and the preset attenuation coefficient, an n-step discounted benefit characterization function is constructed; based on the above n-step discounted benefit characterization function, the preset learning rate, and the characterization function of the jump benefit value before update corresponding to each candidate operation, a characterization function of the updated jump benefit value corresponding to the candidate operation is constructed; based on the characterization function of the updated jump benefit value corresponding to each candidate operation, multiple iterative updates are performed until the preset convergence conditions are met to obtain the final jump benefit value corresponding to each candidate operation.
[0165] Among them, the n-step discounted profit representation function contains n sum terms, among which the first n-1 sum terms include the product of the i-1th power of the attenuation coefficient γ and the i-th return value, and the n-th sum term is the representation function of the jump profit value before the update corresponding to the n-step operation; here, i is a positive integer from 1 to n.
[0166] In addition, the preset convergence condition means that the difference between the jump benefit values obtained by the two most recent iterative updates is less than a set threshold.
[0167] Here, the formula for calculating the jump benefit value corresponding to each candidate operation can be as shown in Formula A and Formula B:
[0168] G t:t+1 =R t+1 +γR t+3 +γ 2 R t+3 +…+γ n Q t+n-1 (S t+n , A t+n ) Formula A
[0169] Q t+n (S t , A t )=Q t+n-1 (S t, A t )+α[G t:t+n -Q t+n-1 (S t , A t Formula B
[0170] Among them, γ represents the preset attenuation coefficient; G t:t+n represents the n-step discounted return representation function; R t+1 Indicates the node on the second page (S t ) to execute the candidate operation and jump to the next state of the second page (or jump to a new test page) S t+1 The return value obtained; R t+2 Indicates that in S t+1 Execute the operation to jump to S t+1 The corresponding next state S t+2 The return value obtained; R t+3 Indicates that in S t+2 Execute the operation to jump to S t+2 S t+2 The corresponding next state S t+3 The return value obtained; Q t+n-1 (S t+n , A t+n ) indicates that in S t+n A representation function of the jump benefit value before the update corresponding to the execution operation.
[0171] Among them, Q t+n (S t , S t ) indicates that in S t The representation function of the jump benefit value after executing the candidate operation; Q t+n-1 (S t , A t ) indicates that in S t The representation function of the jump benefit value before executing the candidate operation; α is the preset learning rate.
[0172] During specific implementation, the n-step SARSA algorithm in the second test method is adopted. According to the above formulas A and B, based on the n reward values corresponding to each candidate operation and the preset attenuation coefficient and learning rate, the jump benefit value corresponding to each candidate operation is iteratively updated multiple times until the preset convergence conditions are met to obtain the final jump benefit value corresponding to the candidate operation. After obtaining the jump benefit value, an operation with a larger jump benefit value and a smaller number of executions can be selected from multiple candidate operations as the target operation.
[0173] Furthermore, based on the number of times the multiple candidate operations have been executed and the jump benefit values respectively corresponding to the multiple candidate operations, a target operation is selected from the multiple candidate operations. In specific implementation, for each of the multiple candidate operations, based on the jump benefit value corresponding to the candidate operation and the number of visits corresponding to the node (i.e., the number of visits corresponding to the current state of the second page), a first access reward value corresponding to the candidate operation can be determined; and based on the number of times the candidate operation has been executed, the number of visits corresponding to the node, and a preset balance coefficient, a second access reward value corresponding to the candidate operation can be determined; the sum of the first access reward value and the second access reward value is used as the total access reward value of the candidate operation; and the candidate operation with the largest corresponding total access reward value is selected from the multiple candidate operations as the target operation.
[0174] Among them, the formula expression is as follows, which can be shown as formula C:
[0175]
[0176] Among them, UCB value of visited operations represents the total visit reward value, which is the total visit reward value corresponding to each candidate operation; P t V represents the jump benefit value corresponding to each candidate operation; t Indicates the number of visits corresponding to the node.
[0177] Among them, the first access reward value is the ratio of the jump benefit value corresponding to the candidate operation to the number of visits corresponding to the node, that is,
[0178] Among them, V c represents the number of times the candidate operation has been executed; C represents the preset balance coefficient, which is used to balance the positive feedback brought by the jump benefit value corresponding to each candidate operation and the negative feedback brought by the number of times each candidate operation has been executed; here C can be taken as 1.4; the second visit reward value is calculated using the formula C in express.
[0179] For example, according to the candidate operations under the state of the second page, the total visit reward value corresponding to the long press function component 1 operation is 10, the total visit reward value corresponding to the click function component 2 operation is 20, the total visit reward value corresponding to the long press function component 2 operation is 5, the total visit reward value corresponding to the click function component 3 operation is 10, and the total visit reward value corresponding to the long press function component 3 operation is 15; then the operation with the largest total visit reward value, click function component 2, can be selected as the target operation.
[0180] Exemplarily, when the candidate operations under the node of the second page are determined to be long press function component 1, click function component 2, long press function component 2, click function component 3, and long press function component 3, and the long press function component 2 operation is an unexecuted operation, the total visit reward value corresponding to the long press function component 1 operation is 5, the total visit reward value corresponding to the click function component 2 operation is 20, the total visit reward value corresponding to the click function component 3 operation is 10, and the total visit reward value corresponding to the long press function component 3 operation is 15; then the unexecuted operation: long press function component 2 is taken as the target operation.
[0181] The disclosed embodiment is based on a state transition model that is updated when an application is tested using a first test method, and determines whether scale information of the updated state transition model meets a preset condition. When it is determined that the preset condition is met, a second test method is used to test the application, thereby achieving reasonable utilization of each application test method, improving test efficiency, and ensuring reasonable resource utilization by converting the test method according to preset conditions.
[0182] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0183] Based on the same inventive concept, an application testing device corresponding to the application testing method is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned application testing method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0184] like Figure 3 FIG. 1 is a schematic diagram of an application program testing device provided by an embodiment of the present disclosure, comprising:
[0185] The acquisition module 301 is used to acquire the current state transition model of the target application; wherein the current state transition model is used to characterize the page states and page state transition information of the pages that have been tested in the target application, and the state transition information is used to characterize the operations performed by jumping between pages;
[0186] A first determination module 302 is used to respond to a path-finding request of a target client, and determine a second page to be jumped to from a first page currently tested by the target client based on a current state migration model by using a first test method;
[0187] An updating module 303, configured to update the current state transition model based on the second page to obtain an updated state transition model;
[0188] The second determination module 304 is used to determine the third page to which the second page is to jump based on the updated state transition model using a second testing method when the scale information of the updated state transition model reaches a preset condition, and to perform testing from the third page, wherein the scale information is used to characterize the amount of information recorded in the state transition model.
[0189] In a possible implementation, the preset condition includes a first quantity threshold of page states recorded in the state transition model, and the device further includes:
[0190] The third determination module 305 is configured to determine that the scale information of the updated state transition model reaches a preset condition when the number of page states recorded in the updated state transition model is greater than the first number threshold.
[0191] In a possible implementation manner, the preset condition includes a jump time-consuming threshold;
[0192] The third determination module 305 is used to determine the jump time taken to calculate the jump from the second page to the next target page using the first test method based on the scale information of the updated state transition model and the updated state transition model;
[0193] When the jump time is greater than the jump time threshold, it is determined that the scale information of the updated state transition model reaches a preset condition.
[0194] In a possible implementation manner, the preset condition includes a link length threshold;
[0195] The third determination module 305 is used to determine multiple candidate operation paths and corresponding lengths of transitioning from the second page to the next target page by using the first test method based on the scale information of the updated state transition model and the updated state transition model;
[0196] Taking a candidate operation path whose length is greater than the link length threshold as a target path;
[0197] When it is determined that the number of continuously generated target paths is greater than a preset second number threshold based on the generation time of the target path, it is determined that the scale information of the updated state transition model reaches a preset condition.
[0198] In a possible implementation manner, the preset condition includes a first revenue convergence value;
[0199] The third determination module 305 is used to calculate the first jump revenue value of jumping from the second page to the next target page and all first jump revenue values before jumping to the second page by using the first test method based on the scale information of the updated state transition model and the updated state transition model;
[0200] Based on the generation time of each first jump benefit value, when the first jump benefit value approaches the first benefit convergence value, it is determined that the scale information of the updated state transition model reaches a preset condition.
[0201] In a possible implementation manner, the preset condition includes a second revenue convergence value;
[0202] The third determination module 305 is used to calculate the second jump revenue value of jumping from the second page to the next target page and all second jump revenue values before jumping to the second page by using a second test method based on the scale information of the updated state transition model and the updated state transition model;
[0203] Based on the generation time of each second jump benefit value, when the second jump benefit value approaches the second benefit convergence value, it is determined that the scale information of the updated state transition model reaches a preset condition.
[0204] In a possible implementation, the first determination module 302 is used to determine the remaining test values of a plurality of second pages having a jump relationship of a preset level with the first page currently tested by the target client based on the page state and state transition information of the tested pages in the current state transition model;
[0205] Based on the remaining test value, a second page to which the currently tested first page is to be jumped is selected from the plurality of second pages.
[0206] In a possible implementation manner, the page state of the second page includes attribute information of the second page;
[0207] The first determination module 302 is used to cluster the functional components that have not performed operations in the second page based on the attribute information of the second page to obtain multiple functional component sets, and determine the linear abstract weight of each of the functional component sets;
[0208] For each set of functional components, determining the number of functional components in the set of functional components;
[0209] Determine the test value of the functional component set based on the number of functional components in the functional component set, the operation type weight corresponding to each operation corresponding to the functional component set, the component type weight corresponding to the functional component set, and the linear abstract weight of the functional component set;
[0210] Based on the test value of each of the functional component sets, a remaining test value of the second page is determined.
[0211] In a possible implementation manner, the first determination module 302 is further configured to determine a target operation path for jumping from the first page to the second page after determining the second page to which the first page currently tested by the target client is to jump;
[0212] The target operation path is sent to the target client, so that the target client jumps from the first page to the second page based on the target operation path.
[0213] In a possible implementation, the second determination module 304 is configured to determine a plurality of candidate operations for the second page;
[0214] For each candidate operation, a jump benefit value corresponding to the candidate operation is calculated; the jump benefit value refers to the benefit value brought by executing multiple steps of operations starting from executing the candidate operation; the benefit value is used to represent the contribution value of the multiple steps of operations to the test coverage growth rate of the page function;
[0215] Based on the number of times the candidate operations have been executed and the jump benefit value respectively corresponding to the candidate operations, a target operation is selected from the candidate operations, and the third page is determined based on the second page and the target operation.
[0216] In a possible implementation, the second determination module 304 is further used to, after determining the multiple candidate operations, and before calculating the jump benefit value corresponding to each candidate operation, when it is determined that there is at least one unexecuted candidate operation among the multiple candidate operations of the second page, select a target operation from the at least one unexecuted candidate operation.
[0217] In a possible implementation, the second determination module 304 is used to determine n reward values corresponding to the candidate operation based on the page element attribute information after executing each of the n operations; the n reward values include the i-th reward value obtained after executing the i-th operation, where the first operation is the candidate operation; i is a positive integer from 1 to n; the reward value is used to represent the initial contribution value of each operation to the test coverage growth rate of the page function;
[0218] Based on the n reward values, the jump benefit value is calculated using a second test method.
[0219] In a possible implementation, the page state of the page includes a state of the page; and
[0220] The second determining module 304 is configured to determine, for each candidate operation among the multiple candidate operations, a first visit reward value corresponding to the candidate operation based on the jump benefit value corresponding to the candidate operation and the number of visits corresponding to the current state of the second page;
[0221] Determine a second access reward value corresponding to the candidate operation based on the number of times the candidate operation has been executed, the number of times the current state has been accessed, and a preset balance coefficient;
[0222] Taking the sum of the first visit reward value and the second visit reward value as the total visit reward value of the candidate operation;
[0223] A candidate operation with the largest corresponding total visit reward value is selected from the multiple candidate operations as the target operation.
[0224] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0225] The present disclosure also provides a computer device, such as Figure 4 FIG. 1 is a schematic diagram of a computer device structure provided in an embodiment of the present disclosure, including:
[0226] A processor 41 and a memory 42; the memory 42 stores machine-readable instructions executable by the processor 41, and the processor 41 is used to execute the machine-readable instructions stored in the memory 42. When the machine-readable instructions are executed by the processor 41, the processor 41 performs the following steps: S101: obtaining the current state migration model of the target application; S102: responding to the path-finding request of the target client, and determining the second page to be jumped to by the first page currently tested by the target client based on the current state migration model using the first test method; S103: updating the current state migration model based on the second page to obtain an updated state migration model; and S104: when the scale information of the updated state migration model reaches a preset condition, determining the third page to be jumped to by the second page based on the updated state migration model using the second test method, and performing a test from the third page.
[0227] The above-mentioned memory 42 includes internal memory 421 and external memory 422; the memory 421 here is also called internal memory, which is used to temporarily store the calculation data in the processor 41 and the data exchanged with the external memory 422 such as the hard disk. The processor 41 exchanges data with the external memory 422 through the internal memory 421.
[0228] In a possible implementation, in the instruction executed by the processor 41, the preset condition includes a first quantity threshold of the page states recorded in the state transition model;
[0229] The method further includes: when the number of page states recorded in the updated state transition model is greater than the first number threshold, determining that the scale information of the updated state transition model reaches a preset condition.
[0230] In a possible implementation, in the instruction executed by the processor 41, the preset condition includes a jump time threshold;
[0231] Then the method further includes: determining, based on the scale information of the updated state transition model and the updated state transition model, calculating the jump time from the second page to the next target page by using a first test method;
[0232] When the jump time is greater than the jump time threshold, it is determined that the scale information of the updated state transition model reaches a preset condition.
[0233] In a possible implementation, in the instruction executed by the processor 41, the preset condition includes a link length threshold;
[0234] Then the method further includes: based on the scale information of the updated state transition model and the updated state transition model, using a first test method to determine a plurality of candidate operation paths and corresponding lengths for transitioning from the second page to a next target page;
[0235] Taking a candidate operation path whose length is greater than the link length threshold as a target path;
[0236] When it is determined that the number of continuously generated target paths is greater than a preset second number threshold based on the generation time of the target path, it is determined that the scale information of the updated state transition model reaches a preset condition.
[0237] In a possible implementation manner, in the instruction executed by the processor 41, the preset condition includes a first revenue convergence value;
[0238] Then the method further includes: based on the scale information of the updated state transition model and the updated state transition model, using a first test method to calculate a first jump revenue value of jumping from the second page to a next target page, and all first jump revenue values before jumping to the second page;
[0239] Based on the generation time of each first jump benefit value, when the first jump benefit value approaches the first benefit convergence value, it is determined that the scale information of the updated state transition model reaches a preset condition.
[0240] In a possible implementation manner, in the instruction executed by the processor 41, the preset condition includes a second revenue convergence value;
[0241] Then the method further includes: based on the scale information of the updated state transition model and the updated state transition model, using a second test method to calculate a second jump revenue value of jumping from the second page to the next target page, and all second jump revenue values before jumping to the second page;
[0242] Based on the generation time of each second jump benefit value, when the second jump benefit value approaches the second benefit convergence value, it is determined that the scale information of the updated state transition model reaches a preset condition.
[0243] In a possible implementation manner, in the instructions executed by the processor 41, determining the second page to be jumped to by the first page currently tested by the target client based on the current state migration model by using the first test mode includes:
[0244] Based on the page states and state transition information of the tested pages in the current state transition model, determining the remaining test values of a plurality of second pages having a jump relationship of a preset level with the first page currently tested by the target client;
[0245] Based on the remaining test value, a second page to which the currently tested first page is to be jumped is selected from the plurality of second pages.
[0246] In a possible implementation manner, in the instruction executed by the processor 41, the page state of the second page includes attribute information of the second page;
[0247] Determining remaining test values of the plurality of second pages includes:
[0248] Based on the attribute information of the second page, clustering the functional components on which no operation is performed in the second page to obtain a plurality of functional component sets, and determining a linear abstract weight of each of the functional component sets;
[0249] For each set of functional components, determining the number of functional components in the set of functional components;
[0250] Determine the test value of the functional component set based on the number of functional components in the functional component set, the operation type weight corresponding to each operation corresponding to the functional component set, the component type weight corresponding to the functional component set, and the linear abstract weight of the functional component set;
[0251] Based on the test value of each of the functional component sets, a remaining test value of the second page is determined.
[0252] In a possible implementation manner, the instructions executed by the processor 41, after determining the second page to be jumped to from the first page currently tested by the target client, further include:
[0253] Determine a target operation path for jumping from the first page to the second page;
[0254] The target operation path is sent to the target client, so that the target client jumps from the first page to the second page based on the target operation path.
[0255] In a possible implementation manner, in the instructions executed by the processor 41, the using the second test mode to determine the third page to which the second page is to jump based on the updated state transition model includes:
[0256] determining a plurality of candidate operations for the second page;
[0257] For each candidate operation, a jump benefit value corresponding to the candidate operation is calculated; the jump benefit value refers to the benefit value brought by executing multiple steps of operations starting from executing the candidate operation; the benefit value is used to represent the contribution value of the multiple steps of operations to the test coverage growth rate of the page function;
[0258] Based on the number of times the candidate operations have been executed and the jump benefit value respectively corresponding to the candidate operations, a target operation is selected from the candidate operations, and the third page is determined based on the second page and the target operation.
[0259] In a possible implementation manner, the instruction executed by the processor 41, after determining the multiple candidate operations and before calculating, for each candidate operation, a jump benefit value corresponding to the candidate operation, further includes:
[0260] When it is determined that there is at least one candidate operation that has not been performed among the plurality of candidate operations of the second page, a target operation is selected from the at least one candidate operation that has not been performed.
[0261] In a possible implementation manner, in the instruction executed by the processor 41, calculating, for each candidate operation, a jump benefit value corresponding to the candidate operation includes:
[0262] Based on the page element attribute information after executing each of the n operations, n reward values corresponding to the candidate operation are determined; the n reward values include the i-th reward value obtained after executing the i-th operation, wherein the first operation is the candidate operation; i is a positive integer from 1 to n; the reward value is used to represent the initial contribution value of each operation to the test coverage growth rate of the page function;
[0263] Based on the n reward values, the jump benefit value is calculated using a second test method.
[0264] In a possible implementation, in the instruction executed by the processor 41, the page status of the page includes the state of the page, and
[0265] The selecting a target operation from the multiple candidate operations based on the number of times the multiple candidate operations have been executed and the jump benefit value respectively corresponds to the multiple candidate operations includes:
[0266] For each candidate operation among the multiple candidate operations, based on the jump benefit value corresponding to the candidate operation and the number of visits corresponding to the current state of the second page, determine a first visit reward value corresponding to the candidate operation;
[0267] Determine a second access reward value corresponding to the candidate operation based on the number of times the candidate operation has been executed, the number of times the current state has been accessed, and a preset balance coefficient;
[0268] Taking the sum of the first visit reward value and the second visit reward value as the total visit reward value of the candidate operation;
[0269] A candidate operation with the largest corresponding total visit reward value is selected from the multiple candidate operations as the target operation.
[0270] The specific execution process of the above instructions can refer to the steps of the application testing method described in the embodiment of the present disclosure, which will not be repeated here.
[0271] The present disclosure also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the application program testing method described in the above method embodiment are executed. The storage medium may be a volatile or non-volatile computer-readable storage medium.
[0272] The computer program product of the application testing method provided in the embodiments of the present disclosure includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the steps of the application testing method described in the above method embodiments. Please refer to the above method embodiments for details, which will not be repeated here.
[0273] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK) and the like.
[0274] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, 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 through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.
[0275] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0276] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0277] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. 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.
[0278] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A method for testing an application program, It is characterized in that include: Obtaining a current state transition model of a target application; wherein the current state transition model is used to characterize the page states and page state transition information of pages that have been tested in the target application, and the state transition information is used to characterize operations performed by jumping between pages; In response to a pathfinding request of a target client, using a first test method based on a current state migration model, determining a second page to be jumped to from a first page currently tested by the target client according to a remaining test value; the remaining test value can represent a value of the number of operations or codes that have not been tested in the page; Update the current state transition model based on the page state and state transition information of the second page to obtain an updated state transition model; Based on the updated state transition model, its corresponding scale information is determined. When the scale information of the updated state transition model reaches a preset condition, a second test method is used to determine the third page to which the second page is to jump based on the updated state transition model, and a test is performed from the third page. The scale information is used to characterize the amount of information recorded in the state transition model.
2. The application testing method according to claim 1, It is characterized in that The preset condition includes a first quantity threshold of the page states recorded in the state migration model; The method further includes: when the number of page states recorded in the updated state transition model is greater than the first number threshold, determining that the scale information of the updated state transition model reaches a preset condition.
3. The application testing method according to claim 1, It is characterized in that The preset conditions include a jump time-consuming threshold; Then the method further includes: determining, based on the scale information of the updated state transition model and the updated state transition model, calculating the jump time from the second page to the next target page by using a first test method; When the jump time is greater than the jump time threshold, it is determined that the scale information of the updated state transition model reaches a preset condition.
4. The application testing method according to claim 1, It is characterized in that The preset condition includes a link length threshold; Then the method further includes: based on the scale information of the updated state transition model and the updated state transition model, using a first test method to determine a plurality of candidate operation paths and corresponding lengths for transitioning from the second page to a next target page; Taking a candidate operation path whose length is greater than the link length threshold as a target path; When it is determined that the number of continuously generated target paths is greater than a preset second number threshold based on the generation time of the target path, it is determined that the scale information of the updated state transition model reaches a preset condition.
5. The application testing method according to claim 1, It is characterized in that The preset conditions include a first benefit convergence value; Then the method further includes: based on the scale information of the updated state transition model and the updated state transition model, using a first test method to calculate a first jump revenue value of jumping from the second page to a next target page, and all first jump revenue values before jumping to the second page; Based on the generation time of each first jump benefit value, when the first jump benefit value approaches the first benefit convergence value, it is determined that the scale information of the updated state transition model reaches a preset condition.
6. The application testing method according to claim 1, It is characterized in that The preset conditions include a second benefit convergence value; Then the method further includes: based on the scale information of the updated state transition model and the updated state transition model, using a second test method to calculate a second jump revenue value of jumping from the second page to the next target page, and all second jump revenue values before jumping to the second page; Based on the generation time of each second jump benefit value, when the second jump benefit value approaches the second benefit convergence value, it is determined that the scale information of the updated state transition model reaches a preset condition.
7. The application testing method according to claim 1, It is characterized in that The method of using the first test mode based on the current state migration model and determining the second page to be jumped to by the first page currently tested by the target client according to the remaining test value includes: Based on the page states and state transition information of the tested pages in the current state transition model, determining the remaining test values of a plurality of second pages having a jump relationship of a preset level with the first page currently tested by the target client; Based on the remaining test value, a second page to which the currently tested first page is to be jumped is selected from the plurality of second pages.
8. The application testing method according to claim 1, It is characterized in that The using the second test mode to determine the third page to which the second page is to jump based on the updated state transition model includes: determining a plurality of candidate operations for the second page; For each candidate operation, a jump benefit value corresponding to the candidate operation is calculated; the jump benefit value refers to the benefit value brought by executing multiple steps of operations starting from executing the candidate operation; the benefit value is used to represent the contribution value of the multiple steps of operations to the test coverage growth rate of the page function; Based on the number of times the candidate operations have been executed and the jump benefit value respectively corresponding to the candidate operations, a target operation is selected from the candidate operations, and the third page is determined based on the second page and the target operation.
9. An application testing device, It is characterized in that include: An acquisition module, used to acquire a current state transition model of a target application; wherein the current state transition model is used to characterize the page states and page state transition information of pages that have been tested in the target application, and the state transition information is used to characterize operations performed by jumping between pages; A first determination module is used to respond to a path-finding request of a target client, and determine a second page to be jumped to from a first page currently tested by the target client according to a remaining test value based on a current state migration model using a first test method; the remaining test value can represent a value of the number of operations or codes that have not been tested in the page; An updating module, configured to update the current state transition model based on the page state and state transition information of the second page to obtain an updated state transition model; The second determination module is used to determine the corresponding scale information based on the updated state transition model. When the scale information of the updated state transition model reaches a preset condition, a second testing method is used to determine the third page to which the second page is to jump based on the updated state transition model, and a test is performed from the third page. The scale information is used to characterize the amount of information recorded in the state transition model.
10. A computer device, It is characterized in that include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory. When the machine-readable instructions are executed by the processor, the processor executes the steps of the application testing method as described in any one of claims 1 to 8.
11. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program. When the computer program is executed by a computer device, the computer device executes the steps of the application program testing method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Method and device for screening function point test implementing ways, and terminal
CN105320701A
Application program testing method and device, and computer storage medium
CN111694753A
Application program testing method and device
CN111694756A