Recording script generation method, device, computer equipment and storage medium
By parsing and editing the initial recording script, a target recording script for unified playback on different operating systems is generated, which solves the problem of inconsistent playback effects of test scripts on terminals with different operating systems, improves the utilization of recording scripts, and achieves Automated testing of end equipment.
Patent Information
- Application Number
- CN202311632646.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-01
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2043-12-01
AI Technical Summary
Existing test scripts have inconsistent playback effects on terminals with different operating systems, resulting in low utilization of recording scripts and making it difficult to implement automated testing of terminal equipment.
Perform user interface testing by recording the application running on the second device, obtain the initial recording script, parse, process and edit it, and generate the target recording script so that it can be played back uniformly on terminals with different operating systems.
It improves the utilization rate of recording scripts, avoids the problem of inconsistent playback on terminals with different operating systems, realizes automated testing of terminal equipment, and saves computer resources.
Smart Images

Figure CN117609060B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a recording script generation method, device, computer equipment and storage medium. Background Art
[0002] With the development of computer technology, UI (User Interface, referred to as UI) automated testing technology has emerged. In UI automated testing, the traditional script generation method is manual writing. The premise of writing is that all elements of the page can be uniquely identified, and the terminal devices rely on the underlying implementation technology, which requires manual writing. The other is to use recording tools to generate test scripts. The recording scripts of terminal devices with different operating systems need to be written and maintained separately, and the generated test scripts are played back on terminal devices with different operating systems to complete UI automated testing.
[0003] However, the current test script generation method has the problem that the test script playback effect on terminals with different operating systems is inconsistent. Summary of the invention
[0004] Based on this, it is necessary to provide a recording script generation method, device, computer equipment and computer-readable storage medium that can improve the utilization rate of recording scripts in response to the above technical problems.
[0005] In a first aspect, the present application provides a recording script generation method, which is applied to a first device, and the method includes:
[0006] Recording a test process of executing a user interface test of an application running on the second device to obtain an initial recording script;
[0007] Parsing the initial recording script to obtain a processed initial recording script;
[0008] The processed initial recording script is edited to obtain a target recording script.
[0009] In one embodiment, the recording of the test process of the application running on the second device performing the user interface test, before obtaining the initial recording script, includes:
[0010] Obtaining a uniform resource locator for the user interface test;
[0011] Generate QR code information according to the uniform resource locator;
[0012] The two-dimensional code information is displayed for scanning by the second device to establish a communication connection between the first device and the second device.
[0013] In one embodiment, recording the test process of the application running on the second device performing the user interface test to obtain the initial recording script includes:
[0014] Intercepting a current interface operation of the application running on the second device to perform a user interface test;
[0015] Identify the target control corresponding to the current interface operation and obtain target control information;
[0016] Determine the operation type of the current interface operation according to the current interface operation;
[0017] Based on the target control information and the operation type, obtaining an operation record;
[0018] The initial recording script is determined based on the operation record.
[0019] In one embodiment, the identifying a target control corresponding to the current interface operation and obtaining target control information includes:
[0020] Obtaining characteristic parameters corresponding to the current interface operation;
[0021] Performing a control query according to a preset mapping relationship and the characteristic parameters to obtain a target control; the preset mapping relationship includes characteristic parameters and controls corresponding to the interface operation;
[0022] Target control information is determined according to the target control.
[0023] In one embodiment, the initial recording script includes a script file in a target storage format; the parsing of the initial recording script to obtain a processed initial recording script includes:
[0024] Parsing the script file in the target storage format to obtain a parsed script file;
[0025] Filter the parsed script file to obtain the operation type of the interface operation and the target control information corresponding to the interface operation;
[0026] The operation type of the interface operation and the target control information corresponding to the interface operation are combined to obtain a processed initial recording script.
[0027] In one of the embodiments, the target control information includes at least one of text, relative layout, and screenshot information.
[0028] In one embodiment, the editing of the processed initial recording script to obtain a target recording script includes:
[0029] In response to a user editing instruction, the processed initial recording script is adjusted to obtain a target recording script.
[0030] In a second aspect, the present application further provides a recording script generating device, the device comprising:
[0031] A recording module, used to record a test process of executing a user interface test of an application running on a second device to obtain an initial recording script;
[0032] A processing module, used for parsing the initial recording script to obtain a processed initial recording script;
[0033] The editing module is used to edit the processed initial recording script to obtain a target recording script.
[0034] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0035] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0036] The above-mentioned recording script generation method, device, computer equipment and storage medium first record the test process of the application running on the second device to perform the user interface test, and obtain the initial recording script; secondly, parse the initial recording script to obtain the processed initial recording script; finally, edit the processed initial recording script to obtain the target recording script. By parsing the initial recording script and then editing the parsed script, a target recording script that can be uniformly played back on terminals with different operating systems is obtained, and the target recording script is played back on terminals with different operating systems, which improves the utilization rate of the recording script and avoids the playback inconsistency of terminals with different operating systems, thereby realizing the automated testing of terminal devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 An application environment diagram of a recording script generation method in one embodiment;
[0039] Figure 2 A schematic diagram of a flow chart of a recording script generation method in one embodiment;
[0040] Figure 3 A schematic diagram of a process for generating a UI script automated test script in another embodiment;
[0041] Figure 4 A flowchart of recording a test process of performing a user interface test of an application running on a second device in an embodiment to obtain an initial recording script;
[0042] Figure 5 A flowchart of recording a test process of performing a user interface test on an application running on a second device to obtain an initial recording script in one embodiment;
[0043] Figure 6 A schematic diagram of a process flow for generating an operation record in one embodiment;
[0044] Figure 7 A schematic diagram of a process for identifying a target control corresponding to a current interface operation and obtaining target control information in an embodiment;
[0045] Figure 8 A schematic diagram of a process flow for generating an initial recorded script after processing in one embodiment;
[0046] Fig. 9 A schematic diagram of filtering a script file after parsing in one embodiment to obtain an operation type of an interface operation and target control information corresponding to the interface operation;
[0047] Fig.10 It is a structural block diagram of a recording script generating device in one embodiment;
[0048] Fig.11 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0050] The recording script generation method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the second device can be a terminal, and the first device can be a server. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The server 104 records the test process of the application running on the terminal 102 to perform the user interface test, and obtains the initial recording script; the initial recording script is parsed and processed to obtain the processed initial recording script; the processed initial recording script is edited to obtain the target recording script. Among them, the terminal 102 can be but is not limited to various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.
[0051] In an exemplary embodiment, Figure 2 As shown, a recording script generation method is provided, which is applied to Figure 1 The server in the example is used to illustrate, including the following steps S202 to S206. Among them:
[0052] Step S202: Record the test process of the application running on the second device executing the user interface test to obtain an initial recording script.
[0053] Among them, the second device can be a terminal device. An application (Application, APP) refers to a computer program for completing one or more specific tasks. It runs in user mode, can interact with users, and has a visual user interface (User Interface, UI). The user interface (User Interface, UI) is a medium for interaction and information exchange between the system and the user. It realizes the conversion between the internal form of information and the form acceptable to humans. The user interface is a related software designed for interaction and communication between users and hardware. The purpose is to enable users to operate hardware conveniently and efficiently to achieve two-way interaction. Automated testing is to use software to implement the test process through manual operation, and to control the test execution process through software. A script is a programming language used to control an application; a recording script refers to a recording script generated by a test case of the application to be tested.
[0054] Optionally, the server records the test process of the application running on the terminal executing the user interface test to obtain an initial recording script, which includes the steps for executing the user interface test, the operations for executing the user interface test, and interface layout data.
[0055] Alternatively, if Figure 3 As shown, terminal device A is connected to the server via a network. The server obtains the terminal device A to be tested and determines whether the terminal device A is idle. When the terminal device A is idle, the user interface test is performed. When the terminal device A is not idle, it waits for idleness and re-executes the step of determining whether the terminal device A is idle.
[0056] Furthermore, when the terminal device A is idle and performs the user interface test, the recording service of the server will record the process of the application running on the terminal device A performing the user interface test, obtain the initial recording script, and automatically upload it to the analysis and conversion service of the server.
[0057] Step S204, parsing the initial recording script to obtain a processed initial recording script.
[0058] Optionally, the server parses the initial recording script, obtains the language recognized by the server, and then converts the parsed initial recording script to obtain a processed initial recording script. Figure 3 As shown, the initial recording script is stored in the target form, and the analysis and conversion service of the server obtains the initial recording script stored in the target form, parses and converts the initial recording script stored in the target form, and synchronously uploads it to the platform backend service of the server.
[0059] Step S206, editing the processed initial recording script to obtain a target recording script.
[0060] Optionally, the server edits the processed initial recording script to obtain a target recording script.
[0061] Furthermore, if Figure 3 As shown, the platform backend service of the server stores the synchronized processed initial recording script as a test case, and edits the test case according to the usage requirements of the test case, and obtains the target recording script that can be run on different devices after editing. For example, the target recording script is sent to terminal device B, and terminal device B plays back the target recording script sent by the platform backend service of the server, so that terminal device B completes the user interface automation test.
[0062] In the above recording script generation method, first, the first device records the test process of the user interface test performed by the application running on the second device to obtain an initial recording script; secondly, the initial recording script is parsed to obtain a processed initial recording script; finally, the processed initial recording script is edited to obtain a target recording script. By parsing the initial recording script and then editing the parsed script, a target recording script is obtained for unified playback on terminals with different operating systems. The target recording script is played back on terminals with different operating systems, which improves the utilization rate of the recording script and avoids inconsistent playback on terminals with different operating systems, thereby realizing automated testing of terminal devices. And through non-invasive recording, there is no need to connect to the tracking point platform, which saves computer resources.
[0063] In an exemplary embodiment, Figure 4 As shown, the test process of recording the user interface test of the application running on the second device, before obtaining the initial recording script, includes steps S402 to S406. Among them:
[0064] Step S402: Obtain the uniform resource locator of the user interface test.
[0065] Among them, Uniform Resource Locator (URL) is a string used to identify the name of an Internet resource. This identifier allows users to interact with resources on the network through specific protocols. Resources can include hypertext markup language documents, images, audio, video clips, programs, etc.
[0066] Optionally, when recording the test process of the user interface test executed by the application running on the second device, before obtaining the initial recording script, the server, that is, the first device, needs to establish a communication connection with the terminal, that is, the second device, so that the server can obtain the test process of the user interface test of the terminal. Therefore, the server obtains the URL of the user interface test related resources.
[0067] Step S404, generating QR code information according to the uniform resource locator.
[0068] Optionally, the server obtains a uniform resource locator URL according to user interface test related resources and performs splicing to generate two-dimensional code information, and the two-dimensional code information can be an entry for the second device to access a web page or program for the user interface test.
[0069] Step S406, displaying the QR code information for scanning by the second device to establish a communication connection between the first device and the second device.
[0070] Optionally, the server, that is, the first device, displays a QR code for scanning and reading by a second device that needs to perform a user interface test. The second device reads the information by scanning the QR code, and parses the information to obtain the URL of resources related to the user interface test, searches for the user interface test resources according to the URL, and implements a communication connection for the user interface test between the first device and the second device.
[0071] In this embodiment, by having the second device scan the QR code generated by the first device according to the URL of the user interface test related resources, a communication connection between the first device and the second device can be established in an easy-to-operate manner, so that the first device can record the test process of the user interface test performed by the second device, thereby improving the efficiency of the connection between the first device and the second device.
[0072] In an exemplary embodiment, Figure 5 As shown, the test process of the application running on the second device performing the user interface test is recorded to obtain an initial recording script, including steps S502 to S510. Among them:
[0073] Step S502: intercepting the current interface operation of executing the user interface test on the second device.
[0074] Optionally, the server intercepts the current interface operation of the user interface test performed by the application running on the second device and records the time of the current interface operation. The server may also determine the type of the current interface operation. The current interface operation may be a click operation on the current interface, a sliding operation on the current interface, or an input operation.
[0075] It should be noted that the current interface operation in this application includes but is not limited to click operation, sliding operation, input operation, etc., and the current interface operation is not specifically limited in this application.
[0076] Alternatively, if Figure 6 As shown, the server intercepts the current interface operation of executing the user interface test on the second device, for example, it may be a click operation.
[0077] Step S504, identifying the target control corresponding to the current interface operation, and obtaining target control information.
[0078] Among them, controls refer to the encapsulation of data and methods. Controls can have their own properties and methods. Among them, properties are simple access to control data, and methods are some simple and visible functions of controls. The control creation process includes design (Design), development (Develop), debugging (Debug), and then the use of controls. Among them, controls include user interface controls. User interface controls are used to develop controls for building user interfaces, helping to complete the development of interface elements such as windows, text boxes, buttons, and drop-down menus in software development.
[0079] Optionally, where the interface is composed of different types of controls, when the server intercepts the current interface operation of the user interface test on the second device, the server records the operation time, operation position, operation object, i.e., control, and other information of the current interface operation on the interface, and identifies the target control corresponding to the current interface operation, and each current interface operation will trigger one or more target controls accordingly. The types of controls include but are not limited to text recognition services, target tracking services, target detection services, and auxiliary function services.
[0080] Optionally, the server obtains target control information according to the identified target control, and the target control information includes but is not limited to text information, screenshot information, relative layout information, etc.
[0081] Furthermore, if Figure 6 The server intercepts the current interface operation and identifies the target control corresponding to the current interface operation. For example, the target control corresponding to the current interface operation is a text recognition service control, which contains text information and interface relative layout information.
[0082] Step S506: Determine the operation type of the current interface operation according to the current interface operation.
[0083] Optionally, the server determines the operation type of the current interface operation based on the current interface operation. For example, the operation type can be click, slide, input, etc. Click can also be single-click, double-click, etc.; sliding can be from top to bottom or from bottom to top, and the sliding direction is not limited.
[0084] Step S508: obtaining an operation record based on the target control information and the operation type.
[0085] Optionally, the server obtains an operation record based on the target control information and operation type corresponding to the current interface operation. For example, if the current interface operation is click, the operation record contains the control information corresponding to the click operation.
[0086] Step S510, determining an initial recording script based on the operation record.
[0087] Optionally, the server generates multiple operation records based on the current interface operation at different times, and determines the initial recording script based on the multiple operation records. For example, if the current interface operation is click, the first operation record contains the control information corresponding to the click operation; if the current interface operation is slide, the second operation record contains the control information corresponding to the slide operation; the first operation record and the second operation record are spliced to determine the initial recording script.
[0088] Optionally, the initial recording script includes not only the operation type and control information in the operation record, but also other current interface operation data.
[0089] It should be noted that the number of operation records is determined according to the actual needs of the initial recording script and is not limited in this application.
[0090] In this embodiment, by identifying the control corresponding to the current interface operation to obtain control information and the type of the current interface operation, the initial recording script is determined, which can simplify the redundant code of the initial recording script and improve the generation efficiency of the initial recording script.
[0091] In an exemplary embodiment, Figure 7 As shown, identifying the target control corresponding to the current interface operation and obtaining the target control information includes steps S702 to S706. Among them:
[0092] Step S702, obtaining characteristic parameters corresponding to the current interface operation.
[0093] Among them, the characteristic parameter is the identifier of the control's response to the interface operation. Each control has a characteristic parameter to record the interface operation of the current control. After the interface operation is set for a control in the business logic, the control that needs to respond to the interface operation can be queried based on the characteristic parameter and the interface operation, and the characteristic can be used as the characteristic parameter.
[0094] Optionally, the server obtains characteristic parameters of the control corresponding to the current interface operation.
[0095] Step S704, performing a control query according to a preset mapping relationship and characteristic parameters to obtain a target control; the preset mapping relationship includes characteristic parameters and controls corresponding to the interface operation;
[0096] Among them, the preset mapping relationship includes characteristic parameters and controls corresponding to the interface operations.
[0097] Optionally, the server performs a control query according to a preset mapping relationship and characteristic parameters, and the server traverses the mapping relationship according to the characteristic parameters to obtain a target control.
[0098] Step S706: determine target control information according to the target control.
[0099] Optionally, the server determines target control information according to the target control, where the target control information includes but is not limited to text information, screenshot information, relative layout information, and the like.
[0100] In this embodiment, the target control is obtained by forming a mapping relationship between the feature parameters and the controls corresponding to the feature parameters and the interface operation, and the target control information is obtained based on the target control. The information of the target control that responds to the interface operation can be obtained, and an operation record can be generated based on the target control information.
[0101] In an exemplary embodiment, Figure 8 As shown, the initial recording script includes a script file in a target storage format; the initial recording script is parsed to obtain a processed initial recording script, including steps S802 to S806. Among them:
[0102] Step S802, parsing the script file in the target storage format to obtain a parsed script file.
[0103] The target storage format may be stored in json format.
[0104] Optionally, the server stores the initial recording script in JSON format, and the initial recording script can be directly played back locally. The server parses and converts the script file stored in JSON format, converts the initial recording script into a script that can be recognized by the automated testing framework, and can be played back on other terminal devices to avoid inconsistent playback.
[0105] Optionally, the server performs JSON parsing on the initial recording script to obtain a parsed initial recording script.
[0106] Step S804, filtering the parsed script file to obtain the operation type of the interface operation and the target control information corresponding to the interface operation.
[0107] Optionally, the server filters the parsed script file to filter out the operation type of the interface operation and the target control information corresponding to the interface operation. Fig. 9 As shown, the operation type of the interface operation is a click operation "click", the target control information corresponding to the interface operation is text information, and the content of the text information is "mine".
[0108] Step S806: Combine the operation type of the interface operation and the target control information corresponding to the interface operation to obtain a processed initial recording script.
[0109] Optionally, the server combines the operation type of the interface operation and the target control information corresponding to the interface operation to obtain a processed initial recording script. For example, the click operation "click" in the above embodiment is combined with the target control information being text information and the content of the text information being "my" to obtain a processed initial recording script.
[0110] In this embodiment, the initial recorded script is processed by analyzing, combining and transforming, and there is no need to manually write the script throughout the process, which can improve the efficiency of the initial script processing.
[0111] In an exemplary embodiment, the target control information includes at least one of text, relative layout, and screenshot information.
[0112] Optionally, the target control information includes at least one of text, relative layout, and screenshot information.
[0113] In this embodiment, the type and content of specific information of the interface operation can be responded to through text, relative layout, and screenshot information.
[0114] In an exemplary embodiment, the processed initial recording script is edited to obtain a target recording script, including: responding to a user editing instruction, adjusting the processed initial recording script to obtain a target recording script.
[0115] Optionally, the user sends an editing instruction to the server according to the needs of using the recorded script, and the service bureau receives the editing instruction and responds to the user's editing instruction to adjust the initial recorded script to obtain the target recorded script. The editing instruction can be an instruction to insert, delete, or modify a step, or an instruction for process control capabilities such as loops and conditions.
[0116] In this embodiment, by editing the processed initial recording script to obtain the target recording script, the maintenance cost of the target recording script can be reduced, and a tool script that requires repeated operations or a stability test script that requires brute force playback can be implemented.
[0117] In an exemplary embodiment,
[0118] The first device obtains a uniform resource locator of a user interface test; generates two-dimensional code information according to the uniform resource locator; and displays the two-dimensional code information for scanning by a second device to establish a communication connection between the first device and the second device.
[0119] The first device intercepts the current interface operation of the application running on the second device to perform the user interface test; obtains the characteristic parameters corresponding to the current interface operation; performs a control query according to the preset mapping relationship and the characteristic parameters to obtain the target control; the preset mapping relationship includes the characteristic parameters and controls corresponding to the interface operation; determines the target control information according to the target control, wherein the target control information includes at least one of text, relative layout, and screenshot information. According to the current interface operation, determine the operation type of the current interface operation; obtain the operation record based on the target control information and the operation type; determine the initial recording script based on the operation record. The initial recording script includes a script file in a target storage format, and the script file in the target storage format is parsed to obtain a parsed script file; the parsed script file is filtered to obtain the operation type of the interface operation and the target control information corresponding to the interface operation; the operation type of the interface operation and the target control information corresponding to the interface operation are combined to obtain the processed initial recording script. In response to the user editing instruction, the processed initial recording script is adjusted to obtain the target recording script.
[0120] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0121] Based on the same inventive concept, the embodiment of the present application also provides a recording script generation device for implementing the recording script generation method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more recording script generation device embodiments provided below can refer to the limitations on the recording script generation method above, and will not be repeated here.
[0122] In an exemplary embodiment, Fig.10 As shown, a recording script generation device is provided, including: a recording module 1001, a processing module 1002 and an editing module 1003, wherein:
[0123] The recording module 1001 is used to record the test process of the application running on the second device executing the user interface test to obtain an initial recording script.
[0124] The processing module 1002 is used to parse the initial recording script to obtain a processed initial recording script.
[0125] The editing module 1003 is used to edit the processed initial recording script to obtain a target recording script.
[0126] In an exemplary embodiment, a recording script generating device further includes:
[0127] The acquisition module is used to obtain the uniform resource locator of the user interface automation test.
[0128] The QR code generation module is used to generate QR code information according to the uniform resource locator.
[0129] The display module is used to display the QR code information for scanning by the second device to establish a communication connection between the first device and the second device.
[0130] In an exemplary embodiment, the recording module 1001 includes:
[0131] The interception unit is used to intercept the current interface operation of the user interface automation test performed on the second device.
[0132] The target control identification unit is used to identify the target control corresponding to the current interface operation and obtain the target control information.
[0133] The operation type determination unit is used to determine the operation type of the current interface operation according to the current interface operation.
[0134] The operation record generating unit is used to obtain the operation record based on the target control information and the operation type.
[0135] The initial recording script determining unit is used to determine the initial recording script based on the operation record.
[0136] In an exemplary embodiment, the target control identification unit includes:
[0137] The acquisition subunit is used to obtain the characteristic parameters corresponding to the current interface operation.
[0138] The target control determination subunit is used to perform control query according to a preset mapping relationship and characteristic parameters to obtain a target control; the preset mapping relationship includes characteristic parameters and controls corresponding to the interface operation.
[0139] The target control information determination subunit is used to determine the target control information according to the target control.
[0140] In an exemplary embodiment, the processing module 1002 includes:
[0141] The parsing unit is used to parse the script file in the target storage format to obtain the parsed script file.
[0142] The screening unit is used to screen the script file after parsing and obtain the operation type of the interface operation and the target control information corresponding to the interface operation.
[0143] The combining unit is used to combine the operation type of the interface operation and the target control information corresponding to the interface operation to obtain a processed initial recording script.
[0144] In an exemplary embodiment, the target control information includes at least one of text, relative layout, and screenshot information.
[0145] Each module in the recording script generating device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0146] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Fig.11 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store recording script data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a recording script generation method is implemented.
[0147] Those skilled in the art will understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0148] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0149] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0150] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0151] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0152] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A recording script generation method, characterized in that: Applied in a first device, the method includes: Obtaining a uniform resource locator of the user interface test; generating two-dimensional code information according to the uniform resource locator; displaying the two-dimensional code information for scanning by a second device to establish a communication connection between the first device and the second device; Intercept the current interface operation of the application running on the second device to perform the user interface test; obtain the characteristic parameters corresponding to the current interface operation; perform a control query according to the preset mapping relationship and the characteristic parameters to obtain a target control; the preset mapping relationship includes the characteristic parameters and controls corresponding to the interface operation; determine the target control information according to the target control; wherein the characteristic parameters are the identifiers of the control responding to the interface operation; determine the operation type of the current interface operation according to the current interface operation; obtain an operation record based on the target control information and the operation type; determine an initial recording script based on the operation record; The initial recording script includes a script file in a target storage format; the target storage format includes a json format; the script file in the target storage format is parsed to obtain a parsed script file; the parsed script file is screened to obtain an operation type of an interface operation and target control information corresponding to the interface operation; the operation type of the interface operation and the target control information corresponding to the interface operation are combined to obtain a processed initial recording script; In response to user editing instructions, the processed initial recording script is adjusted to obtain a target recording script, wherein the editing instructions include at least one of insert instructions, delete instructions, modify instructions, loop instructions, and conditional instructions.
2. The method according to claim 1, characterized in that The target control information includes at least one of text, relative layout, and screenshot information.
3. The method according to claim 1, characterized in that The operation type includes one of a click operation, a slide operation, and an input operation.
4. The method according to claim 3, characterized in that The click operation includes a single click operation or a double click operation.
5. The method according to claim 3, characterized in that: The sliding operation includes a sliding operation from top to bottom or a sliding operation from bottom to top.
6. The method according to claim 1, characterized in that After displaying the two-dimensional code information for scanning by the second device to establish a communication connection between the first device and the second device, the method further includes: Determine whether the second device is idle, perform a user interface test when the second device is idle, and when the second device is not idle, wait for it to be idle and re-execute the step of determining whether the second device is idle.
7. A recording script generating device, characterized in that: The apparatus is applied in a first device and includes: An acquisition module, used for acquiring a uniform resource locator for user interface automation testing; A QR code generation module, used to generate QR code information according to a uniform resource locator; A display module, used to display the QR code information for scanning by the second device to establish a communication connection between the first device and the second device; A recording module, used for intercepting the current interface operation of the application running on the second device to perform the user interface test; obtaining the characteristic parameters corresponding to the current interface operation; performing a control query according to a preset mapping relationship and the characteristic parameters to obtain a target control; the preset mapping relationship includes the characteristic parameters and controls corresponding to the interface operation; determining the target control information according to the target control; wherein the characteristic parameters are identifiers of the control responding to the interface operation; determining the operation type of the current interface operation according to the current interface operation; obtaining an operation record based on the target control information and the operation type; determining an initial recording script based on the operation record; the initial recording script includes a script file in a target storage format; the target storage format includes a json format; A processing module is used to parse the script file in the target storage format to obtain a parsed script file; filter the parsed script file to obtain an operation type of the interface operation and target control information corresponding to the interface operation; combine the operation type of the interface operation and the target control information corresponding to the interface operation to obtain a processed initial recording script; The editing module is used to adjust the processed initial recording script in response to user editing instructions to obtain a target recording script, wherein the editing instructions include at least one of insert instructions, delete instructions, modify instructions, loop instructions, and conditional instructions.
8. The device according to claim 7, characterized in that The target control information includes at least one of text, relative layout, and screenshot information.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
