Automatic testing method, device, equipment and medium

Through automated testing methods, users can monitor the operation of the front-end page of the BMS system and generate test scripts, solving the problem of low testing efficiency in the existing technology and achieving more efficient system testing.

CN120123221APending Publication Date: 2025-06-10NETSUNION CLEARING CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311651938.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-05
Publication Date
2025-06-10

AI Technical Summary

Technical Problem

In the prior art, the automated testing efficiency of BMS systems is low, mainly because the test script needs to be manually written, which is time-consuming and labor-intensive, affecting the system testing efficiency.

Method used

It provides an automated testing method, by receiving user's script recording requests, listening to user's operations on front-end page element nodes, positioning element nodes based on DOM, and generating test scripts to realize automated testing of the system to be tested.

Benefits of technology

By recording and generating test scripts, the steps of manual writing are avoided, and the generation efficiency of the test scripts is improved, thereby improving the system's testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120123221A_ABST
    Figure CN120123221A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic testing method and device, equipment and a medium, and belongs to the technical field of software testing. The automatic testing method comprises the steps that a script recording request of a user for a to-be-tested system is received, and the to-be-tested system is configured to respond to user operation through a front-end page; in response to the script recording request, monitoring an operation of a user on an element node in a front-end page according to an event monitoring component to obtain operation information of operating the element node by the user; positioning the element nodes based on a document object model (DOM) to obtain node information of the element nodes; and generating a test script of the to-be-tested system according to the operation information and the node information under the condition that a script recording ending request of the user for the to-be-tested system is received, so as to test the to-be-tested system according to the test script. Through the scheme disclosed by the invention, the test script generation efficiency can be improved, and then the system test efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the technical field of software testing, and particularly relates to an automated testing method, device, equipment and medium. Background Art

[0002] With the development of Internet technology and software technology, there are more and more Browser Management Systems (BMS) accessed through browsers. Users can access the BMS system through a browser without installing the corresponding client software.

[0003] To ensure that the quality of the BMS system meets the requirements, it is necessary to test the BMS system before it goes online. The test script is an important part of implementing the automated testing of the BMS system.

[0004] In the related art, mainly testers manually write test scripts. Manually writing test scripts is time-consuming and laborious, and the efficiency of generating test scripts is low, which in turn affects the testing efficiency of the BMS system. Summary of the Invention

[0005] The purpose of the embodiments of this application is to provide an automated testing method, device, equipment and medium, which can solve the problem of low system testing efficiency.

[0006] In a first aspect, the embodiments of this application provide an automated testing method, including:

[0007] Receiving a script recording request from a user for a system under test, where the system under test is configured to respond to user operations through a front-end page;

[0008] In response to the script recording request, listening for the user's operations on the element nodes in the front-end page according to the event listening component, and obtaining the operation information of the user-operated element nodes;

[0009] Locating the element nodes based on the Document Object Model (DOM) to obtain the node information of the element nodes;

[0010] When receiving a script end recording request from the user for the system under test, generating a test script for the system under test according to the operation information and the node information, so as to test the system under test according to the test script.

[0011] In a second aspect, the embodiments of this application provide an automated testing device, including:

[0012] A first receiving module, configured to receive a script recording request from a user for a system under test, where the system under test is configured to respond to user operations through a front-end page;

[0013] A monitoring module, configured to respond to a script recording request, monitor, according to an event monitoring component, operations of a user on element nodes in a front-end page, and obtain operation information of the user operating on the element nodes;

[0014] A positioning module, configured to position element nodes based on the DOM and obtain node information of the element nodes;

[0015] A first generation module, configured to, when receiving a script end recording request of a user for a system under test, generate a test script for the system under test according to the operation information and the node information, so as to test the system under test according to the test script.

[0016] In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, where the memory stores a program or instruction that can run on the processor, and when the program or instruction is executed by the processor, the steps of the automated testing method provided in the first aspect of the embodiment of the present application are implemented.

[0017] In a fourth aspect, an embodiment of the present application provides a readable storage medium, where a program or instruction is stored on the readable storage medium, and when the program or instruction is executed by a processor, the steps of the automated testing method provided in the first aspect of the embodiment of the present application are implemented.

[0018] In a fifth aspect, an embodiment of the present application provides a chip, including a processor and a communication interface, where the communication interface is coupled to the processor, and the processor is configured to run a program or instruction to implement the steps of the automated testing method provided in the first aspect of the embodiment of the present application.

[0019] In a sixth aspect, an embodiment of the present application provides a computer program product, where the program product is stored in a storage medium, and the program product is executed by at least one processor to implement the steps of the automated testing method provided in the first aspect of the embodiment of the present application.

[0020] In the embodiment of the present application, by receiving a script recording request of a user for a system under test; responding to the script recording request, monitoring, according to an event monitoring component, operations of the user on element nodes in a front-end page, and obtaining operation information of the user operating on the element nodes; positioning the element nodes based on the DOM and obtaining node information of the element nodes; when receiving a script end recording request of the user for the system under test, generating a test script for the system under test according to the operation information and the node information, so as to test the system under test according to the test script. In this way, a test script for the system under test can be generated by recording, without the need for a tester to manually write a test script, which can improve the generation efficiency of the test script and thus improve the testing efficiency of the system. Description of the Drawings

[0021] To more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the accompanying drawings required for the embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0022] Figure 1 is a schematic flowchart of the automated testing method provided by the embodiments of the present application;

[0023] Figure 2 is a schematic structural diagram of the automated testing device provided by the embodiments of the present application;

[0024] Figure 3 is a schematic structural diagram of the electronic device provided by the embodiments of the present application;

[0025] Figure 4 is a schematic hardware structure diagram of the electronic device implementing the embodiments of the present application. Detailed Embodiments

[0026] The following will clearly describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art belong to the scope of protection of the present application.

[0027] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. generally belong to the same category, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / " generally represents an "or" relationship between the associated objects before and after.

[0028] The following will, with reference to the accompanying drawings, detail the automated testing method, device, equipment, and medium provided by the embodiments of the present application through specific embodiments and their application scenarios.

[0029] Figure 1 is a schematic flowchart of the automated testing method provided by the embodiments of the present application. As Figure 1 shown, the automated testing method may include:

[0030] S101: Receive a script recording request from the user for the system under test, where the system under test is configured to respond to user operations through a front-end page;

[0031] S102: In response to a script recording request, listen for the user's operations on the element nodes in the front-end page according to the event listening component, and obtain the operation information of the user operating on the element nodes.

[0032] S103: Locate the element nodes based on the DOM to obtain the node information of the element nodes.

[0033] S104: When receiving the script end recording request of the user for the system under test, generate a test script for the system under test according to the operation information and the node information, so as to test the system under test according to the test script.

[0034] The specific implementation manners of the above steps will be described in detail below.

[0035] In the embodiment of the present application, by receiving the script recording request of the user for the system under test; in response to the script recording request, listen for the user's operations on the element nodes in the front-end page according to the event listening component, and obtain the operation information of the user operating on the element nodes; locate the element nodes based on the DOM to obtain the node information of the element nodes; when receiving the script end recording request of the user for the system under test, generate a test script for the system under test according to the operation information and the node information, so as to test the system under test according to the test script. In this way, a test script for the system under test can be generated by recording, without the need for testers to manually write test scripts, which can improve the generation efficiency of test scripts and thus improve the test efficiency of the system.

[0036] In some possible implementations of the embodiment of the present application, the system under test in the embodiment of the present application may be a to-be-tested BMS system.

[0037] In some possible implementations of the embodiment of the present application, in S101, when the user clicks the "Record" button in the automated script generation tool for generating a script by recording provided in the embodiment of the present application, the script recording request of the user is received.

[0038] In some possible implementations of the embodiment of the present application, the front-end page in the embodiment of the present application may be a browser page. Correspondingly, in S102, the operations of the user on the element nodes in the browser can be listened for according to the event listening component based on the functional extension of the browser. Among them, the functional extension of the browser may be a Chrome extension.

[0039] In some possible implementations of the embodiment of the present application, the element nodes include but are not limited to: buttons, text boxes, radio boxes, check boxes, scroll bars, etc.

[0040] In some possible implementations of the embodiment of the present application, the operations on the element nodes include but are not limited to: clicking, inputting strings, selecting, closing, etc.

[0041] In some possible implementations of the embodiments of the present application, the DOM treats the web page document as a tree structure, and each leaf in the tree structure is an element node. The ID of the element node is obtained through a function (usually called a method in the software field) for obtaining the ID of the element node, the name of the element node is obtained through a method for obtaining the name of the element node, and the parent node of the element node can be obtained through the parentNode method. Based on the ID, name, and parent node of the element node, etc., the element node can be located.

[0042] In some possible implementations of the embodiments of the present application, in S101, when the user clicks the "Record" button in the automated script generation tool provided by the embodiments of the present application for generating a script by recording, the "Record" button switches to display as a "Stop Recording" button. In S104, when the user clicks the "Stop Recording" button, a script end recording request from the user is received. At this time, according to the operation information of each element node operated by the user and the node information of each element node operated by the user, a test script for the system under test is generated, and then the system under test is tested according to the test script.

[0043] In some possible implementations of the embodiments of the present application, in S104, the operation information of each element node by the user and the node information of each element node can be sent to a script processing center (Script process center), and the script processing center generates a test script and stores the test script in a script database.

[0044] In some possible implementations of the embodiments of the present application, before S102, the automated test method provided by the embodiments of the present application may further include: executing a call command for calling a browser pre-stored in a target database to call the browser to load a front-end page, where the call command is stored in the target database before S101, and an event listening component is configured in the browser.

[0045] In some possible implementations of the embodiments of the present application, the target database in the embodiments of the present application may be the registry of the Windows system.

[0046] In some possible implementations of the embodiments of the present application, when installing the automated script generation tool provided by the embodiments of the present application for generating a script by recording, the call command for calling the browser can be written into the registry. When the user desires to test a certain system, the call command is read from the registry and executed to call the browser to access the system, and then the system is tested.

[0047] In some possible implementations of the embodiments of the present application, the above browser may be a browser installed in an electronic device for implementing the automated testing method provided by the embodiments of the present application, and is usually referred to as a local browser.

[0048] In some possible implementations of the embodiments of the present application, the browser invoked in the embodiments of the present application may be the local default browser, or may be the first browser existing locally among multiple browsers configured in sequence. Exemplarily, the browsers configured in sequence include: Browser D, Browser A, Browser C, and Browser B. If Browser C and Browser D are installed locally, then Browser D is invoked for testing.

[0049] In some possible implementations of the embodiments of the present application, the user can also select a browser from multiple browsers and use the selected browser for testing.

[0050] In some possible implementations of the embodiments of the present application, before S104, the automated testing method provided by the embodiments of the present application may further include: receiving assertion configuration information submitted by the user corresponding to an operation; correspondingly, S104 may include: generating a test script for the system under test according to the assertion configuration information, operation information, and node information.

[0051] In some possible implementations of the embodiments of the present application, the assertion configuration information may include an assertion and an assertion addition location.

[0052] Among them, an assertion is a first-order logic in a program (for example, a logical judgment formula with a result of true or false), and its purpose is to represent and verify the result expected by the software developer. When the program executes to the position of the assertion, the corresponding assertion should be true. If the assertion is not true, the program will abort the execution and give an error message.

[0053] In some possible implementations of the embodiments of the present application, in S104, the assertion can be added to the position in the test script corresponding to the position specified by the user.

[0054] In some possible implementations of the embodiments of the present application, the system under test includes at least two scenarios, and both the script recording request and the test script correspond to the scenarios; the automated testing method provided by the embodiments of the present application may further include: generating a system test script corresponding to the system under test according to the test scripts corresponding to at least two scenarios, so as to test the system under test according to the system test script.

[0055] In some possible implementations of the embodiments of the present application, a scenario in the embodiments of the present application may be a page in the system under test, or may be a functional module in the system under test, or may be all the processes for implementing a service in the system under test.

[0056] Exemplarily, taking the user registration process as an example, the user registration process is as follows: The user clicks the registration button, and the registration interface is displayed. The user enters the username, password, and mobile phone number in the registration interface, clicks the SMS verification code button, enters the SMS verification code in the registration interface, clicks the radio box for agreeing to the agreement, and then clicks the immediate registration button. The registration success interface is displayed, and the username, password, and mobile phone number registered by the user are stored in the user database. Then, this user registration process can be a scenario.

[0057] Exemplarily, taking the scenario corresponding to the above user registration process as an example, when the user clicks the "Record" button, the "Record" button switches to display as the "Stop Recording" button, and the browser is called to display the login interface. The user clicks the registration button in the login interface, and the registration interface is displayed. The user enters the username, password, and mobile phone number in the registration interface, clicks the SMS verification code button, enters the SMS verification code in the registration interface, clicks the radio box for agreeing to the agreement, and then clicks the immediate registration button. The registration success interface is displayed. Then, when the user clicks the "Stop Recording" button, according to the operation information of the user on each element node (registration button, text box for receiving the username, text box for receiving the password, text box for receiving the mobile phone number, SMS verification code button, text box for receiving the SMS verification code, radio box, immediate registration button) and the node information of each of the above element nodes, a test script corresponding to the scenario corresponding to the user registration process is generated.

[0058] In some possible implementations of the embodiments of the present application, the test scripts corresponding to each scenario can be assembled to obtain a system test script corresponding to the system to be tested.

[0059] The embodiments of the present application do not limit the specific process of assembling the test scripts corresponding to each scenario, and any available assembling method can be applied to the embodiments of the present application. For example, assemble them in the generation order of the test scripts for each scenario, that is, the test order of the scenarios by the user.

[0060] In some possible implementations of the embodiments of the present application, the automated test method provided by the embodiments of the present application may further include: sending the system test script and the test cases corresponding to each scenario to at least two test nodes, so that the at least two test nodes test the system to be tested according to the system test script and the test cases, and determining the system test result based on the test results fed back by the at least two test nodes.

[0061] In some possible implementations of the embodiments of the present application, when at least two test nodes complete the test of the system to be tested, they can feedback the test results obtained from their tests. When receiving the test results of testing the system to be tested sent by the at least two test nodes, a test report can be generated according to the test results of testing the system to be tested sent by the at least two test nodes, and the test result of the system to be tested can be obtained for the testers to view.

[0062] Exemplarily, assume that there are three test nodes, namely test node A, test node B, and test node C. Then, the system test script corresponding to the system under test and the test cases corresponding to each scenario included in the system under test are sent to the above three test nodes. After receiving the system test script corresponding to the system under test and the test cases corresponding to each scenario included in the system under test, test node A, test node B, and test node C replay the system test script corresponding to the system under test and use the test cases corresponding to each scenario to test each scenario. Test node A, test node B, and test node C feedback the test results obtained by their respective tests. Based on the test results feedback by test node A, test node B, and test node C, the test result for the system under test is determined to complete the test of the system under test.

[0063] In some possible implementations of the embodiments of the present application, sending the system test script and the test cases corresponding to each scenario to at least two test nodes may include: determining the number of test cases corresponding to each test node among the at least two test nodes based on a rule engine according to the performance of the at least two test nodes; sending the system test script and the test cases with the corresponding number of test cases to each test node.

[0064] In some possible implementations of the embodiments of the present application, the performance of the test node includes but is not limited to: the computing performance of the test node and the network performance of the test node. Among them, the main factors affecting the computing performance of the test node are the CPU and memory; the main factors affecting the network performance of the test node are the bandwidth and latency.

[0065] When the CPU main frequency of test node A is X times that of test node B, the number of test cases sent to test node A can be X times the number of test cases sent to test node B.

[0066] When the memory of test node A is X times that of test node B, the number of test cases sent to test node A can be X times the number of test cases sent to test node B.

[0067] When the bandwidth of test node A is X times that of test node B, the number of test cases sent to test node A can be X times the number of test cases sent to test node B.

[0068] In some possible implementations of the embodiments of the present application, the CPU, memory, bandwidth, latency, etc. of the test node can be comprehensively considered to determine the number of test cases sent to the test node.

[0069] In some possible implementations of the embodiments of the present application, when testing a system under test using at least two test nodes, it can be implemented based on selenium-standalone. Specifically, start the selenium-standalone service on the server, then configure the server address and the concurrency number of the test nodes, and calculate the number of test cases corresponding to each test node; send the system test script corresponding to the system under test and the test cases with the corresponding number of test cases to each test node, and each test node replays the system test script corresponding to the system under test respectively, and uses the test cases corresponding to each scenario to test each scenario to complete the test of the system under test.

[0070] In some possible implementations of the embodiments of the present application, before sending the system test script and the test cases corresponding to each scenario to at least two test nodes, the automated test method provided by the embodiments of the present application may further include: classifying the test scripts corresponding to at least two scenarios according to the scenario information to obtain a classification result; configuring the target test cases for testing the target scenario according to the classification result, where the target scenario is the scenario corresponding to the test script that belongs to the common script among the test scripts corresponding to at least two scenarios, and the target test cases are the test cases for the normal business process in the target scenario.

[0071] In some possible implementations of the embodiments of the present application, the scenarios in the embodiments of the present application may include: common scenarios and business scenarios, etc. The test cases for the normal business process in the target scenario may be the test cases that can pass the test in the target scenario.

[0072] In some possible implementations of the embodiments of the present application, the scenarios that no longer need to be tested are called common scenarios. The scenario test script corresponding to the common scenario is called a common script.

[0073] After generating the test scripts corresponding to each scenario, the scenario information corresponding to the test scripts corresponding to each scenario can be obtained, and then, the test scripts corresponding to each scenario are classified, and the test cases corresponding to the common scenario are configured as the test cases that can pass the test.

[0074] For example, when paying more attention to the business scenarios of the system under test, the login scenario can be not tested, then the login scenario is a common scenario, and the test cases corresponding to the login scenario can be configured as the test cases that can pass the test.

[0075] The following takes the system under test as a material management system as an example for illustration.

[0076] First, install the automated script generation tool provided by the embodiments of the present application for generating scripts by recording. When installing this automated script generation tool, write the call command for calling the local browser into the registry.

[0077] Open the tool, read and execute the call command from the registry, and call the local browser in the tool.

[0078] Enter the network address of the material management system to access the material management system.

[0079] Suppose the material management system includes user login scenarios, user registration scenarios, basic material information management scenarios, material outbound scenarios, and material inbound scenarios.

[0080] When the user wants to generate a scenario test script corresponding to the material outbound scenario and clicks the "Record" button, the "Record" button switches to display as the "Stop Recording" button, and the user performs various operations on the material outbound scenario.

[0081] When the user clicks the "Stop Recording" button, the operation information of each element node of the user operation and the node information of each element node of the user operation are sent to the Script process center. The Script process center generates a test script corresponding to the material outbound scenario and stores the test script corresponding to the material outbound scenario in the script database. Then, configure the test case corresponding to the material outbound scenario.

[0082] Similarly, test scripts corresponding to other scenarios can be generated, and test cases corresponding to other scenarios can be configured. For test scripts belonging to common scripts, the test cases for the corresponding scenarios can be configured as test cases that can pass the test. For example, configure the test case for the user login scenario as a test case that can pass the test.

[0083] After generating the test scripts corresponding to each scenario, the test scripts corresponding to each scenario can be assembled to obtain the system test script corresponding to the material management system.

[0084] Start the selenium-standalone service, then configure the server address and the concurrency number of the test nodes, calculate the number of test cases corresponding to each test node; send the system test script corresponding to the material management system and the test cases with the corresponding number of test cases to each test node. Each test node replays the system test script corresponding to the material management system and uses the test cases corresponding to each scenario to test each scenario to complete the test of the material management system.

[0085] After each test node has completed the test on the material management system, it can feedback the test results obtained from the test. After receiving the test results of the test material management system sent by each test node, a test report can be generated based on the test results of the test material management system sent by each test node. The test report is sent to the testers by email for the testers to view.

[0086] It should be noted that for the automated testing method provided in the embodiments of the present application, the execution subject can be an automated testing device. In the embodiments of the present application, taking the automated testing device executing the automated testing method as an example, the automated testing device provided in the embodiments of the present application is described.

[0087] Figure 2 It is a schematic structural diagram of the automated testing device provided in the embodiments of the present application. As Figure 2 shown, the automated testing device 200 may include:

[0088] A first receiving module 201, configured to receive a script recording request of a to-be-tested system from a user, where the to-be-tested system is configured to respond to user operations through a front-end page;

[0089] A listening module 202, configured to, in response to the script recording request, listen to the operations of the user on the element nodes in the front-end page according to the event listening component, and obtain the operation information of the user operating on the element nodes;

[0090] A positioning module 203, configured to locate the element nodes based on the DOM to obtain the node information of the element nodes;

[0091] A first generating module 204, configured to, when receiving a script end recording request of the to-be-tested system from the user, generate a test script of the to-be-tested system according to the operation information and the node information, so as to test the to-be-tested system according to the test script.

[0092] In the embodiments of the present application, by receiving a script recording request of a to-be-tested system from a user; in response to the script recording request, listening to the operations of the user on the element nodes in the front-end page according to the event listening component to obtain the operation information of the user operating on the element nodes; locating the element nodes based on the DOM to obtain the node information of the element nodes; when receiving a script end recording request of the to-be-tested system from the user, generating a test script of the to-be-tested system according to the operation information and the node information, so as to test the to-be-tested system according to the test script. In this way, the test script of the to-be-tested system can be generated through recording, without the need for testers to manually write test scripts, which can improve the generation efficiency of test scripts and thus improve the testing efficiency of the system.

[0093] In some possible implementations of the embodiments of the present application, the automated testing device 200 further includes:

[0094] An execution module, configured to execute a call command for calling a browser, which is pre-stored in a target database, so as to call the browser to load a front-end page. The call command is stored in the target database before receiving a script recording request of a user for a system under test. An event listening component is configured in the browser.

[0095] In some possible implementations of the embodiments of the present application, the automated testing apparatus 200 further includes:

[0096] A second receiving module, configured to receive assertion configuration information submitted by a user corresponding to an operation;

[0097] Correspondingly, the first generating module 204 may specifically be configured to:

[0098] Generate a test script for the system under test according to the assertion configuration information, operation information, and node information.

[0099] In some possible implementations of the embodiments of the present application, the system under test includes at least two scenarios, and both the script recording request and the test script correspond to the scenarios; the automated testing apparatus 200 further includes:

[0100] A second generating module, configured to generate a system test script corresponding to the system under test according to the test scripts corresponding to at least two scenarios, so as to test the system under test according to the system test script.

[0101] In some possible implementations of the embodiments of the present application, the automated testing apparatus 200 further includes:

[0102] A sending module, configured to send the system test script and test cases corresponding to each scenario to at least two test nodes, so that the at least two test nodes test the system under test according to the system test script and the test cases;

[0103] A determining module, configured to determine a system test result based on test results fed back by at least two test nodes.

[0104] In some possible implementations of the embodiments of the present application, the sending module includes:

[0105] A determining sub-module, configured to determine the number of test cases corresponding to each test node among the at least two test nodes based on a rule engine according to the performance of the at least two test nodes;

[0106] A sending sub-module, configured to send the system test script and test cases with a corresponding number of test cases to each test node.

[0107] In some possible implementations of the embodiments of the present application, the automated testing apparatus 200 further includes:

[0108] A classification module, configured to classify test scripts corresponding to at least two scenarios according to scenario information, so as to obtain a classification result;

[0109] A configuration module, configured to configure a target test case for testing a target scenario according to the classification result, where the target scenario is the scenario corresponding to the test script that belongs to the common script among the test scripts corresponding to at least two scenarios, and the target test case is a test case for the normal business process under the corresponding target scenario.

[0110] The automated test device in the embodiments of the present application may be an electronic device or a component in an electronic device, such as an integrated circuit or a chip. The electronic device may be a terminal or other devices other than terminals. Exemplarily, the electronic device may be a mobile phone, a tablet computer, a laptop computer, a handheld computer, a vehicle-mounted electronic device, a Mobile Internet Device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc., and may also be a server, a Network Attached Storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, etc. The embodiments of the present application do not make specific limitations.

[0111] The automated test device in the embodiments of the present application may be a device with an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems. The embodiments of the present application do not make specific limitations.

[0112] The automated test device provided in the embodiments of the present application can implement Figure 1 each process in the embodiments of the automated test method. To avoid repetition, it will not be elaborated here.

[0113] Optionally, as Figure 3 shown, the embodiments of the present application further provide an electronic device 300, including a processor 301 and a memory 302. The memory 302 stores a program or instruction that can run on the processor 301. When the program or instruction is executed by the processor 301, it implements each step of the above-mentioned embodiments of the automated test method and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.

[0114] In some possible implementations of the embodiments of the present application, the processor 301 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.

[0115] In some possible implementations of the embodiments of the present application, the memory 302 may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical, or other physical / tangible memory storage device. Thus, generally, the memory 302 includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the automated test method according to the embodiments of the present application.

[0116] Figure 4 It is a schematic diagram of the hardware structure of the electronic device implementing the embodiments of the present application.

[0117] The electronic device 400 includes, but is not limited to: a radio frequency unit 401, a network module 402, an audio output unit 403, an input unit 404, a sensor 405, a display unit 406, a user input unit 407, an interface unit 408, a memory 409, and a processor 410, etc.

[0118] Those skilled in the art can understand that the electronic device 400 may further include a power supply (such as a battery) for supplying power to each component, and the power supply may be logically connected to the processor 410 through a power management system, so as to implement functions such as management of charging, discharging, and power consumption management through the power management system. Figure 4 The structure of the electronic device shown in does not limit the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0119] Among them, the processor 410 is configured to: receive a script recording request of the system under test, where the system under test is configured to respond to user operations through a front-end page; in response to the script recording request, listen to the user's operations on the element nodes in the front-end page according to the event listening component, and obtain the operation information of the user-operated element nodes; locate the element nodes based on the DOM to obtain the node information of the element nodes; in the case of receiving a script end recording request of the system under test, generate a test script of the system under test according to the operation information and the node information, so as to test the system under test according to the test script.

[0120] In the embodiments of the present application, by receiving a script recording request of the system under test; in response to the script recording request, listening to the user's operations on the element nodes in the front-end page according to the event listening component, and obtaining the operation information of the user-operated element nodes; locating the element nodes based on the DOM to obtain the node information of the element nodes; in the case of receiving a script end recording request of the system under test, generating a test script of the system under test according to the operation information and the node information, so as to test the system under test according to the test script. In this way, a test script of the system under test can be generated by recording, without the need for testers to manually write test scripts, which can improve the generation efficiency of test scripts and thus improve the test efficiency of the system.

[0121] In some possible implementations of the embodiments of the present application, the processor 410 may further be configured to:

[0122] Execute a call command for calling a browser pre-stored in the target database to call the browser to load the front-end page, where the call command is stored in the target database before receiving the script recording request of the system under test, and the event listening component is configured in the browser.

[0123] In some possible implementations of the embodiments of the present application, the processor 410 may further be configured to: receive assertion configuration information submitted by the user corresponding to the operation;

[0124] Correspondingly, the processor 410 may specifically be configured to:

[0125] Generate a test script of the system under test according to the assertion configuration information, the operation information, and the node information.

[0126] In some possible implementations of the embodiments of the present application, the system under test includes at least two scenarios, and both the script recording request and the test script correspond to the scenarios; the processor 410 may further be configured to:

[0127] Generate a system test script corresponding to the system under test according to the test scripts corresponding to at least two scenarios, so as to test the system under test according to the system test script.

[0128] In some possible implementations of the embodiments of the present application, the processor 410 may further be configured to:

[0129] Send a system test script and test cases corresponding to each scenario to at least two test nodes, so that the at least two test nodes test the system to be tested according to the system test script and the test cases;

[0130] Determine the system test result based on the test results fed back by the at least two test nodes.

[0131] In some possible implementations of the embodiments of the present application, the processor 410 may specifically be configured to

[0132] Based on the performance of the at least two test nodes, determine the number of test cases corresponding to each test node among the at least two test nodes based on a rule engine;

[0133] Send the system test script and test cases with the corresponding number of test cases to each test node.

[0134] In some possible implementations of the embodiments of the present application, the processor 410 may further be configured to:

[0135] Classify the test scripts corresponding to at least two scenarios according to the scenario information to obtain a classification result;

[0136] Configure target test cases for testing a target scenario according to the classification result, where the target scenario is the scenario corresponding to the test script that belongs to the common script among the test scripts corresponding to the at least two scenarios, and the target test cases are test cases for the normal business process under the corresponding target scenario.

[0137] It should be understood that in the embodiments of the present application, the input unit 404 may include a graphics processing unit (GPU) 4041 and a microphone 4042. The graphics processing unit 4041 processes the image data of static pictures or videos obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 406 may include a display panel 4061, and the display panel 4061 may be configured in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit 407 includes at least one of a touch panel 4071 and other input devices 4072. The touch panel 4071 is also referred to as a touch screen. The touch panel 4071 may include two parts: a touch detection device and a touch controller. The other input devices 4072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be elaborated here.

[0138] The memory 409 can be used to store software programs and various data. The memory 409 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data. Among them, the first storage area may store an operating system, application programs or instructions required for at least one function (such as a sound playback function, an image playback function, etc.). In addition, the memory 409 may include a volatile memory or a non-volatile memory, or the memory 409 may include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDR SDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synch link dynamic random access memory (SLDRAM), and a direct rambus random access memory (DRRAM). The memory 409 in the embodiments of the present application includes, but is not limited to, these and any other suitable types of memories.

[0139] The processor 410 may include one or more processing units; optionally, the processor 410 integrates an application processor and a modem processor. Among them, the application processor mainly processes operations related to the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communication signals, such as a baseband processor. It can be understood that the above modem processor may not be integrated into the processor 410 either.

[0140] The embodiments of the present application also provide a readable storage medium. A program or instruction is stored on the readable storage medium. When the program or instruction is executed by a processor, it implements each process of the above embodiment of the automated test method and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.

[0141] Among them, the processor is the processor in the electronic device in the above-mentioned embodiment. The readable storage medium includes a computer-readable storage medium. Examples of the computer-readable storage medium include non-transitory computer-readable storage media, such as ROM, RAM, magnetic disks, or optical discs, etc.

[0142] An embodiment of the present application further provides a chip, including a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement each process of the above-mentioned embodiment of the automated testing method and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.

[0143] It should be understood that the chip mentioned in the embodiment of the present application may also be referred to as a system-on-chip, system chip, chip system, or system-on-chip, etc.

[0144] An embodiment of the present application further provides a computer program product. The program product is stored in a storage medium. The program product is executed by at least one processor to implement each process of the above-mentioned embodiment of the automated testing method and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.

[0145] It should be noted that in this article, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, the element defined by the statement "including one..." does not exclude the existence of another identical element in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in a reverse order according to the functions involved. For example, the described methods may be performed in an order different from that described, and various steps may be added, omitted, or combined. Additionally, the features described with reference to certain examples may be combined in other examples.

[0146] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-described example methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the related technology, can be embodied in the form of a computer software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions for causing a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in various embodiments of the present application.

[0147] The embodiments of the present application have been described above in conjunction with the accompanying drawings. However, the present application is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Under the inspiration of the present application, those of ordinary skill in the art can also make many forms without departing from the purpose of the present application and the scope protected by the claims, and all of them fall within the protection scope of the present application.

Claims

1. An automated testing method, characterized in that, the method includes: Receiving a script recording request from a user for a system under test, wherein the system under test is configured to respond to user operations through a front-end page; In response to the script recording request, listening to the user's operations on the element nodes in the front-end page according to an event listening component, and obtaining operation information of the user operating the element nodes; Locating the element nodes based on the Document Object Model (DOM) to obtain node information of the element nodes; In the case of receiving a script end recording request from the user for the system under test, generating a test script for the system under test according to the operation information and the node information, so as to test the system under test according to the test script.

2. The method according to claim 1, characterized in that, before listening to the user's operations on the element nodes in the front-end page according to the event listening component, the method further includes: Executing a call command for calling a browser pre-stored in a target database to call the browser to load the front-end page, wherein the call command is stored in the target database before receiving the script recording request from the user for the system under test, and the event listening component is configured in the browser.

3. The method according to claim 1, characterized in that, before generating the test script for the system under test according to the operation information and the node information, the method further includes: Receiving assertion configuration information submitted by the user corresponding to the operation; Generating the test script for the system under test according to the operation information and the node information includes: Generating the test script for the system under test according to the assertion configuration information, the operation information and the node information.

4. The method according to claim 1, characterized in that, the system under test includes at least two scenarios, and both the script recording request and the test script correspond to the scenarios; the method further includes: Generating a system test script corresponding to the system under test according to the test scripts corresponding to the at least two scenarios, so as to test the system under test according to the system test script.

5. The method according to claim 4, characterized in that, the method further includes: Sending the system test script and test cases corresponding to each scenario to at least two test nodes, so that the at least two test nodes test the system under test according to the system test script and the test cases; Determining a system test result based on the test results fed back by the at least two test nodes.

6. The method according to claim 5, characterized in that, sending the system test script and test cases corresponding to each scenario to at least two test nodes includes: Determining the number of test cases corresponding to each test node among the at least two test nodes based on a rule engine according to the performance of the at least two test nodes; Sending the system test script and the test cases with the corresponding number of test cases to each test node.

7. The method according to claim 5, characterized in that, Before sending the system test script and test cases corresponding to each scenario to at least two test nodes, the method further includes: Classifying the test scripts corresponding to the at least two scenarios according to scenario information to obtain a classification result; Configuring target test cases for testing a target scenario according to the classification result, where the target scenario is the scenario corresponding to the test script that belongs to the common script among the test scripts corresponding to the at least two scenarios, and the target test cases are test cases for the normal business process under the target scenario.

8. An automated testing device Characterized in that The device includes: A first receiving module, configured to receive a script recording request of a system under test, where the system under test is configured to respond to user operations through a front-end page; A listening module, configured to, in response to the script recording request, listen for operations of the user on element nodes in the front-end page according to an event listening component to obtain operation information of the user operating the element nodes; A positioning module, configured to locate the element nodes based on the DOM to obtain node information of the element nodes; A first generating module, configured to, when receiving a script end recording request of the user for the system under test, generate a test script of the system under test according to the operation information and the node information, so as to test the system under test according to the test script.

9. An electronic device Characterized in that The electronic device includes: a processor and a memory, the memory stores a program or instruction that can run on the processor, and when the program or instruction is executed by the processor, the steps of the automated testing method according to any one of claims 1 to 7 are implemented.

10. A readable storage medium Characterized in that The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the automated testing method according to any one of claims 1 to 7 are implemented.