Test case reuse method and device, electronic device, computer storage medium

By determining the similarity matching of new and old pages and page elements during version iteration and establishing mapping relationships, the problem of non-reusability of front-end test cases is solved, achieving efficient reuse of test cases, reducing costs and improving efficiency.

CN115469861BActive Publication Date: 2026-07-21JINGDONG TECH HLDG CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JINGDONG TECH HLDG CO LTD
Filing Date
2021-06-11
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

In existing technologies, front-end test cases cannot be effectively reused when versions are updated, resulting in high testing costs and low efficiency.

Method used

By identifying the new and missing test objects in the new version, similarity matching is used to establish a mapping relationship between the old and new pages and page elements, enabling the reuse of test cases.

Benefits of technology

It improved the reusability of test cases, reduced testing costs, and increased testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115469861B_ABST
    Figure CN115469861B_ABST
Patent Text Reader

Abstract

The application discloses a test case multiplexing method and device, electronic equipment and computer storage medium. The method comprises the following steps: when a product to be tested is iterated, determining a new measured object added in a new version of the product to be tested and a lost old measured object; the new measured object comprises a new page and a new page element; the old measured object comprises an old page and an old page element; performing similarity matching on the new page and the old page under the same level, and performing similarity matching on the new page element and the old page element under the same page; establishing a mapping relationship between a unique key value corresponding to the new page and the old page matched with the new page, and establishing a mapping relationship between a unique key value corresponding to the new page element and the old page element matched with the new page element; the unique key value corresponding to the old measured object is generated when the old measured object is registered, or the unique key value corresponding to the old measured object matched with the old measured object is obtained by establishing a mapping relationship when the old measured object is added as the new measured object.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of front-end testing technology, and in particular to a method and apparatus for reusing test cases, electronic devices, and computer storage media. Background Technology

[0002] Front-end testing ensures the effective implementation and reasonableness of front-end functions. Therefore, front-end testing is usually required when a product is launched or when a version is updated.

[0003] Creating automated test cases is crucial in front-end testing. Current methods primarily involve recording and replaying test cases. However, with version updates, changes to the front-end often render the original test cases unusable. The current approach is to discard the entire original test case set and then record new ones.

[0004] It is evident that the existing approach lacks the ability to reuse test cases, resulting in high testing costs and the need to re-record test cases, which also leads to problems such as testing efficiency. Summary of the Invention

[0005] In view of the shortcomings of the prior art, this application provides a method and apparatus for reusing test cases, an electronic device, and a computer storage medium to solve the problem that the prior art lacks a way to effectively reuse test cases.

[0006] To achieve the above objectives, this application provides the following technical solution:

[0007] The first aspect of this application provides a method for reusing test cases, comprising:

[0008] When the product under test undergoes a version iteration, the newly added test objects and the lost old test objects in the new version of the product under test are identified; wherein, the new test objects include new pages and new page elements; the old test objects include old pages and old page elements;

[0009] The new page and the old page at the same level are matched for similarity, and the elements of the new page and the elements of the old page at the same level are matched for similarity.

[0010] Establish a mapping relationship between the new page and the unique key value corresponding to the matching old page, and establish a mapping relationship between the new page element and the unique key value corresponding to the matching old page element.

[0011] Optionally, in the above method, a unique key value corresponding to an old test object is generated when the old test object is registered for testing, or obtained by establishing a mapping relationship through the unique key value corresponding to the previous old test object that matched it when the old test object was previously added as a new test object.

[0012] Optionally, in the above method, the step of performing similarity matching between the new page and the old page at the same level includes:

[0013] Determine the new page and the old page at the same level that meet the preset page matching conditions;

[0014] Calculate the sum of the weights corresponding to each of the page matching conditions that the new page and the old page meet;

[0015] Determine whether the sum of the weights corresponding to each of the page matching conditions that the new page and the old page meet is greater than a first threshold;

[0016] If the sum of the weights corresponding to all the page matching conditions that the new page and the old page meet is greater than the first threshold, then the new page is determined to be a match for the old page.

[0017] Optionally, in the above method, determining the preset page matching conditions that the new page and the old page at the same level meet includes:

[0018] Determine whether the new page and the old page at the same level meet the first page matching condition, the second page matching condition, and the third page matching condition; wherein, the first page matching condition is that the similarity between the title of the new page and the title of the old page is greater than a first similarity; the second page matching condition is that the similarity between the thumbnail of the new page and the thumbnail of the old page is greater than a second similarity; the third page matching condition is that the attributes of each specified page element of the new page and the old page are consistent;

[0019] If there is a page matching condition where the new page does not match the old page, then the text in the new page has been replaced with synonyms.

[0020] Determine whether the new page after synonym replacement matches the old page, and identify each page matching condition where the new page before synonym replacement does not match the old page.

[0021] Optionally, in the above method, the step of performing similarity matching between the new page elements and the old page elements on the same page includes:

[0022] Determine the preset element matching conditions that the new page elements and the old page elements on the same page meet;

[0023] Calculate the sum of the weights corresponding to each element matching condition that the new page element and the old page element meet;

[0024] Determine whether the sum of the weights corresponding to each element matching condition that the new page element and the old page element meet is greater than a second threshold;

[0025] If the sum of the weights corresponding to all the element matching conditions that the new page element and the old page element meet is greater than the second threshold, then it is determined that the new page element and the old page element are matched.

[0026] Optionally, in the above method, determining the preset element matching conditions that the new page element and the old page element on the same page meet includes:

[0027] Determine whether the new page element and the old page element on the same page meet the first element matching condition, the second element matching condition, and the third element matching condition; wherein, the first element matching condition is that the similarity between the name of the new page element and the name of the old page element is greater than a fourth similarity; the second element matching condition is that the similarity between the first string corresponding to the new page element and the first string corresponding to the old page element is greater than a fifth similarity; the third element matching condition is that the similarity between the second string corresponding to the new page element and the second string corresponding to the old page element is a sixth similarity; the first string consists of the element type and index; the second string consists of the element name, type, and index;

[0028] If there is an element matching condition where the new page element does not match the old page element, then the text in the new page element has been replaced with a synonym.

[0029] Determine whether the new page elements after synonym replacement match the old page elements, and identify the matching conditions for each element that does not match the old page elements before synonym replacement.

[0030] A second aspect of this application provides a test case reuse device, comprising:

[0031] The first determining unit is used to determine, when the product under test undergoes a version iteration, the newly added test objects and the lost old test objects in the new version of the product under test; wherein, the new test objects include new pages and new page elements; and the old test objects include old pages and old page elements.

[0032] A page matching unit is used to perform similarity matching between the new page and the old page at the same level;

[0033] An element matching unit is used to perform similarity matching between the new page elements and the old page elements on the same page;

[0034] The association unit is used to establish a mapping relationship between the new page and the unique key value corresponding to the matching old page, and to establish a mapping relationship between the new page element and the unique key value corresponding to the matching old page element; wherein, a unique key value corresponding to an old test object is generated when the old test object is registered for testing, or is obtained by establishing a mapping relationship with the unique key value corresponding to the previous old test object when the old test object was previously added as a new test object.

[0035] Optionally, in the above-described apparatus, the page matching unit includes:

[0036] The page condition matching unit is used to determine the preset page matching conditions that the new page and the old page at the same level meet.

[0037] The first calculation unit is used to calculate the sum of the weights corresponding to each of the page matching conditions that the new page and the old page meet;

[0038] The first judgment unit is used to determine whether the sum of the weights corresponding to each of the page matching conditions that the new page and the old page meet is greater than a first threshold.

[0039] The second determining unit is used to determine that the new page matches the old page when the first determining unit determines that the sum of the weights corresponding to each of the page matching conditions that the new page and the old page meet is greater than a first threshold.

[0040] Optionally, in the above-described apparatus, the page condition matching unit includes:

[0041] The first page matching unit is used to determine whether the new page and the old page at the same level meet the first page matching condition, the second page matching condition, and the third page matching condition; wherein, the first page matching condition is that the similarity between the title of the new page and the title of the old page is greater than a first similarity; the second page matching condition is that the similarity between the thumbnail of the new page and the thumbnail of the old page is greater than a second similarity; the third page matching condition is that the attributes of each specified page element of the new page and the old page are consistent;

[0042] The first replacement unit is used to replace the text in the new page with synonyms when there is a page matching condition that does not match the old page;

[0043] The second page condition matching unit is used to determine whether the new page after synonym replacement matches the old page, and the various page matching conditions where the new page before synonym replacement does not match the old page.

[0044] Optionally, in the above-described apparatus, the element matching unit includes:

[0045] The element condition matching unit is used to determine the preset element matching conditions that the new page element and the old page element under the same page meet.

[0046] The first calculation unit is used to calculate the sum of the weights corresponding to each element matching condition that the new page element and the old page element meet;

[0047] The second judgment unit is used to determine whether the sum of the weights corresponding to each element matching condition that the new page element and the old page element meet is greater than the second threshold.

[0048] The third determining unit is used to determine that the new page element matches the old page element when the second determining unit determines that the sum of the weights corresponding to each element matching condition that the new page element and the old page element meet is greater than a second threshold.

[0049] Optionally, in the above-described apparatus, the element condition matching unit includes:

[0050] The first element matching unit is used to determine whether the new page element and the old page element on the same page meet the first element matching condition, the second element matching condition, and the third element matching condition; wherein, the first element matching condition is that the similarity between the name of the new page element and the name of the old page element is greater than a fourth similarity; the second element matching condition is that the similarity between the first string corresponding to the new page element and the first string corresponding to the old page element is greater than a fifth similarity; the third element matching condition is that the similarity between the second string corresponding to the new page element and the second string corresponding to the old page element is a sixth similarity; the first string consists of the element type and index; the second string consists of the element name, type, and index;

[0051] The second replacement unit is used to perform synonym replacement on the text in the new page element if there is an element matching condition that does not match the old page element.

[0052] The second element condition matching unit is used to determine whether the new page element after synonym replacement matches the old page, and the element matching conditions under which the new page element before synonym replacement does not match the old page element.

[0053] A third aspect of this application provides an electronic device, comprising:

[0054] Memory and processor;

[0055] The memory is used to store programs;

[0056] The processor is used to execute the program, which, when executed, is specifically used to implement the test case reuse method as described in any of the above.

[0057] A fourth aspect of this application provides a computer storage medium for storing a computer program, which, when executed, implements the test case reuse method as described in any of the preceding claims.

[0058] This application provides a test case reuse method. When the product under test undergoes version iteration, it identifies newly added test objects and lost old test objects in the new version of the product. New test objects include new pages and new page elements. Old test objects include old pages and old page elements. Then, similarity matching is performed between new pages and old pages at the same level, and similarity matching is performed between new page elements and old page elements at the same page. This identifies highly similar new and old pages and elements, which can then reuse the test cases associated with the matched old pages and elements. Therefore, a mapping relationship is established between the unique key values ​​corresponding to the new page and its matched old page, and a mapping relationship is established between the unique key values ​​corresponding to the new page element and its matched old page element, allowing direct reuse of test cases associated with the old pages and elements. Attached Figure Description

[0059] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0060] Figure 1 A flowchart illustrating a test case reuse method provided in an embodiment of this application;

[0061] Figure 2A flowchart illustrating a page similarity matching method provided in another embodiment of this application;

[0062] Figure 3 A flowchart illustrating a method for determining the conditions that a page meets, as provided in another embodiment of this application;

[0063] Figure 4 A flowchart illustrating a method for matching page element similarity according to another embodiment of this application;

[0064] Figure 5 A flowchart illustrating a method for determining conditions met by a page element, provided as another embodiment of this application;

[0065] Figure 6 A schematic diagram of the structure of a test case reuse device provided in another embodiment of this application;

[0066] Figure 7 A schematic diagram of the structure of a page matching unit provided in another embodiment of this application;

[0067] Figure 8 A schematic diagram of the structure of a page condition matching unit provided in another embodiment of this application;

[0068] Figure 9 A schematic diagram of the structure of an element matching unit provided in another embodiment of this application;

[0069] Figure 10 A schematic diagram of the structure of an element condition matching unit provided in another embodiment of this application;

[0070] Figure 11 This is a schematic diagram of the structure of an electronic device provided in another embodiment of this application. Detailed Implementation

[0071] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0072] In this application, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0073] This application provides a method for reusing test cases, such as... Figure 1 As shown, it includes the following steps:

[0074] S101. When the product under test undergoes a version iteration, identify the new test objects added in the new version of the product under test and the old test objects that are lost. The new test objects include new pages and new page elements, and the old test objects include old pages and old page elements.

[0075] In this context, "new pages" and "new page elements" refer to the pages and elements added in the new version. "Old pages" and "old page elements," on the other hand, refer to the pages and elements that have been removed from the new version compared to the previous one.

[0076] It should be noted that during version iterations of the product under test, the tested object may experience document loss or addition. Specifically, this can be divided into two scenarios: the addition and loss of elements on a page, and the addition and loss of the entire page. This application's embodiment employs a matching method to automatically associate the old page with the elements on the new and old pages, thereby enabling the reuse of test cases for the tested object. Association refers to establishing a mapping relationship between the changed page elements and the pages in the old and new versions. After establishing the mapping relationship, test cases related to the pages and page elements in the old version can be reused based on this mapping.

[0077] Therefore, when the product under test undergoes a version iteration, first identify the new test objects added in the new version of the product under test and the old test objects that have been lost, and then execute step S101.

[0078] S102. Perform similarity matching between new pages and old pages at the same level, and perform similarity matching between new page elements and old page elements at the same page.

[0079] The similarity matching process identifies test objects whose similarity meets the requirements. Specifically, if the similarity between two test objects meets the preset requirements, then the two test objects are a match; otherwise, they are not considered to meet the preset requirements.

[0080] Since use cases involving the old test object can only be reused when the new test object is highly similar to the old test object, and only pages at the same level and page elements within the same page can be reused, we perform similarity matching between new and old pages at the same level, and between new and old page elements within the same page.

[0081] It should be noted that if there are multiple new page elements and old page elements on a page, then each new page element will be matched with each old page element in turn based on similarity.

[0082] Optionally, in another embodiment of this application, one implementation of step S102, which involves performing similarity matching between new and old pages at the same level, is as follows: Figure 2 As shown, it includes the following steps:

[0083] S201. Determine the new and old pages at the same level and their matching conditions according to the preset page matching criteria.

[0084] It should be noted that in this embodiment, multiple page matching conditions are pre-set. For each level of new and old pages, the information of the two pages is matched with each page matching condition to determine the page matching conditions that the two pages meet.

[0085] Optionally, in another embodiment of this application, one specific implementation of step S201 is as follows: Figure 3 As shown, it includes the following steps:

[0086] S301. Determine whether new and old pages at the same level meet the first page matching condition, the second page matching condition, and the third page matching condition.

[0087] The first matching criterion is that the similarity between the title of the new page and the title of the old page is greater than a first similarity score. Specifically, the similarity can be determined by string comparison or by using language models or other techniques. The first similarity score can be set to 801%, or other values.

[0088] The second matching criterion is that the similarity between the thumbnail of the new page and the thumbnail of the old page is greater than a second similarity score. Optionally, the second similarity score can be set to 90% or other values.

[0089] The third-party matching criterion is that the attributes of all specified page elements in the new page and the old page are consistent. These specified page element attributes can include the number, type, and position of the elements. Therefore, by comparing the number, type, and position of elements in the new page and the old page, it can be determined whether the new page and the old page meet the third-party matching criteria.

[0090] S302. If there are page matching conditions that do not match the old page, then the text in the new page has been replaced with synonyms.

[0091] It should be noted that when text on a new page is a synonym for text on an old page, the two pages should treat the text as equivalent. For example, cancel = delete = cancel = Cancel.

[0092] However, differences in text may cause the new page and the old page to not meet the page matching conditions. Therefore, to eliminate the influence of this factor, in this embodiment, after initially matching the new page with the old page and each page matching condition, if there are page matching conditions that do not match the new page with the old page, the text in the new page is replaced with synonyms, and then a second matching is performed with the page matching conditions that do not match.

[0093] Optionally, certain synonym expression mapping relationships can be pre-defined, and then the text in the new page can be replaced with synonyms based on the synonym expression mapping relationships.

[0094] S303. Determine whether the new page after synonym replacement matches the old page, and the matching conditions for each page where the new page before synonym replacement does not match the old page.

[0095] S202. Calculate the sum of the weights corresponding to each page matching condition that the new page and the old page meet.

[0096] Optionally, the weight of each page matching condition can be configured in advance according to the importance of each page matching condition, and then the sum of the weights corresponding to each page matching condition that the new page and the old page meet can be calculated.

[0097] S203. Determine whether the sum of the weights corresponding to each page matching condition that the new page and the old page meet is greater than the first threshold.

[0098] If the sum of the weights corresponding to all the page matching conditions that the new page and the old page meet is greater than the first threshold, then step S204 is executed.

[0099] Optionally, if it is determined that the sum of the weights corresponding to the various page matching conditions that the new page and the old page meet is not greater than the first threshold, then a message can be sent indicating that the test cases corresponding to the old page cannot be reused.

[0100] S204. Ensure the new page matches the old page.

[0101] Optionally, after determining that the new page matches the old page, the matching result can be fed back to the user for confirmation. After receiving the confirmation instruction triggered by the user, step S103 is then executed for the two pages.

[0102] Optionally, in another embodiment of this application, one implementation of the similarity matching between new page elements and old page elements on the same page in step S102 is as follows: Figure 4 As shown, it includes the following steps:

[0103] S401. Determine the new page elements and old page elements on the same page that meet the preset element matching conditions.

[0104] It should be noted that in this embodiment, multiple element matching conditions are pre-set. For each new page element and old page element on each page, the information of the two page elements is matched with each element matching condition to determine the element matching conditions that the two page elements meet.

[0105] Optionally, one implementation of step S401 is as follows: Figure 5 As shown, it includes the following steps:

[0106] S501. Determine whether the new page element and the old page element on the same page meet the first element matching condition, the second element matching condition, and the third element matching condition.

[0107] The first matching criterion is that the similarity between the name of the new page element and the name of the old page element is greater than the fourth similarity criterion. Optionally, the name of the page element can be segmented into words, and then a similarity score can be determined based on the inclusion relationship between each segment and the segment of another element, thereby determining whether it meets the first matching criterion. The fourth similarity criterion can be set to 80%, or other values.

[0108] The second element matching criterion is that the first string corresponding to the new page element has a similarity score greater than the first string corresponding to the old page element. The first string consists of the element's type and index. The fifth similarity score can be set to 80%, or other values.

[0109] The third element matching criterion is the sixth similarity between the second string corresponding to the new page element and the second string corresponding to the old page element. The second string consists of the element's name, type, and index. The sixth similarity can be set to 60%, or other values.

[0110] S502. If there are element matching conditions that do not match the old page elements, then the text in the new page elements has been replaced with synonyms.

[0111] Similarly, to avoid the influence of synonyms on the matching results of new and old page elements and element matching conditions, when there are element matching conditions that do not match the old page elements, the text in the new page elements is replaced with synonyms, and then step S503 is executed to perform matching again.

[0112] S503. Determine whether the new page elements after synonym replacement match the old page elements, and the matching conditions for each element that does not match the old page elements before synonym replacement.

[0113] S402. Calculate the sum of the weights corresponding to each element matching condition that the new page element meets with the old page element.

[0114] S403. Determine whether the sum of the weights corresponding to the matching conditions of the new page elements and the old page elements is greater than the second threshold.

[0115] If the sum of the weights corresponding to the matching conditions of the new page elements and the old page elements is greater than the second threshold, then step S404 is executed.

[0116] Alternatively, if the sum of the weights corresponding to the matching conditions of the new page element and the old page element is determined to be no greater than the second threshold, a message can be sent indicating that the test cases corresponding to the old page element cannot be reused.

[0117] S404. Ensure that the new page elements match the old page elements.

[0118] Similarly, after determining that the new page element matches the old page element, the matching result can be fed back to the user for confirmation. After receiving the confirmation instruction triggered by the user, step S103 can be executed for the two page elements.

[0119] S103. Establish a mapping relationship between the unique key value of the new page and the matching old page, and establish a mapping relationship between the unique key value of the new page element and the matching old page element.

[0120] The unique key value corresponding to an old test object is generated when registering the old test object for testing, or obtained by establishing a mapping relationship with the unique key value of the previous old test object when the old test object was previously added as a new test object. The previous new test object refers to the page or page element added before the current new test object. The previous old test object refers to the old test object relative to the newly added test object at that time.

[0121] In other words, the unique key value corresponding to the old page and the unique key value corresponding to the old page element are both generated during the test registration. Alternatively, when an old page or old page element was previously added as a new test object, the method provided in this application embodiment is used to match the previous old test object that was matched with the old page or old page element that was the new test object at that time. Then, a mapping relationship is established with the unique key value corresponding to the matched previous old test object. That is, when an old page or old page element was previously added as a new test object, the method provided in this application embodiment is executed on the old page or old page element to obtain its corresponding unique key value.

[0122] Specifically, when the product under test is first registered, all pages and page elements are registered, and unique keys are generated for each page and page element. For subsequent additions of pages and page elements, the method provided in this application is used to match the new pages and page elements, and a mapping relationship is established between the new pages and page elements and the unique keys corresponding to the successfully matched test objects. If no matching test object is found, unique keys will be generated for the newly added pages and page elements accordingly.

[0123] This application provides a test case reuse method. When a product under test undergoes version iteration, it identifies newly added test objects and lost old test objects in the new version of the product. The new test objects include new pages and new page elements. The old test objects include old pages and old page elements. Then, similarity matching is performed between the new pages and the old pages at the same level, and similarity matching is performed between the new page elements and the old page elements at the same page. This identifies highly similar new and old pages and elements, which can then reuse the test cases associated with the matched old pages and elements. Therefore, a mapping relationship is established between the unique key values ​​corresponding to the new pages and their matched old pages, and a mapping relationship is established between the unique key values ​​corresponding to the new page elements and their matched old page elements, allowing direct reuse of test cases associated with the old pages and elements.

[0124] Another embodiment of this application provides a test case reuse device, such as... Figure 6 As shown, it includes the following units:

[0125] The first determining unit 601 is used to determine the newly added test objects and the lost old test objects in the new version of the test product when the product under test undergoes version iteration.

[0126] The new test objects include new pages and new page elements; the old test objects include old pages and old page elements.

[0127] Page matching unit 602 is used to perform similarity matching between new pages and old pages at the same level.

[0128] Element matching unit 603 is used to perform similarity matching between new page elements and old page elements on the same page.

[0129] The association unit 604 is used to establish a mapping relationship between the unique key value of the new page and the matching old page, and to establish a mapping relationship between the unique key value of the new page element and the matching old page element.

[0130] Among them, the unique key value corresponding to an old test object is generated when the old test object is registered for testing, or obtained by establishing a mapping relationship with the unique key value corresponding to the previous old test object when the old test object was previously added as a new test object.

[0131] Optionally, in another embodiment of the test case reuse device provided in this application, the page matching unit, such as Figure 7 As shown, it includes the following units:

[0132] The page condition matching unit 701 is used to determine the preset page matching conditions that new and old pages at the same level meet.

[0133] The first calculation unit 702 is used to calculate the sum of the weights corresponding to each page matching condition that the new page and the old page meet.

[0134] The first judgment unit 703 is used to determine whether the sum of the weights corresponding to each page matching condition that the new page and the old page meet is greater than the first threshold.

[0135] The second determining unit 704 is used to determine that the new page matches the old page when the first determining unit determines that the sum of the weights corresponding to each page matching condition that the new page matches the old page is greater than the first threshold.

[0136] Optionally, in another embodiment of the test case reuse device provided in this application, the page condition matching unit, such as Figure 8 As shown, it includes:

[0137] The first page condition matching unit 801 is used to determine whether new pages and old pages at the same level meet the first page matching condition, the second page matching condition, and the third page matching condition.

[0138] The first page matching criterion is that the similarity between the title of the new page and the title of the old page is greater than a first similarity score. The second page matching criterion is that the similarity between the thumbnail of the new page and the thumbnail of the old page is greater than a second similarity score. The third page matching criterion is that the attributes of all specified page elements of the new page and the old page are consistent.

[0139] The first replacement unit 802 is used to replace the text in the new page with synonyms when there are page matching conditions that do not match the old page.

[0140] The second page condition matching unit 803 is used to determine whether the new page after synonym replacement matches the old page, and the page matching conditions where the new page before synonym replacement does not match the old page.

[0141] Optionally, in another embodiment of the test case reuse device provided in this application, the element matching unit, such as Figure 9 As shown, it includes the following units:

[0142] The element condition matching unit 901 is used to determine the preset element matching conditions that new page elements and old page elements on the same page meet.

[0143] The first calculation unit 902 is used to calculate the sum of the weights corresponding to each element matching condition that the new page element meets with the old page element.

[0144] The second judgment unit 903 is used to determine whether the sum of the weights corresponding to each element matching condition that the new page element meets with the old page element is greater than the second threshold.

[0145] The third determining unit 904 is used to determine that the new page element matches the old page element when the sum of the weights corresponding to each element matching condition that the new page element matches the old page element is greater than the second threshold, as determined by the second determining unit.

[0146] Optionally, in another embodiment of the test case reuse device provided in this application, the element condition matching unit, such as Figure 10 As shown, it includes:

[0147] The first element condition matching unit 1001 is used to determine whether new page elements and old page elements on the same page meet the first element matching condition, the second element matching condition, and the third element matching condition.

[0148] The first element matching condition is that the similarity between the name of the new page element and the name of the old page element is greater than the fourth similarity score. The second element matching condition is that the similarity between the first string corresponding to the new page element and the first string corresponding to the old page element is greater than the fifth similarity score. The third element matching condition is that the similarity between the second string corresponding to the new page element and the second string corresponding to the old page element is the sixth similarity score. The first string consists of the element's type and index; the second string consists of the element's name, type, and index.

[0149] The second replacement unit 1002 is used to replace the text in the new page element with a synonym if there is an element matching condition that does not match the old page element.

[0150] The second element condition matching unit 1003 is used to determine whether the new page element after synonym replacement matches the old page, and the matching conditions of each element where the new page element before synonym replacement does not match the old page element.

[0151] It should be noted that the specific working process of each unit provided in the above embodiments of this application can be referred to the corresponding steps in the above method embodiments, and will not be repeated here.

[0152] Another embodiment of this application provides an electronic device, such as... Figure 11 As shown, it includes:

[0153] Memory 1101 and processor 1102.

[0154] The memory 1101 is used to store programs. The processor 1102 is used to execute the programs stored in the memory 1101, and when the programs are executed, they are specifically used to implement the test case reuse method provided in any of the above embodiments.

[0155] Another embodiment of this application provides a computer storage medium for storing a computer program, which, when executed, implements a test case reuse method as provided in any of the above embodiments.

[0156] Computer storage media, including both permanent and non-permanent, removable and non-removable media, can store information using any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0157] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0158] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for reusing test cases, characterized in that, include: When the product under test undergoes a version iteration, the newly added test objects and the lost old test objects in the new version of the product under test are identified; wherein, the new test objects include new pages and new page elements; the old test objects include old pages and old page elements; The similarity matching is performed between the new page and the old page at the same level, and between the elements of the new page and the elements of the old page at the same page; wherein, the similarity matching between the new page and the old page is to match the similarity of the title, thumbnail and specified page element attributes of the new page and the old page; the similarity matching between the new page elements and the old page elements is to match the similarity of the name, type and index of the new page elements and the old page elements. A mapping relationship is established between the new page and the unique key value corresponding to the old page that meets the similarity matching requirement, and a mapping relationship is established between the new page element and the unique key value corresponding to the old page element that meets the similarity matching requirement, so as to reuse the use cases involved in the pages and page elements in the old version based on the mapping relationship. Among them, a unique key value corresponding to an old test object is generated when the old test object is registered for testing, or obtained by establishing a mapping relationship with the unique key value corresponding to the previous old test object when the old test object was previously added as a new test object.

2. The method according to claim 1, characterized in that, The step of performing similarity matching between the new page and the old page at the same level includes: Determine the preset page matching conditions that the new page and the old page at the same level meet; Calculate the sum of the weights corresponding to each of the page matching conditions that the new page and the old page meet; Determine whether the sum of the weights corresponding to each of the page matching conditions that the new page and the old page meet is greater than a first threshold; If the sum of the weights corresponding to all the page matching conditions that the new page and the old page meet is greater than the first threshold, then the new page is determined to be a match for the old page.

3. The method according to claim 2, characterized in that, The step of determining the preset page matching conditions that the new page and the old page at the same level meet includes: Determine whether the new page and the old page at the same level meet the first page matching condition, the second page matching condition, and the third page matching condition; wherein, the first page matching condition is that the similarity between the title of the new page and the title of the old page is greater than a first similarity; the second page matching condition is that the similarity between the thumbnail of the new page and the thumbnail of the old page is greater than a second similarity; the third page matching condition is that the attributes of each specified page element of the new page and the old page are consistent; If there is a page matching condition where the new page does not match the old page, then the text in the new page has been replaced with synonyms. Determine whether the new page after synonym replacement matches the old page, and identify each page matching condition where the new page before synonym replacement does not match the old page.

4. The method according to claim 1, characterized in that, The step of performing similarity matching between the new page elements and the old page elements on the same page includes: Determine the preset element matching conditions that the new page elements and the old page elements on the same page meet; Calculate the sum of the weights corresponding to each element matching condition that the new page element and the old page element meet; Determine whether the sum of the weights corresponding to each element matching condition that the new page element and the old page element meet is greater than a second threshold; If the sum of the weights corresponding to all the element matching conditions that the new page element and the old page element meet is greater than the second threshold, then it is determined that the new page element and the old page element are matched.

5. The method according to claim 4, characterized in that, The preset element matching conditions for determining whether the new page element and the old page element on the same page meet include: Determine whether the new page element and the old page element on the same page meet the first element matching condition, the second element matching condition, and the third element matching condition; wherein, the first element matching condition is that the similarity between the name of the new page element and the name of the old page element is greater than a fourth similarity; the second element matching condition is that the similarity between the first string corresponding to the new page element and the first string corresponding to the old page element is greater than a fifth similarity; the third element matching condition is that the similarity between the second string corresponding to the new page element and the second string corresponding to the old page element is a sixth similarity; the first string consists of the element type and index; the second string consists of the element name, type, and index; If there is an element matching condition where the new page element does not match the old page element, then the text in the new page element has been replaced with a synonym. Determine whether the new page elements after synonym replacement match the old page elements, and identify the matching conditions for each element that does not match the old page elements before synonym replacement.

6. A test case reuse device, characterized in that, include: The first determining unit is used to determine, when the product under test undergoes a version iteration, the newly added test objects and the lost old test objects in the new version of the product under test; wherein, the new test objects include new pages and new page elements; and the old test objects include old pages and old page elements. A page matching unit is used to perform similarity matching between the new page and the old page at the same level; An element matching unit is used to perform similarity matching between the new page elements and the old page elements on the same page; wherein, the similarity matching between the new page and the old page is to match the similarity of the title, thumbnail and specified page element attributes of the new page and the old page; the similarity matching between the new page elements and the old page elements is to match the similarity of the name, type and index of the new page elements and the old page elements. The association unit is used to establish a mapping relationship between the new page and the unique key value corresponding to the old page that matches the similarity matching requirement, and to establish a mapping relationship between the new page element and the unique key value corresponding to the old page element that matches the similarity matching requirement, so as to reuse the test cases involving the pages and page elements in the old version based on the mapping relationship; wherein, a unique key value corresponding to an old test object is generated when the old test object is registered for testing, or is obtained by establishing a mapping relationship through the unique key value corresponding to the previous old test object that matched it when the old test object was previously added as a new test object.

7. The apparatus according to claim 6, characterized in that, The page matching unit includes: A page condition matching unit is used to determine the preset page matching conditions that the new page and the old page at the same level meet; The first calculation unit is used to calculate the sum of the weights corresponding to each of the page matching conditions that the new page and the old page meet; The first judgment unit is used to determine whether the sum of the weights corresponding to each of the page matching conditions that the new page and the old page meet is greater than a first threshold. The second determining unit is used to determine that the new page matches the old page when the first determining unit determines that the sum of the weights corresponding to each of the page matching conditions that the new page and the old page meet is greater than a first threshold.

8. The apparatus according to claim 7, characterized in that, The page condition matching unit includes: The first page matching unit is used to determine whether the new page and the old page at the same level meet the first page matching condition, the second page matching condition, and the third page matching condition; wherein, the first page matching condition is that the similarity between the title of the new page and the title of the old page is greater than a first similarity; the second page matching condition is that the similarity between the thumbnail of the new page and the thumbnail of the old page is greater than a second similarity; the third page matching condition is that the attributes of each specified page element of the new page and the old page are consistent; The first replacement unit is used to replace the text in the new page with synonyms when there is a page matching condition that does not match the old page; The second page condition matching unit is used to determine whether the new page after synonym replacement matches the old page, and the various page matching conditions where the new page before synonym replacement does not match the old page.

9. An electronic device, characterized in that, include: Memory and processor; The memory is used to store programs; The processor is used to execute the program, which, when executed, is specifically used to implement the test case reuse method as described in any one of claims 1 to 5.

10. A computer storage medium, characterized in that, Used to store computer programs, which, when executed, are used to implement the test case reuse method as described in any one of claims 1 to 5.