Method, device, computer equipment and storage medium for generating UI automation script
By burying point monitoring for designated applications, obtaining user operation information, generating user behavior trajectories, and obtaining business weights through the association model, it solves the problem of obtaining and maintaining existing UI automation test cases, and improves testing efficiency and accuracy.
Patent Information
- Application Number
- CN202110692102.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-22
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2041-06-22
AI Technical Summary
Existing UI automation test cases need to be obtained manually, with high technical thresholds and low testing efficiency, and frequent changes to front-end pages lead to difficulty in maintaining test scripts.
Through the first buried point rule, global monitoring of the designated application is obtained, user operation information and configuration data are obtained, user behavior trajectories are generated, and business weights are obtained through the association model. When the business weight is greater than or equal to the preset threshold, set the test case and execute it in the preset recording environment to obtain the test script.
Improve the accuracy and efficiency of UI automation testing, save the time required for testing, and reduce the cost of test script maintenance.
Smart Images

Figure CN113419950B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of test cases, and in particular to a method, device, computer equipment and storage medium for generating UI automation scripts. Background Art
[0002] With the rapid development of the Internet, the application of UI (short for User Interface) automation architecture is becoming more and more widespread. Most companies develop corresponding UI automation frameworks according to their business needs. The mainstream UI automation frameworks include uiautomator, appium, robotium, Airtest, webdriveragent, selenium, etc. However, due to the complexity of enterprise business links, the dispersion of front-end business personnel, and personnel changes, the use and maintenance of UI automation frameworks have at least the following problems:
[0003] 1. UI automation test cases need to be obtained through manual test cases, rather than based on the conversion of real online user behavior trajectories;
[0004] 2. The technical threshold for UI automated test generation is high. From environment installation to code generation, testers need to spend a lot of time on learning and coding. In addition, the test quality is low and the operation failure rate is high.
[0005] 3. Due to the frequent changes of front-end pages, UI automation test scripts require a lot of manpower and time to maintain. Summary of the invention
[0006] Based on this, it is necessary to provide a method, device, computer equipment and storage medium for generating UI automation scripts to solve the problem of low efficiency of UI automation testing based on the above technical problems.
[0007] A method for generating a UI automation script, comprising:
[0008] Use the first tracking rule to globally monitor user operation events of the specified application to obtain user operation information and configuration data;
[0009] Generate a user behavior track based on the user operation information, save the user operation information and the configuration data in a local cache library, report the user operation information to a data upload platform, and send the configuration data to the configuration platform; the data upload platform stores the business data of the target business;
[0010] Inputting the user behavior trajectory and the business data into a preset association model to obtain a business weight corresponding to the user behavior trajectory output by the association model;
[0011] When the service weight is greater than or equal to a preset threshold, setting a test case according to the user behavior trajectory corresponding to the service weight;
[0012] Execute the test steps involved in the test case in a preset recording environment to obtain a test script for the test case.
[0013] A device for generating a UI automation script, comprising:
[0014] A user data acquisition module is used to globally monitor user operation events of a specified application through a first tracking rule to obtain user operation information and configuration data;
[0015] A user data processing module is used to generate a user behavior track according to the user operation information, save the user operation information and the configuration data in a local cache library, report the user operation information to a data upload platform, and send the configuration data to the configuration platform; the data upload platform stores the business data of the target business;
[0016] An association model module, used to input the user behavior trajectory and the business data into a preset association model to obtain a business weight corresponding to the user behavior trajectory output by the association model;
[0017] A test case module, used for setting a test case according to the user behavior trajectory corresponding to the business weight when the business weight is greater than or equal to a preset threshold;
[0018] The test script module is used to execute the test steps involved in the test case in a preset recording environment to obtain the test script of the test case.
[0019] A computer device includes a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor. When the processor executes the computer-readable instructions, the method for generating a UI automation script is implemented.
[0020] One or more readable storage media storing computer-readable instructions, wherein when the computer-readable instructions are executed by one or more processors, the one or more processors execute the above-mentioned method for generating UI automation scripts.
[0021] The above-mentioned method, device, computer equipment and storage medium for generating UI automation scripts globally monitor the user operation events of the specified application through the first burying point rule to obtain user operation information and configuration data; generate user behavior tracks according to the user operation information, and save the user operation information and the configuration data in the local cache library at the same time, and report the user operation information to the data upload platform, and send the configuration data to the configuration platform; the data upload platform stores the business data of the target business; input the user behavior track and the business data into the preset association model to obtain the business weight corresponding to the user behavior track output by the association model; when the business weight is greater than or equal to the preset threshold, set the test case according to the user behavior track corresponding to the business weight; execute the test steps involved in the test case in the preset recording environment to obtain the test script of the test case. The present invention obtains the real user operation through burying points, generates user behavior tracks, and obtains the user behavior track with a larger business weight through the association model, and then obtains the test script associated with the business. The present invention improves the accuracy and efficiency of UI automation testing and saves the time required for testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0023] Figure 1 It is a schematic diagram of an application environment of a method for generating a UI automation script in one embodiment of the present invention;
[0024] Figure 2 It is a flow chart of a method for generating a UI automation script in one embodiment of the present invention;
[0025] Figure 3 It is a structural schematic diagram of a device for generating a UI automation script in one embodiment of the present invention;
[0026] Figure 4 is a schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0028] The method for generating a UI automation script provided in this embodiment can be applied to Figure 1 In an application environment, a client communicates with a server. The client includes but is not limited to various personal computers, laptops, smart phones, tablet computers, and portable wearable devices. The server can be implemented with an independent server or a server cluster consisting of multiple servers.
[0029] In one embodiment, if Figure 2 As shown, a method for generating a UI automation script is provided, and the method is applied in Figure 1 The server in the example is used as an example to illustrate the following steps:
[0030] S10. Globally monitor user operation events of the specified application through the first tracking rule to obtain user operation information and configuration data.
[0031] It can be understood that the first tracking rule refers to the monitoring rule used when monitoring the elements of the specified application page. The first tracking rule can adopt a full tracking method to track the series of user behaviors on each page of the platform. Global monitoring refers to monitoring the global custom elements of the specified application page in a full tracking method. User operation events refer to operation events such as user clicks or slides within the specified application page. Through global monitoring, user operation events such as user clicks and slides, as well as element information and page information corresponding to user operation events can be recorded. At the same time, the configuration data of the page is recorded. Among them, the configuration data refers to the environmental operation information provided by the configuration platform.
[0032] S20. Generate a user behavior trajectory based on the user operation information, save the user operation information and the configuration data in a local cache library, report the user operation information to a data upload platform, and send the configuration data to the configuration platform; the data upload platform stores the business data of the target business.
[0033] Specifically, all monitored elements of the page are obtained, all monitored elements are traversed, and monitoring events are added. When a certain element is detected to be clicked, the element information, page information and configuration data of the clicked element are obtained and collected, and saved in the local cache library, and a scheduled task is set to report the collected element information, page information and configuration data of the clicked element to the data upload platform. According to the element information and page information of the element clicked by the user, the routing process and operation process of the page are calculated to obtain the user behavior trajectory. Among them, the data upload platform is a storage and management platform for buried point data. The target business refers to the business that is buried according to the demand. By burying the target business, business data can be collected, scheduled tasks can be set, and the business data can be reported to the data upload platform. Business data includes business ID, element information, page information, user operation events and element binding data, and the business data is associated with several business pages. The configuration platform is a platform that provides configuration data.
[0034] S30: Input the user behavior trajectory and the business data into a preset association model to obtain a business weight corresponding to the user behavior trajectory output by the association model.
[0035] It can be understood that the preset association model is a model based on the frequent item set algorithm. The preset association model can be used to find the data sets that frequently appear in the data values. Business data is associated with several business pages. Among them, the frequent item set can be evaluated by support, confidence and lift. In an example, the calculation of the frequent item set is as follows:
[0036] Input: data set D (user behavior trajectory and business data), support threshold α;
[0037] Output: The largest frequent k-item set.
[0038] (1) Scan the entire data set and obtain all the data that have appeared as candidate frequent 1-item sets. k = 1, the frequent 0-item set is an empty set.
[0039] (2) Mining frequent k-item sets:
[0040] Scan the data to calculate the support of candidate frequent k-item sets;
[0041] Remove the data sets with support lower than the threshold in the candidate frequent k-item set to obtain the frequent k-item set. If the obtained frequent k-item set is empty, directly return the set of frequent k-1 item sets as the algorithm result, and the algorithm ends. If the obtained frequent k-item set has only one item, directly return the set of frequent k-item sets as the algorithm result, and the algorithm ends.
[0042] Based on the frequent k-item sets, candidate frequent k+1-item sets are generated through concatenation.
[0043] (3) Let k=k+1 and go to step 2.
[0044] Through the above steps (1)-(3), the frequent item sets (business pages) corresponding to the user behavior trajectory can be obtained, and then the number of times the frequent item sets are accessed by users can be obtained, and the access rate of the frequent item sets (business pages) accessed by users can be calculated, that is, the business weight of the business page.
[0045] S40: When the service weight is greater than or equal to a preset threshold, a test case is set according to the user behavior trajectory corresponding to the service weight.
[0046] It is understandable that the preset threshold can be set according to actual needs. When the business weight is greater than or equal to the preset threshold, the user behavior trajectory corresponding to the business weight is obtained, and the user behavior trajectory is set as a test case. When the business weight is less than the preset threshold, the user behavior trajectory corresponding to the business weight may not be set as a test case.
[0047] S50: Execute the test steps involved in the test case in a preset recording environment to obtain a test script of the test case.
[0048] It can be understood that the preset recording environment is a pre-set tool for recording test cases, which can automatically record the test steps involved in the test case and then generate a test script. The test script contains libraries, modules, and methods that the script method or keyword depends on. Specifically, when recording the test case, the operation information and element information of the test case are standardized to obtain a list output as a json object, extract the events in the list and convert them into method names or keywords required in the test script, extract the parameters in the list as the corresponding parameters of the method name or keyword in the test script, and extract the page information in the list to generate the name of the test script.
[0049] In embodiments S10-S50, the user operation events of the specified application are globally monitored through the first tracking rule to obtain user operation information and configuration data; based on the user operation information, a user behavior trajectory is generated, and the user operation information and the configuration data are saved in the local cache library, and the user operation information is reported to the data upload platform, and the configuration data is sent to the configuration platform; the data upload platform stores the business data of the target business; the user behavior trajectory and the business data are input into the preset association model to obtain the business weight corresponding to the user behavior trajectory output by the association model; when the business weight is greater than or equal to the preset threshold, a test case is set according to the user behavior trajectory corresponding to the business weight; the test steps involved in the test case are executed in the preset recording environment to obtain the test script of the test case. The present invention obtains the real user operation through tracking, generates a user behavior trajectory, and obtains the user behavior trajectory with a larger business weight through the association model, and then obtains the test script associated with the business. The accuracy and efficiency of UI automation testing are improved and the time required for testing is saved.
[0050] Optionally, in step S10, that is, obtaining configuration data, includes:
[0051] S101, when the local interface recording switch of the user terminal is in an on state, obtaining the request content of the user through several designated interfaces; the several designated interfaces are determined according to the interface configuration data after the user terminal obtains the interface configuration data from the configuration platform; the request content is the content fed back by the business system in response to the request information after the user terminal sends the request information to the business system;
[0052] S102: Generate the configuration data according to the request content.
[0053] It is understandable that the local interface recording switch is set at the user end, and only when the local interface recording switch at the user end is turned on, can the user's request content be obtained through several designated interfaces. The configuration platform includes several configuration data and several interface configuration data corresponding to the configuration data.
[0054] In one example, when the local interface recording switch is turned on, the user terminal sends a request message to the business system, and the business system provides feedback on the request message, and obtains the request content based on the feedback content. Specifically, the user terminal obtains the interface configuration data from the configuration platform, and multiple designated interfaces can be determined based on the interface configuration data. The user's request content can be obtained through multiple designated interfaces. Then, the configuration data is generated based on the user's request content.
[0055] Optionally, in step S10, that is, obtaining user operation information, further includes:
[0056] S103: When the user's operation of accessing the designated application is monitored, the user's operation on the designated application is recorded to generate user operation information.
[0057] It is understandable that when the user's access to the specified application is monitored, the user's click and slide operation events performed when accessing the specified application, as well as the element information and page information corresponding to the user operation events are recorded to generate user operation information. For example, when the user's access to the Taobao application is monitored, the user's click operation, slide operation, etc. in the application are recorded, and the element information and page information clicked by the user are recorded. For example, when the user enters Taobao and a link to page A of an activity pops up, the customer clicks the link and enters page A of the activity, and the information of the link and page A is recorded.
[0058] Optionally, in step S20, reporting the user operation information to a data upload platform includes:
[0059] S104: Acquire a first reporting interface of the data upload platform, and report the user operation information to the data upload platform through the first reporting interface.
[0060] It is understandable that when the user's operation of accessing the specified application is monitored, the operation events such as clicks and slides performed by the user when accessing the specified application, as well as the element information and page information corresponding to the user operation events are recorded to generate user operation information. The data upload platform provides multiple reporting interfaces, and different reporting interfaces are used to report different data configurations. When reporting data, obtain the corresponding reporting interface and report the data to the data upload platform. Obtain the first reporting interface from the data upload platform and report the user operation information to the data upload platform.
[0061] Optionally, before step S10, that is, before globally monitoring the user operation events of the specified application through the first tracking rule and obtaining the user operation information and configuration data, the method further includes:
[0062] S105, tracking the target business through the second tracking rule, and collecting the business data through the tracking;
[0063] S106: Obtain a second reporting interface of the data upload platform, and report the business data to the data upload platform through the second reporting interface.
[0064] It is understandable that the second tracking rule refers to the monitoring rule used when monitoring the elements of the business page. The second tracking rule can be used in the form of back-end tracking to collect business data such as the business ID, element information, page information, user operation events, and element-bound data of the specified business. When reporting data, obtain the corresponding reporting interface, and report the data to the data upload platform through the reporting interface. In one example, the second reporting interface is obtained from the data upload platform, and the obtained business data is reported to the data upload platform on a regular basis.
[0065] Optionally, in step S50, that is, executing the test steps involved in the test case in the preset recording environment to obtain the test script of the test case includes:
[0066] S501, determining whether the local cache library contains configuration data corresponding to the test case;
[0067] S502: When the local cache library contains configuration data corresponding to the test case, a first recording operation of the test case is performed according to the configuration data corresponding to the test case in the local cache library;
[0068] S503: Generate a first test script according to the first recording operation.
[0069] It is understandable that the preset recording environment can automatically record the test steps involved in the test case and generate a test script. When recording the test case through the preset recording environment, it is necessary to obtain the configuration data corresponding to the test case to complete the recording of the test case. Since the configuration platform contains a number of configuration data, and the configuration data of the configuration platform is randomly configured to the client, different configuration data will display different content on the client page. As a result, the page displayed by the user each time the mobile application is opened may be different.
[0070] Specifically, the acquired test case is input into the automated generation system. When the test case is recorded by the automated generation system, the test case data can be used to query whether there is corresponding configuration data in the local cache library. If the local cache library is found to have corresponding configuration data, the configuration data is obtained to perform the operation in the test case, and the operation is determined as the first recording operation. The automated generation system generates a test script corresponding to the first recording operation based on the first recording operation, and determines the test script as the first test script.
[0071] Optionally, after step S501, that is, after determining whether the local cache library contains configuration data corresponding to the test case, the process further includes:
[0072] S504: When the local cache library does not contain configuration data corresponding to the test case, perform a second recording operation of the test case according to the server configuration data;
[0073] S505. Generate a second test script according to the second recording operation.
[0074] It is understandable that if the configuration data corresponding to the test case is not found in the local cache library, the configuration data corresponding to the test case cannot be obtained from the local cache library to perform the recording operation.
[0075] Specifically, when the local cache library does not contain configuration data corresponding to the test case, the real configuration data is obtained from the mobile application server to perform the recording operation of the test case, and the operation is determined as the second recording operation. The automatic generation system generates a test script corresponding to the second recording operation according to the second recording operation, and determines the test script as the second test script.
[0076] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0077] In one embodiment, a device for generating a UI automation script is provided, and the device for generating a UI automation script corresponds one-to-one to the method for generating a UI automation script in the above embodiment. Figure 3 As shown, the UI automation script generation device includes a user data acquisition module 10, a user data processing module 20, a correlation model module 30, a test case module 40 and a test script module 50. The functional modules are described in detail as follows:
[0078] The user data acquisition module 10 is used to globally monitor the user operation events of the specified application through the first tracking rule to obtain user operation information and configuration data;
[0079] The user data processing module 20 is used to generate a user behavior track according to the user operation information, save the user operation information and the configuration data in a local cache library, report the user operation information to a data upload platform, and send the configuration data to the configuration platform; the data upload platform stores the business data of the target business;
[0080] The association model module 30 is used to input the user behavior trajectory and the business data into a preset association model to obtain the business weight corresponding to the user behavior trajectory output by the association model;
[0081] A test case module 40, configured to set a test case according to the user behavior trajectory corresponding to the business weight when the business weight is greater than or equal to a preset threshold;
[0082] The test script module 50 is used to execute the test steps involved in the test case in a preset recording environment to obtain the test script of the test case.
[0083] Optionally, the user data acquisition module 10 includes:
[0084] A request content acquisition unit, used for acquiring the request content of the user through a number of designated interfaces when the local interface recording switch of the user terminal is in an on state; the number of designated interfaces are determined according to the interface configuration data after the user terminal acquires the interface configuration data from the configuration platform; the request content is the content fed back by the business system in response to the request information after the user terminal sends the request information to the business system;
[0085] A configuration data generating unit is used to generate the configuration data according to the request content.
[0086] Optionally, the user data acquisition module 10 further includes:
[0087] The user operation information unit is used to record the user's operation on the specified application and generate user operation information when monitoring the user's operation of accessing the specified application.
[0088] Optionally, the user data processing module 20 includes:
[0089] The user operation information processing unit is used to obtain a first reporting interface of the data upload platform, and report the user operation information to the data upload platform through the first reporting interface.
[0090] Optionally, before the user data acquisition module 10, it includes:
[0091] A business data unit, used to perform tracking on the target business according to the second tracking rule, and collect the business data through the tracking;
[0092] The business data processing unit is used to obtain the second reporting interface of the data upload platform, and report the business data to the data upload platform through the second reporting interface.
[0093] Optionally, the test script module 50 further includes:
[0094] A judging unit, used to judge whether the local cache library contains configuration data corresponding to the test case;
[0095] A first recording operation unit, configured to, when the local cache library contains configuration data corresponding to the test case, perform a first recording operation of the test case according to the configuration data corresponding to the test case in the local cache library;
[0096] The first test script unit is used to generate a first test script according to the first recording operation.
[0097] Optionally, after the judgment unit, it also includes:
[0098] A second recording operation unit, configured to perform a second recording operation of the test case according to the server configuration data when the local cache library does not contain the configuration data corresponding to the test case;
[0099] The second test script unit is used to generate a second test script according to the second recording operation.
[0100] For the specific definition of the UI automation script generation device, please refer to the definition of the UI automation script generation method above, which will not be repeated here. Each module in the above-mentioned UI automation script generation device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0101] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a readable storage medium and an internal memory. The readable storage medium stores an operating system, computer-readable instructions and a database. The internal memory provides an environment for the operation of the operating system and computer-readable instructions in the readable storage medium. The database of the computer device is used to store data involved in the method for generating UI automation scripts. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer-readable instructions are executed by the processor, a method for generating UI automation scripts is implemented. The readable storage medium provided in this embodiment includes a non-volatile readable storage medium and a volatile readable storage medium.
[0102] In one embodiment, a computer device is provided, including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, wherein the processor executes the computer-readable instructions to implement the following steps:
[0103] Use the first tracking rule to globally monitor user operation events of the specified application to obtain user operation information and configuration data;
[0104] Generate a user behavior track based on the user operation information, save the user operation information and the configuration data in a local cache library, report the user operation information to a data upload platform, and send the configuration data to the configuration platform; the data upload platform stores the business data of the target business;
[0105] Inputting the user behavior trajectory and the business data into a preset association model to obtain a business weight corresponding to the user behavior trajectory output by the association model;
[0106] When the service weight is greater than or equal to a preset threshold, setting a test case according to the user behavior trajectory corresponding to the service weight;
[0107] Execute the test steps involved in the test case in a preset recording environment to obtain a test script for the test case.
[0108] In one embodiment, one or more computer-readable storage media storing computer-readable instructions are provided. The readable storage media provided in this embodiment include non-volatile readable storage media and volatile readable storage media. The readable storage media store computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the following steps are implemented:
[0109] Use the first tracking rule to globally monitor user operation events of the specified application to obtain user operation information and configuration data;
[0110] Generate a user behavior track based on the user operation information, save the user operation information and the configuration data in a local cache library, report the user operation information to a data upload platform, and send the configuration data to the configuration platform; the data upload platform stores the business data of the target business;
[0111] Inputting the user behavior trajectory and the business data into a preset association model to obtain a business weight corresponding to the user behavior trajectory output by the association model;
[0112] When the service weight is greater than or equal to a preset threshold, setting a test case according to the user behavior trajectory corresponding to the service weight;
[0113] Execute the test steps involved in the test case in a preset recording environment to obtain a test script for the test case.
[0114] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing related hardware through computer-readable instructions, and the computer-readable instructions can be stored in a non-volatile readable storage medium or a volatile readable storage medium. When the computer-readable instructions are executed, they may include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0115] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0116] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A method for generating a UI automation script, characterized in that: include: The user operation events of the specified application are globally monitored through the first tracking rule to obtain user operation information and configuration data; the first tracking rule is a full tracking method; the configuration data refers to the environment operation information provided by the configuration platform; Generate a user behavior track based on the user operation information, save the user operation information and the configuration data in a local cache library, report the user operation information to a data upload platform, and send the configuration data to the configuration platform; the data upload platform stores the business data of the target business; Inputting the user behavior trajectory and the business data into a preset association model to obtain a business weight corresponding to the user behavior trajectory output by the association model; When the service weight is greater than or equal to a preset threshold, setting a test case according to the user behavior trajectory corresponding to the service weight; Execute the test steps involved in the test case in a preset recording environment to obtain a test script for the test case; The step of executing the test steps involved in the test case in the preset recording environment to obtain the test script of the test case includes: Determine whether the local cache library contains configuration data corresponding to the test case; When the local cache library contains configuration data corresponding to the test case, performing a first recording operation of the test case according to the configuration data corresponding to the test case in the local cache library; Generate a first test script according to the first recording operation; When the local cache library does not contain the configuration data corresponding to the test case, performing a second recording operation of the test case according to the server configuration data; A second test script is generated according to the second recording operation.
2. The method for generating a UI automation script according to claim 1, wherein: The obtaining of configuration data includes: When the local interface recording switch of the user terminal is in the on state, the request content of the user is obtained through several designated interfaces; the several designated interfaces are determined according to the interface configuration data after the user terminal obtains the interface configuration data from the configuration platform; the request content is the content fed back by the business system in response to the request information after the user terminal sends the request information to the business system; The configuration data is generated according to the request content.
3. The method for generating a UI automation script according to claim 1, wherein: The obtaining of user operation information includes: When the operation of the user accessing the designated application is monitored, the operation of the user on the designated application is recorded to generate the user operation information.
4. The method for generating a UI automation script according to claim 3, wherein: Reporting the user operation information to the data upload platform includes: Obtain a first reporting interface of the data upload platform, and report the user operation information to the data upload platform through the first reporting interface.
5. The method for generating a UI automation script according to claim 1, wherein: Before globally monitoring the user operation events of the specified application through the first tracking rule and obtaining the user operation information and configuration data, the method includes: Tracking the target business through the second tracking rule, and collecting the business data through the tracking; Obtain a second reporting interface of the data upload platform, and report the business data to the data upload platform through the second reporting interface.
6. A device for generating a UI automation script, characterized in that: include: A user data acquisition module is used to globally monitor user operation events of a specified application through a first tracking rule to obtain user operation information and configuration data; the first tracking rule is a full tracking method; the configuration data refers to the environment operation information provided by the configuration platform; A user data processing module is used to generate a user behavior track according to the user operation information, save the user operation information and the configuration data in a local cache library, report the user operation information to a data upload platform, and send the configuration data to the configuration platform; the data upload platform stores the business data of the target business; An association model module, used to input the user behavior trajectory and the business data into a preset association model to obtain a business weight corresponding to the user behavior trajectory output by the association model; A test case module, used for setting a test case according to the user behavior trajectory corresponding to the business weight when the business weight is greater than or equal to a preset threshold; A test script module, used to execute the test steps involved in the test case in a preset recording environment to obtain a test script for the test case; The test script module includes: Determine whether the local cache library contains configuration data corresponding to the test case; When the local cache library contains configuration data corresponding to the test case, performing a first recording operation of the test case according to the configuration data corresponding to the test case in the local cache library; Generate a first test script according to the first recording operation; When the local cache library does not contain the configuration data corresponding to the test case, performing a second recording operation of the test case according to the server configuration data; A second test script is generated according to the second recording operation.
7. A computer device comprising a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, characterized in that: When the processor executes the computer-readable instructions, the method for generating a UI automation script according to any one of claims 1 to 5 is implemented.
8. One or more readable storage media storing computer-readable instructions, wherein when the computer-readable instructions are executed by one or more processors, the one or more processors execute the method for generating a UI automation script as claimed in any one of claims 1 to 5.
Citation Information
Patent Citations
User interface automatic testing method and device and computer readable storage medium
CN110297758A
Test case generation method and device and computer readable storage medium
CN111104324A
Test case generation method, device and equipment
CN112115039A