Application test method and device, electronic equipment and storage medium
By calculating the redundancy of unoperated elements and the benefit value of operated elements, the application testing path is optimized, solving the problems of low test coverage and poor efficiency in existing technologies, and realizing efficient and stable application testing.
Patent Information
- Application Number
- CN202111418324.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-25
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2041-11-25
AI Technical Summary
Existing application testing methods rely on manual configuration, resulting in low test coverage, poor efficiency, and high labor costs.
By acquiring the current page elements and operation data, the redundancy of unoperated elements is calculated, and the elements with the lowest redundancy are prioritized for operation. The test path is then optimized by combining the benefit value and attribute data of the operated elements.
It improved the coverage and efficiency of application testing, reduced labor costs, and enhanced the stability and effectiveness of testing.
Smart Images

Figure CN114036061B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, and particularly relates to the technical field of cloud computing. BACKGROUND
[0002] At present, testing of an application is performed by identifying elements on a page, generating an element operation path by means of manual configuration, randomness, search and the like, so as to test the application. The test coverage effect of the configuration method is strongly dependent on the experience of a test configuration personnel, and requires a high human cost, and the test effect and efficiency are poor. SUMMARY
[0003] The present disclosure provides an application testing method and device, electronic equipment and storage medium.
[0004] According to an aspect of the present disclosure, an application testing method is provided, comprising:
[0005] obtaining all elements and element operation data in a current page;
[0006] dividing all elements into operated elements and unoperated elements according to the element operation data;
[0007] calculating redundancy of each unoperated element;
[0008] placing all unoperated elements with redundancy less than a first preset value into a first priority set;
[0009] sorting unoperated elements in the first priority set according to redundancy;
[0010] in response to existence of at least one unoperated element in the first priority set, operating an unoperated element with minimum redundancy in the first priority set.
[0011] According to another aspect of the present disclosure, an application testing device is provided, comprising:
[0012] a collection module configured to obtain all elements and element operation data in a current page;
[0013] a processing module configured to divide all elements into operated elements and unoperated elements according to the element operation data;
[0014] a calculation module configured to calculate redundancy of each unoperated element;
[0015] the processing module is further configured to place all unoperated elements with redundancy less than a first preset value into a first priority set;
[0016] the processing module is further configured to sort unoperated elements in the first priority set according to redundancy;
[0017] operating, in response to the presence of at least one unoperated element in the first priority set, an unoperated element in the first priority set with the least redundancy.
[0018] According to another aspect of the present disclosure, an electronic device is provided, comprising:
[0019] at least one processor; and
[0020] a memory connected with the at least one processor; wherein
[0021] the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of the above.
[0022] According to another aspect of the present disclosure, a non-transitory computer readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to perform the method of any one of the above.
[0023] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the method of any one of the above.
[0024] It should be understood that the content described in this section is not intended to identify key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become apparent through the following description. BRIEF DESCRIPTION OF DRAWINGS
[0025] The accompanying drawings are used to better understand the present scheme, and do not limit the present disclosure. Among them:
[0026] Figure 1 is a flowchart of an application test method according to an embodiment of the present disclosure;
[0027] Figure 2 is a flowchart of an application test method according to an embodiment of the present disclosure;
[0028] Figure 3 is a structural schematic diagram of an application test device according to an embodiment of the present disclosure;
[0029] Figure 4 is a block diagram of an electronic device for implementing an application test method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0030] Exemplary embodiments of the present disclosure are described herein with reference to the accompanying drawings, which are cited as illustrative examples. Various details of the embodiments of the present disclosure are described herein in order to provide a thorough understanding of the present disclosure. It will be understood by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Also, for the sake of brevity and clarity, descriptions of well-known functions and constructions are omitted herein.
[0031] In order to improve the test coverage of the tested application, improve the effect and efficiency of application testing, as shown in the prior art, an embodiment of the present disclosure provides an application testing method, which comprises the steps of: Figure 1
[0032] Step 101, obtaining all elements and element operation data in the current page.
[0033] Obtaining all elements and element operation data in the current page, the element operation data contains the historical operation data of all pages, and the element operation data is updated after each operation element.
[0034] Step 102, dividing all elements into operated elements and unoperated elements according to the element operation data.
[0035] According to the element operation data, it is determined whether the element has been operated. The operated element is divided into the operated element, and the unoperated element is divided into the unoperated element.
[0036] Step 103, calculating the redundancy of each unoperated element.
[0037] Step 104, putting all unoperated elements with redundancy less than a first preset value into a first priority set.
[0038] Putting all unoperated elements with redundancy less than a first preset value into a first priority set.
[0039] For example, the first preset value can be set to 0.2, and there are 5 unoperated elements in the current page, and the redundancies of the 5 unoperated elements are 0.1, 0.3, 0.2, 0.4 and 0.15 respectively. Then, the unoperated elements with redundancies of 0.1 and 0.15 are put into the first priority set.
[0040] Step 105, sorting the unoperated elements in the first priority set according to the redundancy.
[0041] The smaller the redundancy is, the lower the similarity between the unoperated element and other elements is. Operating the unoperated element with small redundancy can improve the test coverage of the tested application, improve the test effect, and repeating the operation of the element with high similarity can reduce the test efficiency. Therefore, the unoperated element with small redundancy is placed in the front row, and the unoperated element with high redundancy is placed in the back row.
[0042] In step 106, in response to the existence of at least one unoperated element in the first priority set, the unoperated element with the smallest redundancy in the first priority set is operated.
[0043] By calculating the redundancy of all unoperated elements to determine the elements in the first priority set, and operating the unoperated element with the smallest redundancy in the first priority set, the test coverage of the tested application can be significantly improved, and the test effect and efficiency can be improved.
[0044] After step 105, in an implementation, in step 201, in response to the absence of unoperated elements in the first priority set, the benefit value of each operated element is calculated.
[0045] All elements of the current page can be operated, or the redundancy of all unoperated elements is greater than or equal to the first preset value, so that there is no unoperated element in the first priority set. Therefore, the benefit value of each operated element is calculated.
[0046] In step 202, the failure operation times ratio of each operated element is determined according to the element operation data.
[0047] According to the element operation data, the failure operation times and the operation times of each operated element are determined. The failure operation times ratio of each operated element is obtained by dividing the failure operation times of each operated element by the operation times.
[0048] For example, the failure operation times of a certain operated element is 5 times, and the operated element is operated 10 times in total. Therefore, the failure operation times ratio of the operated element is 50%.
[0049] In step 203, the operated element with a failure operation times ratio less than the first preset percentage is placed in the second priority set.
[0050] The operated element with a failure operation times ratio less than the first preset percentage is placed in the second priority set.
[0051] For example, the first preset percentage can be set as 40%, there are 4 operated elements in the current page, and the failure operation percentage of the 4 operated elements is 30%, 25%, 45% and 60% respectively, then the operated elements with 30% and 25% are put into the second priority set.
[0052] In step 204, the operated elements in the second priority are sorted according to the benefit value.
[0053] The benefit value can represent the subsequent benefit of the operated element after being operated, the operated element with high operation benefit can further improve the test coverage, effect and efficiency of the tested application, therefore, the operated element with high benefit value is arranged in the front row, and the operated element with low benefit value is arranged in the rear row.
[0054] In step 205, in response to the second priority set containing at least one operated element, the operated element with the maximum benefit value in the second priority set is operated.
[0055] By sorting the operated elements in the second priority according to the benefit value, arranging the operated element with high benefit value in the front row and the operated element with low benefit value in the rear row, and operating the operated element with the maximum benefit value in the second priority, the test coverage, effect and efficiency of the tested application can be further improved.
[0056] After step 204, in an implementable manner, in step 301, in response to the second priority set containing no operated element, all the unoperated elements with redundancy greater than or equal to the first preset value and less than the second preset value are put into a third priority set.
[0057] If the failure operation percentage of all the operated elements in the current page is greater than or equal to the first preset percentage, then the second priority set can contain no operated element, then all the unoperated elements with redundancy greater than or equal to the first preset value but less than the second preset value are put into the third priority set.
[0058] For example, the first preset value can be set as 0.2, the second preset value can be set as 1, there are 5 unoperated elements in the current page, and the redundancy of the 5 unoperated elements is 0.3, 0.4, 0.6, 1 and 1 respectively, then the unoperated elements with redundancy of 0.3, 0.4 and 0.6 are put into the third priority set.
[0059] In step 302, the unoperated elements in the third priority set are sorted according to the redundancy.
[0060] Step 303, in response to the existence of at least one unoperated element in the third priority set, operating the unoperated element with the minimum redundancy in the third priority set.
[0061] The unoperated element with too high redundancy may have a high similarity with too many other elements, so operating these unoperated elements with high redundancy has a high possibility of failing to improve the test coverage of the tested application, so the element in the third priority set is operated only when there is no element in the first priority set and the second priority set, but operating the element in the third priority set does not mean that there is no possibility of improving the test coverage of the tested application, so continuing to operate the element in the third priority set can improve the stability and test coverage of the overall test.
[0062] In step 102, after all elements are divided into operated elements and unoperated elements according to the element operation data, in an implementable manner, step 401, element attribute data is obtained.
[0063] The element attribute data includes attribute data of all elements.
[0064] Step 402, calculate the average Manhattan distance of each element from all other operated elements in the current page to obtain the crowded distance of each element.
[0065] The crowded distance of each element is obtained by calculating the average Manhattan distance of each element from all other operated elements in the current page. First, the Manhattan distance of each element from the center point coordinates of the operation area of other operated elements in the current page is calculated, and then the Manhattan distance of each element from all other operated elements in the current page is averaged to obtain the average Manhattan distance of each element, that is, the crowded distance.
[0066] For example, there are 5 elements in the current page, and the Manhattan distances between one element and the other 4 elements are 4, 8, 10, and 6 respectively. The crowded distance of the element is 7.
[0067] In an implementable manner, the crowded distance L of each element can also be calculated according to the following formula: C :
[0068]
[0069] Wherein, L M-i is the Manhattan distance of the i-th element, and k is the number of other elements.
[0070] Step 403, determine the operation type score, level score, importance score, and element area of each element according to the element attribute data.
[0071] determining the operation type score, the level score, the importance score and the element area of each element according to the element attribute data;
[0072] Each element has its own operation type, such as clickable, slidable operation type, etc. The operation type score of the element is determined according to the operation type of the element itself. For example, the operation type of an element is slidable, and the operation type score of the element can be set to 0.5.
[0073] Each element has its own level in the structure tree. The level score of the element is determined according to the level of the element itself. For example, the level of an element is 5, and the level score of the element can be set to 1.
[0074] Each element has its own corresponding importance level. The element is divided into a first importance level or a second importance level according to the importance of the text corresponding to the element. Then the importance score of the element is determined according to the importance level corresponding to the element. For example, an element is a first importance level, and the importance score of the element is set to 2.
[0075] The operable area of each element is calculated to obtain the element area of each element.
[0076] Step 404, multiplying the crowded distance of each element by the first weight, multiplying the operation type score by the second weight, multiplying the level score by the third weight, multiplying the importance score by the fourth weight, multiplying the element area by the fifth weight and adding them up to obtain the score value of each element.
[0077] The score value S of each element is calculated according to the following formula:
[0078] S = Q1*L C + Q2*S1+Q3*S2+Q4*S3+Q5*A
[0079] Wherein, Q1 is the first weight, Q2 is the second weight, S1 is the operation type score, Q3 is the third weight, S2 is the level score, Q4 is the fourth weight, S3 is the importance score, Q5 is the fifth weight, and A is the element area.
[0080] The score value calculated by the multiple attribute data of each element and the corresponding weight can accurately represent the value of each element. The score value of each element can be calculated after step 101. When the redundancy or the benefit value of two elements is the same in step 106, step 204 and step 302, the elements can be sorted according to the score value. The element with high score value is arranged in front, and the element with low score value is arranged in back, which improves the stability and effect of the whole test.
[0081] After step 302, in an embodiment, step 501, in response to the fact that there is no unoperated element in the third priority set, all unoperated elements with redundancy greater than or equal to the second preset value are put into the fourth priority set.
[0082] If the redundancy of all unoperated elements is greater than or equal to the second preset value, there can be no element in the third priority set, and then all unoperated elements with redundancy greater than or equal to the second preset value are put into the fourth priority set.
[0083] Step 502, all operated elements with failure operation frequency ratio greater than or equal to the first preset percentage are put into the fifth priority set.
[0084] Step 503, all elements in the fourth priority set and the fifth priority set are sorted according to the score value.
[0085] Step 504, in response to the fact that there is at least one unoperated element in the fourth priority set, the unoperated element with the highest score value in the fourth priority set is operated.
[0086] Step 505, or in response to the fact that there is no unoperated element in the fourth priority set, the operated element with the highest score value in the fifth priority set is operated.
[0087] The unoperated element with very high redundancy has higher benefits than the operated element with high failure operation frequency ratio. Operating the elements in the fourth priority set and the fifth priority set does not mean that there is no possibility to improve the test coverage of the tested application, so continuing to operate these elements can improve the stability and test coverage of the overall test.
[0088] The elements in the fourth priority set and the elements in the fifth priority set may cause the redundancy to become smaller or the benefit value to become larger after being operated for multiple times. When the redundancy of the unoperated element in the fourth priority set becomes smaller than the second preset value, the unoperated element is put back into the third priority set. When the operated element in the fifth priority set is operated and succeeds, the failure operation frequency ratio of the operated element may become smaller. When the failure operation frequency ratio of the operated element becomes smaller than the first preset percentage, the operated element is put back into the second priority set, further improving the stability and effect of the overall test.
[0089] In step 103, the redundancy of each unoperated element is calculated. In an embodiment, step 601, the Hamming distance of each unoperated element and each operated element is obtained.
[0090] The Hamming distance is an attribute of each element itself, and the Hamming distance between each unoperated element and each operated element is calculated according to the attribute;
[0091] For example, there are 2 unoperated elements and 4 operated elements in the current page, the attribute of the 2 unoperated elements is {a-1, b-1, c-1} and {a-1, b-1, c-2}, and the attribute of the 4 operated elements is {a-1, b-1, c-1}, {a-1, b-2, c-1}, {a-1, b-1, c-2} and {a-2, b-1, c-1} respectively. When the corresponding attributes are the same, the Hamming distance of the attribute is 0, and when the corresponding attributes are different, the Hamming distance of the attribute is 1. For example, a-1 and a-1 have the same attribute a, so the corresponding Hamming distance of a is 0. Therefore, the Hamming distance between the unoperated element with the attribute {a-1, b-1, c-1} and the 4 operated elements is {0, 0, 0}, {0, 1, 0}, {0, 0, 1} and {1, 0, 0} respectively, and the Hamming distance between the unoperated element with the attribute {a-1, b-1, c-2} and the 4 operated elements is {0, 0, 1}, {0, 1, 1}, {0, 0, 0} and {1, 0, 1} respectively.
[0092] Step 602, calculating the similarity between each unoperated element and each operated element according to the Hamming distance between each unoperated element and each operated element.
[0093] According to the Hamming distance between each unoperated element and each operated element, the similarity between each unoperated element and each operated element is calculated;
[0094] For example, there are 2 unoperated elements and 4 operated elements in the current page, the Hamming distance between the first unoperated element and the 4 operated elements is {0, 0, 0}, {0, 1, 0}, {0, 0, 1} and {1, 0, 0} respectively, and the Hamming distance between the second unoperated element and the 4 operated elements is {0, 0, 1}, {0, 1, 1}, {0, 0, 0} and {1, 0, 1} respectively. Each sub-Hamming distance in the Hamming distance has a corresponding priority attribute, each sub-Hamming distance is weighted according to the priority, and finally the sum of all priorities is taken. If the priority of a, b and c is 1, 2 and 3 respectively, the similarity between the first unoperated element and the 4 operated elements is The similarity between the second unoperated element and the 4 operated elements is
[0095] Step 603, averaging the similarity between each unoperated element and each operated element to obtain the redundancy of each unoperated element.
[0096] averaging the similarity of each unoperated element and each operated element to obtain the redundancy of each unoperated element;
[0097] For example, there are 2 unoperated elements and 4 operated elements in the current page, the similarity of the first unoperated element and the 4 operated elements is 1, 0.5, 0.5 and 0.5 respectively, the similarity of the second unoperated element and the 4 operated elements is 0.5, 0.5, 0.5 and 0.5 respectively, then the redundancy of the first unoperated element is (1+0.5+0.5+0.5) / 4=0.625, and the redundancy of the second unoperated element is (0.5+0.5+0.5+0.5) / 4=0.375.
[0098] By calculating the similarity of each unoperated element and each operated element according to the Hamming distance between each unoperated element and each operated element, the similarity of each unoperated element and all the operated elements in the current page can be accurately obtained, so that the redundancy calculated finally can more accurately represent the similarity of the unoperated element and the operated element. According to the redundancy, the unoperated elements can be sorted and the unoperated element with the smallest redundancy can be selected for operation, which can significantly improve the effect and efficiency of the test and improve the test coverage of the tested application.
[0099] In step 201, the benefit value of each operated element is calculated. In an embodiment, step 701, a plurality of pages associated with each operated element is determined according to the element operation data.
[0100] The plurality of pages associated with each operated element refers to the pages jumped to by clicking the element or other associated pages.
[0101] Step 702, the average number of effective elements of the plurality of pages associated with each operated element is calculated.
[0102] First, the number of effective elements of each page associated with each operated element is calculated, which is the total number of all elements in the first priority set, the second priority set and the third priority set of the page. Then, the average number of effective elements of the plurality of pages associated with each operated element is calculated.
[0103] For example, a certain operated element is associated with 2 pages, and the number of effective elements of the 2 pages is 16 and 20 respectively, so the average number of effective elements of the plurality of pages associated with the operated element is (16+20) / 2=18.
[0104] Step 703, the total number of element operations, the number of operations of each operated element, the number of entries of all pages and the number of entries of the target page of each operated element are obtained according to the element operation data.
[0105] Step 704, calculating the profit value of each operated element according to the average effective element quantity of the plurality of pages associated with each operated element, the total operation times of elements, the operation times of each operated element, the entering times of all pages and the entering times of the target page of each operated element, the target page of the operated element refers to the page jumped to by clicking the operated element, if the operated element has no page to jump to, then the operated element has no target page.
[0106] When the operated element has no target page, the profit value P of each operated element is calculated according to the following formula:
[0107]
[0108] Wherein, is the average effective element quantity of the plurality of pages associated with the operated element, C is the total operation times of elements, C j is the operation times of the operated element;
[0109] When the operated element has no target page, the profit value P of each operated element is calculated according to the following formula:
[0110]
[0111] Wherein, W is the entering times of all pages, W j is the entering times of the target page of the operated element.
[0112] By calculating the profit value of each operated element according to the average effective element quantity of the plurality of pages associated with each operated element and a plurality of operation data, the profit that can be obtained by each operated element after being operated can be accurately represented, and the effect and efficiency of the test can be significantly improved by sorting the operated elements according to the profit values and selecting the operated element with the largest profit value to operate, and the test coverage of the tested application can be improved.
[0113] In an implementation, the current page information is acquired;
[0114] In response to the current page exceeding the test range, the root node is returned.
[0115] The current page information is acquired and it is judged whether the current page exceeds the test range according to the current page information, if the current page exceeds the test range, the root node is returned, the test range is the test range of the application determined before the test, the nodes outside the possible test range have not been completed, jumping to the nodes outside the possible test range may cause the application to crash or be unresponsive, and the test may be stuck, so the application needs to be cold started to return to the root node, therefore, when it is judged that the current page exceeds the test range, the root node is returned, which can improve the stability of the overall test.
[0116] In an embodiment, the most recent operation links are determined according to the element operation data;
[0117] In response to the most recent operation links being the same and the number being greater than a third preset value, a root node is returned.
[0118] The most recent operation links are determined according to the element operation data, and if the most recent operation links are the same and the number is greater than a third preset value, a root node is returned. When the most recent operation links are the same and the number is greater than a third preset value, it indicates that the test is trapped in a loop at this time and cannot continue to test, so a root node is directly returned to continue testing, further improving the stability of the overall test.
[0119] In an embodiment, an operation time of a current page is obtained;
[0120] The operation time of the current page is obtained according to the element operation data;
[0121] In response to the operation time of the current page being greater than a preset time length or the operation number of the current page being greater than a fourth preset value, a root node is returned.
[0122] The operation time of the current page and the operation number of the current page are obtained, and when the operation time of the current page is greater than a preset time length or the operation number of the current page is greater than a fourth preset value, it indicates that the test at the current page is stagnant and cannot continue to test, so a root node is directly returned to continue testing, further improving the stability of the overall test.
[0123] In an embodiment, current page information is obtained;
[0124] In response to the current page being a leaf node, a previous page is returned;
[0125] In response to a return failure, a return failure number is incremented by 1;
[0126] In response to the return failure number being greater than or equal to a fifth preset value, a root node is returned.
[0127] Acquire the current page information and determine whether the current page is at a leaf node according to the current page information, if at a leaf node, return the previous page, the leaf node refers to the node cannot jump to other pages by clicking elements, at this time, it is needed to try to return the previous page first, if the return of the previous page fails, the return failure number is added by 1, if the return failure number exceeds the fifth preset value, it is explained that the leaf node can not return the previous page, the application needs to be cold started to return the root node, when at the leaf node cannot jump to other pages and cannot return the previous page, at this time, the test will be stuck, so when judging that the current page is at the leaf node and cannot return the previous page, the root node is returned, the stability of the overall test can be improved.
[0128] As shown in Figure 2 An embodiment of the present disclosure provides an application test method, the method comprises:
[0129] Step 101, acquire all elements and element operation data in the current page.
[0130] Step 102, divide all elements into operated elements and unoperated elements according to the element operation data.
[0131] Step 103, calculate the redundancy of each unoperated element.
[0132] Step 104, put all unoperated elements with redundancy less than a first preset value into a first priority set.
[0133] Step 105, sort the unoperated elements in the first priority set according to the redundancy.
[0134] When sorting the unoperated elements in the first priority set according to the redundancy, it is needed to determine whether there is at least one unoperated element in the first priority set;
[0135] Step 106, in response to that there is at least one unoperated element in the first priority set, operate the unoperated element with the smallest redundancy in the first priority set.
[0136] Step 201, in response to that there is no unoperated element in the first priority set, calculate the benefit value of each operated element.
[0137] Step 202, determine the failure operation number proportion of each operated element according to the element operation data.
[0138] Step 203, put the operated element with the failure operation number proportion less than a first preset percentage into a second priority set.
[0139] Step 204, sort the operated elements in the second priority set according to the benefit value.
[0140] In the step of sorting the operated elements in the second priority according to the revenue values, it is needed to determine whether there is at least one operated element in the second priority;
[0141] In response to the existence of at least one operated element in the second priority set, the operated element with the maximum revenue value in the second priority set is operated in step 205.
[0142] In response to the absence of operated elements in the second priority set, all unoperated elements with redundancy greater than or equal to the first preset value and less than the second preset value are put into a third priority set in step 301.
[0143] The unoperated elements in the third priority set are sorted according to the redundancy in step 302.
[0144] After the unoperated elements in the third priority set are sorted according to the redundancy, it is needed to determine whether there is at least one unoperated element in the third priority set;
[0145] In response to the existence of at least one unoperated element in the third priority set, the unoperated element with the minimum redundancy in the third priority set is operated in step 303.
[0146] If there is no unoperated element in the third priority set in the step of determining whether there is at least one unoperated element in the third priority set, the score value of each element is calculated in steps 401 to 404.
[0147] After the score value of each element is calculated, all unoperated elements with redundancy greater than or equal to the second preset value are put into a fourth priority set in step 501 in response to the absence of unoperated elements in the third priority set.
[0148] All operated elements with a failure operation frequency ratio greater than or equal to the first preset percentage are put into a fifth priority set in step 502.
[0149] All elements in the fourth priority set and the fifth priority set are sorted according to the score value in step 503.
[0150] In response to the existence of at least one unoperated element in the fourth priority set, the unoperated element with the highest score value in the fourth priority set is operated in step 504.
[0151] In response to the absence of unoperated elements in the fourth priority set, the operated element with the highest score value in the fifth priority set is operated in step 505.
[0152] An embodiment of the present disclosure provides an application testing device, as shown inFigure 3 The device comprises:
[0153] The acquisition module 10 is configured to acquire all elements and element operation data in a current page.
[0154] The processing module 20 is configured to divide all elements into operated elements and unoperated elements according to the element operation data.
[0155] The calculation module 30 is configured to calculate redundancy of each unoperated element.
[0156] The processing module 20 is further configured to put unoperated elements with redundancy less than a first preset value into a first priority set.
[0157] The processing module 20 is further configured to sort unoperated elements in the first priority set according to redundancy.
[0158] The operation module 40 is configured to operate an unoperated element with minimum redundancy in the first priority set in response to existence of at least one unoperated element in the first priority set.
[0159] The calculation module 30 is further configured to calculate a benefit value of each operated element in response to non-existence of unoperated elements in the first priority set.
[0160] The calculation module 30 is further configured to determine a failure operation times proportion of each operated element according to the element operation data.
[0161] The processing module 20 is further configured to put operated elements with failure operation times proportion less than a first preset percentage into a second priority set.
[0162] The processing module 20 is further configured to sort operated elements in the second priority set according to benefit values.
[0163] The operation module 40 is further configured to operate an operated element with maximum benefit value in the second priority set in response to existence of at least one operated element in the second priority set.
[0164] The processing module 20 is further configured to put unoperated elements with redundancy greater than or equal to a first preset value and less than a second preset value into a third priority set in response to non-existence of operated elements in the second priority set.
[0165] The processing module 20 is further configured to sort unoperated elements in the third priority set according to redundancy.
[0166] The operation module 40 is further configured to operate an unoperated element with the minimum redundancy in the third priority set in response to the existence of at least one unoperated element in the third priority set.
[0167] The collection module 10 is further configured to collect element attribute data.
[0168] The calculation module 30 is further configured to calculate an average Manhattan distance of each element from all the operated elements in the current page, to obtain a crowded distance of each element.
[0169] The calculation module 30 is further configured to determine an operation type score, a level score, an importance score and an element area of each element according to the element attribute data.
[0170] The calculation module 30 is further configured to multiply the crowded distance of each element by a first weight, multiply the operation type score by a second weight, multiply the level score by a third weight, multiply the importance score by a fourth weight, multiply the element area by a fifth weight, and add them together, to obtain a score value of each element.
[0171] The processing module 20 is further configured to put all the unoperated elements with redundancy greater than or equal to a second preset value into a fourth priority set in response to the absence of unoperated elements in the third priority set.
[0172] The processing module 20 is further configured to put all the operated elements with a failure operation frequency ratio greater than or equal to a first preset percentage into a fifth priority set.
[0173] The processing module 20 is further configured to sort all the elements in the fourth priority set and the fifth priority set according to the score values.
[0174] The operation module 40 is further configured to operate an unoperated element with the highest score value in the fourth priority set in response to the existence of at least one unoperated element in the fourth priority set.
[0175] The operation module 40 is further configured to operate an operated element with the highest score value in the fifth priority set in response to the absence of unoperated elements in the fourth priority set.
[0176] The collection module 10 is further configured to collect a Hamming distance of each unoperated element and each operated element.
[0177] The calculation module 30 is further configured to calculate a similarity of each unoperated element and each operated element according to the Hamming distance of each unoperated element and each operated element.
[0178] The computing module 30 is further configured to average the similarity of each unoperated element and each operated element to obtain redundancy of each unoperated element.
[0179] The processing module 20 is further configured to determine a plurality of pages associated with each operated element according to the element operation data.
[0180] The computing module 30 is further configured to calculate an average number of effective elements of the plurality of pages associated with each operated element.
[0181] The computing module 30 is further configured to obtain a total number of element operations, a number of operations of each operated element, a number of entries of all pages, and a number of entries of a target page of each operated element according to the element operation data.
[0182] The computing module 30 is further configured to calculate a benefit value of each operated element according to the average number of effective elements of the plurality of pages associated with each operated element, the total number of element operations, the number of operations of each operated element, the number of entries of all pages, and the number of entries of the target page of each operated element.
[0183] The acquisition module 10 is further configured to obtain current page information.
[0184] The processing module 20 is further configured to return a root node in response to the current page being in a leaf node or exceeding a test range.
[0185] The computing module 30 is further configured to determine a plurality of latest operation links according to the element operation data.
[0186] The processing module 20 is further configured to return the root node in response to the plurality of latest operation links being the same and the number of the plurality of latest operation links being greater than a third preset value.
[0187] The acquisition module 10 is further configured to obtain operation time of a current page.
[0188] The computing module 30 is further configured to obtain a number of operations of the current page according to the element operation data.
[0189] The processing module 20 is further configured to return the root node in response to the operation time of the current page being greater than a preset time length or the number of operations of the current page being greater than a fourth preset value.
[0190] The acquisition module 10 is further configured to obtain current page information.
[0191] The processing module 20 is further configured to return a previous page in response to the current page being in a leaf node.
[0192] The computing module 30 is further configured to, in response to the return failure, increase the return failure number by 1.
[0193] The processing module 20 is further configured to, in response to the return failure number being greater than or equal to a fifth preset value, return the root node.
[0194] In the technical solution of the present disclosure, the acquisition, storage and application of user personal information are in line with relevant laws and regulations and do not violate public order and good customs.
[0195] According to the embodiments of the present disclosure, the present disclosure further provides an electronic device, a readable storage medium and a computer program product.
[0196] Figure 4 A schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present disclosure described and / or claimed in this document.
[0197] As shown in Figure 4 The electronic device 800 includes a computing unit 801 that can perform various appropriate actions and processes in accordance with a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. Various programs and data required for the operation of the electronic device 800 can also be stored in the RAM 803. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other through a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0198] Various components in the electronic device 800 are connected to the I / O interface 805, including an input unit 806, such as a keyboard, a mouse, etc., an output unit 807, such as various types of displays, a speaker, etc., the storage unit 808, such as a magnetic disk, an optical disk, etc., and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the electronic device 800 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0199] The computing unit 801 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs various methods and processes described above, such as the application testing method. For example, in some embodiments, the application testing method can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded onto the RAM 803 and executed by the computing unit 801, one or more steps of the application testing method described above can be performed. Alternatively, in other embodiments, the computing unit 801 can be configured to perform the application testing method by any other suitable means, such as by means of firmware.
[0200] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (PLD), a computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0201] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces the functions / operations specified in the flowcharts and / or the block diagrams. The program code can be executed entirely on a machine, partially on a machine, partially on a machine and partially on a remote machine or entirely on a remote machine or server.
[0202] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0203] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0204] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0205] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0206] It should be understood that the various forms of flow shown above can be used to reorder, add, or remove steps. For example, the steps described in the present disclosure can be performed in parallel, in series, or in a different order, without limitation herein, so long as the desired results of the technology described in the present disclosure are achieved.
[0207] The specific implementation described above does not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. An application testing method, comprising: obtaining all elements and element operation data in a current page; dividing all elements into operated elements and unoperated elements according to the element operation data; calculating redundancy of each unoperated element, the redundancy representing similarity of the unoperated element with other operated elements; putting all unoperated elements with redundancy less than a first preset value into a first priority set; sorting unoperated elements in the first priority set according to redundancy; in response to existence of at least one unoperated element in the first priority set, operating an unoperated element with minimum redundancy in the first priority set; wherein the calculating redundancy of each unoperated element comprises: obtaining Hamming distance of each unoperated element and each operated element; calculating similarity of each unoperated element and each operated element according to Hamming distance of each unoperated element and each operated element; averaging similarity of each unoperated element and each operated element to obtain redundancy of each unoperated element.
2. The method of claim 1, further comprising: in response to non-existence of unoperated elements in the first priority set, calculating a benefit value of each operated element, the benefit value representing a benefit obtainable after the operated element is operated; determining a failure operation times proportion of each operated element according to the element operation data; putting operated elements with failure operation times proportion less than a first preset percentage into a second priority set; sorting operated elements in the second priority set according to the benefit value; in response to existence of at least one operated element in the second priority set, operating an operated element with maximum benefit value in the second priority set; wherein the calculating a benefit value of each operated element comprises: determining a plurality of pages associated with each operated element according to the element operation data; calculating an average effective element number of the plurality of pages associated with each operated element; obtaining a total element operation times, an operation times of each operated element, an entering times of all pages and an entering times of a target page of each operated element according to the element operation data; calculating a benefit value of each operated element according to the average effective element number of the plurality of pages associated with each operated element, the total element operation times, the operation times of each operated element, the entering times of all pages and the entering times of the target page of each operated element.
3. The method of claim 2, further comprising: in response to non-existence of operated elements in the second priority set, putting unoperated elements with redundancy greater than or equal to a first preset value and less than a second preset value into a third priority set; sorting unoperated elements in the third priority set according to redundancy; in response to existence of at least one unoperated element in the third priority set, operating an unoperated element with minimum redundancy in the third priority set.
4. The method of claim 3, further comprising, after dividing all elements into operated elements and unoperated elements according to the element operation data: obtaining element attribute data; calculate an average Manhattan distance of each element to all other operated elements in the current page, to obtain a crowded distance of each element; determine an operation type score, a level score, an importance score, and an element area of each element according to the element attribute data; multiply the crowded distance of each element by a first weight, multiply the operation type score by a second weight, multiply the level score by a third weight, multiply the importance score by a fourth weight, multiply the element area by a fifth weight, and add them together to obtain a score value of each element.
5. The method of claim 4, further comprising: in response to the absence of unoperated elements in the third priority set, placing all unoperated elements with redundancy greater than or equal to a second preset value into a fourth priority set; placing all operated elements with a failure operation frequency ratio greater than or equal to a first preset percentage into a fifth priority set; sorting all elements in the fourth priority set and the fifth priority set according to the score value; in response to the presence of at least one unoperated element in the fourth priority set, operating the unoperated element with the highest score value in the fourth priority set; or in response to the absence of unoperated elements in the fourth priority set, operating the operated element with the highest score value in the fifth priority set.
6. The method of claim 1, further comprising: obtaining current page information; in response to the current page being outside a test range, returning a root node.
7. The method of claim 1, further comprising: determining a plurality of recent operation links according to the element operation data; in response to the plurality of recent operation links being the same and the number being greater than a third preset value, returning a root node.
8. The method of claim 1, further comprising: obtaining an operation time of the current page; obtaining an operation frequency of the current page according to the element operation data; in response to the operation time of the current page being greater than a preset time length or the operation frequency of the current page being greater than a fourth preset value, returning a root node.
9. The method of claim 1, further comprising: obtaining current page information; in response to the current page being at a leaf node, returning a previous page; in response to a return failure, adding 1 to a return failure frequency; in response to the return failure frequency being greater than or equal to a fifth preset value, returning a root node.
10. An application testing device, comprising: a collection module configured to obtain all elements and element operation data in a current page; a processing module configured to divide all elements into operated elements and unoperated elements according to the element operation data; a calculation module configured to calculate a redundancy of each unoperated element, the redundancy being determined based on a Hamming distance between the unoperated element and each operated element, the redundancy representing a similarity between the unoperated element and other operated elements; the processing module is further configured to place all unoperated elements with a redundancy less than a first preset value into a first priority set; the processing module is further configured to sort the unoperated elements in the first priority set according to the redundancy; an operation module configured to operate the unoperated element with the smallest redundancy in the first priority set in response to the presence of at least one unoperated element in the first priority set.
11. An electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-9.
12. A non-transitory computer readable storage medium having stored thereon computer instructions, wherein, the computer instructions are for causing the computer to perform the method of any one of claims 1-9.
13. A computer program product comprising a computer program which, when executed by a processor, implements the method of any one of claims 1-9.
Citation Information
Patent Citations
Application testing method and apparatus
CN106919503A
User interface (UI) testing method and device, server and storage medium
CN107506300A