Method for generating user interface automation test cases and related device
Through the operation path buried point SDK, the user behavior generation operation link is analyzed, which solves the problem of high generation cost of user interface automation use cases and realizes low-cost automatic generation without manual participation.
Patent Information
- Application Number
- CN202211683216.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-27
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2042-12-27
AI Technical Summary
In the prior art, the generation of user interface automation use cases requires testers to have programming capabilities, with high technical thresholds and high costs.
Through the pre-constructed operation path buried SDK, the buried point data of the target application is obtained, the user behavior is analyzed to generate operation links, the link with high frequency is counted and the user interface automation use cases are generated.
No manual participation is required, which reduces the cost of generating user interface automation use cases and realizes automatic generation of user interface automation use cases.
Smart Images

Figure CN115934564B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the front-end field, and in particular to a method for automatically generating a user interface use case and a related device. Background Art
[0002] In the field of software automation testing, current user interface automation use cases are primarily implemented by manually locating page elements and then manually writing test scripts. This requires testers to have programming skills, and building user interface automation use cases through code writing is technically demanding and expensive. Summary of the Invention
[0003] In view of the above problems, the present invention provides a method and related apparatus for automatically generating a user interface use case, which overcomes the above problems or at least partially solves the above problems.
[0004] In a first aspect, a method for automatically generating a user interface use case includes:
[0005] Obtain tracking data for the target application through a pre-built operation path tracking SDK, where the tracking data includes data generated by multiple users performing corresponding user behaviors on the target application in multiple operation cycles. One user corresponds to at least one operation cycle, one operation cycle corresponds to multiple user behaviors, and one user behavior corresponds to one piece of tracking data.
[0006] For the first operation cycle of any of the users, generating an operation link corresponding to the first operation cycle according to each buried data corresponding to the first operation cycle;
[0007] For any operation cycle after the first operation cycle of the user, generating the operation link corresponding to the operation cycle according to each buried data corresponding to the operation cycle and the operation link corresponding to the previous operation cycle, wherein one operation cycle corresponds to one operation link;
[0008] Counting the occurrence frequencies of the operation links, and determining the operation links whose occurrence frequencies are higher than a preset frequency threshold or whose occurrence frequencies are ranked in the top N, where N is an integer greater than 1;
[0009] Based on the determined tracking data corresponding to the operation link, a corresponding user interface automation use case is generated.
[0010] In conjunction with the first aspect, in certain optional implementations, after generating corresponding user interface automation use cases based on the determined tracking data corresponding to the operation link, the method further includes:
[0011] The user interface automation use case is saved in a use case library.
[0012] In combination with the previous embodiment, in some optional embodiments, after saving the user interface automation use case to the use case library, the method further includes:
[0013] Obtain the user interface automation use case from the use case library;
[0014] Parsing the user interface automation use case to obtain a corresponding executable script or data format;
[0015] Executing the executable script or data format based on the automated testing framework;
[0016] Obtaining the execution result of the automated testing framework feedback;
[0017] A test report corresponding to the user interface automation use case is generated according to the execution result.
[0018] In conjunction with the first aspect, in certain optional implementations, for a first operation cycle of any of the users, generating an operation link corresponding to the first operation cycle based on each buried data corresponding to the first operation cycle includes:
[0019] For the first operation cycle of any of the users, the first shortest operation link corresponding to the first operation cycle is generated based on the parameters in each buried point data corresponding to the first operation cycle, wherein the first shortest operation link includes multiple link nodes, one link node corresponds to one buried point data, each link node includes the corresponding user behavior type parameter in the buried point data and the corresponding page element parameter in the buried point data, and the node order of each link node matches the corresponding user step sequence parameter in each buried point data.
[0020] In combination with the previous embodiment, in certain optional embodiments, for any operation cycle after the first operation cycle of the user, generating the operation link corresponding to the operation cycle based on each buried data corresponding to the operation cycle and the operation link corresponding to the previous operation cycle of the operation cycle includes:
[0021] For any operation cycle after the first operation cycle of the user, generating a second shortest operation link according to parameters in each buried data corresponding to the operation cycle;
[0022] A complete third shortest operation link corresponding to the operation cycle is generated based on the second shortest operation link and the operation link corresponding to the previous operation cycle of the operation cycle.
[0023] In combination with the previous embodiment, in certain optional embodiments, generating a complete third shortest operation link corresponding to the operation cycle based on the second shortest operation link and the operation link corresponding to the previous operation cycle of the operation cycle includes:
[0024] If the link nodes included in the second shortest operation link are duplicated with the link nodes included in the operation link corresponding to the operation cycle before the operation cycle, deleting the duplicated nodes from the second shortest operation link;
[0025] The second shortest operation link with duplicate nodes deleted and the operation link corresponding to the previous operation cycle of the operation cycle are spliced to obtain the third shortest operation link.
[0026] In combination with the previous embodiment, in some optional embodiments, generating a corresponding user interface automation use case based on each tracking data corresponding to the determined operation link includes:
[0027] Based on the determined embedded point data corresponding to each link node included in the operation link, a corresponding user interface automation use case is generated, wherein the data structure of the user interface automation use case is consistent with the data structure of the embedded point data.
[0028] In a second aspect, a user interface automation use case generation device includes: a buried point data acquisition unit, a first link generation unit, a second link generation unit, a frequency statistics unit, and a use case generation unit;
[0029] The tracking data acquisition unit is configured to obtain tracking data for a target application through a pre-built operation path tracking SDK, wherein the tracking data includes data generated by multiple users performing corresponding user behaviors on the target application in multiple operation cycles, wherein one user corresponds to at least one operation cycle, one operation cycle corresponds to multiple user behaviors, and one user behavior corresponds to one piece of tracking data;
[0030] The first link generating unit is configured to generate, for a first operation cycle of any user, an operation link corresponding to the first operation cycle according to each buried point data corresponding to the first operation cycle;
[0031] The second link generating unit is configured to generate, for any operation cycle after the first operation cycle of the user, the operation link corresponding to the operation cycle based on each buried data corresponding to the operation cycle and the operation link corresponding to the previous operation cycle, wherein one operation cycle corresponds to one operation link;
[0032] The frequency counting unit is configured to count the occurrence frequencies of the operation links and determine the operation links whose occurrence frequencies are higher than a preset frequency threshold or whose occurrence frequencies are ranked in the top N, where N is an integer greater than 1;
[0033] The use case generation unit is used to generate corresponding user interface automation use cases based on the determined tracking data corresponding to the operation link.
[0034] In a third aspect, a computer-readable storage medium stores a program thereon, which, when executed by a processor, implements any of the above-mentioned methods for automatically generating user interface use cases.
[0035] In a fourth aspect, an electronic device comprises at least one processor, and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other through the bus; and the processor is used to call program instructions in the memory to execute any one of the above-mentioned user interface automation use case generation methods.
[0036] By means of the above technical solution, the present invention provides a user interface automation use case generation method and related devices, which can obtain tracking data for a target application through a pre-built operation path tracking SDK, wherein the tracking data includes data generated by multiple users performing corresponding user behaviors on the target application in multiple operation cycles, one user corresponds to at least one operation cycle, one operation cycle corresponds to multiple user behaviors, and one user behavior corresponds to one tracking data; for the first operation cycle of any of the users, an operation link corresponding to the first operation cycle is generated based on the tracking data corresponding to the first operation cycle; for any of the operation cycles after the first operation cycle of the user, an operation link corresponding to the operation cycle is generated based on the tracking data corresponding to the operation cycle and the operation link corresponding to the previous operation cycle of the operation cycle, wherein one operation cycle corresponds to one operation link; the occurrence frequency of each operation link is counted, and the operation link whose occurrence frequency is higher than a preset frequency threshold or whose occurrence frequency ranks in the top N is determined, wherein N is an integer greater than 1; and the corresponding user interface automation use case is generated based on the tracking data corresponding to the determined operation link. From this, it can be seen that the present invention can obtain tracking data based on the operation path tracking SDK, and then analyze the tracking data to determine the operation links with more frequent operations, and then select the corresponding tracking data to build corresponding user interface automation use cases, without the need for human participation and at a relatively low cost.
[0037] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are specifically listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the present invention. The same reference symbols are used throughout the drawings to represent the same components. In the drawings:
[0039] Figure 1 A flowchart of a method for automatically generating a user interface use case provided by the present invention is shown;
[0040] Figure 2 A schematic diagram of the data structure of a buried point data provided by the present invention is shown;
[0041] Figure 3 A flowchart of another method for automatically generating a user interface use case provided by the present invention is shown;
[0042] Figure 4 A schematic structural diagram of a user interface automation use case generation device provided by the present invention is shown;
[0043] Figure 5 A structural diagram of an electronic device provided by the invention is shown. DETAILED DESCRIPTION
[0044] Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.
[0045] like Figure 1 As shown, the present invention provides a method for automatically generating a user interface use case, including: S100, S200, S300, S400 and S500;
[0046] S100: Obtain tracking data for a target application using a pre-built operation path tracking SDK, wherein the tracking data includes data generated by multiple users performing corresponding user behaviors on the target application during multiple operation cycles, wherein one user corresponds to at least one operation cycle, one operation cycle corresponds to multiple user behaviors, and one user behavior corresponds to one piece of tracking data;
[0047] Optionally, the present invention can pre-develop a general-purpose native operation path tracking SDK and then connect the SDK to the target application. After the target application is started, the SDK can report the current user operation to the execution entity of the present invention through the interface. The execution entity of the present invention can analyze the large amount of reported tracking data through intelligent algorithms and select the operation path with the highest user operation frequency as the core use case in the UI automation use case (user interface automation use case).
[0048] It should be noted that the native SDK provides a standardized interface to the target application. When user behavior occurs in the target application, the event is reported through the SDK native interface. The native interface obtains the corresponding parameters through the event type, and then calls the http interface internally to perform data reporting.
[0049] Optionally, the present invention does not impose any specific restrictions on the data format of the tracking data reported by the SDK. Generally speaking, a large number of users will perform corresponding user behaviors on the target application. Therefore, the present invention can generate a unique corresponding user behavior ID when the user starts the target application. It should be noted that the user behavior ID mentioned in the present invention can include two parts, namely the ID prefix and the ID suffix. The generation rules of the user behavior ID are as follows:
[0050] (1) After the user starts the target application, a unique user behavior ID is generated (the ID suffix is empty at this time). The user behavior ID is unique throughout the entire life cycle of the target application.
[0051] (2) When the user operates on the current page or on a lower-level page, the user behavior ID generated in (1) is transparently transmitted and reported;
[0052] (3) When the user triggers the page return operation for the first time, a new user behavior ID is generated based on the user behavior ID generated in (1). That is, an ID suffix is added to the user behavior ID in (1) to obtain a user behavior ID such as "oprsession_1", where "oprsession" is the user behavior ID in (1) and "_1" is the ID suffix added in (3);
[0053] (4) If the user initiates another page return operation based on (3), a user behavior ID such as "oprsession_2" is generated, and the cycle continues. That is, the ID suffix matches the number of times the user triggers the page return operation, and the present invention does not impose any restrictions on this.
[0054] That is, each time the user triggers a page return operation, the operation cycle is terminated, and a newly generated user behavior ID is returned. Within the same startup cycle of the application, the newly generated user behavior ID uses the same ID prefix. This is done to inherit the preceding steps after the target application is started, so as to facilitate the parsing of an independent and complete operation path. For example, the user's first operation process is as follows: start the target application to the homepage -> operate to the first-level page -> operate to the second-level page. Assuming that the user behavior ID generated by starting the target application to the homepage is "oprsession", the user operates to the second-level page without triggering the page return operation. The user behavior ID of the embedded data records corresponding to each user behavior is "oprsession". At this point, a complete operation path (corresponding to user interface automation test case A) can be generated based on all embedded data with the user behavior ID "oprsession". If the user performs the first page return operation from the secondary page to the primary page at this time, the user behavior ID of the new buried data is "oprsession_1". At this time, all buried data with user behavior ID "oprsession" and user behavior ID "oprsession_1" can be used to generate another complete operation path (corresponding to user interface automation test case B). The present invention does not limit this.
[0055] S200: For a first operation cycle of any user, generate an operation link corresponding to the first operation cycle based on each buried data corresponding to the first operation cycle;
[0056] Optionally, taking the first operation process of the above-mentioned user (corresponding to the first operation cycle) as an example: starting the target application to the homepage -> operating to the first-level page -> operating to the second-level page, the link nodes of the generated operation link are, in sequence: the link node of starting the target application to the homepage, the link node of operating to the first-level page, and the link node of operating to the second-level page. The present invention does not impose any restrictions on this.
[0057] Combine Figure 1 In the embodiment shown, in some optional embodiments, the S200 includes: step 1.1;
[0058] Step 1.1. For the first operation cycle of any of the users, generate the first shortest operation link corresponding to the first operation cycle based on the parameters in each buried point data corresponding to the first operation cycle, wherein the first shortest operation link includes multiple link nodes, one link node corresponds to one buried point data, each link node includes the corresponding user behavior type parameter in the buried point data and the corresponding page element parameter in the buried point data, and the node order of each link node matches the corresponding user step sequence parameter in each buried point data.
[0059] Optionally, the buried point data of the present invention may include: Figure 2 The various parameters shown include: user behavior ID, user behavior type, user step sequence, page element ID, page element Xpath, operation start coordinates, operation end coordinates, and reserved extension fields. When generating an operation link, the present invention needs to clarify the buried data corresponding to each link node, and then based on the user behavior type parameters, user step sequence parameters, and page element parameters (page element ID or page element Xpath) of the corresponding buried data, the order of each link node is set based on the user step sequence parameters, that is, the order of each link node reflects the user step sequence parameters of the corresponding buried data.
[0060] Based on the above content, if there are two operation links that meet the following conditions: 1. The number of link nodes is the same; 2. The link nodes of the two operation links are consistent and the order is consistent, then it can be determined that the two operation links are exactly the same, that is, the number of times the operation link appears can be recorded as 2.
[0061] S300: For any operation cycle after the first operation cycle of the user, generate the operation link corresponding to the operation cycle based on each buried data corresponding to the operation cycle and the operation link corresponding to the previous operation cycle, wherein one operation cycle corresponds to one operation link;
[0062] Optionally, take the above-mentioned user's first operation process (corresponding to the first operation cycle) as an example: start the target application to the homepage -> operate to the first-level page -> operate to the second-level page. If the user then triggers the page return operation on the second-level page, then operates to the first-level page, then operates to the second-level page, and then operates to the third-level page. That is, the second operation process performed by the user on the second-level page (corresponding to the second operation cycle) is: return to the first-level page -> operate to the second-level page -> operate to the third-level page. At this time, the link nodes of the operation link generated for the second operation cycle are, in order: the link node for starting the target application to the homepage, the link node for operating to the first-level page, the link node for operating to the second-level page, and the link node for operating to the third-level page.
[0063] Similarly, the operation link corresponding to the third operation cycle also needs to be connected to the link node from the initial launch target application to the homepage, thereby ensuring that each operation link starts from the link node from the launch target application to the homepage.
[0064] That is, in combination with the previous embodiment, in some optional embodiments, the S300 includes: step 2.1 and step 2.2;
[0065] Step 2.1: For any operation cycle after the first operation cycle of the user, generate a second shortest operation link based on parameters in each buried data corresponding to the operation cycle;
[0066] Optionally, the link nodes included in the second shortest operation link mentioned here are established only based on the parameters of the embedded data of the operation cycle (e.g., the second operation cycle). That is, the second shortest operation link does not start from the link node from launching the target application to the homepage. Therefore, subsequent steps need to be performed to complete the operation link.
[0067] Step 2.2: Generate a complete third shortest operation link corresponding to the operation cycle based on the second shortest operation link and the operation link corresponding to the previous operation cycle of the operation cycle.
[0068] In combination with the previous embodiment, in some optional embodiments, the step 2.2 includes: step 3.1 and step 3.2;
[0069] Step 3.1: If the link nodes included in the second shortest operation link are duplicated with the link nodes included in the operation link corresponding to the operation cycle before the operation cycle, the duplicated nodes are deleted from the second shortest operation link;
[0070] Optionally, as mentioned above, different operation cycles are divided based on page return operations, and page return operations generally return to the page that has been operated before. That is, the buried point data involved in the subsequent operation cycle will generally be repeated with the buried point data involved in the previous operation cycle. Therefore, the operation link corresponding to the subsequent operation cycle and the operation link corresponding to the previous operation cycle generally have repeated link nodes. In order to obtain the shortest operation link, the present invention can retain the shortest link of the previous operation cycle and then splice the new link node in the current operation cycle. The present invention does not limit this.
[0071] Step 3.2: Concatenate the second shortest operation link with duplicate nodes deleted and the operation link corresponding to the previous operation cycle of the operation cycle to obtain the third shortest operation link.
[0072] It should be noted that the link node corresponding to the page return operation is not reflected in the shortest operation link of the corresponding life cycle. That is, the shortest operation link corresponding to each new operation cycle inherits the shortest operation link of the previous operation cycle. After deleting the node data corresponding to the page return operation, the shortest operation link of the current operation cycle is generated. For example, when splicing the third shortest operation link, the link node corresponding to the page return operation is deleted, that is, there is no node data corresponding to the page return operation in the third shortest operation link.
[0073] S400: Count the occurrence frequencies of the operation links, and determine the operation links whose occurrence frequencies are higher than a preset frequency threshold or whose occurrence frequencies are ranked in the top N, where N is an integer greater than 1.
[0074] Alternatively, the present invention can count the frequency of occurrence of operation links with the same number of link nodes, completely recurring link nodes, and completely consistent link node order. Of course, the number of occurrences can also be directly counted. The operation links with higher frequency or more occurrences are then selected as the operation links required for subsequent generation of user interface automation use cases.
[0075] The present invention does not impose any specific restrictions on the preset frequency threshold and N, and they can be set according to actual needs.
[0076] S500: Generate a corresponding user interface automation use case based on the determined tracking data corresponding to the operation link.
[0077] Optionally, the present invention can generate corresponding user interface automation use cases based on the embedded data corresponding to each link node of the operation link. That is, in combination with the previous embodiment, in some optional embodiments, the S500 includes: step 4.1;
[0078] Step 4.1: Generate a corresponding user interface automation use case based on the determined embedded point data corresponding to each link node included in the operation link, wherein the data structure of the user interface automation use case is consistent with the data structure of the embedded point data.
[0079] Optionally, as mentioned above, when generating an operation link, it is sometimes necessary to deduplicate the link nodes. The buried data corresponding to each link node of the operation link is also the buried data after deduplication. Therefore, the user step sequence parameters in the buried data corresponding to each link node of the operation link may be discontinuous. Therefore, the present invention directly uses other parameters in the buried data, but in the user interface automation use case, it is necessary to adjust the user step sequence parameters in each buried data to be continuous, and the present invention does not limit this.
[0080] Optional, combined Figure 1 In the embodiment shown, in certain optional embodiments, after S500, the method further includes: step 5.1;
[0081] Step 5.1: Save the user interface automation use case to a use case library.
[0082] Optionally, in combination with the previous embodiment, in some optional embodiments, after step 5.1, the method further includes: step 6.1, step 6.2, step 6.3, step 6.4 and step 6.5;
[0083] Step 6.1, obtaining the user interface automation use case from the use case library;
[0084] Optionally, the present invention may obtain user interface automation use cases from a use case library through an execution engine, and the present invention does not impose any limitation on this.
[0085] Step 6.2: Parse the user interface automation use case to obtain a corresponding executable script or data format;
[0086] Optionally, execution engines in different automation frameworks may have different requirements for running user interface automation use cases. Therefore, the present invention can parse the user interface automation use case based on the execution engine's automation framework to obtain a corresponding execution script or data format. For example, an execution engine integrated with the Appium automation framework can execute a user interface automation use case using predefined code configurations without converting it into an additional executable script. An execution engine integrated with the RobotFramework automation framework must convert the user interface automation use case into a keyword-driven executable script, which is then executed by the framework.
[0087] Step 6.3: Execute the executable script or data format based on the automated testing framework;
[0088] Step 6.4: Obtain the execution result of the automated testing framework feedback;
[0089] Optionally, the present invention can monitor the execution results of the automation framework through a report analyzer. For example, the report analyzer provides a callback interface to the execution engine, and each time the execution engine completes a user interface automation use case, it can synchronize the user interface automation use case and execution results to the report analyzer.
[0090] Step 6.5: Generate a test report corresponding to the user interface automation use case based on the execution result.
[0091] Optionally, the report analyzer can display the data analysis on the test report page through the data transmitted by the execution engine callback interface, and make a more concise and easy-to-understand analysis of the execution failure results and display it on the test report page.
[0092] Optionally, in order to more clearly describe the above solution of the present invention, see Figure 3 The execution process shown is not described in detail in the present invention.
[0093] like Figure 4 As shown, the present invention provides a user interface automation use case generation device, comprising: a buried point data acquisition unit 100, a first link generation unit 200, a second link generation unit 300, a frequency statistics unit 400 and a use case generation unit 500;
[0094] The tracking data acquisition unit 100 is used to obtain tracking data for a target application through a pre-built operation path tracking SDK, wherein the tracking data includes data generated by multiple users performing corresponding user behaviors on the target application in multiple operation cycles, one user corresponds to at least one operation cycle, one operation cycle corresponds to multiple user behaviors, and one user behavior corresponds to one piece of tracking data;
[0095] The first link generating unit 200 is configured to generate, for a first operation cycle of any user, an operation link corresponding to the first operation cycle according to each buried data corresponding to the first operation cycle;
[0096] The second link generating unit 300 is configured to generate, for any operation cycle after the first operation cycle of the user, the operation link corresponding to the operation cycle based on each buried data corresponding to the operation cycle and the operation link corresponding to the previous operation cycle, wherein one operation cycle corresponds to one operation link;
[0097] The frequency counting unit 400 is configured to count the occurrence frequencies of the operation links and determine the operation links whose occurrence frequencies are higher than a preset frequency threshold or whose occurrence frequencies are ranked in the top N, where N is an integer greater than 1;
[0098] The use case generation unit 500 is used to generate a corresponding user interface automation use case based on the determined tracking data corresponding to the operation link.
[0099] Combine Figure 4 In certain optional embodiments of the illustrated embodiment, the apparatus further comprises: a use case storage unit;
[0100] The use case storage unit is used to save the user interface automation use case to the use case library after the root generates the corresponding user interface automation use case based on the various embedded point data corresponding to the determined operation link.
[0101] In combination with the previous embodiment, in some optional embodiments, the apparatus further comprises: a use case obtaining unit, a use case parsing unit, a test execution unit, a result obtaining unit, and a report generating unit;
[0102] The use case obtaining unit is configured to obtain the user interface automation use case from the use case library after the user interface automation use case is saved in the use case library;
[0103] The use case parsing unit is used to parse the user interface automation use case to obtain a corresponding executable script or data format;
[0104] The test execution unit is used to execute the executable script or data format based on the automated testing framework;
[0105] The result obtaining unit is used to obtain the execution result fed back by the automated testing framework;
[0106] The report generating unit is configured to generate a test report corresponding to the user interface automation use case according to the execution result.
[0107] Combine Figure 4 In the illustrated embodiment, in certain optional embodiments, the first link generation unit 200 includes: a first link generation subunit;
[0108] The first link generation sub-unit is used to generate the first shortest operation link corresponding to the first operation cycle of any of the users according to the parameters in each buried point data corresponding to the first operation cycle, wherein the first shortest operation link includes multiple link nodes, one link node corresponds to one buried point data, each link node includes the corresponding user behavior type parameter in the buried point data and the corresponding page element parameter in the buried point data, and the node order of each link node matches the corresponding user step sequence parameter in each buried point data.
[0109] In combination with the previous embodiment, in some optional embodiments, the second link generation unit 300 includes: a second link generation subunit and a third link generation subunit;
[0110] The second link generating subunit is configured to generate a second shortest operation link for any operation cycle after the first operation cycle of the user according to parameters in each buried point data corresponding to the operation cycle;
[0111] The third link generating subunit is configured to generate a complete third shortest operating link corresponding to the operating cycle based on the second shortest operating link and the operating link corresponding to the previous operating cycle of the operating cycle.
[0112] In combination with the previous embodiment, in some optional embodiments, the third link generation subunit includes: a node deletion subunit and a fourth link generation subunit;
[0113] The node deletion subunit is configured to delete the duplicated node from the second shortest operation link if the link nodes included in the second shortest operation link are duplicated with the link nodes included in the operation link corresponding to the operation cycle last before the operation cycle;
[0114] The fourth link generation subunit is configured to concatenate the second shortest operation link with duplicate nodes deleted and the operation link corresponding to the previous operation cycle of the operation cycle to obtain the third shortest operation link.
[0115] In combination with the previous embodiment, in some optional embodiments, the use case generation unit 500 includes: a use case generation subunit;
[0116] The use case generation sub-unit is used to generate a corresponding user interface automation use case based on the embedded point data corresponding to each link node included in the determined operation link, wherein the data structure of the user interface automation use case is consistent with the data structure of the embedded point data.
[0117] The present invention provides a computer-readable storage medium having a program stored thereon, wherein when the program is executed by a processor, the method for automatically generating a user interface use case described in any one of the above is implemented.
[0118] like Figure 5 As shown, the present invention provides an electronic device 70, which includes at least one processor 701, and at least one memory 702 and a bus 703 connected to the processor 701; wherein the processor 701 and the memory 702 communicate with each other through the bus 703; the processor 701 is used to call the program instructions in the memory 702 to execute any of the above-mentioned user interface automation use case generation methods.
[0119] In the present invention, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus comprising the element.
[0120] Each embodiment in this specification is described in a related manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiment is generally similar to the method embodiment, so the description is relatively simple. For related parts, refer to the description of the method embodiment.
[0121] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present invention. 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 the present invention. Therefore, the present invention is not limited to the embodiments shown herein, but is intended to be embodied in the widest possible manner consistent with the principles and novel features disclosed herein.
[0122] The above description is only a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention are included in the scope of protection of the present invention.
Claims
1. A method for automatically generating a user interface use case, characterized in that: include: Obtain tracking data for the target application through a pre-built operation path tracking SDK, where the tracking data includes data generated by multiple users performing corresponding user behaviors on the target application in multiple operation cycles. One user corresponds to at least one operation cycle, one operation cycle corresponds to multiple user behaviors, and one user behavior corresponds to one piece of tracking data. For a first operation cycle of any of the users, generating an operation link corresponding to the first operation cycle according to each buried data corresponding to the first operation cycle; For any operation cycle after the first operation cycle of the user, generating the operation link corresponding to the operation cycle according to each buried data corresponding to the operation cycle and the operation link corresponding to the previous operation cycle, wherein one operation cycle corresponds to one operation link; Counting the occurrence frequencies of the operation links, and determining the operation links whose occurrence frequencies are higher than a preset frequency threshold or whose occurrence frequencies are ranked in the top N, where N is an integer greater than 1; Based on the determined tracking data corresponding to the operation link, a corresponding user interface automation use case is generated.
2. The method according to claim 1, characterized in that After generating corresponding user interface automation use cases based on the determined tracking data corresponding to the operation link, the method further includes: The user interface automation use case is saved in a use case library.
3. The method according to claim 2, characterized in that After saving the user interface automation use case to a use case library, the method further includes: Obtain the user interface automation use case from the use case library; Parsing the user interface automation use case to obtain a corresponding executable script or data format; Executing the executable script or data format based on the automated testing framework; Obtaining the execution result of the automated testing framework feedback; A test report corresponding to the user interface automation use case is generated according to the execution result.
4. The method according to claim 1, wherein For the first operation cycle of any of the users, generating an operation link corresponding to the first operation cycle according to each buried data corresponding to the first operation cycle includes: For the first operation cycle of any of the users, the first shortest operation link corresponding to the first operation cycle is generated based on the parameters in each buried point data corresponding to the first operation cycle, wherein the first shortest operation link includes multiple link nodes, one link node corresponds to one buried point data, each link node includes the corresponding user behavior type parameter in the buried point data and the corresponding page element parameter in the buried point data, and the node order of each link node matches the corresponding user step sequence parameter in each buried point data.
5. The method according to claim 4, characterized in that For any operation cycle after the first operation cycle of the user, generating the operation link corresponding to the operation cycle according to each buried data corresponding to the operation cycle and the operation link corresponding to the previous operation cycle of the operation cycle, including: For any operation cycle after the first operation cycle of the user, generating a second shortest operation link according to parameters in each buried data corresponding to the operation cycle; A complete third shortest operation link corresponding to the operation cycle is generated based on the second shortest operation link and the operation link corresponding to the previous operation cycle of the operation cycle.
6. The method according to claim 5, characterized in that Generating a complete third shortest operation link corresponding to the operation cycle according to the second shortest operation link and the operation link corresponding to the previous operation cycle of the operation cycle includes: If the link nodes included in the second shortest operation link are duplicated with the link nodes included in the operation link corresponding to the operation cycle before the operation cycle, deleting the duplicated nodes from the second shortest operation link; The second shortest operation link with duplicate nodes deleted and the operation link corresponding to the previous operation cycle of the operation cycle are spliced to obtain the third shortest operation link.
7. The method according to claim 6, characterized in that Generating a corresponding user interface automation use case based on each tracking point data corresponding to the determined operation link includes: Based on the determined embedded point data corresponding to each link node included in the operation link, a corresponding user interface automation use case is generated, wherein the data structure of the user interface automation use case is consistent with the data structure of the embedded point data.
8. A user interface automation use case generation device, characterized in that: include: Point data acquisition unit, first link generation unit, second link generation unit, frequency statistics unit and use case generation unit; The tracking data acquisition unit is configured to obtain tracking data for a target application through a pre-built operation path tracking SDK, wherein the tracking data includes data generated by multiple users performing corresponding user behaviors on the target application in multiple operation cycles, wherein one user corresponds to at least one operation cycle, one operation cycle corresponds to multiple user behaviors, and one user behavior corresponds to one piece of tracking data; The first link generating unit is configured to generate, for a first operation cycle of any user, an operation link corresponding to the first operation cycle according to each buried point data corresponding to the first operation cycle; The second link generating unit is configured to generate, for any operation cycle after the first operation cycle of the user, the operation link corresponding to the operation cycle based on each buried data corresponding to the operation cycle and the operation link corresponding to the previous operation cycle, wherein one operation cycle corresponds to one operation link; The frequency counting unit is configured to count the occurrence frequencies of the operation links and determine the operation links whose occurrence frequencies are higher than a preset frequency threshold or whose occurrence frequencies are ranked in the top N, where N is an integer greater than 1; The use case generation unit is used to generate corresponding user interface automation use cases based on the determined tracking data corresponding to the operation link.
9. A computer-readable storage medium having a program stored thereon, characterized in that: When the program is executed by a processor, the method for automatically generating a user interface use case according to any one of claims 1 to 7 is implemented.
10. An electronic device, characterized in that: The electronic device includes at least one processor, and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the user interface automation use case generation method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
User behavior test case generation method, flow playback method and electronic equipment
CN111708712A
Test case generation method, device and system, offline server and storage medium
CN113297061A