Detailed Description
In order to better understand the technical solutions, the technical solutions of the embodiments of the present specification are described in detail below with reference to the drawings and specific embodiments, and it should be understood that the specific features of the embodiments and embodiments of the present specification are detailed descriptions of the technical solutions of the embodiments of the present specification, and are not limitations of the technical solutions of the present specification, and the technical features of the embodiments and embodiments of the present specification may be combined with each other without conflict.
Please refer to fig. 1, which is a schematic diagram of an operating environment suitable for the embodiment of the present disclosure. As shown in fig. 1, one or more terminal devices 100 (only four shown in fig. 1) may be connected via a network 200 to one or more servers 300 (only one shown in fig. 1) for data communication or interaction. The terminal device 100 may be a Personal Computer (PC), a notebook Computer, a tablet Computer, a smart phone, an electronic reader, a vehicle-mounted device, a network television, a wearable device, and other smart devices having a network function.
In the embodiment of the present specification, the first terminal device that records and submits the test script corresponding to the application program to be tested, and the second terminal device that runs the test script to test the application program to be tested may be any type of terminal device, and may be installed with a web browser or an application client. In the embodiment of the invention, the first terminal equipment, the second terminal equipment and the server can be directly connected through the communication network. The first terminal device, the second terminal device and the server can establish wireless remote communication connection in a Wi-Fi (wireless fidelity) network, a 2G/3G/4G/5G network or a local area network.
In the embodiments of the present specification, the first terminal device and the second terminal device may preferably be mobile terminals, such as smart phones.
In the application program testing method, the application program testing device, the electronic device, and the readable storage medium provided in the embodiments of the present specification, when detecting that a user triggers a first preset instruction, a first terminal device monitors a first user operation performed by the user on an application program to be tested through the first terminal device, generates a test script based on the first user operation, and sends the test script to a server; and the server sends the test script to one or more second terminal devices in an idle state at present, so that the second terminal devices play back the test script to realize the test of the application program to be tested. The second terminal device is a terminal device which establishes communication connection with the server by registering device information in the server in advance. Therefore, the user can record the test script conveniently, the user operation is simplified, and compared with a mode that the server is connected with the test equipment through a data line, the equipment management is more flexible, and the utilization rate of resources is improved. The present invention will be described in detail with reference to specific examples.
In a first aspect, an embodiment of the present disclosure provides an application testing method, which is an application testing method executed by a first terminal device. The application program testing method provided by the embodiment of the specification comprises a first testing process. Referring to fig. 2, the first testing process may include at least steps S201 to S204.
Step S201, detecting whether the user triggers a first preset instruction.
The first test process is a process that a user records a test script corresponding to the application program to be tested, the test script is uploaded to the server, the server issues the test script to the second terminal equipment in an idle state at present, and the second terminal equipment plays back the test script, so that the application program to be tested is tested.
In an embodiment of the present specification, the first preset instruction is used to start a first test process. For example, the user may trigger the first preset instruction by triggering a button for starting a script recording function.
Step S202, when detecting that the user triggers a first preset instruction, monitoring a first user operation executed by the user on the application program to be tested, and generating a test script based on the first user operation.
And when detecting that the user triggers a first preset instruction, starting a first test process and starting a script recording function. The user can open the application program to be tested through the first terminal device, and corresponding first user operation is executed aiming at the service module to be tested. Monitoring a first user operation executed on the first terminal device, generating a test script based on the first user operation, and storing the test script to the local. The service module to be tested may be selected according to actual needs, for example, may be a login module of an application program to be tested.
For example, when the first terminal device is a smart phone, taking the smart phone with an android system as an example, the first terminal device may monitor the operation of the first user by using an auxiliary function (accessitivyservice), where the accessitivyservice is a service that runs in a background of the smart phone and can monitor an event sent by the system.
Specifically, the process of generating the test script based on the first user operation may adopt an algorithm of converting the operation into json, and specifically may be: and sequentially recording characters, coordinates, sizes, structural information, operation types (such as clicking, sliding, inputting and the like) and parameters of the control triggered by the first user operation to construct json data, and using the constructed json data as a test script. The structural information refers to an Xpath tree structure of the node and the character, coordinate and size information of the child node which are constructed based on the page structure. Correspondingly, the test script can be played back by adopting an algorithm for playing back according to json, specifically, matching can be performed on the current page structure based on the characters, coordinates, sizes and structural information transmitted by json, a control with the highest matching degree is searched, and then related operations are executed based on the operation types and parameters transmitted by json, so that the test script can be played back.
Of course, in other embodiments of the present disclosure, the generation of the test script based on the first user operation may be implemented in other ways, which is not limited herein.
It should be noted that, before starting the script recording function, the user may download and install the application program to be tested in the first terminal device in advance; or, the user may also store the application program to be tested in a designated location such as a server or other cloud storage platform in advance, download and install the application program to be tested through a storage path of the application program to be tested after starting the script recording function, open the application program to be tested, and execute corresponding first user operation for the functional module to be tested, so that the downloading and installing processes of the application program to be tested can be recorded as the script.
As an optional implementation manner, in addition to recording the test script, feature information corresponding to the recorded test script needs to be acquired, and after the script is recorded, the recorded test script and the feature information corresponding to the test script are uploaded to the server together, so that the server manages the received test script. Specifically, the feature information may include, but is not limited to, a name of an application under test corresponding to the test script, a name of the service module, and a name of the test script. The feature information corresponding to the recorded test script may be input by the user before the recording starts or after the recording is completed.
Step S203, sending the test script to a server, so that the server sends the test script to one or more second terminal devices currently in an idle state for execution, where the second terminal devices are terminal devices that establish a communication connection with the server by registering device information in the server in advance.
In this embodiment, the server may store the received test script and manage the test script. Specifically, the test script may be managed according to feature information corresponding to the test script, and the test task may be created based on the received test script. The test task may include test requirement information and one or more test scripts. The test requirement information may include test items and test time. The model and the number of the target test device can be specifically determined according to the test items. For example, the test items may include compatibility tests or regression tests, and the like. The test time is a time for controlling the target test apparatus to execute the test script.
And after the test task is determined, acquiring the second terminal equipment in the idle state at present, and selecting one or more second terminal equipment from the second terminal equipment in the idle state at present based on the test requirement information. In a specific application scenario, a user can check test scripts related to the user through registering or logging in a front-end cloud test platform of a server, and create a test task on the cloud test platform based on the test scripts, so that one or more second terminal devices are selected from second terminal devices which are displayed by the cloud test platform and are currently in an idle state.
Of course, in other application scenarios in the embodiments of the present specification, the feature information may further include the test requirement information, and the server may create a test task based on the received test script and the feature information corresponding to the test script, and further select one or more second terminal devices from the second terminal devices currently in the idle state according to the test items included in the corresponding test requirement information and the preset matching rule corresponding to the test items. The preset matching rule may be set according to actual needs, for example, a brand of a mobile phone, an operating system version, a resolution and the like that the selected second terminal device needs to cover may be set in advance for a compatibility test of the mobile phone application software.
Further, the test script included in the test task is sent to the determined one or more second terminal devices currently in the idle state. And the second terminal equipment plays back the received test script to realize the test of the application program to be tested and sends the running result and the log related data to the server.
It will be appreciated that before the test script is sent to the server via the first terminal device, a communication connection between the first terminal device and the server needs to be established. Therefore, the application program testing method provided by the embodiment of the specification further comprises a communication connection step. Specifically, the communication connection step may include: a first terminal device initiates a registration request to the server, wherein the registration request comprises device information of the first terminal device, so that the server stores the device information of the first terminal device in a preset device information base; after receiving the registration request, the server stores the equipment information of the first terminal equipment in a preset equipment information base after passing the verification and feeds back registration success confirmation information to the first terminal equipment; and when the first terminal equipment receives the successful registration confirmation information, establishing communication connection between the first terminal equipment and the server, and displaying the successful registration confirmation information to the user.
In this embodiment, the device information may include an IP address. Optionally, the device information may further include, but is not limited to, model configuration information, for example, the model configuration information may include a brand, a resolution, a memory, and a version of an operating system. Specifically, the embodiment of verifying the registration request may be set according to actual needs, for example, whether the device information in the registration request satisfies a preset registration condition may be verified.
Similarly, the process that the second terminal device establishes the communication connection with the server by registering the device information in the server in advance may specifically include: the second terminal equipment sends a registration request to the server, wherein the registration request comprises equipment information of the second terminal equipment; the server verifies the registration request, acquires the equipment information in the registration request after the verification is passed, adds the equipment information into an equipment information base, and successfully registers the equipment information to the second terminal equipment to confirm the information; and the second terminal equipment establishes communication connection with the server when receiving the registration success confirmation information and displays the registration success confirmation information to the user. Therefore, a user corresponding to the second terminal equipment can establish communication connection with the server only by registering the equipment information of the second terminal equipment to the server through the wireless network when the second terminal equipment is idle, so that the second terminal equipment can be used for testing the application program to be tested and can be used for other purposes in non-cloud testing time, and the equipment availability is greatly improved.
Optionally, in this embodiment of the present specification, the registration request may include, but is not limited to, a user name and a password in addition to the device information, so that a subsequent login operation may be performed through the user name and the password to establish a communication connection with the server.
It is understood that after the communication connection is established between the second terminal device and the server, the server can manage the second terminal device with which the connection is established. At this time, the server may monitor the current state of the second terminal device, and update the preset state information table according to the monitored current state of the second terminal device. And the state information table stores state information corresponding to the second terminal equipment registered to the server. The current state of the second terminal equipment is an idle state or a busy state, and only the second terminal equipment in the idle state can be used for executing the test task.
For example, when the second terminal device is a smart phone, taking the smart phone with an android system as an example, it may be monitored by using the accessitivyserve whether the second user performs a user operation on the second terminal device, such as clicking an operation interface, if so, it indicates that the second terminal device is in a busy state, and if not, it indicates that the second terminal device is in an idle state.
Optionally, the application program testing method provided in the embodiment of the present specification may further include a second testing process in addition to the first testing process, so as to achieve an effect of one-machine multi-control, and a user can conveniently implement testing on the application program to be tested by performing real-time control on the second terminal device. The user can select whether to adopt the first test process or the second test process according to requirements. Specifically, in the second testing process, after the communication connection is established between the first terminal device and the target testing device, the first terminal device controls the target testing device to execute a corresponding second user operation, so as to test the application program to be tested. As shown in fig. 3, the second test procedure may include at least steps S301 to S302:
step S301, detecting whether the user triggers a second preset instruction, and when the user triggers the second preset instruction, establishing a communication connection with a target test device, wherein the target test device comprises one or more second terminal devices which are currently in an idle state.
In an embodiment of the present specification, the second preset instruction is used to start a second test process. For example, the user may trigger the second preset instruction by triggering a button for initiating the second test procedure.
And when the user triggers a second preset instruction, the first terminal equipment enters a second test process. Specifically, the specific implementation process of establishing the communication connection with the target test device may include: acquiring equipment information of target test equipment; and sending a communication connection request to the target test equipment based on the equipment information of the target test equipment so as to establish communication connection with the target test equipment.
As an optional implementation manner, the specific process of acquiring the device information of the target test device may include: sending an equipment information acquisition request to a server; and receiving the device information of the target test device fed back by the server based on the device information acquisition request.
In the implementation process, there are various ways of sending the device information acquisition request to the server, and two of them are listed below for description, but of course, in the implementation process, the two cases are not limited to the following two cases, and in addition, in the case of no conflict, the two cases may be used in combination.
First, an available device list issued by the server may be obtained and displayed, where the available device list includes identification information of a plurality of second terminal devices currently in an idle state. At this time, the user may select one or more second terminal devices from the available device list according to the test requirements. Then, the target test device is determined from the available device list based on a trigger operation of the user on one or more second terminal devices in the available device list. Then, generating an equipment information acquisition request based on the identification information of the target test equipment; and sending the equipment information acquisition request to the server so that the server can search the equipment information of the target test equipment in the equipment information base based on the identification information of the target test equipment and feed back the equipment information of the target test equipment to the first terminal equipment.
In the embodiment of the present specification, the identification information is used to uniquely identify the terminal device that registers the device information in the server, and is specifically set according to actual needs, where the identification information of different terminal devices is different. For example, the identification information may be a name defined by the server for the terminal device based on model configuration information, such as a brand, an operating system, a memory, and a resolution, of the terminal device registered to the server.
Second, the server may group in advance second terminal devices that are registered with the server and currently in an idle state, and generate a group list. Each packet in the packet list includes identification information of one or more second terminal devices currently in an idle state. The specific grouping mode may be set according to actual needs, for example, the grouping may be performed randomly, or the grouping may be performed according to the current test requirements. When the user triggers the second preset instruction, the first terminal device may acquire and display the grouping list from the server, and at this time, the user may select one grouping from the grouping list as a target grouping as needed. Based on a target group selected by the user from the group list, a device information acquisition request is generated and sent to the server. At this time, the second terminal device included in the target packet is the target test device. And the server feeds back the device information of the second terminal device included in the target group to the first terminal device.
Of course, in other embodiments of this specification, the device information of the target test device may also be obtained in other manners, for example, a user may directly add one or more pieces of device information in the first terminal device, and use the second terminal device corresponding to the device information as the target test device.
For example, when the device information of the target test device is acquired, the first terminal device may establish a communication connection with the target test device through a Socket communication protocol. Of course, in other embodiments of the present disclosure, the first terminal device may also use other communication protocols to establish a communication connection with the target testing device.
It is understood that, when the target test device includes a plurality of second terminal devices, the first terminal device needs to send a communication connection request to each of the second terminal devices in the target test device, so as to establish a communication connection with each of the second terminal devices in the target test device.
Step S302, monitoring a second user operation executed by the user on the application program to be tested, and controlling the target test equipment to execute the same operation as the second user operation on the application program to be tested when the second user operation is monitored so as to test the application program to be tested in real time.
For example, when the first terminal device is a smart phone, taking the smart phone with an android system as an example, the accessitivetyserve may be used to monitor a second user operation performed by the user on the application program to be tested through the first terminal device.
And when the target testing equipment finishes the operation, the user executes the next operation on the application program to be tested. For example, when it is monitored that a user downloads an application program to be tested from a specified storage position and installs the downloaded application program to be tested in the first terminal device, the target test device is controlled to download the application program to be tested from the specified storage position and install the downloaded application program to be tested in the target test device; and when the fact that the user triggers the login button of the application program to be tested is monitored, controlling the target test equipment to execute the operation of triggering the login button of the application program to be tested. For example, high-permission operation in a non-Root environment may be implemented by using ADB (Android Debug Bridge), and the target test device is controlled to perform the same operation as the first terminal device.
Specifically, the above process of controlling the target test apparatus to perform the same operation as the second user operation on the application program under test may include: for each second user operation that is heard, performing the steps of: converting the second user operation into a real-time instruction, and sending the real-time instruction to the target testing equipment so that the target testing equipment executes the real-time instruction; and receiving the execution result of the real-time instruction fed back by the target test equipment. The execution result may be complete or incomplete, and for each second terminal device in the target test device, when the real-time instruction is completed, the execution result of the real-time instruction is complete, and when the real-time instruction is not completed, the execution result of the real-time instruction is incomplete.
As an optional implementation, the second testing process may further include: step S303, when detecting a third preset instruction triggered by the user, sending an end instruction to the target testing device to end the test.
The above step S303 is executed after the above step S302, i.e., when the second test procedure needs to be ended. After the test is finished, the target testing device may be controlled to execute an initialization operation, that is, the target testing device may be restored to a state before the test task is executed, for example, the initialization operation may include uninstalling an application installed during the test task and/or deleting related log data generated during the test task.
In a specific application scenario, when a user executes a second test process through a first terminal device, the first terminal device and each second terminal device in a target test device may establish Socket communication connection. As shown in fig. 4, the Socket communication process may specifically include: the first terminal equipment sends a FIND request to the second terminal equipment to apply for establishing connection; the second terminal device returns CONNECT to the host to indicate that connection establishment is confirmed; the first terminal equipment sends ASSIGN setting slave role to the second terminal equipment; the first terminal equipment sends an READIME _ COMMAND message to the second terminal equipment to inform the second terminal equipment to carry out real-time operation, and the second terminal equipment sends the READIME _ RESULT message to the first terminal equipment and returns an execution RESULT; after receiving the READIME _ RESULT message, the first terminal device continues to send the next READIME _ COMMAND message to the second terminal device, and so on until the first terminal device sends the READIME _ FINISH message to the second terminal device, and notifies the second terminal device of finishing the real-time operation.
The application program testing method provided by the embodiment of the specification is greatly convenient for a user to record the testing script and beneficial to simplifying the user operation. In addition, the second terminal device registers the device information to the server to realize communication connection with the server, and compared with a mode of connection through a data line, the device management is more flexible, and the utilization rate of resources is improved.
In a second aspect, an embodiment of the present disclosure provides an application testing method, and this embodiment is an application testing method executed by a second terminal device. Referring to fig. 5, the application testing method provided in the embodiments of the present disclosure at least includes the following steps S501 to S503.
Step S501, sending a registration request to a server, where the registration request includes device information of a second terminal device, so that the server stores the device information in a preset device information base.
Step S502, when receiving the registration success confirmation information fed back by the server based on the registration request, establishing a communication connection between the second terminal device and the server.
It is understood that after the communication connection between the second terminal device and the server is established, the server needs to be able to obtain the current state of the second terminal device in real time so as to distribute the test task to the second terminal device. Therefore, the application program testing method provided by the embodiments of the present specification further includes: monitoring the current state of the second terminal equipment, wherein the current state is an idle state or a busy state; and sending the current state to the server so that the server updates a preset state information table according to the current state, wherein the state information table stores state information corresponding to second terminal equipment registered to the server. The specific implementation process may refer to the corresponding description in the first aspect, and is not described herein again.
Step S503, when receiving the test script corresponding to the application program to be tested and issued by the server, executing the test script.
Specifically, the specific implementation process of steps S501 to S503 may refer to the corresponding description in the first aspect, and is not described herein again.
It is understood that, in the step S503, the second terminal device is used to execute the first test procedure described in the first aspect. After the second terminal device executes the test script, the running result and the related log data corresponding to the test script are obtained, and the running result and the log data are sent to the server, so that the server can display the test result to a user conveniently.
In the embodiment of the specification, the server is in communication connection with the second terminal device for executing the test script through a wireless network, and a user corresponding to the second terminal device can establish communication connection with the server only by registering device information of the second terminal device to the server through the wireless network when the second terminal device is idle, so that the user is controlled by the server to test the application program to be tested, the second terminal device can be used for other purposes in non-cloud testing time, and the device availability is greatly improved.
Optionally, the second terminal device registered to the server may be further configured to perform the second testing procedure described in the first aspect. As shown in fig. 6, the application program testing method provided in the embodiment of the present specification may further include the following steps S601 to S602.
Step S601, when a communication connection request sent by a first terminal device is received, establishing communication connection with the first terminal device based on the communication connection request;
step S602, controlling the second terminal device to execute the same operation as the second user operation monitored by the first terminal device on the application program to be tested, so as to test the application program to be tested in real time.
Specifically, the process of controlling the second terminal device to perform the same operation on the application program to be tested as the second user operation monitored by the first terminal device may include: when a real-time instruction sent by the first terminal equipment is received, controlling the second terminal equipment to execute the real-time instruction and obtaining an execution result of the real-time instruction; and returning the execution result to the first terminal equipment. The specific implementation process may refer to the related description of the first aspect, and is not described herein again.
In order to facilitate the user to obtain the test result of the second test process, optionally, after the controlling the second terminal device to execute the same operation as the operation of the second user monitored by the first terminal device on the application program to be tested, the method further includes: and generating a test result, and sending the test result to the server, so that the server displays the test result to the user. The test result may be determined according to a specific test requirement, for example, the test result may include an interface screenshot, and the screenshot is performed and stored on the operation interface every time the second terminal device performs one operation following the first terminal device, so that the execution condition of each operation performed by the second terminal device following the first terminal device may be obtained.
As an alternative implementation, on the basis of the application program testing method shown in fig. 6, the method may further include: step S603, when receiving the end instruction sent by the first terminal device, ending the test.
Optionally, according to the needs of the actual application scenario, one second terminal device may also be set as a master controller, and the user realizes the test of the application program to be tested in a manner that the slave controller controls the slave by acquiring the device information of the slave to be controlled from the server. At this time, the application program testing method provided in the embodiments of the present specification may further include: when a fourth preset instruction triggered by a user is detected, setting second terminal equipment as a master control machine, and establishing communication connection between the master control machine and a slave machine; and monitoring a third user operation executed by the user on the application program to be tested, and controlling the slave to execute the same operation as the third user operation on the application program to be tested when the third user operation is monitored so as to test the application program to be tested in real time. The slave machine comprises one or more other second terminal devices which register the device information to the server in advance and are in idle states currently. It is understood that the other second terminal device does not include the second terminal device set as the master. Further, when a fifth preset instruction triggered by the user is detected, an ending instruction is sent to the slave machine to end the test.
Specifically, establishing a communication connection between the master controller and the slave may include: sending an equipment information acquisition request to a server so that the server issues equipment information of the slave machine based on the equipment information acquisition request; and receiving the equipment information of the slave machine sent by the server, and sending a communication connection request to the slave machine based on the equipment information of the slave machine so as to establish communication connection with the slave machine.
It should be noted that, the specific implementation process of the second terminal device as the master controller and the implementation process of the user controlling the slave device through the master controller to implement the test on the application program to be tested is similar to the implementation process of the user controlling the target test device through the first terminal device, and reference may be specifically made to the corresponding description in the first aspect, and details are not repeated here.
In the embodiment of the present description, no matter in a manner that a user controls a target test device through a first terminal device, or in a manner that a user sets a second terminal device as a master controller, a test on an application program to be tested is realized in a manner that the master controller controls a slave, a test master controller may not be a designated server any more, and a disaster tolerance capability of device management is improved.
In a third aspect, an embodiment of the present specification provides an application program testing method, and this embodiment is an application program testing method executed by a server. Referring to fig. 7, the application testing method provided in the embodiments of the present disclosure at least includes the following steps S701 to S702.
Step S701, when a test script sent by a first terminal device is received, one or more second terminal devices in an idle state at present are determined based on the test script, wherein the second terminal devices are terminal devices which are in communication connection with a server in advance by sending a registration request to the server;
step S702, sending the test script to the one or more second terminal devices currently in the idle state, so that the second terminal devices execute the test script.
Specifically, the process in which the second terminal device establishes a communication connection with the server by registering device information in the server in advance may specifically include: receiving a registration request sent by second terminal equipment, wherein the registration request comprises equipment information of the second terminal equipment; and verifying the registration request, storing the equipment information in a preset equipment information library when the verification is passed, and feeding back registration success confirmation information to the second terminal equipment so as to establish communication connection between the second terminal equipment and the server.
It is understood that after the communication connection is established between the second terminal device and the server, the server can manage the second terminal device with which the connection is established. At this time, the server may receive the current state fed back by the second terminal device, where the current state is an idle state or a busy state, and update the preset state information table according to the current state of the second terminal device. And the state information table stores state information corresponding to the second terminal equipment registered to the server. It should be noted that only the second terminal device in the idle state can be used to perform the test task. At this time, the server may determine one or more second terminal devices currently in an idle state according to the state information table.
As an alternative embodiment, the server may generate the list of available devices based on the state information table. The available device list comprises a plurality of second terminal devices currently in an idle state. It should be noted that the available device list may be generated in real time when the request sent by the first terminal device is received, and has instantaneity.
Similarly, before the first terminal device sends the test script to the server, the communication connection between the first terminal device and the server needs to be established. Therefore, the application program testing method provided by the embodiments of the present specification further includes: receiving a registration request sent by first terminal equipment, wherein the registration request comprises equipment information of the first terminal equipment; and verifying the registration request, storing the equipment information in a preset equipment information library when the verification is passed, and feeding back registration success confirmation information to the first terminal equipment so as to establish communication connection between the first terminal equipment and the server.
In this embodiment, the device information may include an IP address. Optionally, the device information may further include, but is not limited to, model configuration information, for example, the model configuration information may include a brand, a resolution, a memory, and a version of an operating system.
Optionally, the user may execute the second test procedure according to the first aspect through the first terminal device. When the user executes the second test procedure through the first terminal device, the application program test method provided in the embodiment of the present specification further includes: and when receiving an equipment information acquisition request sent by the first terminal equipment, feeding back equipment information of the target test equipment to the first terminal equipment based on the equipment information acquisition request. The specific implementation process may refer to the corresponding description in the first aspect, and is not described herein again.
Optionally, the user may set a second terminal device as the master controller according to the actual application scenario requirement. At this time, the second terminal device serving as the master requests the server for device information of the slave. In this case, the application program testing method provided in the embodiment of the present specification further includes: and when receiving a device information acquisition request sent by the second terminal device, feeding back device information of the slave to the second terminal device based on the device information acquisition request. The slave machine comprises one or more other second terminal devices which register the device information to the server in advance and are in idle states currently.
The application program testing method provided by the embodiment of the specification is greatly convenient for a user to record the testing script and beneficial to simplifying the user operation. In addition, the second terminal device registers the device information to the server to realize communication connection with the server, and compared with a mode of connection through a data line, the device management is more flexible, and the utilization rate of resources is improved.
In a fourth aspect, based on the same inventive concept as the application program testing method provided in the first aspect, an embodiment of the present specification further provides an application program testing apparatus, where the apparatus provided in this embodiment is operable in a first terminal device. Referring to fig. 8, the application testing apparatus 81 may include:
the first detection module 811 is configured to detect whether a user triggers a first preset instruction;
a script generating module 812, configured to, when it is detected that the user triggers a first preset instruction, monitor a first user operation performed on an application program to be tested by the user through the first terminal device, and generate a test script based on the first user operation;
a first script sending module 813, configured to send the test script to a server, so that the server sends the test script to one or more second terminal devices currently in an idle state for execution, where the second terminal devices are terminal devices that establish a communication connection with the server in advance by registering device information in the server.
As an optional implementation, the application testing apparatus 81 further includes:
a first registration module, configured to initiate a registration request to the server, where the registration request includes device information of the first terminal device, so that the server stores the device information in a preset device information base; and when receiving registration success confirmation information fed back by the server based on the registration request, establishing communication connection between the first terminal equipment and the server.
As an optional implementation, the application testing apparatus 81 further includes:
a second detecting module 814, configured to detect whether the user triggers a second preset instruction, and when the user triggers the second preset instruction, establish a communication connection with a target test device, where the target test device includes one or more second terminal devices currently in an idle state;
the first control module 815 is configured to monitor a second user operation performed by the user on the application program to be tested, and when the second user operation is monitored, control the target test device to perform the same operation as the second user operation on the application program to be tested, so as to test the application program to be tested in real time.
As an alternative embodiment, the second detection module 814 includes: an obtaining submodule 8141, configured to obtain device information of the target test device; the connection sub-module 8142 is configured to send a communication connection request to the target test device based on the device information of the target test device, so as to establish a communication connection with the target test device.
As an optional implementation, the obtaining sub-module 8141 is configured to: sending an equipment information acquisition request to the server; and receiving the equipment information of the target test equipment fed back by the server based on the equipment information acquisition request.
As an optional implementation, the obtaining sub-module 8141 is configured to: acquiring and displaying an available equipment list issued by the server, wherein the available equipment list comprises identification information of a plurality of second terminal equipments in an idle state; determining the target test equipment from the available equipment list based on the triggering operation of the user on one or more second terminal equipment in the available equipment list; and generating a device information acquisition request based on the identification information of the target test device and sending the device information acquisition request to the server.
As an optional implementation, the application testing apparatus 81 further includes: and the first end module is used for sending an end instruction to the target test equipment to end the test when detecting a third preset instruction triggered by the user.
As an optional implementation manner, the first control module 815 is specifically configured to: for each second user operation that is heard, performing the steps of: converting the second user operation into a real-time instruction, and sending the real-time instruction to the target testing equipment so that the target testing equipment executes the real-time instruction; and receiving the execution result of the real-time instruction fed back by the target test equipment.
It should be noted that, the application program testing apparatus 81 provided in the embodiment of the present specification, specific ways in which the respective units perform operations have been described in detail in the method embodiment provided in the first aspect, and will not be described in detail here.
In a fifth aspect, based on the same inventive concept as the application program testing method provided in the second aspect, an embodiment of the present specification further provides an application program testing apparatus, where the apparatus provided in this embodiment is operable in a second terminal device. Referring to fig. 9, the application testing device 82 may include:
a second registration module 821, configured to send a registration request to a server, where the registration request includes device information of a second terminal device, so that the server stores the device information in a preset device information base;
a first connection module 822, configured to establish a communication connection between the second terminal device and the server when receiving registration success confirmation information fed back by the server based on the registration request;
the execution module 823 is configured to execute the test script when receiving the test script corresponding to the application to be tested and sent by the server.
As an optional implementation, the application testing device 82 further includes:
a second connection module 824, configured to, when receiving a communication connection request sent by a first terminal device, establish a communication connection with the first terminal device based on the communication connection request;
the second control module 825 is configured to control the second terminal device to execute the same operation as the second user operation monitored by the first terminal device on the application program to be tested, so as to test the application program to be tested in real time.
As an optional implementation, the application testing device 82 further includes: and the second ending module is used for ending the test when receiving an ending instruction sent by the first terminal equipment.
As an optional implementation manner, the second control module 825 is specifically configured to: when a real-time instruction sent by the first terminal equipment is received, controlling the second terminal equipment to execute the real-time instruction and obtaining an execution result of the real-time instruction; and returning the execution result to the first terminal equipment.
As an optional implementation, the application testing device 82 further includes: and the test result generating module is used for generating a test result and sending the test result to the server so that the server can display the test result to the user.
As an optional implementation, the application testing device 82 further includes:
the state monitoring module is used for monitoring the current state of the second terminal equipment, and the current state is an idle state or a busy state;
and the state sending module is used for sending the current state to the server so that the server updates a preset state information table according to the current state, and the state information table stores state information corresponding to second terminal equipment registered to the server.
As an optional implementation, the application testing device 82 further includes:
the setting module is used for setting the second terminal equipment as a master control machine and establishing communication connection between the master control machine and a slave machine when a fourth preset instruction triggered by a user is detected, wherein the slave machine comprises one or more other second terminal equipment which registers equipment information to the server in advance and is in an idle state currently;
and the third control module is used for monitoring a third user operation executed by the user on the application program to be tested, and controlling the slave to execute the same operation as the third user operation on the application program to be tested when the third user operation is monitored so as to test the application program to be tested in real time.
As an optional implementation, the setting module is configured to: sending an equipment information acquisition request to the server so that the server issues equipment information of a slave machine based on the equipment information acquisition request; and receiving the equipment information of the slave machine sent by the server, and sending a communication connection request to the slave machine based on the equipment information of the slave machine so as to establish communication connection with the slave machine.
As an optional implementation, the application testing device 82 further includes: and the third ending module is used for sending an ending instruction to the slave machine to end the test when a fifth preset instruction triggered by the user is detected.
It should be noted that, the application test apparatus 82 provided in the embodiment of the present specification, the specific manner in which each unit performs the operation has been described in detail in the embodiment of the method provided in the second aspect, and will not be elaborated herein.
In a sixth aspect, based on the same inventive concept as the application program testing method provided in the third aspect, an embodiment of the present specification further provides an application program testing apparatus, where the apparatus provided in this embodiment is operable on a server. Referring to fig. 10, the application testing device 83 may include:
a script receiving module 831, configured to, when receiving a test script sent by a first terminal device, determine, based on the test script, one or more second terminal devices currently in an idle state, where the second terminal devices are terminal devices that have previously established a communication connection with the server by sending a registration request to the server;
a second script sending module 832, configured to send the test script to the one or more second terminal devices currently in an idle state, so that the second terminal devices execute the test script.
As an optional implementation, the application testing device 83 further includes:
a registration request receiving module 833, configured to receive a registration request sent by a second terminal device, where the registration request includes device information of the second terminal device;
a third registration module 834, configured to verify the registration request, store the device information in a preset device information library when the verification passes, and feed back registration success confirmation information to the second terminal device, so as to establish a communication connection between the second terminal device and the server.
As an optional implementation, the application testing device 83 further includes:
the state receiving module is used for receiving the current state fed back by the second terminal equipment, and the current state is an idle state or a busy state;
and the state updating module is used for updating a preset state information table according to the current state, and the state information table stores state information corresponding to second terminal equipment registered to the server.
As an optional implementation, the application testing device 83 further includes: and the list generating module is used for generating an available equipment list based on the state information table, wherein the available equipment list comprises a plurality of second terminal equipment which are currently in an idle state.
It should be noted that, the application program testing apparatus 83 provided in the embodiment of the present specification, specific ways in which the respective units perform operations have been described in detail in the method embodiment provided in the third aspect, and will not be described in detail here.
In a seventh aspect, based on the same inventive concept, as shown in fig. 11, an embodiment of this specification further provides a cloud test system 90, including: a server 91, a first terminal device 92 and one or more second terminal devices 93.
The first terminal device 92 is configured to detect whether a user triggers a first preset instruction; when detecting that the user triggers a first preset instruction, monitoring a first user operation executed by the user on an application program to be tested through the first terminal equipment, and generating a test script based on the first user operation; sending the test script to a server 91;
the server 91 is used for determining one or more second terminal devices 93 which are currently in an idle state based on the test script; sending the test script to the one or more second terminal devices 93 currently in an idle state; the second terminal device 93 is a terminal device that establishes a communication connection with the server 91 by sending a registration request to the server 91 in advance;
and the second terminal device 93 is configured to execute the test script when receiving the test script corresponding to the application program to be tested.
It should be noted that, in the cloud testing system 90 provided in this embodiment of the present disclosure, the first terminal device 92 is configured to execute the application testing method provided by the first aspect, the second terminal device 93 is configured to execute the application testing method provided by the second aspect, and the server 91 is configured to execute the application testing method provided by the third aspect, and specific implementation and generated technical effects are the same as those in the foregoing method embodiment, and for brief description, corresponding contents in the foregoing method embodiment may be referred to where this embodiment is not mentioned.
In an eighth aspect, based on the same inventive concept, the present invention further provides an electronic device, as shown in fig. 12, comprising a memory 904, one or more processors 902, and a computer program stored on the memory 904 and executable on the processors 902. The steps of the application testing method provided in the first aspect above or the application testing method provided in the second aspect above or the application testing method provided in the third aspect above are implemented when the computer program is executed by the processor 902.
Where in fig. 12 a bus architecture (represented by bus 900), bus 900 may include any number of interconnected buses and bridges, and bus 900 links together various circuits including one or more processors, represented by processor 902, and memory, represented by memory 904. The bus 900 may also link together various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. A bus interface 905 provides an interface between the bus 900 and the receiver 901 and transmitter 903. The receiver 901 and the transmitter 903 may be the same element, i.e., a transceiver, providing a means for communicating with various other apparatus over a transmission medium. The processor 902 is responsible for managing the bus 900 and general processing, and the memory 904 may be used for storing data used by the processor 902 in performing operations.
It will be appreciated that the configuration shown in fig. 12 is merely illustrative and that the electronic device described above may also include more or fewer components than shown in fig. 12 or have a different configuration than shown in fig. 12. The components shown in fig. 12 may be implemented in hardware, software, or a combination thereof.
In a ninth aspect, based on the same inventive concept as the application program testing method in the embodiment provided in the foregoing first aspect, the present invention further provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, realizes the steps of the application program testing method provided in the foregoing first aspect.
Tenth aspect, based on the same inventive concept as the application program testing method in the embodiment provided in the foregoing second aspect, the present invention also provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, realizes the steps of the application program testing method provided in the foregoing second aspect.
In an eleventh aspect, based on the same inventive concept as the application program testing method in the embodiment provided in the foregoing third aspect, the present invention further provides a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the steps of the application program testing method provided in the foregoing third aspect.
The description has been presented with reference to flowchart illustrations and/or block diagrams of methods, apparatus, and computer program products according to embodiments of the description. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present specification have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all changes and modifications that fall within the scope of the specification.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present specification without departing from the spirit and scope of the specification. Thus, if such modifications and variations of the present specification fall within the scope of the claims of the present specification and their equivalents, the specification is intended to include such modifications and variations.