Terminal testing method and device, production line machine table, terminal and storage medium
By adopting socket communication and unified instruction format in terminal testing, the communication efficiency and readability of ADB and MMI instructions in terminal testing in the prior art are solved, and the efficiency and maintainability of terminal testing are improved.
Patent Information
- Application Number
- CN202311331148.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-13
- Publication Date
- 2025-04-15
AI Technical Summary
In the prior art, in terminal testing, ADB instructions have good readability but low communication efficiency. Although MMI instructions have high communication efficiency but poor readability, and it is difficult to ensure the readability of instructions and feedback of error information during the test.
By establishing a socket communication connection between the production line machine and the terminal to be tested, a unified instruction format is adopted when sending and receiving test requests and responses, ensuring that the ADB and MMI test requests and responses in the test requests and responses are in a unified instruction format.
It improves the communication efficiency of terminal testing, simplifies the maintenance of the test process, avoids multiple transfers of instructions, and enhances the readability of test results and feedback of error information.
Smart Images

Figure CN119829337A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of terminal testing technology, and in particular to a terminal testing method, device, production line machine, terminal and storage medium. Background Art
[0002] In order to ensure the availability of terminal functions, terminals need to undergo a series of tests before leaving the factory.
[0003] In the related art, the test of the terminal includes ADB (Android Debug Bridge) test and MMI (Multi Media Interface) test. Summary of the invention
[0004] The embodiment of the present application provides a terminal testing method, device, production line machine, terminal and storage medium. The technical solution is as follows:
[0005] On the one hand, an embodiment of the present application provides a terminal testing method, which is used for a production line machine, and the method includes:
[0006] Obtain the terminal IP (Internet Protocol) of the terminal to be tested;
[0007] Establishing a socket communication connection with the terminal to be tested based on the terminal IP;
[0008] Sending a test request to the terminal to be tested through the socket communication connection, wherein the test request includes at least one of an ADB test request and an MMI test request, and the ADB test request and the MMI test request adopt a unified instruction format;
[0009] A test response sent by the terminal to be tested is received through the socket communication connection, wherein the test response includes at least one of an ADB test response and an MMI test response, and the ADB test response and the MMI test response adopt a unified instruction format.
[0010] On the other hand, an embodiment of the present application provides a terminal testing method, which is used for a terminal to be tested, and the method includes:
[0011] Establishing a socket communication connection with a production line machine, wherein the socket communication connection is established by the production line machine based on the terminal IP of the terminal to be tested;
[0012] Receiving a test request sent by the production line machine through the socket communication connection, the test request including at least one of an ADB test request and an MMI test request, and the ADB test request and the MMI test request adopt a unified instruction format;
[0013] A test response is sent to the terminal to be tested through the socket communication connection, wherein the test response includes at least one of an ADB test response and an MMI test response, and the ADB test response and the MMI test response adopt a unified instruction format.
[0014] On the other hand, an embodiment of the present application provides a terminal testing device, the device comprising:
[0015] An acquisition module is used to obtain the terminal IP of the terminal to be tested;
[0016] A connection module, used to establish a socket communication connection with the terminal to be tested based on the terminal IP;
[0017] A sending module, used for sending a test request to the terminal to be tested through the socket communication connection, wherein the test request includes at least one of an ADB test request and an MMI test request, and the ADB test request and the MMI test request adopt a unified instruction format;
[0018] The receiving module is used to receive a test response sent by the terminal to be tested through the socket communication connection, wherein the test response includes at least one of an ADB test response and an MMI test response, and the ADB test response and the MMI test response adopt a unified instruction format.
[0019] On the other hand, an embodiment of the present application provides a terminal testing device, the device comprising:
[0020] A connection module, used to establish a socket communication connection with a production line machine, wherein the socket communication connection is established by the production line machine based on the terminal IP of the terminal to be tested;
[0021] A receiving module, configured to receive a test request sent by the production line machine through the socket communication connection, wherein the test request includes at least one of an ADB test request and an MMI test request, and the ADB test request and the MMI test request adopt a unified instruction format;
[0022] The sending module is used to send a test response to the terminal to be tested through the socket communication connection, wherein the test response includes at least one of an ADB test response and an MMI test response, and the ADB test response and the MMI test response adopt a unified instruction format.
[0023] On the other hand, an embodiment of the present application provides a production line machine, which includes a processor and a memory; the memory stores at least one instruction, and the at least one instruction is used to be executed by the processor to implement the terminal testing method described in the above aspect.
[0024] On the other hand, an embodiment of the present application provides a terminal, which includes a processor and a memory; the memory stores at least one instruction, and the at least one instruction is used to be executed by the processor to implement the terminal testing method described in the above aspect.
[0025] On the other hand, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores at least one instruction, and the instruction is loaded and executed by a processor to implement the terminal testing method as described in the above aspects.
[0026] On the other hand, an embodiment of the present application provides a computer program product, which includes computer instructions, which are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the terminal testing method provided in the above aspect.
[0027] In the embodiment of the present application, during the process of the production line machine testing the terminal to be tested, the test request adopts a unified instruction format, and the test response also adopts a unified instruction format. Compared with the testing method that does not adopt a unified format, the instructions in a unified format are conducive to the maintenance of the test process. The production line machine and the terminal to be tested can communicate directly through the socket, avoiding multiple transfers of instructions, improving communication efficiency, and thereby improving terminal testing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0029] Figure 1 A schematic diagram of an implementation environment provided by an exemplary embodiment of the present application is shown;
[0030] Figure 2 A flowchart of a terminal testing process provided by an exemplary embodiment of the present application is shown;
[0031] Figure 3A flowchart of a terminal testing process on a production line machine side provided by an exemplary embodiment of the present application is shown;
[0032] Figure 4 A schematic diagram of a production line tool process structure of a production line machine provided by an exemplary embodiment of the present application is shown;
[0033] Figure 5 An example diagram of a call request provided by an exemplary embodiment of the present application is shown;
[0034] Figure 6 is a schematic diagram of a unified instruction format of a test request shown in an exemplary embodiment of the present application;
[0035] Figure 7 is a schematic diagram of a unified instruction format of a test response shown in an exemplary embodiment of the present application;
[0036] Figure 8 is an example diagram of a test request and a corresponding test response shown in an exemplary embodiment of the present application;
[0037] Fig. 9 It is a schematic diagram of an implementation of a production line machine side terminal testing process provided by an exemplary embodiment of the present application;
[0038] Fig.10 A flowchart of a terminal testing process on a terminal side to be tested provided by an exemplary embodiment of the present application is shown;
[0039] Fig.11 It is a schematic diagram of the process structure of a working model of a terminal to be tested provided by an exemplary embodiment of the present application;
[0040] Fig.12 It is a schematic diagram of an implementation of a terminal side terminal testing process provided by an exemplary embodiment of the present application;
[0041] Fig.13 A structural block diagram of a terminal testing device provided by an exemplary embodiment of the present application is shown;
[0042] Fig.14 A structural block diagram of a terminal testing device provided by another exemplary embodiment of the present application is shown;
[0043] Fig.15 A schematic diagram of the structure of a production line machine provided by an exemplary embodiment of the present application is shown;
[0044] Fig.16 A schematic diagram of the structure of a terminal provided by an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION
[0045] 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 with reference to the accompanying drawings.
[0046] In the related technology, during the testing of the terminal to be tested by the production line machine, the production line machine first connects to the terminal to be tested, then starts the MMI service through the ADB command to establish a socket connection, and then sends the MMI command to the terminal to be tested. After the terminal to be tested completes the test, the production line machine receives the test results sent by the terminal to be tested, and determines the test results of the terminal to be tested through analysis and processing.
[0047] ADB instructions have good readability and can return error information when the request fails. However, in order to use ADB instructions, the production line machine needs to configure the ADB usage environment separately, and the call of ADB instructions needs to be transferred multiple times between multiple processes, resulting in low communication efficiency. Although MMI instructions communicate based on socket connections and have good communication efficiency, MMI instructions have poor readability and will not return error information when the MMI instruction request fails. In addition, the call of MMI instructions depends on the ADB instruction to start, and the ADB instruction is required to forward the TCP (Transmission Control Protocol) port data of the production line machine to the port of the terminal to be tested.
[0048] It can be seen that the related art has the disadvantages of not being able to simultaneously ensure that the instructions are readable, return error information, and have high communication efficiency. The present application aims to solve the above problems, while taking into account instruction readability and error information feedback, and improving communication efficiency.
[0049] Please refer to Figure 1 , which shows a schematic diagram of an implementation environment provided by an exemplary embodiment of the present application. The implementation environment at least includes: a production line machine 101 and a device to be tested 102, and the production line machine 101 and the device to be tested 102 are connected via an AP (Access Point, wireless access node) 103.
[0050] The production line machine 101 is used to perform automated testing on the terminal to be tested, which may be a computer device, a production control tool, etc. The production line machine 101 sends a test request to the terminal to be tested 102, then receives a test response sent by the terminal to be tested 102, and obtains a test result by parsing the test response.
[0051] The terminal to be tested 102 is a terminal device that needs to be tested after production, such as a mobile phone device. After receiving the test request sent by the production line machine 101, the terminal to be tested calls the internal process test calibration and then sends a test response to the production line machine 101.
[0052] Before the production line machine 101 tests the terminal to be tested 102 , the production line machine 101 and the terminal to be tested 102 need to be connected to the same AP.
[0053] The production line machine 101 and the device to be tested 102 are connected to AP103 through a wireless network formed by AP103, and AP103 is connected to a wired network through a switch 104. Since one AP can connect multiple terminals to be tested and production line machines, the production line machine 101 can test multiple terminals to be tested.
[0054] In the following embodiments, the application of the terminal testing method to a production line machine 101 and a device to be tested 102 is taken as an example for description.
[0055] See also Figure 2 , which shows a flow chart of a terminal testing method provided by an exemplary embodiment of the present application. The method may include the following steps.
[0056] Step 201: The production line machine obtains the terminal IP address of the terminal to be tested.
[0057] Since the AP can connect to multiple production line machines and terminals to be tested, in order to select the terminal to be tested for automated testing, the production line machine needs to obtain the terminal IP of the terminal to be tested.
[0058] Since there may be multiple APs near the production line machine and the terminal to be tested, in order to improve communication efficiency, in one possible implementation, the terminal to be tested selects the AP with the strongest signal to connect to, and then the terminal to be tested displays a QR code containing IP information, and the production line machine obtains the IP information of the terminal to be tested by scanning the QR code of the terminal to be tested.
[0059] Step 202: The production line machine establishes a socket communication connection with the terminal to be tested based on the terminal IP.
[0060] Step 203 , the terminal to be tested establishes a socket communication connection with the production line machine, and the socket communication connection is established by the production line machine based on the terminal IP of the terminal to be tested.
[0061] The socket communication connection is used to realize the network communication between the internal program of the production line machine and the internal program of the terminal to be tested, wherein the internal program of the production line machine acts as the client and the internal program of the terminal to be tested acts as the server, and the two transmit data by creating and using sockets.
[0062] In some possible implementations, the internal program of the production line machine sends a connection request to the internal program of the terminal to be tested corresponding to the terminal IP, and the terminal to be tested establishes a socket connection with the production line machine after monitoring the connection request sent by the production line machine.
[0063] Step 204: The production line machine sends a test request to the terminal to be tested through a socket communication connection. The test request includes at least one of an ADB test request and an MMI test request, and the ADB test request and the MMI test request use a unified instruction format.
[0064] The test request is used to guide the terminal to be tested to perform automated testing. After the socket communication connection is established, the production line machine transmits the test request to the terminal to be tested in the form of a socket.
[0065] In some embodiments, the client program of the production line machine sends a test request in a unified instruction format to the server program of the terminal to be tested through a socket communication connection.
[0066] Among them, test requests can include the following six types.
[0067] 1. Get request, used to obtain the status information, flags, and basic information of the terminal to be tested.
[0068] 2. Update request, used to update the status information, flags, and basic information of the terminal to be tested.
[0069] 3. Push request, used to push files or other resources to the terminal to be tested.
[0070] 4. Pull request, used to obtain files or other resources from the terminal to be tested.
[0071] 5. Delete request, used to delete files or other resources of the terminal to be tested.
[0072] 6. OPT request, used to control the terminal to be tested to perform test operations, such as controlling the terminal to be tested to turn on the flashlight.
[0073] Step 205: The terminal to be tested receives a test request sent by the production line machine through a socket communication connection. The test request includes at least one of an ADB test request and an MMI test request, and the ADB test request and the MMI test request use a unified instruction format.
[0074] Step 206: The terminal to be tested sends a test response to the production line machine through a socket communication connection. The test response includes at least one of an ADB test response and an MMI test response, and the ADB test response and the MMI test response use a unified instruction format.
[0075] The test response is used to feed back the test results to the production line machine. After the socket communication connection is established, the terminal to be tested transmits the test response to the production line machine in the form of a socket.
[0076] In some embodiments, the server program of the terminal to be tested sends a test response in a unified instruction format to the client program of the production line machine through a socket communication connection.
[0077] Corresponding to the test request, the test response may also include six types, namely, get response, update response, push response, pull response, delete response and opt response.
[0078] Step 207: The production line machine receives a test response sent by the terminal to be tested through a socket communication connection. The test response includes at least one of an ADB test response and an MMI test response, and the ADB test response and the MMI test response use a unified instruction format.
[0079] To sum up, in the embodiment of the present application, during the test of the terminal to be tested by the production line machine, the test request adopts a unified instruction format, and the test response also adopts a unified instruction format. Compared with the test method that does not adopt a unified format, the instructions in a unified format are conducive to the maintenance of the test process. The production line machine and the terminal to be tested can communicate directly through the socket, avoiding multiple transfers of instructions, improving communication efficiency, and thereby improving terminal testing efficiency.
[0080] In the above embodiment, the steps with the production line machine as the execution subject can be independently implemented as the terminal testing method on the production line machine side, and the steps with the terminal to be tested as the execution subject can be independently implemented as the terminal testing method on the terminal to be tested side. The terminal testing process on the production line machine side is described below.
[0081] See also Figure 3 , which shows a flow chart of a production line machine side terminal testing process provided by an exemplary embodiment of the present application. The method includes the following steps.
[0082] Step 301: Obtain the terminal IP of the terminal to be tested.
[0083] The implementation of this step may refer to the above step 201, and this embodiment will not be described in detail here.
[0084] Step 302: Establish a socket communication connection with the terminal to be tested based on the terminal IP.
[0085] The production line tool process of the production line machine runs a production line tool program and a communication protocol client. The production line machine establishes a socket communication connection with the terminal to be tested based on the production line tool program and the communication protocol client. For example, the schematic diagram of the production line tool process is as follows: Figure 4As shown, on the production line machine 401 with an IP address of 10.192.149.01, a production line tool program named production line tool.exe and a communication protocol client named ofcp.dll are running in the production line tool process 402.
[0086] This step may include the following sub-steps.
[0087] Step 302A, creating a communication thread based on the terminal IP, and randomly assigning a machine port to the communication thread, wherein different terminal IPs correspond to different communication threads, and different communication threads correspond to different machine ports.
[0088] In a possible implementation, after obtaining the terminal IP, the production line machine creates a communication thread corresponding to the terminal IP through the production line tool program, and then the communication protocol client allocates a different machine port to each communication thread to establish a socket communication connection with the terminal to be tested.
[0089] For example, Figure 4 As shown, after receiving the IP address 10.192.149.81 of the terminal 1 to be tested and the IP address 10.192.149.90 of the terminal 2 to be tested, the production line tool.exe creates communication thread 1 and communication thread 2 respectively, and then ofcp.dll allocates random machine port 487678 to communication thread 1 and random machine port 573875 to communication thread 2.
[0090] Step 302B: Based on the machine IP and the machine port, a socket communication connection is established with the terminal to be tested through a communication thread.
[0091] Since different terminals to be tested have different terminal IPs, different terminals to be tested correspond to different communication threads, and the production line machine can establish socket communication connections with multiple terminals to be tested.
[0092] For example, Figure 4 As shown, the machine IP of production line machine 401 is 10.192.149.01, ofcp.dll allocates random machine port 487678 for communication thread 1, and establishes a socket communication connection with terminal 1 to be tested, and ofcp.dll allocates random machine port 573875 for communication thread 2, and establishes a socket communication connection with terminal 2 to be tested.
[0093] Step 303: The production line tool program sends a call request to the communication protocol client, where the call request is used to request to call the communication protocol client to perform terminal testing.
[0094] In a possible implementation, the production line tool program sends a call request to the communication protocol client by way of a function call, thereby requesting to call the communication protocol client to perform a terminal test.
[0095] Optionally, the production line tool program may include an instruction configuration module, a process control module and an interface.
[0096] In one possible implementation, the production line tool program performs instruction configuration through an instruction configuration module, then reads instructions through a process control module, then writes instructions to an interface, encapsulates communication instructions, obtains a call request, and then sends the call request to a communication protocol client.
[0097] Optionally, the call request may include three parts: request type, instruction name and parameter list. For example, Figure 5 , shows a call request to obtain the configuration file AeAfParam.xml from the terminal to be tested. In which, pull is the request type, configurations is the instruction name, from is the parameter name of the first parameter, the string after the equal sign is the value of the from parameter, indicating the path to obtain the configuration file, to is the parameter name of the second parameter, and the parameter value after the equal sign indicates the destination path of the configuration file.
[0098] Since the request type, instruction name, and parameter name of the call request are all named in the form of English words with specific semantics, the call request has good readability and easy configuration.
[0099] Step 304: The communication protocol client generates a test request in a unified instruction format based on the call request.
[0100] Optionally, the communication protocol client may include three parts: data parsing, scheduling planning and interface.
[0101] In a possible implementation, the communication protocol client first receives a call request through an interface, and then performs data analysis on the call request. After the data analysis, the analysis result is written to the interface for encapsulation, and then the communication protocol client sends a test request in a unified instruction format to the terminal to be tested. The scheduling planning part of the communication protocol client is used to deal with abnormal situations and reduce false detection.
[0102] Optionally, the unified instruction format of the test request may include a request type field, a request instruction field, and a request data field.
[0103] The request type field is used to indicate the request type of the test request. For example, when the request type field value is 0x3, the test request type is MMI_COMMAND_REQUEST.
[0104] The request instruction field is used to indicate the request instruction used by the test request under the request type. For example, when the request instruction field takes a value of 0x2, it indicates that the request instruction is MMI_SW_VERSION.
[0105] It should be noted that the request type field and the request instruction field jointly determine the test operations to be performed and the data content to be carried during the test process.
[0106] The request data field is used to indicate the request content of the request instruction. The request content of the request instruction is determined according to the specific situation.
[0107] In addition, the unified instruction format of the test request may also include a flag field, a protocol version field, and a metadata field. Among them, the flag field is used to mark that the test request adopts the unified instruction format, for example, OFCP\0 is used to indicate that the test response adopts the unified instruction format in the embodiment of the present application, the protocol version field is used to record the version of the unified instruction format used by the test request, for example, 0x1 is used to indicate that the protocol followed by the unified instruction format is the initial version, and the metadata field is used to describe the characteristics of the request data field, which may include a timestamp and a checksum, for example, the timestamp may be expressed as {timestamp:168984}.
[0108] For example, the unified instruction format of the test request is as follows: Figure 6 As shown, the test request includes three parts: fixed-length control data, variable-length metadata and variable-length actual data. The control data includes a flag field, a protocol version field, a request type field, a request instruction field, a frame header length and a data frame length. The metadata includes a header field name and a field value. The actual data includes a request data field.
[0109] It should be noted that each field in the test request is represented by a numerical value and a character. Although the instruction can be directly transmitted through the socket communication connection, which improves the communication efficiency, the instruction lacks readability. In the embodiment of the present application, the readability of the instruction and the error feedback are mainly realized by calling the request.
[0110] Step 305: The communication protocol client sends a test request to the terminal to be tested through a socket communication connection.
[0111] After establishing the socket communication connection, the communication protocol client transmits the test response to the terminal to be tested in the form of a socket.
[0112] During the test of the terminal by the production line machine, the test communication between the production line machine and the terminal to be tested may be abnormal due to software problems, causing misdetection events. In order to ensure the stability of communication and reduce the possibility of misdetection, the communication protocol client can perform timeout resend requests and disconnection reconnection.
[0113] Regarding the timeout resend request, in a possible implementation, if the communication protocol client does not receive a test response within the target time after sending the test request, the communication protocol client resends the test request to the terminal to be tested through the socket communication connection. For example, if the communication protocol client does not receive a test response within 1000ms after sending the test request, it resends the test request to the terminal to be tested after 1000ms, and then waits for the terminal to be tested to send a test response.
[0114] Optionally, the production line machine can automatically determine the target time that the communication protocol client waits for a test response.
[0115] In one possible implementation, the communication protocol client first determines the maximum test duration of the function to be tested based on the function to be tested indicated by the call request, and then determines the target duration based on the maximum test duration, wherein the target duration is greater than or equal to the maximum test duration.
[0116] For example, function 1 requires a test duration of 1000ms, function 2 requires a test duration of 100ms, and function 3 requires a test duration of 2000ms. The maximum test duration is 2000ms, so the target duration can be 2000ms or greater. This ensures that the timeout retransmission function of the communication protocol client is implemented while ensuring that the functional test duration is sufficient.
[0117] The disconnection and reconnection function of the communication protocol client can realize re-establishing the socket communication connection when the socket communication connection is disconnected. The disconnection and reconnection can include the following sub-steps.
[0118] 1. The communication protocol client monitors the connection status of the socket communication connection.
[0119] In a possible implementation, the communication protocol client continuously sends a simple communication packet to the terminal to be tested based on a fixed time interval, and if the communication protocol client can receive a corresponding response from the terminal to be tested within a certain period of time, the communication protocol client determines that the current connection state is normal. If the communication protocol client fails to receive a corresponding response from the terminal to be tested within a certain period of time, the communication protocol client can determine that the socket communication connection is in a disconnected state, and then re-establish the socket communication connection.
[0120] 2. When the disconnection command sent by the production line tool program is not received and the socket communication connection is detected to be disconnected, the communication protocol client reconnects the socket communication connection with the terminal to be tested.
[0121] Generally, after the test is completed, the production line tool program disconnects the socket by sending a disconnect command to the terminal to be tested.
[0122] If the disconnection command sent by the production line tool program is not received and the socket communication connection is detected to be disconnected, the socket communication connection may be disconnected due to unstable connection. In this case, the communication protocol client can resend the connection request to the terminal to be tested to establish the socket communication connection.
[0123] In addition, the communication protocol client can also track the testing process of the production line machines by printing records at embedded points.
[0124] In one possible implementation, the communication protocol client collects and records key data during the test process by calling specific codes. In the event of a test abnormality, the production line machine can analyze the cause of the error by tracking the buried data.
[0125] Step 306: The communication protocol client receives a test response sent by the terminal to be tested through a socket communication connection.
[0126] In one possible implementation, the test response is sent to the corresponding port of the production line machine in the form of a socket, and then the communication protocol client determines the terminal to be tested corresponding to the test response based on the port number of the machine receiving the test response, thereby completing the reception of the test response for the specific terminal to be tested.
[0127] Step 307: The communication protocol client parses the test response based on the unified instruction format adopted by the test response to obtain a test result.
[0128] Optionally, the unified instruction format used by the test response may include a response type field, a response instruction field, a test result field, an error code field, and a response data field.
[0129] The response type field is used to indicate the response type of the test response. For example, when the response type field value is 0x4, the response type is MMI_COMMAND_RESPONSE.
[0130] The response instruction field is used to indicate the response instruction used for the test response under the response type. For example, when the response instruction field takes a value of 0x2, it means that the response instruction is MMI_SW_VERSION.
[0131] The test result field is used to indicate the execution result of the test request. For example, when the test result field value is 0x0, it indicates that the execution is successful, when it is 0x1, it indicates that the execution fails, and when it is 0x2, it indicates that an undefined result occurs, or the terminal to be tested does not support the test request sent by the production line machine.
[0132] The error code field is used to indicate the error type when the execution fails. For example, when the error code value is 0x1, it means that the relevant test file does not exist.
[0133] The response data field is used to indicate the response content of the response instruction. Generally, the content of the response data field is consistent with the content requested by the request data field.
[0134] In addition, the unified instruction format of the test response may also include a flag field, a protocol version field, and a metadata field. Among them, the flag field is used to mark that the test request adopts the unified instruction format. For example, OFCP\0 is used to indicate that the test response adopts the unified instruction format in the embodiment of the present application. The protocol version field is used to record the version of the unified instruction format used by the test request. For example, 0x1 is used to indicate that the protocol followed by the unified instruction format is the initial version. The metadata field is used to describe the characteristics of the request data field, including a timestamp and a checksum. For example, the timestamp can be expressed as {timestamp:168984}.
[0135] Exemplarily, the unified instruction format of the test response is as follows: Figure 7 As shown, it includes control data of fixed length, metadata of variable length and actual data of variable length, wherein the control data includes a flag field, a protocol version field, a response type field, a response instruction field, a test result field, an error code field, a frame header length, and a data frame length; the metadata includes a header field name and a field value; and the actual data includes a response data field.
[0136] Taking obtaining the configuration file AeAfParam.xml from the terminal to be tested as an example, the communication protocol client sends a test request in a unified instruction format to the terminal to be tested through a socket communication connection, and then receives a corresponding test response in the unified instruction format.
[0137] See also Figure 8, shows the test request and corresponding test response for obtaining the configuration file AeAfParam.xml from the terminal to be tested. Among them, the request type of the test request is PULL_REQUEST, the request instruction is CONFIGURATION, and the request content is / sdcard / camera_sfr / AeAfParam.xml. In the corresponding test response, the response type is PULL_RESPONSE, the response instruction is CONFIGURATION, the execution result is 0, the error code is 0, indicating that the test is successful, and the response content is the string shown in the Data data.
[0138] In addition, the metadata of the test request is NULL. The metadata of the test response includes the total field, the current field, and the contenttype field. The contenttype field is used to describe the type of data being transmitted, assisting the production line machine and the terminal to be tested in data parsing. The total field and the current field are used to identify the total file size and the offset of the currently transmitted data in the file when there is a lot of data being transmitted in segments.
[0139] Step 308: The communication protocol client feeds back the test results to the production line tool program.
[0140] After the communication protocol client receives the test response, the communication protocol client may send a call response to the production line tool program, thereby feeding back the test result to the production line tool program.
[0141] Optionally, in order to make the call response more readable, the call response can record information in json format, where, if the request is successful, the call response indicates that the request is successful and returns the request result; if the request fails, the call response returns the error type and the reason for the error.
[0142] Exemplarily, the call response may include two fields. If the request is successful, the call response includes a code field and a data field, where the code field content is "ok" indicating that the request is successful, and the data field content is the returned request result. If the request fails, the call response includes a code field and a message field, where the code field content is the error type, and the message field content is the specific error reason returned.
[0143] Optionally, the production line tool program may also include a log printing module and a result display module.
[0144] In a possible implementation, the communication protocol client sends a call response to the production line tool program, the production line tool program receives the call response through the interface, and then returns the test results for result display and log printing.
[0145] Indicative, Fig. 9 The implementation diagram of the terminal test process on the production line machine side is shown. The production line tool.exe first configures the instructions, and then writes the interface through the process control module instructions. The production line tool.exe sends a call request to ofcp.dll through a function call. ofcp.dll receives the call request through the interface and then performs data analysis on the call request. The scheduling planning part of ofcp.dll can perform busy control on the data parsing process.
[0146] After the data is parsed, ofcp.dll transmits the test request in the form of a socket to the terminal to be tested through the interface. Since communication anomalies may occur during the communication process, ofcp.dll can handle the anomalies, including resending the test request after a timeout, reconnecting after a socket interruption, and recording data through embedded point printing.
[0147] After the terminal to be tested returns the test response, it is received by the interface of ofcp.dll and the test response is parsed. Then, ofcp.dll sends a call response containing the test result to the production line tool.exe through the interface. After the production line tool.exe receives the call response through the interface, it prints the log and displays the result according to the test result.
[0148] In the embodiment of the present application, in the production line machine, the production line tool program sends a call request to the communication protocol client to call the communication protocol client to generate a test request using a unified instruction format, and then sends it to the terminal to be tested. After receiving the test response sent by the terminal to be tested, the communication protocol client feeds back the test result to the production line tool program through data analysis, during which the transfer level of the instruction is reduced and the transmission efficiency of the instruction is improved.
[0149] See also Fig.10 , which shows a flow chart of a terminal test process on the terminal side to be tested provided by an exemplary embodiment of the present application. A communication protocol server and a test tool are running in the industrial model process of the terminal to be tested, so the terminal test process on the terminal side to be tested includes the following steps.
[0150] Step 1001, establish a socket communication connection with a production line machine, where the socket communication connection is established by the production line machine based on the terminal IP of the terminal to be tested.
[0151] The communication protocol server and the test tool are running in the process of the terminal to be tested. The communication protocol server is used to perform socket communication with the communication protocol client in the process of the production line tool. The test tool is used to execute the test function.
[0152] For example, Fig.11 As shown, the communication protocol server ofcp1.jar and test tool 1 are running in the industrial model process 1 of the terminal 1 to be tested, and the communication protocol server ofcp2.jar and test tool 2 are running in the industrial model process 2 of the terminal 2 to be tested. The IP address of the terminal 1 to be tested is 10.192.149.81, and the IP address of the terminal 2 to be tested is 10.192.149.90. The terminal 1 to be tested establishes a socket communication connection with the production line machine through ofcp1.jar, and the terminal 2 to be tested establishes a socket communication connection with the production line machine through ofcp2.jar. ofcp1.jar and ofcp2.jar communicate with the production line machine through the same fixed port 54654.
[0153] Step 1002: The communication protocol server parses the test request based on the unified instruction format adopted by the test request to obtain the content to be tested.
[0154] Optionally, the work performed within the communication protocol server may include data parsing.
[0155] In one possible implementation, after receiving a test request through an interface, the communication protocol server parses the test request in a unified instruction format, obtains the content representing the test operation and test data in the test request, such as the request type, request instruction, and request content, and obtains the content to be tested.
[0156] Step 1003: The communication protocol server calls a test tool based on the content to be tested to perform a test and obtain a test result.
[0157] Optionally, the work performed inside the communication protocol server may also include task scheduling. The test tool may include status acquisition services and device calibration services.
[0158] In a possible implementation, after obtaining the content to be tested, the communication protocol server calls a corresponding service in the test tool, such as a device calibration service, according to the content to be tested, to complete the test and obtain the test result.
[0159] Step 1004: The communication protocol server generates a test response in a unified instruction format based on the test result.
[0160] In one possible implementation, the communication protocol server writes the test result into the test result field of the unified instruction format by encoding, and generates a test response in the unified instruction format by combining error information, response data, response type, response instruction and other information.
[0161] Optionally, the work of the communication protocol server may also include service registration. The service registration is used to register the test service, and the registered test service supports being called by the communication protocol server. The communication protocol server may manage the service through the task scheduling function.
[0162] Optionally, the communication protocol server can also perform embedded printing of task scheduling events to record clues of task scheduling in order to track the test process.
[0163] Step 1005 : Send a test response to the terminal to be tested through a socket communication connection. The test response includes at least one of an ADB test response and an MMI test response. The ADB test response and the MMI test response use a unified instruction format.
[0164] In a possible implementation, the communication protocol server sends a test response in a unified instruction format to a production line machine through an interface.
[0165] Indicative, Fig.12 The implementation diagram of the terminal test process on the terminal side is shown. After the ofcp.jar of the terminal to be tested receives the test request from ofcp.dll through the interface, it parses the test request data to obtain the content to be tested, and then calls the service of the app according to the content to be tested to obtain the test result. Then ofcp.jar compiles the test result into the test response through data parsing, and then sends the test response to ofcp.dll through the interface.
[0166] In the embodiment of the present application, in the terminal to be tested, after receiving the test request sent by the production line machine, the communication protocol server parses the test request according to the unified instruction format to obtain the content to be tested, and then calls the corresponding service in the test tool according to the content to be tested for testing. After the test is completed, the communication protocol server writes the test result in the test response in a unified instruction format and sends it to the communication protocol client through a socket connection. Using the solution provided by the embodiment of the present application, the terminal to be tested can communicate directly with the production line machine through a socket communication connection, wherein the test request and test response adopt a unified instruction format, which improves the communication efficiency and thus improves the terminal test efficiency.
[0167] See also Fig.13, which shows a structural block diagram of a terminal testing device provided by an exemplary embodiment of the present application. The device includes:
[0168] The acquisition module 1310 is used to acquire the terminal IP of the terminal to be tested;
[0169] A connection module 1320 is used to establish a socket communication connection with the terminal to be tested based on the terminal IP;
[0170] A sending module 1330, configured to send a test request to the terminal to be tested through the socket communication connection, wherein the test request includes at least one of an ADB test request and an MMI test request, and the ADB test request and the MMI test request adopt a unified instruction format;
[0171] The receiving module 1340 is used to receive a test response sent by the terminal to be tested through the socket communication connection, wherein the test response includes at least one of an ADB test response and an MMI test response, and the ADB test response and the MMI test response adopt a unified instruction format.
[0172] Optionally, a production line tool program and a communication protocol client are running in the production line tool process of the production line machine.
[0173] Optionally, the sending module 1330 is further used to:
[0174] The production line tool program sends a call request to the communication protocol client, where the call request is used to request to call the communication protocol client to perform a terminal test;
[0175] The communication protocol client generates the test request in a unified instruction format based on the call request;
[0176] The communication protocol client sends the test request to the terminal to be tested through the socket communication connection.
[0177] Optionally, the sending module 1330 is further used to:
[0178] In the case that the test response is not received within the target time period after sending the test request, the communication protocol client re-sends the test request to the terminal to be tested through the socket communication connection.
[0179] Optionally, the sending module 1330 is further used to:
[0180] The communication protocol client determines the maximum test duration of the function to be tested based on the function to be tested indicated by the call request;
[0181] The target duration is determined based on the maximum test duration, and the target duration is greater than or equal to the maximum test duration.
[0182] Optionally, the sending module 1330 is further used to:
[0183] The communication protocol client monitors the connection status of the socket communication connection;
[0184] When the disconnection instruction sent by the production line tool program is not received and the socket communication connection is detected to be disconnected, the communication protocol client reconnects the socket communication connection with the terminal to be tested.
[0185] Optionally, the receiving module 1340 is further configured to:
[0186] The communication protocol client receives the test response sent by the terminal to be tested through the socket communication connection;
[0187] The device also includes:
[0188] A parsing module, used for the communication protocol client to parse the test response based on the unified instruction format adopted by the test response to obtain a test result;
[0189] A feedback module is used for the communication protocol client to feed back the test result to the production line tool program.
[0190] Optionally, the connection module 1320 is further used for:
[0191] Creating a communication thread based on the terminal IP, and randomly assigning a machine port to the communication thread, wherein different terminal IPs correspond to different communication threads, and different communication threads correspond to different machine ports;
[0192] Based on the machine IP and the machine port, the socket communication connection is established with the terminal to be tested through the communication thread.
[0193] Optionally, the unified instruction format adopted by the test request includes a request type field, a request instruction field and a request data field;
[0194] The request type field is used to indicate the request type of the test request;
[0195] The request instruction field is used to indicate the request instruction adopted by the test request under the request type;
[0196] The request data field is used to indicate the request content of the request instruction;
[0197] Optionally, the unified instruction format adopted by the test response includes a response type field, a response instruction field, a test result field, an error code field and a response data field;
[0198] The response type field is used to indicate the response type of the test response;
[0199] The response instruction field is used to indicate the response instruction adopted by the test response under the response type;
[0200] The test result field is used to indicate the execution result of the test request;
[0201] The error code field is used to indicate the error type when the execution fails;
[0202] The response data field is used to indicate the response content of the response instruction.
[0203] See also Fig.14 , which shows a structural block diagram of a terminal testing device provided by another exemplary embodiment of the present application. The device includes:
[0204] A connection module 1410 is used to establish a socket communication connection with a production line machine, wherein the socket communication connection is established by the production line machine based on the terminal IP of the terminal to be tested;
[0205] The receiving module 1420 is used to receive the test request sent by the production line machine through the socket communication connection, wherein the test request includes at least one of an ADB test request and an MMI test request, and the ADB test request and the MMI test request adopt a unified instruction format;
[0206] The sending module 1430 is used to send a test response to the terminal to be tested through the socket communication connection, wherein the test response includes at least one of an ADB test response and an MMI test response, and the ADB test response and the MMI test response adopt a unified instruction format.
[0207] Optionally, a communication protocol server and a testing tool are running in the working model process of the terminal to be tested.
[0208] Optionally, the receiving module 1420 is further configured to:
[0209] The communication protocol server receives the test request sent by the production line machine through the socket communication connection;
[0210] Optionally, the device further includes:
[0211] A parsing module, used for the communication protocol server to parse the test request based on the unified instruction format adopted by the test request to obtain the content to be tested;
[0212] A calling module, used for the communication protocol server to call the test tool to perform a test based on the content to be tested and obtain a test result;
[0213] A generation module is used for the communication protocol server to generate the test response in a unified instruction format based on the test result.
[0214] Optionally, the device further includes:
[0215] A registration module is used for the test tool to perform service registration at the communication protocol server, wherein the service registration is used to register the test service, and the registered test service supports being called by the communication protocol server.
[0216] See also Fig.15 , which shows a schematic diagram of the structure of a production line machine provided by an exemplary embodiment of the present application. The production line machine includes a processor 1510 and a memory 1520.
[0217] The processor 1510 uses various interfaces and lines to connect various parts of the entire production line machine, and executes the test function of the production line machine side by running or executing the instructions, programs, code sets or instruction sets stored in the memory 1520. Optionally, the processor 1510 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA).
[0218] The memory 1520 may include a random access memory (RAM) or a read-only memory (ROM). The memory 1520 may be used to store instructions, programs, codes, code sets or instruction sets.
[0219] In addition, those skilled in the art will understand that the structure of the production line machine shown in the above drawings does not constitute a limitation of the production line machine. The production line machine may include more or fewer components than shown in the figure (such as cameras for scanning QR codes, communication components, terminal fixtures, etc.), or a combination of certain components, or different component arrangements.
[0220] See also Fig.16, which shows a schematic diagram of the structure of a terminal provided by an exemplary embodiment of the present application. The terminal includes a processor 1610 and a memory 1620.
[0221] The processor 1610 uses various interfaces and lines to connect various parts in the entire terminal, and executes the test function on the terminal side by running or executing instructions, programs, code sets or instruction sets stored in the terminal. Optionally, the processor 1610 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA).
[0222] The memory 1620 may include a random access memory (RAM) or a read-only memory (ROM). The memory 1620 may be used to store instructions, programs, codes, code sets or instruction sets.
[0223] In addition, those skilled in the art will understand that the structure of the terminal shown in the above figures does not constitute a limitation on the terminal, and the terminal may include more or fewer components (such as communication components) than shown in the figure, or combine certain components, or arrange the components differently.
[0224] The embodiment of the present application also provides a computer-readable storage medium, in which at least one instruction is stored, and the at least one instruction is executed by a processor to implement the method described in the above embodiment. Optionally, the computer-readable storage medium may include: ROM, RAM, solid state drive (SSD, Solid State Drives) or optical disk, etc. Among them, RAM may include resistance random access memory (ReRAM, Resistance Random Access Memory) and dynamic random access memory (DRAM, Dynamic Random Access Memory).
[0225] The embodiment of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the terminal test method provided in various optional implementations of the above aspects.
[0226] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A terminal testing method, characterized in that: The method is used for a production line machine, and the method comprises: Get the terminal IP of the terminal to be tested; Establishing a socket communication connection with the terminal to be tested based on the terminal IP; Sending a test request to the terminal to be tested through the socket communication connection, wherein the test request includes at least one of an ADB test request and an MMI test request, and the ADB test request and the MMI test request adopt a unified instruction format; A test response sent by the terminal to be tested is received through the socket communication connection, wherein the test response includes at least one of an ADB test response and an MMI test response, and the ADB test response and the MMI test response adopt a unified instruction format.
2. The method according to claim 1, characterized in that The production line tool process of the production line machine runs a production line tool program and a communication protocol client; The sending of the test request to the terminal to be tested through the socket communication connection includes: The production line tool program sends a call request to the communication protocol client, where the call request is used to request to call the communication protocol client to perform a terminal test; The communication protocol client generates the test request in a unified instruction format based on the call request; The communication protocol client sends the test request to the terminal to be tested through the socket communication connection.
3. The method according to claim 2, characterized in that After the communication protocol client sends the test request to the terminal to be tested through the socket communication connection, the method further includes: In the case that the test response is not received within the target time period after sending the test request, the communication protocol client re-sends the test request to the terminal to be tested through the socket communication connection.
4. The method according to claim 3, characterized in that The method further comprises: The communication protocol client determines the maximum test duration of the function to be tested based on the function to be tested indicated by the call request; The target duration is determined based on the maximum test duration, and the target duration is greater than or equal to the maximum test duration.
5. The method according to claim 2, characterized in that: The method further comprises: The communication protocol client monitors the connection status of the socket communication connection; When the disconnection instruction sent by the production line tool program is not received and the socket communication connection is detected to be disconnected, the communication protocol client reconnects the socket communication connection with the terminal to be tested.
6. The method according to claim 2, characterized in that The receiving, through the socket communication connection, a test response sent by the terminal to be tested, comprises: The communication protocol client receives the test response sent by the terminal to be tested through the socket communication connection; The method further comprises: The communication protocol client performs data parsing on the test response based on the unified instruction format adopted by the test response to obtain a test result; The communication protocol client feeds back the test result to the production line tool program.
7. The method according to claim 1, characterized in that The establishing a socket communication connection with the terminal to be tested based on the terminal IP includes: Creating a communication thread based on the terminal IP, and randomly assigning a machine port to the communication thread, wherein different terminal IPs correspond to different communication threads, and different communication threads correspond to different machine ports; Based on the machine IP and the machine port, the socket communication connection is established with the terminal to be tested through the communication thread.
8. The method according to claim 1, characterized in that The unified instruction format adopted by the test request includes a request type field, a request instruction field and a request data field; The request type field is used to indicate the request type of the test request; The request instruction field is used to indicate the request instruction adopted by the test request under the request type; The request data field is used to indicate the request content of the request instruction; The unified instruction format adopted by the test response includes a response type field, a response instruction field, a test result field, an error code field and a response data field; The response type field is used to indicate the response type of the test response; The response instruction field is used to indicate the response instruction adopted by the test response under the response type; The test result field is used to indicate the execution result of the test request; The error code field is used to indicate the error type when the execution fails; The response data field is used to indicate the response content of the response instruction.
9. A terminal testing method, characterized in that: The method is used for a terminal to be tested, and the method comprises: Establishing a socket communication connection with a production line machine, wherein the socket communication connection is established by the production line machine based on the terminal IP of the terminal to be tested; Receiving a test request sent by the production line machine through the socket communication connection, the test request including at least one of an ADB test request and an MMI test request, and the ADB test request and the MMI test request adopt a unified instruction format; A test response is sent to the terminal to be tested through the socket communication connection, wherein the test response includes at least one of an ADB test response and an MMI test response, and the ADB test response and the MMI test response adopt a unified instruction format.
10. The method according to claim 9, characterized in that A communication protocol server and a test tool are running in the working model process of the terminal to be tested; The receiving the test request sent by the production line machine through the socket communication connection includes: The communication protocol server receives the test request sent by the production line machine through the socket communication connection; The method further comprises: The communication protocol server performs data parsing on the test request based on the unified instruction format adopted by the test request to obtain the content to be tested; The communication protocol server calls the test tool to perform a test based on the content to be tested, and obtains a test result; The communication protocol server generates the test response in a unified instruction format based on the test result.
11. The method according to claim 10, characterized in that The method further comprises: The testing tool performs service registration at the communication protocol server, wherein the service registration is used to register a testing service, and the registered testing service supports being called by the communication protocol server.
12. A terminal testing device, characterized in that: The device comprises: An acquisition module is used to obtain the terminal IP of the terminal to be tested; A connection module, used to establish a socket communication connection with the terminal to be tested based on the terminal IP; A sending module, used for sending a test request to the terminal to be tested through the socket communication connection, wherein the test request includes at least one of an ADB test request and an MMI test request, and the ADB test request and the MMI test request adopt a unified instruction format; The receiving module is used to receive a test response sent by the terminal to be tested through the socket communication connection, wherein the test response includes at least one of an ADB test response and an MMI test response, and the ADB test response and the MMI test response adopt a unified instruction format.
13. A terminal testing device, characterized in that: The device comprises: A connection module, used to establish a socket communication connection with a production line machine, wherein the socket communication connection is established by the production line machine based on the terminal IP of the terminal to be tested; A receiving module, configured to receive a test request sent by the production line machine through the socket communication connection, wherein the test request includes at least one of an ADB test request and an MMI test request, and the ADB test request and the MMI test request adopt a unified instruction format; The sending module is used to send a test response to the terminal to be tested through the socket communication connection, wherein the test response includes at least one of an ADB test response and an MMI test response, and the ADB test response and the MMI test response adopt a unified instruction format.
14. A production line machine, characterized in that: The production line machine includes a processor and a memory; the memory stores at least one instruction, and the at least one instruction is used to be executed by the processor to implement the terminal testing method as described in any one of claims 1 to 8.
15. A terminal, characterized in that: The terminal includes a processor and a memory; the memory stores at least one instruction, and the at least one instruction is used to be executed by the processor to implement the terminal testing method according to any one of claims 9 to 11.
16. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, and the at least one instruction is used to be executed by a processor to implement the terminal testing method according to any one of claims 1 to 8, or the terminal testing method according to any one of claims 9 to 11.
17. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device implements the terminal testing method according to any one of claims 1 to 8, or the terminal testing method according to any one of claims 9 to 11.