Automated testing methods and equipment
In the automated testing of Android devices, the connection between the test terminal and the device under test is simulating system events, and the problems of low use case coverage and limited test scenarios are solved, achieving wider test applicability.
Patent Information
- Application Number
- CN202011102721.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-15
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2040-10-15
AI Technical Summary
Existing automated testing methods cannot meet the problems of low use case coverage and limited testing scenarios, especially in the simulation of system events on Android devices.
By establishing a connection between the test terminal and the device under test, installing the test application, and simulating system events when the test application is executed, and sending simulation operations to the device under test using a simulation operation interface (such as the adb command) to achieve use case-level system event simulation.
Improves use case coverage and expands the applicability of test scenarios, making automated testing suitable not only for system testing, but also for integration testing and unit testing.
Smart Images

Figure CN114371983B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to automated testing technology. Background Art
[0002] Android devices (such as mobile phones, payment devices, TVs, tablets, etc.) need to be tested before they leave the factory or before new versions of Android applications are launched. There are two main existing automated testing methods: (1) testing based on the native automated testing framework of the Android platform, such as instrumentation, uiautomator, etc.; (2) testing based on recording or writing automated test scripts.
[0003] However, the two existing testing methods cannot meet the existing testing needs. The native automated testing framework based on the Android platform cannot simulate system events, and there is a problem of low use case coverage when performing automated system testing. Although the method based on recording or writing automated test scripts can achieve the purpose of simulating system events, its applicable scenarios are limited and it is mostly suitable for system testing, not for integration testing and unit testing. Summary of the invention
[0004] The purpose of this application is to provide an automated testing method and device that supports use case level simulation of system events, solving the problems of low use case coverage and limited test scenarios.
[0005] The present application discloses an automated testing method, comprising:
[0006] The test terminal establishes a connection with the device under test;
[0007] Installing a test application to the device under test, wherein the test application includes a plurality of test cases;
[0008] The test application executes the test cases in sequence, and when executing a test case that depends on a system event, sends a request to simulate the system event to the test terminal;
[0009] In response to the request, the test terminal sends a simulation operation interface corresponding to the system event to the device under test to simulate the system event, and returns a simulation result to the test application;
[0010] The test application executes the test case that depends on the system event according to the simulation result, and returns the execution result to the test terminal.
[0011] In a preferred embodiment, the system event includes turning off any one or more network switches except the USB sharing network;
[0012] The test terminal establishes a connection with the device under test, further comprising:
[0013] The test terminal establishes a USB shared network connection with the device under test.
[0014] In a preferred embodiment, the test subjects of the test cases include one or more of the following:
[0015] The entire system, the integration and calling relationships between modules, and the programs within the modules.
[0016] In a preferred embodiment, the system event further includes one or more of the following:
[0017] Turn off the traffic switch, turn off the Bluetooth switch, turn off the location service switch, increase the permissions of the application under test, and reduce the permissions of the application under test.
[0018] In a preferred example, the device under test is an Android device, and the simulated operation interface is an adb command.
[0019] In a preferred example, when the test terminal establishes a USB shared network connection with the device under test, the method further includes:
[0020] The test terminal starts the Http Server;
[0021] The test application executes test cases in sequence, and when executing a test case that depends on a system event, sends a request to simulate the system event to the test terminal, further comprising:
[0022] The test application executes the test cases in sequence, and when executing a test case that depends on a system event, sends an Http request containing the system event parameters to the Http Server;
[0023] In response to the request, the test terminal sends a simulation operation interface corresponding to the system event to the device under test to simulate the system event, and returns the simulation result to the test application, further comprising:
[0024] In response to the Http request, the Http Server parses the Http request, searches for an adb command corresponding to a system event parameter in the Http request, sends the adb command to the Android device to simulate a system event and obtains a simulation result, and returns the simulation result to the test application through an Http response.
[0025] In a preferred example, the test terminal establishing a connection with the device under test further comprises:
[0026] The test terminal uses an adb forward command to start a forwarding function between the first port of the test terminal and the second port of the Android device;
[0027] The test terminal starts the socket client to connect to the first port, and the Android device starts the socket server to listen to the second port;
[0028] The test application executes test cases in sequence, and when executing a test case that depends on a system event, sends a request to simulate the system event to the test terminal, further comprising:
[0029] The test application sends a message including the system event parameters to the socket client through the socket server;
[0030] In response to the request, the test terminal sends a simulation operation interface corresponding to the system event to the device under test to simulate the system event, and returns the simulation result to the test application, further comprising:
[0031] Parsing the message through the socket client, searching for an adb command corresponding to a system event parameter in the message, sending the adb command to the Android device to simulate a system event, obtaining a simulation result, and returning the simulation result to the socket server;
[0032] The socket server forwards the result of the simulated system event to the test application.
[0033] In a preferred example, the test application executes the test case dependent on the system event according to the simulation result and returns the execution result to the test terminal, further comprising:
[0034] If the simulation result is "successful", the test application executes the test case that depends on the system event, otherwise it is determined that the test case that depends on the system event fails to execute;
[0035] The test application returns the simulation result and the execution result of the test case to the test terminal.
[0036] The present application also discloses an automated testing device comprising:
[0037] A communication module, used to establish a connection with a device under test, install a test application to the device under test, wherein the test application includes a plurality of test cases, wherein the test application is configured to execute the test cases in sequence after being installed to the device under test, and when executing a test case that depends on a system event, send a request to the automated test device to simulate the system event;
[0038] A simulation operation module is used to respond to the request, send a simulation operation interface corresponding to the system event to the device under test to simulate the system event, and return the simulation result to the test application, wherein the test application is also configured to execute the test case that depends on the system event according to the simulation result, and return the execution result to the automated testing device.
[0039] In a preferred example, the system event includes turning off any one or more network switches except the USB shared network, and the communication module is further used to establish a USB shared network connection with the device under test.
[0040] In a preferred embodiment, the test subjects of the test cases include one or more of the following:
[0041] The entire system, the integration and calling relationships between modules, and the programs within the modules.
[0042] In a preferred embodiment, the system event further includes one or more of the following:
[0043] Turn off the traffic switch, turn off the Bluetooth switch, turn off the location service switch, increase the permissions of the application under test, and reduce the permissions of the application under test.
[0044] In a preferred example, the device under test is an Android device, and the simulated operation interface is an adb command.
[0045] In a preferred example, the communication module is also used to start the Http Server;
[0046] The test application is further configured to execute test cases in sequence, and when executing a test case that depends on a system event, send an Http request containing the system event parameters to the Http Server;
[0047] The simulation operation module is also used to respond to the Http request, parse the Http request through the Http Server, find the adb command corresponding to the system event parameter in the Http request, send the adb command to the Android device to simulate the system event and obtain the simulation result, and return the simulation result to the test application through the Http response.
[0048] In a preferred example, the communication module is further used to start the forwarding function between the first port of the automated test equipment and the second port of the Android device using an adb forward command, start the socket client to connect to the first port, and the Android device starts the socket server to listen to the second port;
[0049] The test application is further configured to send a message including the system event parameters to the socket client through the socket server;
[0050] The simulation operation module is also used to parse the message through the socket client, find the adb command corresponding to the system event parameter in the message, send the adb command to the Android device to simulate the system event, and obtain the simulation result, return the simulation result to the socket server, and forward the result of the simulated system event to the test application through the socket server.
[0051] The present application also discloses an automated testing device comprising:
[0052] a memory for storing computer executable instructions; and,
[0053] A processor is used to implement the steps in the method described above when executing the computer executable instructions.
[0054] The present application also discloses a computer-readable storage medium in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the steps in the method described above are implemented.
[0055] Compared with the prior art, the present invention has at least the following advantages:
[0056] Based on the native automated testing framework of the Android platform, the function of simulating system events is added, which supports the simulation of system events at the use case level. The test objects of the test cases can include one or more of the entire system, the integration and calling relationship between modules, and the programs within the modules, which solves the problems of low use case coverage and limited test scenarios.
[0057] Moreover, the implementation methods of the present application are not only applicable to black box testing, but also to white box testing.
[0058] A large number of technical features are recorded in the specification of this application, which are distributed in various technical solutions. If all possible combinations of technical features of this application (i.e., technical solutions) are to be listed, the specification will be too long. In order to avoid this problem, the various technical features disclosed in the above-mentioned invention content of this application, the various technical features disclosed in the various embodiments and examples below, and the various technical features disclosed in the accompanying drawings can be freely combined with each other to form various new technical solutions (these technical solutions are all deemed to have been recorded in this specification), unless the combination of such technical features is technically infeasible. For example, in one example, feature A+B+C is disclosed, and in another example, feature A+B+D+E is disclosed, and features C and D are equivalent technical means that play the same role. Technically, only one can be used, and it is impossible to use them at the same time. Feature E can be combined with feature C technically. Then, the solution of A+B+C+D should not be deemed to have been recorded because it is technically infeasible, and the solution of A+B+C+E should be deemed to have been recorded. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 It is a schematic flow chart of the automated testing method according to the first embodiment of the present application.
[0060] Figure 2 This is a flowchart of an example automated testing method according to the present application.
[0061] Figure 3 This is a flowchart of an example automated testing method according to the present application.
[0062] Figure 4 It is a schematic diagram of the structure of the automated testing equipment according to the second embodiment of the present application. DETAILED DESCRIPTION
[0063] In the following description, many technical details are provided to help readers better understand the present application. However, those skilled in the art can understand that the technical solution claimed in the present application can be implemented even without these technical details and various changes and modifications based on the following embodiments.
[0064] Description of some concepts:
[0065] USB shared network: A technology that allows an external device under test to share network resources with a PC via a USB connection.
[0066] adb: android debug bridge.
[0067] Automated testing: generally refers to the automation of software testing. Software testing is to run the system or application under preset conditions and evaluate the running results. The preset conditions should include normal conditions and abnormal conditions.
[0068] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0069] The first embodiment of the present application relates to an automated testing method, the process of which is as follows: Figure 1 As shown, the method comprises the following steps:
[0070] In step 101, a test terminal establishes a connection with a device under test, such as, but not limited to, a USB connection.
[0071] Optionally, the test terminal may be, but is not limited to, a PC.
[0072] Optionally, the device under test may be, but is not limited to, an Android device, and the simulated operation interface is an adb command.
[0073] Then, the process proceeds to step 102, where the test terminal installs a test application to the device under test, where the test application includes a number of test cases.
[0074] Optionally, the test subjects of the test cases include one or more of the following:
[0075] The entire system, the integration and calling relationships between modules, and the programs within the modules.
[0076] Then, the process proceeds to step 103 , where the test application executes the test cases in sequence, and when executing a test case that depends on a system event, a request for simulating the system event is sent to the test terminal.
[0077] Optionally, the system event may include turning off any one or more network switches except the USB shared network, such as turning off both the WLAN network switch and the mobile network switch, or only turning off the WLAN network switch, etc. Step 101 is further implemented as: the test terminal establishes a USB shared network connection with the device under test.
[0078] Optionally, the system event may also include one or more of the following:
[0079] Turn off the traffic switch, turn off the Bluetooth switch, turn off the location service switch, increase the permissions of the application under test, and reduce the permissions of the application under test.
[0080] Then, the process proceeds to step 104 , in which, in response to the request, the test terminal sends a simulation operation interface corresponding to the system event to the device under test to simulate the system event, and returns the simulation result to the test application.
[0081] In one embodiment, when the test terminal establishes a USB shared network connection with the device under test, it also includes the step of: the test terminal starts the Http Server. The step 103 can be further implemented as: the test application executes the test cases in sequence, and when executing the test cases that depend on the system events, sends an Http request carrying the parameters that identify the system event to the Http Server. The step 104 can be further implemented as: in response to the Http request, the parameters of the Http request are parsed by the Http Server, the system events corresponding to the parameters are searched, an adb command is sent to the Android device to simulate the system event and the adb command execution result is obtained, and the execution result is returned to the test application through an Http response.
[0082] In another embodiment, after step 101, the following steps are also included: the test terminal uses the adbforward command to start the forwarding function between the first port of the test terminal and the second port of the Android device; the test terminal starts the socket client to connect to the first port; the Android device starts the socket server to listen to the second port. Step 103 can be further implemented as: the test application sends a message carrying the system event parameter to the socket client through the socket server. Step 104 can be further implemented as: the socket client parses the parameters in the message, searches for the system event corresponding to the parameter, sends an adb command to the Android device to simulate the system event, obtains the adb command execution result, and returns the result of the simulated system event to the socket server; the socket server forwards the result of the simulated system event to the test application.
[0083] Afterwards, the process proceeds to step 105 , where the test application executes the test case that depends on the system event according to the simulation result, and returns the execution result to the test terminal.
[0084] Optionally, step 105 may further include the following sub-steps 105a to 105c:
[0085] Step 105a, if the simulation result is "successful", the test application executes the test case that depends on the system event;
[0086] Step 105b, if the simulation result is "failure", it is determined that the test case that depends on the system event has failed to execute;
[0087] Step 105c: The test application returns the simulation result and the execution result of the test case to the test terminal.
[0088] Optionally, the automated testing method further includes: when the test application executes the test cases in sequence, before the current test case is executed and before the next test case starts to be executed, the test terminal sends a simulated operation interface of the reverse system event of the system event that the current test case depends on to the device under test to simulate the system event, and returns the simulation result to the test application. For example, if the system event that the current test case depends on is "turn off the Bluetooth switch", in order not to affect the execution of the next test case, before executing the next test case, the test terminal sends a simulated operation interface of "turn on the Bluetooth switch" to the device under test to simulate the system event.
[0089] In order to better understand the technical solution of the present application, two specific examples (Example 1 and Example 2) are used for illustration below. The details listed in the examples are mainly for ease of understanding and are not intended to limit the scope of protection of the present application.
[0090] Example 1 illustrates how the present invention implements use case-level system event simulation, where the reason for using USB shared network is that after the Android device turns off the network switch, the Android device can still communicate with the PC through the shared network. The present invention uses the method of building an Http Server on the PC to achieve device communication. Figure 2 As shown, Example 1 specifically includes the following steps 1 to 9:
[0091] Step 1: Connect the Android device to the PC via USB.
[0092] Step 2: Turn on the USB sharing switch on your Android device;
[0093] Step 3: Connect the PC to the shared network of the Android device and close other network connections;
[0094] Step 4: Start the Http Server on the PC to monitor the Http requests from the Android device.
[0095] Step 5: After completing the use case code writing and compilation on the PC, install the test application on the Android device and start the automated testing process;
[0096] Step 6, the test application executes a test case that depends on the system event, which includes steps 7, 8, and 9;
[0097] Step 7: The test application sends an HTTP request to the HTTP Server on the PC, and the request parameter identifies a system event.
[0098] Step 8: The Http Server on the PC parses the Http request parameters, searches for the system events corresponding to the parameters, sends an adb command to the Android device via USB to simulate the system event, and obtains the adb command execution result;
[0099] Step 9: The Http Server on the PC returns the result of the simulated system event to the test application through an Http response.
[0100] Example 2 illustrates how the present invention implements use case-level system event simulation, where adb forward is used for port forwarding because the Android device can still communicate with the PC through port forwarding after the network switch is turned off. The present invention uses socket communication to implement device communication. Figure 3 As shown, Example 1 specifically includes the following steps 1 to 9:
[0101] Step 1: Connect the Android device to the PC via USB.
[0102] Step 2, use the adb forward command to start the port forwarding function, which can forward the message sent to the PC device port A to the Android device port B. In this patent, port A is called the forwarding port and port B is called the receiving port;
[0103] Step 3: Start a socket server on the Android device to listen to the receiving port;
[0104] Step 4: Start a socket client on the PC to connect to the forwarding port. This actually establishes a connection with the socket server of the Android device. The client is used to receive commands from the server.
[0105] Step 5: After completing the use case code writing and compilation on the PC, install the test application on the Android device and start the automated testing process;
[0106] Step 6, the test application executes a test case that depends on the system event, which includes steps 7, 8, and 9;
[0107] Step 7: The test application sends a TCP message to the socket client on the PC through the socket server. The message carries parameters, and the parameters identify a system event.
[0108] Step 8: The socket client on the PC parses the parameters in the TCP message, searches for the system events corresponding to the parameters, sends an adb command to the Android device via USB to simulate the system event, and obtains the adb command execution result;
[0109] Step 9: The socket client on the PC returns the result of the simulated system event to the socket server via a TCP message, and the socket server forwards it to the test application.
[0110] The second embodiment of the present application relates to an automated testing device, the structure of which is as follows: Figure 4 As shown, the automated testing equipment includes a communication module and a simulation operation module;
[0111] The communication module is used to establish a connection with the device under test (for example, it can be but is not limited to a USB connection), install a test application to the device under test, the test application includes a plurality of test cases, wherein the test application is configured to execute the test cases in sequence after being installed on the device under test, and when executing a test case that depends on a system event, send a request to simulate the system event to the automated testing device; the simulation operation module is used to respond to the request, send a simulation operation interface corresponding to the system event to the device under test to simulate the system event, and return the simulation result to the test application, wherein the test application is also configured to execute the test case that depends on the system event according to the simulation result, and return the execution result to the automated testing device.
[0112] Optionally, the system event may include turning off any one or more network switches except the USB shared network, such as turning off the WLAN network switch and the mobile network switch at the same time, such as turning off only the WLAN network switch, etc. The communication module is also used to establish a USB shared network connection with the device under test.
[0113] Optionally, the test subjects of the test cases include one or more of the following:
[0114] The entire system, the integration and calling relationships between modules, and the programs within the modules.
[0115] Optionally, the system event also includes one or more of the following:
[0116] Turn off the traffic switch, turn off the Bluetooth switch, turn off the location service switch, increase the permissions of the application under test, and reduce the permissions of the application under test.
[0117] Optionally, the test terminal may be, but is not limited to, a PC.
[0118] Optionally, the device under test may be, but is not limited to, an Android device, and the simulated operation interface is an adb command.
[0119] In one embodiment, the communication module is also used to start the Http Server; the test application is also configured to execute test cases in sequence, and when executing a test case that depends on a system event, send an Http request carrying a parameter that identifies the system event to the Http Server; the simulation operation module is also used to respond to the Http request, parse the parameters of the Http request through the Http Server, find the system event corresponding to the parameter, send an adb command to the Android device to simulate the system event and obtain the adb command execution result, and return the execution result to the test application through an Http response.
[0120] In another embodiment, the communication module is also used to use the adb forward command to start the forwarding function between the first port of the automated test equipment and the second port of the Android device, and start the socket client to connect to the first port; the Android device starts the socket server to listen to the second port; the test application is also configured to send a message carrying parameters identifying the system event to the socket client through the socket server; the simulation operation module is also used to parse the parameters in the message through the socket client, find the system event corresponding to the parameter, send an adb command to the Android device to simulate the system event, and obtain the adb command execution result, return the result of the simulated system event to the socket server, and forward the result of the simulated system event to the test application through the socket server.
[0121] The first implementation manner is a method implementation manner corresponding to the present implementation manner. The technical details in the first implementation manner can be applied to the present implementation manner, and the technical details in the present implementation manner can also be applied to the first implementation manner.
[0122] It should be noted that those skilled in the art should understand that the implementation functions of each module shown in the above-mentioned embodiment of the automated test equipment can be understood with reference to the relevant description of the aforementioned automated test method. The functions of each module shown in the above-mentioned embodiment of the automated test equipment can be realized by a program (executable instruction) running on a processor, or by a specific logic circuit. If the above-mentioned automated test equipment of the embodiment of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM, Read Only Memory), a disk or an optical disk. In this way, the embodiment of the present application is not limited to any specific combination of hardware and software.
[0123] Accordingly, the present application also provides a computer-readable storage medium in which computer executable instructions are stored, and when the computer executable instructions are executed by the processor, the various method embodiments of the present application are implemented. Computer-readable storage media include permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be a computer-readable instruction, a data structure, a module of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable storage media do not include temporary computer-readable media (transitory media), such as modulated data signals and carriers.
[0124] In addition, the embodiment of the present application also provides an automated testing device, which includes a memory for storing computer executable instructions, and a processor; the processor is used to implement the steps in the above-mentioned method implementation when executing the computer executable instructions in the memory. Among them, the processor can be a central processing unit (Central Processing Unit, referred to as "CPU"), or other general-purpose processors, digital signal processors (Digital Signal Processor, referred to as "DSP"), Application Specific Integrated Circuit (Application Specific Integrated Circuit, referred to as "ASIC"), etc. The aforementioned memory can be a read-only memory (read-only memory, referred to as "ROM"), a random access memory (random access memory, referred to as "RAM"), a flash memory (Flash), a hard disk or a solid-state hard disk, etc. The steps of the method disclosed in each embodiment of the present invention can be directly embodied as a hardware processor to be executed, or a combination of hardware and software modules in the processor can be executed.
[0125] It should be noted that in the application documents of this patent, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one" do not exclude the existence of other identical elements in the process, method, article or device including the elements. In the application documents of this patent, if it is mentioned that an action is performed according to an element, it means that the action is performed at least according to the element, which includes two situations: performing the action only according to the element, and performing the action according to the element and other elements. Expressions such as multiple, multiple, and multiple include 2, 2 times, 2 kinds, and more than 2, more than 2 times, and more than 2 kinds.
[0126] All documents mentioned in this application are considered to be included in the disclosure of this application as a whole, so that they can be used as a basis for modification when necessary. In addition, it should be understood that the above is only a preferred embodiment of this specification and is not intended to limit the scope of protection of this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of this specification should be included in the scope of protection of one or more embodiments of this specification.
Claims
1. An automated testing method, characterized in that: include: The test terminal establishes a connection with the device under test; Installing a test application to the device under test, wherein the test application includes a plurality of test cases; The test application executes the test cases in sequence, and when executing a test case that depends on a system event, sends a request to simulate the system event to the test terminal; In response to the request, the test terminal sends a simulation operation interface corresponding to the system event to the device under test to simulate the system event, and returns a simulation result to the test application; The test application executes the test case that depends on the system event according to the simulation result, and returns the execution result to the test terminal.
2. The automated testing method according to claim 1, wherein: The system event includes turning off any one or more network switches except the USB shared network; The test terminal establishes a connection with the device under test, further comprising: The test terminal establishes a USB shared network connection with the device under test.
3. The automated testing method according to claim 1 or 2, characterized in that: The test subjects of the test cases include one or more of the following: The entire system, the integration and calling relationships between modules, and the programs within the modules.
4. The automated testing method according to claim 1 or 2, wherein: The device under test is an Android device, and the simulated operation interface is an adb command.
5. The automated testing method according to claim 4, wherein: When the test terminal establishes a USB shared network connection with the device under test, it also includes: The test terminal starts the Http Server; The test application executes test cases in sequence, and when executing a test case that depends on a system event, sends a request to simulate the system event to the test terminal, further comprising: The test application executes the test cases in sequence, and when executing a test case that depends on a system event, sends an Http request containing the system event parameters to the HttpServer; In response to the request, the test terminal sends a simulation operation interface corresponding to the system event to the device under test to simulate the system event, and returns the simulation result to the test application, further comprising: In response to the Http request, the Http Server parses the Http request, searches for an adb command corresponding to a system event parameter in the Http request, sends the adb command to the Android device to simulate a system event and obtains a simulation result, and returns the simulation result to the test application through an Http response.
6. The automated testing method according to claim 4, wherein: The test terminal establishing a connection with the device under test further comprises: The test terminal uses an adb forward command to start a forwarding function between the first port of the test terminal and the second port of the Android device; The test terminal starts the socket client to connect to the first port, and the Android device starts the socket server to listen to the second port; The test application executes test cases in sequence, and when executing a test case that depends on a system event, sends a request to simulate the system event to the test terminal, further comprising: The test application sends a message including the system event parameters to the socket client through the socket server; In response to the request, the test terminal sends a simulation operation interface corresponding to the system event to the device under test to simulate the system event, and returns the simulation result to the test application, further comprising: Parsing the message through the socket client, searching for an adb command corresponding to a system event parameter in the message, sending the adb command to the Android device to simulate a system event, obtaining a simulation result, and returning the simulation result to the socket server; The socket server forwards the result of the simulated system event to the test application.
7. The automated testing method according to claim 1, wherein: The test application executes the test case dependent on the system event according to the simulation result and returns the execution result to the test terminal, further comprising: If the simulation result is "success", the test application executes the test case that depends on the system event, otherwise it is determined that the test case that depends on the system event fails to execute; The test application returns the simulation result and the execution result of the test case to the test terminal.
8. An automated testing device, characterized in that: include: A communication module, used to establish a connection with a device under test, install a test application to the device under test, wherein the test application includes a plurality of test cases, wherein the test application is configured to execute the test cases in sequence after being installed to the device under test, and when executing a test case that depends on a system event, send a request to the automated test device to simulate the system event; A simulation operation module is used to respond to the request, send a simulation operation interface corresponding to the system event to the device under test to simulate the system event, and return the simulation result to the test application, wherein the test application is also configured to execute the test case that depends on the system event according to the simulation result, and return the execution result to the automated testing device.
9. The automated testing device according to claim 8, characterized in that: The system event includes turning off any one or more network switches except the USB shared network, and the communication module is further used to establish a USB shared network connection with the device under test.
10. The automated testing device according to claim 8, characterized in that: The test subjects of the test cases include one or more of the following: The entire system, the integration and calling relationships between modules, and the programs within the modules.
11. The automated testing device according to claim 8 or 9, characterized in that: The device under test is an Android device, and the simulated operation interface is an adb command.
12. The automated testing device according to claim 11, characterized in that: The communication module is also used to start HttpServer; The test application is further configured to execute test cases in sequence, and when executing a test case that depends on a system event, send an Http request containing the system event parameters to the Http Server; The simulation operation module is also used to respond to the Http request, parse the Http request through the Http Server, find the adb command corresponding to the system event parameter in the Http request, send the adb command to the Android device to simulate the system event and obtain the simulation result, and return the simulation result to the test application through the Http response.
13. The automated testing device according to claim 11, characterized in that: The communication module is also used to start the forwarding function between the first port of the automated test device and the second port of the Android device using the adbforward command, start the socket client to connect to the first port, and the Android device starts the socket server to listen to the second port; The test application is further configured to send a message containing system event parameters to the socket client through the socket server when executing a test case that depends on the system event; The simulation operation module is also used to parse the message through the socket client, find the adb command corresponding to the system event parameter in the message, send the adb command to the Android device to simulate the system event, and obtain the simulation result, return the simulation result to the socket server, and forward the result of the simulated system event to the test application through the socket server.
14. An automated testing device, characterized in that: include: A memory for storing computer executable instructions; as well as, A processor, configured to implement the steps in the method according to any one of claims 1 to 7 when executing the computer executable instructions.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the steps in the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Android terminal simulation testing system
CN107678939A
Service application testing method and device, computer equipment and storage medium
CN109815144A