Test method, test system and code scanning test equipment
Through the automated testing process of the code scanning test equipment, the high cost and low consistency problems caused by manual operation are solved, and efficient and accurate main scanning and scanned function testing of mobile payment applications is achieved.
Patent Information
- Application Number
- CN202411656808.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2044-11-19
AI Technical Summary
In the prior art, the main scanning and scanned function testing of mobile payment applications relies on manual operations, resulting in high labor costs and difficulty in ensuring test consistency.
Using the code scanning test equipment, the test control terminal is connected to the local startup service application of the terminal under test to automatically execute the test process of the main scanning and scanned functions, including login, code scanning interface startup, payment operations, etc., and generate a test report.
Automated testing is achieved, which reduces labor costs and improves test quality and consistency.
Smart Images

Figure CN119669051B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software testing, and in particular to a testing method, a testing system and a code scanning testing device. Background Art
[0002] With the rapid development of mobile payments, client application testing often requires active scanning (actively scanning QR codes) and scanned code functionality (displaying a QR code for scanning). These features are widely used in payment, identity authentication, and other scenarios. Testing these features typically relies on manual operation, requiring testers to manually operate one or more client devices to simulate both active and scanned code scanning to verify the accuracy of the client functionality. This not only consumes significant labor costs but also makes it difficult to ensure consistency across tests. Summary of the Invention
[0003] In view of this, the purpose of the present invention is to provide a testing method, a testing system and a code scanning testing device, which can automatically test the main scanning and scanned functions of the application to be tested, effectively reducing labor costs and improving test quality.
[0004] In the first aspect, an embodiment of the present invention provides a testing method, which is applied to a code scanning test device, the code scanning test device includes a test control terminal and a terminal to be tested; a local startup service application is pre-installed in the test control terminal and the terminal to be tested; the test control terminal is connected to the terminal to be tested through the local startup service application; the application to be tested is pre-installed on the terminal to be tested; the application to be tested includes a main scanning application and a scanned application; the method includes: the test control terminal connects and logs in to the main scanning application; when the test control terminal receives a first connection success feedback information sent by the main scanning application, it sends a code scanning function startup request to the main scanning application, so that the main scanning application starts the code scanning interface and waits for scanning; when the test control terminal receives the startup success feedback information sent by the main scanning application, it connects and logs in to the scanned application; when the test control terminal receives the second connection success feedback information sent by the scanned application, it sends a QR code display request to the scanned application, so that the scanned application starts the QR code display interface for the main scanning application to scan the code; the test control terminal obtains the code scanning result information sent by the scanned application and the payment result information sent by the main scanning application; the test control terminal generates a test report corresponding to the application to be tested based on the code scanning result information and the payment result information.
[0005] Furthermore, the terminal to be tested includes a main scanning terminal; a main scanning application is pre-installed on the main scanning terminal; the steps of the test control terminal connecting to and logging into the main scanning application include: when the test control terminal receives a test instruction, sending a first connection request to the main scanning terminal; the main scanning terminal initializes the main scanning application, establishes a connection with the main scanning application, and returns a first connection success response to the test control terminal; when the test control terminal receives the first connection success response, it sends a first login request to the main scanning terminal; the main scanning terminal controls the login to the main scanning application and sends a first connection success feedback message to the test control terminal.
[0006] Furthermore, the first login request includes: first interface element information; the first interface element information is used to represent the button position in the main scanning application; the main scanning terminal controls the steps of logging into the main scanning application, including: the main scanning terminal determines the position of the login button in the main scanning application based on the first interface element information, and operates the login to the main scanning application based on the position of the login button.
[0007] Furthermore, the terminal to be tested includes a scanned terminal; a scanned application is pre-installed on the scanned terminal; the scanning result information is a scanning success information or a scanning failure information; before the test control terminal obtains the scanning result information sent by the scanned application, the method also includes: the scanned application determines whether the QR code display interface is read within a preset time interval; if the QR code display interface is read within the preset time interval, the scanned application sends a scanning success information to the test control terminal through the scanned terminal; if the QR code display interface is not read within the preset time interval, the scanned application sends a scanning failure information to the test control terminal through the scanned terminal.
[0008] Furthermore, the terminal to be tested includes a main scanning terminal; a main scanning application is pre-installed on the main scanning terminal; payment information and second interface element information are pre-stored in the test control terminal; the second interface element information is used to represent the button position in the scanned application; after the test control terminal obtains the scanning result information sent by the scanned application, the method also includes: the test control terminal identifies the scanning result information; if the scanning result information is a successful scanning information, a payment interface display request containing the second interface element information is sent to the main scanning terminal, so that the main scanning terminal locates the payment interface button of the main scanning application based on the second interface element information and displays the payment interface; if the payment interface display success information sent by the main scanning terminal is received, a payment request is sent to the main scanning terminal based on the second interface element information, so that the main scanning terminal locates the payment button of the main scanning application based on the second interface element information and performs the payment operation.
[0009] Furthermore, the payment result information is payment success information or payment failure information; the step of obtaining the payment result information sent by the main scanning application includes: the main scanning application determines whether the payment operation is performed within a preset time interval; if the payment operation is performed within the preset time interval, the main scanning application sends the payment success information to the test control terminal through the main scanning terminal; if the payment operation is not performed within the preset time interval, the main scanning application sends the payment failure information to the test control terminal through the main scanning terminal.
[0010] Furthermore, the terminal to be tested includes a main scanning terminal; a main scanning application is pre-installed on the main scanning terminal; first interface element information is pre-set in the test control terminal; the first interface element information is used to represent the button position in the main scanning application; a step of sending a scanning function start request to the main scanning application so that the main scanning application starts the scanning interface and waits for scanning includes: sending a scanning function start request containing the first interface element information to the main scanning application through the main scanning terminal, so that the main scanning terminal locates the scanning interface button of the main scanning application based on the first interface element information and starts the scanning interface.
[0011] Furthermore, the terminal to be tested includes a scanned terminal; a scanned application is pre-installed on the scanned terminal; second interface element information is pre-set in the test control terminal; the second interface element information is used to represent the button position in the scanned application; the step of sending a QR code display request to the scanned application so that the scanned application starts the QR code display interface includes: sending a QR code display request containing the second interface element information to the scanned application through the scanned terminal, so that the scanned terminal locates the QR code display button of the scanned application based on the second interface element information and starts the QR code display interface.
[0012] In the second aspect, an embodiment of the present invention provides a test system, which is applied to a code scanning test device, and the code scanning test device includes a test control terminal and a terminal to be tested; a local startup service application is pre-installed in the test control terminal and the terminal to be tested; the test control terminal is connected to the terminal to be tested through the local startup service application; the terminal to be tested is pre-installed with an application to be tested; the application to be tested includes a main scanning application and a scanned application; the system includes: a main scanning application control module, which is used for the test control terminal to connect to and log in to the main scanning application; the main scanning application control module is also used to send a code scanning function startup request to the main scanning application when the test control terminal receives the first connection success feedback information sent by the main scanning application, so that the main scanning application starts scanning The test control terminal receives the startup success feedback information sent by the main scanning application, and the scanned application control module is used to connect to and log in to the scanned application; the scanned application control module is also used to send a QR code display request to the scanned application when the test control terminal receives the second connection success feedback information sent by the scanned application, so that the scanned application starts the QR code display interface for the main scanning application to scan the code; the test report generation module is used for the test control terminal to obtain the scanning result information sent by the scanned application and the payment result information sent by the main scanning application; the test report generation module is also used for the test control terminal to generate a test report corresponding to the application to be tested based on the scanning result information and the payment result information.
[0013] In the third aspect, a code scanning test device includes a test control terminal and a terminal to be tested; a local startup service application is pre-installed in the test control terminal and the terminal to be tested; the test control terminal is communicated with the terminal to be tested through the local startup service application; the application to be tested is pre-installed on the terminal to be tested; the application to be tested includes a main scanning application and a scanned application; the terminal to be tested includes a main scanning terminal and a scanned terminal; the main scanning application runs on the main scanning terminal, the scanned application runs on the scanned terminal, and the main scanning terminal and the scanned terminal are placed in a corresponding position to realize the code scanning operation; the above-mentioned test system is deployed in the test control terminal.
[0014] The embodiment of the present invention provides a test method, a test system and a code scanning test device, which are applied to the code scanning test device, wherein the code scanning test device includes a test control terminal and a terminal to be tested; a local startup service application is pre-installed in the test control terminal and the terminal to be tested; the test control terminal is connected to the terminal to be tested through the local startup service application; the application to be tested is pre-installed on the terminal to be tested; the application to be tested includes a main scanning application and a scanned application; the method includes: the test control terminal connects to and logs in to the main scanning application; when the test control terminal receives a first connection success feedback message sent by the main scanning application, it sends a code scanning function startup message to the main scanning application The test control terminal sends a QR code display request to the scanned application, so that the main scanning application starts the code scanning interface and waits for the code to be scanned; when the test control terminal receives the startup success feedback information sent by the main scanning application, it connects and logs in to the scanned application; when the test control terminal receives the second connection success feedback information sent by the scanned application, it sends a QR code display request to the scanned application, so that the scanned application starts the QR code display interface for the main scanning application to scan the code; the test control terminal obtains the code scanning result information sent by the scanned application and the payment result information sent by the main scanning application; the test control terminal generates a test report corresponding to the application to be tested based on the code scanning result information and the payment result information. In this method, the test control terminal opens the code scanning interface and QR code display interface of the application to be tested by locally starting the service application to automatically test the main scanning and scanned functions of the application to be tested, effectively reducing labor costs and improving test quality.
[0015] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or understood by practicing the present invention. The purposes and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0016] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 A flow chart of the testing method provided in an embodiment of the present invention;
[0019] Figure 2A partial schematic diagram of a code scanning test device provided in an embodiment of the present invention;
[0020] Figure 3 Flowchart of a method for connecting a test control terminal to and logging into a main scanning application program provided in the first embodiment of the present invention;
[0021] Figure 4 Flowchart of the method for reading and judging a QR code display interface provided in Example 1 of the present invention;
[0022] Figure 5 Flowchart of the method for the test control terminal to identify the scan result information provided in the first embodiment of the present invention;
[0023] Figure 6 A flowchart of the steps for obtaining payment result information sent by the main scanning application provided in the first embodiment of the present invention;
[0024] Figure 7 A schematic diagram of a test system provided in Example 2 of the present invention;
[0025] Figure 8 Detailed schematic diagram of the code scanning test equipment provided in Example 3 of the present invention.
[0026] Icons: 1-main scanning application control module; 2-scanned application control module; 3-test report generation module; 21-test control terminal; 22-terminal to be tested; 23-local startup service application; 24-test system; 221-main scanning terminal; 222-main scanning application; 223-scanned terminal; 224-scanned application. DETAILED DESCRIPTION
[0027] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0028] To facilitate understanding of this embodiment, the embodiment of the present invention is described in detail below.
[0029] Example 1:
[0030] Figure 1 This is a flow chart of the testing method provided by an embodiment of the present invention.
[0031] Figure 2 A partial schematic diagram of the code scanning test equipment provided in an embodiment of the present invention.
[0032] Reference Figure 2The test method is applied to a code scanning test device, which includes a test control terminal 21 and a terminal to be tested 22; a local startup service application 23 is pre-installed in the test control terminal 21 and the terminal to be tested 22; the test control terminal 21 is communicated with the terminal to be tested 22 through the local startup service application 23; the application to be tested is pre-installed on the terminal to be tested 22; the application to be tested includes a main scanning application 222 and a scanned application 224.
[0033] Here, the terminal to be tested 22 includes a main scanning terminal 221, on which a main scanning application 222 is pre-installed. The terminal to be tested 22 includes a scanned terminal 223, on which a scanned application 224 is pre-installed.
[0034] The main scanning application 222 and the scanned application 224 may be two different applications, or two different functions of the same application.
[0035] The main scanning application 222 runs on the main scanning terminal 221, and the scanned application 224 runs on the scanned terminal 223. The main scanning terminal 221 and the scanned terminal 223 are placed in corresponding positions to enable the code scanning operation.
[0036] The test control terminal 21 and the terminal to be tested 22 are connected in communication by starting a service application 23 locally.
[0037] Reference Figure 1 In one embodiment, the testing method of the present application includes:
[0038] Step S101: Test the connection of the control terminal and log in to the main scanning application.
[0039] Here, the test control terminal sends a login request to the main scanning application, instructing it to perform the login operation. After the main scanning application completes the login, it returns a login success message to the test control terminal. Login methods can include entering a username and password or using other authentication methods (such as fingerprint or facial recognition). The test control terminal needs to verify the response information from the main scanning application to confirm whether the login is successful.
[0040] In one embodiment, referring to Figure 3 The steps of step S101 include:
[0041] Step S201: When the test control terminal receives a test instruction, it sends a first connection request to the main scanning terminal.
[0042] Here, the test control terminal receives the start instruction of the test task and prepares to connect to the main scanning terminal. The test control terminal sends a first connection request to the main scanning terminal to establish a communication connection.
[0043] The first connection request may include identification information of the main scanning terminal (such as device ID or network address) for locating the target terminal.
[0044] In step S202 , the main scanning terminal initializes the main scanning application, establishes a connection with the main scanning application, and returns a first connection success response to the test control terminal.
[0045] Here, after receiving the first connection request, the main scanning terminal starts and initializes the main scanning application. The main scanning terminal establishes an internal communication connection with the main scanning application to ensure that the main scanning application can operate normally. The main scanning terminal returns a first connection success response to the test control terminal, indicating that the connection is established and the main scanning application is ready.
[0046] The initialization process may include loading the main scanning application, checking system status, and allocating resources. The main scanning terminal will check the operating status of the main scanning application and, upon confirmation, send a connection success response. If the connection fails or initialization fails, the main scanning terminal will return an error code or exception information to the test control terminal.
[0047] Step S203: When the test control terminal receives the first connection success response, it sends a first login request to the main scanning terminal.
[0048] Here, after receiving the first connection success response, the test control terminal confirms that the communication status between the main scanning terminal and the main scanning application is normal. The test control terminal sends a first login request to the main scanning terminal, instructing it to perform the application login operation.
[0049] The first login request can include user credentials (such as username and password), authentication parameters (such as security keys), or other auxiliary information (such as device ID). The test control terminal can preset the login process based on the test scenario to simulate the user's actual login behavior. The login request must ensure data integrity during the communication process to avoid login failures due to network interruptions.
[0050] Step S204: the main scanning terminal controls the login of the main scanning application and sends a first connection success feedback message to the test control terminal.
[0051] Here, after receiving the first login request, the main scanning terminal simulates user operations and controls the main scanning application to complete the login. After the login is completed, the main scanning terminal sends a first connection success feedback message to the test control terminal, indicating that the main scanning application has successfully logged in.
[0052] If the main scanning application supports the automation interface, the main scanning terminal can directly call the relevant API (Application Programming Interface) to complete the login operation. If there is no interface support, the UI (User Interface) automation tool is used to simulate the user clicking the login button.
[0053] The first connection success feedback information may include login status (success or failure), user identification (such as Session ID), login time, etc.
[0054] If the login fails, the main scanning terminal should feedback the detailed failure reason (such as invalid credentials, network timeout, etc.) to the test control terminal.
[0055] In one embodiment, the first login request includes: first interface element information; the first interface element information is used to represent the button position in the main scanning application.
[0056] Here, the test control terminal predefines the first interface element information in the test script, and sends it to the main scanning terminal through a login request.
[0057] The first interface element information refers to the location information or identification information of the target button (such as the "Login" button) in the main scanning application. This information can be recorded and extracted in advance through tools (such as UI automation tools App i um and UIAutomator). It may include the button's element ID, XPath path (XML Path Language), CSS selector, or screen coordinates. If the interface elements of the main scanning application vary due to different device resolutions or languages, corresponding element information can be set for different versions of the interface.
[0058] In step S204, the main scanning terminal controls the steps of logging into the main scanning application, including:
[0059] The main scanning terminal determines the position of the login button in the main scanning application based on the first interface element information, and logs into the main scanning application based on the position of the login button.
[0060] Here, the main scanning terminal determines the specific location of the "Login" button in the main scanning application based on the first interface element information. The positioning method can be element ID positioning, XPath path positioning or screen coordinate positioning.
[0061] Specifically, the main scanning terminal simulates clicking the login button through a UI automation tool or a custom script. If the login process requires entering a username and password, the script can automatically fill them in.
[0062] The main scanning terminal can obtain dynamically input login credentials from the test control terminal to simulate different user identity tests.
[0063] After the login operation is completed, the main scanning terminal needs to monitor the feedback of the main scanning application (such as login success or failure) and return the result to the test control terminal.
[0064] If the login button is in the wrong position (cannot be located) or the click is invalid, the error feedback mechanism should be triggered and the abnormal information should be sent to the test control terminal for debugging.
[0065] Step S102: When the test control terminal receives the first connection success feedback information sent by the main scanning application, it sends a code scanning function start request to the main scanning application, so that the main scanning application starts the code scanning interface and waits for scanning.
[0066] Here, the test control terminal receives a first connection success feedback message when the main scanning application successfully establishes a connection and completes initialization. The test control terminal sends a code scanning function start request to the main scanning application. The main scanning application starts the code scanning interface according to the request and enters the waiting state for code scanning.
[0067] The request to start the code scanning function may include interface element location information, such as the element ID or coordinate position of the code scanning button.
[0068] After the main scanning application starts the code scanning interface, it needs to return startup success feedback information to the test control terminal.
[0069] The QR code scanning interface enters the QR code scanning waiting state, ready to receive the QR code content.
[0070] In one embodiment, in step S102, the step of sending a code scanning function start request to the main scanning application so that the main scanning application starts a code scanning interface and waits for code scanning includes:
[0071] The main scanning terminal sends a scanning function start request containing the first interface element information to the main scanning application, so that the main scanning terminal locates the scanning interface button of the main scanning application based on the first interface element information and starts the scanning interface.
[0072] Here, the first interface element information is used to describe the position information or identification of the code scanning interface button in the main scanning application.
[0073] The test control terminal encapsulates the first interface element information into a code scanning function start request, and sends the request to the main scanning application through the main scanning terminal.
[0074] In addition to the first interface element information, the request to start the code scanning function may also include other control parameters, such as the start flag of the code scanning function, the log recording switch, etc.
[0075] The main scanning terminal parses the first interface element information in the scanning function start request and locates the scanning interface button in the main scanning application according to the description information.
[0076] Step S103: When the test control terminal receives the startup success feedback information sent by the main scanning application, it connects to and logs in to the scanned application.
[0077] Here, the test control terminal establishes a connection with the scanned application through the local startup service. The test control terminal sends a login request to the scanned application, instructing the scanned application to perform the login operation. After the scanned application completes the login, it returns a login success feedback message to the test control terminal.
[0078] The scanned application can use the same or different authentication mechanism as the main scanning application to log in. The main scanning and scanned applications are connected independently at different stages to avoid conflicts.
[0079] Step S104: When the test control terminal receives the second connection success feedback information sent by the scanned application, it sends a QR code display request to the scanned application, so that the scanned application starts a QR code display interface for the main scanning application to scan the code.
[0080] Here, the test control terminal receives the connection success feedback information from the scanned application. The test control terminal sends an instruction to the scanned application, requesting it to generate and display a QR code. The scanned application launches the QR code display interface according to the instruction.
[0081] The QR code content can include payment information, a transaction ID, or other test data. After the scanned application launches the QR code interface, it returns a successful interface launch response to the test control terminal. The main scanning application waits on the code scanning interface, ready to scan the displayed QR code.
[0082] In one embodiment, the test control terminal is pre-set with second interface element information; the second interface element information is used to represent the position of a button in the scanned application.
[0083] In step S104, the step of sending a QR code display request to the scanned application so that the scanned application starts a QR code display interface includes:
[0084] The scanned terminal sends a QR code display request containing the second interface element information to the scanned application, so that the scanned terminal locates the QR code display button of the scanned application based on the second interface element information and starts the QR code display interface.
[0085] Here, the second interface element information is used to describe the position or identification of the QR code display button in the scanned application.
[0086] The QR code display request includes the second interface element information, indicating the intention of the test control terminal to request the scanned application to display the QR code.
[0087] The test control terminal sends a QR code display request to the scanned application through the scanned terminal.
[0088] The scanned terminal locates the QR code display button in the scanned application according to the second interface element information in the QR code display request.
[0089] After successfully locating the button, the scanned terminal simulates a user click operation to trigger the scanned application to start the QR code display interface.
[0090] The scanned application starts the QR code display interface and generates a QR code displayed on the interface for the main scanning terminal to scan.
[0091] In one embodiment, referring to Figure 4 In step S105, before the test control terminal obtains the scanning result information sent by the scanned application, the test method further includes:
[0092] Step S301: The scanned application determines whether the QR code display interface has been read within a preset time interval.
[0093] Here, the preset time interval is pre-set according to actual conditions and can be set to 5s or 10s. Within the preset time interval, the scanned application needs to continuously determine whether the QR code display interface is read by the main scanning terminal.
[0094] Whether the QR code display interface has been read can be determined through the following mechanisms:
[0095] 1. Event triggering mechanism, detecting the event that the QR code is successfully scanned by the main scanning terminal (such as the callback of successful scanning).
[0096] 2. Status update mechanism, monitoring the QR code status identification (such as the QR code validity status changes from unread to read).
[0097] 3. Request-response mechanism: After scanning the code, the main scanning terminal sends a confirmation request to the scanned application. The scanned application confirms that the QR code has been read by receiving the request.
[0098] If you use the event triggering mechanism, you can register a listener in the scanned application to specifically detect whether the QR code has been read.
[0099] If a status update mechanism is used, the scanned application can associate a unique identifier with the QR code when it is generated and monitor its status changes.
[0100] If the QR code is deleted or expires within the preset time after it is generated, the scanned application should determine that the QR code has not been read and send a corresponding failure message.
[0101] In step S302, if the QR code display interface is read within a preset time interval, the scanned application sends a scan success message to the test control terminal via the scanned terminal.
[0102] Here, after confirming that the QR code has been successfully scanned by the main scanning terminal, the scanned application generates a scan success message. The scanned application sends the success message to the test control terminal through the scanned terminal for recording or triggering subsequent operations.
[0103] The successful scanning information may include the unique identifier of the QR code, the reading timestamp, and the identifier of the device being read (such as the main scanning terminal ID).
[0104] In step S303, if the QR code display interface is not read within a preset time interval, the scanned application sends a scan failure message to the test control terminal via the scanned terminal.
[0105] Here, when the QR code is not detected to be scanned by the main scanning terminal within a preset time interval, the scanned application marks the QR code status as unread. The scanned application sends a scan failure message to the test control terminal through the scanned terminal.
[0106] The scanning failure information may include the unique identifier of the QR code, a description of the failure reason (such as timeout and failure to read) and a timestamp.
[0107] Step S105: The test control terminal obtains the code scanning result information sent by the scanned application and the payment result information sent by the main scanning application.
[0108] Here, after the QR code is scanned, the scanned application sends the scan result information to the test control terminal, including the scan success or failure status. The main scanning application performs the payment operation after the scan is successful and sends the payment result (success or failure) to the test control terminal.
[0109] The test control terminal verifies the scan success based on the feedback from the scanned application. The test control terminal also verifies the payment success based on the payment result feedback from the primary scanning application. The scan results and payment results must be correlated to ensure logical consistency throughout the entire process.
[0110] In one embodiment, the test control terminal pre-stores payment information and second interface element information; the second interface element information is used to represent the button position in the scanned application.
[0111] Payment information is used as test data to simulate payment operations and may include payment amount, user ID, transaction ID, and more. This information is typically pre-stored in the test control terminal's configuration file or database to ensure data consistency across tests. Payment information can be generated dynamically based on actual test scenarios or configured using a fixed template.
[0112] The second interface element information is used to describe the location or identification of payment-related buttons in the scanned application, including the element ID, XPath path or screen coordinates of the payment interface button and the payment confirmation button.
[0113] Reference Figure 5 In step S105, after the test control terminal obtains the scanning result information sent by the scanned application, the method further includes:
[0114] Step S401: The test control terminal identifies the scan result information.
[0115] Here, after receiving the scanning result information sent by the scanned application, the test control terminal parses the information to determine whether the scanning is successful.
[0116] The scanning result information may include status identification (success or failure), QR code content, scanning time, etc.
[0117] If the code scanning fails, the subsequent process will be terminated and the reason for the failure will be recorded.
[0118] In step S402, if the scanning result information is a successful scanning information, a payment interface display request containing the second interface element information is sent to the main scanning terminal, so that the main scanning terminal locates the payment interface button of the main scanning application based on the second interface element information and displays the payment interface.
[0119] Here, the test control terminal sends a payment interface display request to the main scanning terminal, instructing the main scanning application to start the payment interface. The payment interface display request includes second interface element information for locating the payment interface button of the main scanning application.
[0120] If the request fails to be sent or the main scanning terminal does not respond, the test control terminal should record detailed logs and try again.
[0121] In step S403, if the payment interface display success information sent by the main scanning terminal is received, a payment request is sent to the main scanning terminal based on the second interface element information, so that the main scanning terminal locates the payment button of the main scanning application based on the second interface element information and performs the payment operation.
[0122] Here, the main scanning terminal parses the second interface element information in the payment interface display request and locates the payment interface button. The main scanning terminal simulates a user clicking the payment interface button, triggering the main scanning application to display the payment interface. After the main scanning application successfully launches the payment interface, it returns a payment interface display success message to the main scanning terminal and simultaneously sends it to the test control terminal.
[0123] The test control terminal sends a payment request to the main scanning terminal, instructing the main scanning application to perform the payment operation. The payment request contains payment information (such as payment amount, transaction ID) and second interface element information for locating the payment button.
[0124] If the payment interface fails to display or the payment request is not successfully sent, the test control terminal should interrupt the process and record detailed error information.
[0125] The main scanning terminal uses the second interface element information to locate the payment button in the main scanning application. The main scanning terminal simulates the user clicking the payment button, triggering the main scanning application to complete the payment operation.
[0126] After the payment is completed, the main scanning application should return payment result information (such as payment success or failure).
[0127] In one embodiment, the payment result information is payment success information or payment failure information.
[0128] Here, the payment success information is the result information generated by the main scanning application when the payment operation is successfully completed within a preset time interval, indicating that the payment has been completed. It includes relevant information such as the transaction ID, payment amount, and payment time.
[0129] Payment failure information is the result information generated by the main scanning application when the payment operation fails to complete within the preset time interval, indicating that the payment was unsuccessful. It includes the reason for the failure (such as timeout, cancellation, insufficient balance, etc.).
[0130] Reference Figure 6 In step S105, the step of obtaining the payment result information sent by the main scanning application includes:
[0131] Step S501: The main scanning application determines whether a payment operation is performed within a preset time interval.
[0132] Here, the payment operation includes steps such as clicking the payment button, completing the payment authentication, and the server returning the payment confirmation. The main scanning application determines whether the payment is completed within the preset time by monitoring the user operation event or the payment process status.
[0133] The main scanning application can monitor the click event of the payment button or the completion event of the payment authentication as the basis for the completion of the payment operation.
[0134] When the payment interface is launched, the application starts timing. If the payment completion event is not detected within the preset time, the payment is deemed not executed.
[0135] If the payment process is interrupted due to network problems or other abnormalities within the preset time, the application must return a payment failure message.
[0136] In step S502 , if a payment operation is performed within the preset time interval, the main scanning application sends a payment success message to the test control terminal via the main scanning terminal.
[0137] Here, if the payment process is successfully completed within a preset time interval (e.g., after clicking the payment button, the payment server returns a successful response), the main scanning application generates a payment success message containing key payment data (e.g., transaction ID, amount, time). The main scanning application sends the payment success message to the test control terminal via the main scanning terminal to record the test results.
[0138] Before generating payment success information, the main scanning application needs to verify the integrity of the payment data (such as confirming that the transaction amount is consistent with the order amount).
[0139] In step S503, if the payment operation is not performed within the preset time interval, the main scanning application sends a payment failure message to the test control terminal via the main scanning terminal.
[0140] Here, if no payment completion event is detected within a preset time interval (e.g., the user does not click the payment button or payment authentication fails), the main scanning application generates a payment failure message describing the reason for the failure (e.g., timeout, operation cancellation). The main scanning application sends the payment failure message to the test control terminal via the main scanning terminal to record the failure result.
[0141] Step S106: The test control terminal generates a test report corresponding to the application to be tested based on the code scanning result information and the payment result information.
[0142] Here, the test control terminal aggregates the scan and payment results and generates a test report. This report includes the execution results of each test step, the scan status, the payment status, and any possible error messages. The test report can be stored locally or uploaded to a server for further analysis.
[0143] If an error occurs during scanning or payment, the test report should record the error type, error code, and detailed log information. Performance metrics such as scanning and payment response time and latency can be added to the test report. The test report can be used to analyze the stability and performance of the application under test and provide a basis for optimization.
[0144] An embodiment of the present invention provides a testing method, which is applied to a code scanning test device, wherein the code scanning test device includes a test control terminal and a terminal to be tested; a local startup service application is pre-installed in the test control terminal and the terminal to be tested; the test control terminal is connected to the terminal to be tested through the local startup service application; the application to be tested is pre-installed on the terminal to be tested; the application to be tested includes a main scanning application and a scanned application; the method includes: the test control terminal connects to and logs in to the main scanning application; when the test control terminal receives a first connection success feedback information sent by the main scanning application, it sends a code scanning function startup request to the main scanning application, so that the main scanning application starts a code scanning interface and waits for scanning; when the test control terminal receives a startup success feedback information sent by the main scanning application, it connects to and logs in to the scanned application; when the test control terminal receives a second connection success feedback information sent by the scanned application, it sends a QR code display request to the scanned application, so that the scanned application starts a QR code display interface for the main scanning application to scan the code; the test control terminal obtains the code scanning result information sent by the scanned application and the payment result information sent by the main scanning application; the test control terminal generates a test report corresponding to the application to be tested based on the code scanning result information and the payment result information. In this method, the test control terminal opens the code scanning interface and QR code display interface of the application to be tested by locally launching the service application to automatically test the main scanning and scanned functions of the application to be tested, realizing automated payment testing on the mobile terminal, effectively reducing labor costs and improving test quality.
[0145] Example 2:
[0146] Figure 7 This is a schematic diagram of a test system provided in Example 2 of the present invention.
[0147] The test system is applied to a code scanning test device, which includes a test control terminal and a terminal to be tested; the test control terminal and the terminal to be tested are pre-installed with a local startup service application; the test control terminal communicates with the terminal to be tested through the local startup service application; the terminal to be tested is pre-installed with an application to be tested; the application to be tested includes a main scanning application and a scanned application.
[0148] Reference Figure 7 , the system includes:
[0149] The main scanning application control module 1 is used to test the control terminal connection and log in to the main scanning application.
[0150] The main scanning application control module 1 is also used to send a scanning function start request to the main scanning application when the test control terminal receives the first connection success feedback information sent by the main scanning application, so that the main scanning application starts the scanning interface and waits for scanning.
[0151] The scanned application control module 2 is configured to connect to and log in to the scanned application when the test control terminal receives startup success feedback information sent by the main scanning application.
[0152] The scanned application control module 2 is also used to send a QR code display request to the scanned application when the test control terminal receives the second connection success feedback information sent by the scanned application, so that the scanned application starts the QR code display interface for the main scanning application to scan the code.
[0153] The test report generation module 3 is used to test that the control terminal obtains the scanning result information sent by the scanned application and the payment result information sent by the main scanning application.
[0154] The test report generation module 3 is also used for the test control terminal to generate a test report corresponding to the application to be tested based on the code scanning result information and the payment result information.
[0155] In one embodiment, the terminal to be tested includes a main scanning terminal; a main scanning application is pre-installed on the main scanning terminal. The main scanning application control module 1 is further used to:
[0156] When the test control terminal receives the test instruction, it sends a first connection request to the main scanning terminal.
[0157] The main scanning terminal initializes the main scanning application, establishes a connection with the main scanning application, and returns a first connection success response to the test control terminal.
[0158] When the test control terminal receives the first connection success response, it sends a first login request to the main scanning terminal.
[0159] The main scanning terminal controls logging into the main scanning application and sends first connection success feedback information to the test control terminal.
[0160] In one embodiment, the first login request includes: first interface element information; the first interface element information is used to represent the button position in the main scanning application. The main scanning application control module 1 is further used to:
[0161] The main scanning terminal determines the position of the login button in the main scanning application based on the first interface element information, and logs into the main scanning application based on the position of the login button.
[0162] In one embodiment, the main scanning application control module 1 is further configured to:
[0163] The main scanning terminal sends a scanning function start request containing the first interface element information to the main scanning application, so that the main scanning terminal locates the scanning interface button of the main scanning application based on the first interface element information and starts the scanning interface.
[0164] In one embodiment, the terminal to be tested includes a scanned terminal; the scanned terminal has a scanned application pre-installed on it; the scan result information is a scan success message or a scan failure message. The scanned application control module 2 is further configured to:
[0165] The scanned application determines whether the QR code display interface has been read within a preset time interval.
[0166] If the QR code display interface is read within the preset time interval, the scanned application sends a scan success message to the test control terminal through the scanned terminal.
[0167] If the QR code display interface is not read within a preset time interval, the scanned application sends a scan failure message to the test control terminal through the scanned terminal.
[0168] In one embodiment, the scanned application control module 2 is further configured to:
[0169] The scanned terminal sends a QR code display request containing the second interface element information to the scanned application, so that the scanned terminal locates the QR code display button of the scanned application based on the second interface element information and starts the QR code display interface.
[0170] In one embodiment, the terminal to be tested includes a main scanning terminal; the main scanning terminal has a main scanning application pre-installed on it; the test control terminal has payment information and second interface element information pre-stored; the second interface element information is used to represent the button position in the scanned application. The test report generation module 3 is also used to:
[0171] Test the control terminal to recognize the scan result information.
[0172] If the scanning result information is a successful scanning information, a payment interface display request containing the second interface element information is sent to the main scanning terminal, so that the main scanning terminal locates the payment interface button of the main scanning application based on the second interface element information and displays the payment interface.
[0173] If the payment interface display success information sent by the main scanning terminal is received, a payment request is sent to the main scanning terminal based on the second interface element information, so that the main scanning terminal locates the payment button of the main scanning application based on the second interface element information and performs the payment operation.
[0174] In one embodiment, the payment result information is payment success information or payment failure information. The test report generation module 3 is further used to:
[0175] The main scanning application determines whether a payment operation is performed within a preset time interval.
[0176] If a payment operation is performed within the preset time interval, the main scanning application sends a payment success message to the test control terminal via the main scanning terminal.
[0177] If the payment operation is not performed within the preset time interval, the main scanning application sends a payment failure message to the test control terminal via the main scanning terminal.
[0178] An embodiment of the present invention provides a testing system applied to a code scanning test device. In this method, the test control terminal opens the code scanning interface and QR code display interface of the application to be tested by locally starting the service application to automatically test the main scanning and scanned functions of the application to be tested, effectively reducing labor costs and improving test quality.
[0179] Example 3:
[0180] Figure 8 Detailed schematic diagram of the code scanning test equipment provided in Example 3 of the present invention.
[0181] Reference Figure 8 , including a test control terminal 21 and a terminal to be tested 22; a local startup service application 23 is pre-installed in the test control terminal 21 and the terminal to be tested 22; the test control terminal 21 is connected to the terminal to be tested 22 through the local startup service application 23; the terminal to be tested 22 is pre-installed with an application to be tested; the application to be tested includes a main scanning application 222 and a scanned application 224; the terminal to be tested includes a main scanning terminal 221 and a scanned terminal 223; the main scanning application 222 runs on the main scanning terminal 221, and the scanned application 224 runs on the scanned terminal 223, and the main scanning terminal 221 and the scanned terminal 223 are placed in a corresponding position to realize the code scanning operation; the above-mentioned test system 24 is deployed in the test control terminal 21.
[0182] The computer program product provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. For specific implementation, please refer to the method embodiments and will not be repeated here.
[0183] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems and devices can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0184] In addition, in the description of the embodiments of the present invention, unless otherwise expressly specified or limited, the terms "mounted," "connected," and "connected" should be understood in a broad sense. For example, they may refer to fixed connections, detachable connections, or integral connections; they may refer to mechanical connections or electrical connections; they may refer to direct connections or indirect connections through an intermediate medium; and they may refer to internal communication between two components. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on the specific circumstances.
[0185] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0186] In the description of the present invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings and are intended solely to facilitate and simplify the description of the present invention. They are not intended to indicate or imply that the devices or components referred to must have, be constructed, or operate in a specific orientation, and therefore should not be construed as limitations on the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0187] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the above-described embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above-described embodiments within the technical scope disclosed by the present invention, or replace some of the technical features therein with equivalents. Such modifications, changes, or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.
Claims
1. A testing method, characterized in that: Applied to a code scanning test device, the code scanning test device includes a test control terminal and a terminal to be tested; the test control terminal and the terminal to be tested are pre-installed with a local startup service application; The test control terminal is connected to the terminal under test through the local startup service application; the terminal under test is pre-installed with the application under test; The application to be tested includes a main scanning application and a scanned application; the method includes: The test control terminal connects to and logs into the main scanning application; When the test control terminal receives the first connection success feedback information sent by the main scanning application, it sends a code scanning function start request to the main scanning application, so that the main scanning application starts the code scanning interface and waits for scanning; When the test control terminal receives the startup success feedback information sent by the main scanning application, it connects to and logs in to the scanned application; When the test control terminal receives the second connection success feedback information sent by the scanned application, it sends a QR code display request to the scanned application, so that the scanned application starts a QR code display interface for the main scanning application to scan the code; The test control terminal obtains the scanning result information sent by the scanned application and the payment result information sent by the main scanning application; The test control terminal generates a test report corresponding to the application to be tested based on the code scanning result information and the payment result information; The terminal to be tested includes a main scanning terminal; the main scanning terminal is pre-installed with the main scanning application; the terminal to be tested includes a scanned terminal; the scanned application is pre-installed on the scanned terminal; the scanning result information is scanning success information or scanning failure information; the test control terminal is pre-stored with payment information and second interface element information; the second interface element information is used to represent the button position in the scanned application; the test control terminal is pre-set with first interface element information; the first interface element information is used to represent the button position in the main scanning application; The step of connecting the test control terminal to and logging into the main scanning application comprises: When the test control terminal receives the test instruction, it sends a first connection request to the main scanning terminal; The main scanning terminal initializes the main scanning application, establishes a connection with the main scanning application, and returns a first connection success response to the test control terminal; When the test control terminal receives the first connection success response, sending a first login request to the main scanning terminal; The main scanning terminal controls logging into the main scanning application and sends the first connection success feedback information to the test control terminal.
2. The testing method according to claim 1, wherein: The first login request includes: the first interface element information; The step of the main scanning terminal controlling the login to the main scanning application program includes: The main scanning terminal determines a position of a login button in the main scanning application based on the first interface element information, and logs into the main scanning application based on the position of the login button.
3. The testing method according to claim 1, wherein: Before the step of the test control terminal acquiring the scanning result information sent by the scanned application, the method further includes: The scanned application determines whether the QR code display interface has been read within a preset time interval; If the QR code display interface is read within the preset time interval, the scanned application sends the scanning success information to the test control terminal via the scanned terminal; If the QR code display interface is not read within the preset time interval, the scanned application sends the code scanning failure information to the test control terminal through the scanned terminal.
4. The testing method according to claim 3, wherein: After the test control terminal obtains the scanning result information sent by the scanned application, the method further includes: The test control terminal identifies the code scanning result information; If the code scanning result information is the code scanning success information, sending a payment interface display request including the second interface element information to the main scanning terminal, so that the main scanning terminal locates the payment interface button of the main scanning application based on the second interface element information and displays the payment interface; If the payment interface display success information sent by the main scanning terminal is received, a payment request is sent to the main scanning terminal based on the second interface element information, so that the main scanning terminal locates the payment button of the main scanning application based on the second interface element information and performs the payment operation.
5. The testing method according to claim 4, characterized in that: The payment result information is payment success information or payment failure information; The step of obtaining the payment result information sent by the main scanning application comprises: The main scanning application determines whether the payment operation is performed within a preset time interval; If the payment operation is performed within the preset time interval, the main scanning application sends the payment success information to the test control terminal via the main scanning terminal; If the payment operation is not performed within the preset time interval, the main scanning application sends the payment failure information to the test control terminal via the main scanning terminal.
6. The testing method according to claim 1, wherein: The step of sending a code scanning function start request to the main scanning application so that the main scanning application starts a code scanning interface and waits for code scanning includes: A scanning function start request including the first interface element information is sent to the main scanning application through the main scanning terminal, so that the main scanning terminal locates the scanning interface button of the main scanning application based on the first interface element information and starts the scanning interface.
7. The testing method according to claim 1, wherein: The step of sending a QR code display request to the scanned application so that the scanned application starts a QR code display interface includes: A QR code display request including the second interface element information is sent to the scanned application via the scanned terminal, so that the scanned terminal locates the QR code display button of the scanned application based on the second interface element information and starts the QR code display interface.
8. A testing system, characterized in that: Applied to a code scanning test device, the code scanning test device includes a test control terminal and a terminal to be tested; the test control terminal and the terminal to be tested are pre-installed with a local startup service application; The test control terminal is connected to the terminal under test through the local startup service application; the terminal under test is pre-installed with the application under test; The application to be tested includes a main scanning application and a scanned application; the system includes: A main scanning application control module, used for the test control terminal to connect to and log in to the main scanning application; The main scanning application control module is further configured to, when the test control terminal receives the first connection success feedback information sent by the main scanning application, send a code scanning function start request to the main scanning application, so that the main scanning application starts the code scanning interface and waits for code scanning; The scanned application control module is configured to connect to and log in to the scanned application when the test control terminal receives the startup success feedback information sent by the main scanning application; The scanned application control module is further configured to, when the test control terminal receives the second connection success feedback information sent by the scanned application, send a QR code display request to the scanned application, so that the scanned application starts a QR code display interface for the main scanning application to scan the code; A test report generation module is used for the test control terminal to obtain the scanning result information sent by the scanned application and the payment result information sent by the main scanning application; The test report generating module is further configured to generate a test report corresponding to the application to be tested based on the code scanning result information and the payment result information by the test control terminal; The terminal to be tested includes a main scanning terminal; the main scanning terminal is pre-installed with the main scanning application; the terminal to be tested includes a scanned terminal; the scanned application is pre-installed on the scanned terminal; the scanning result information is scanning success information or scanning failure information; the test control terminal is pre-stored with payment information and second interface element information; the second interface element information is used to represent the button position in the scanned application; the test control terminal is pre-set with first interface element information; the first interface element information is used to represent the button position in the main scanning application; The main scanning application control module is further used to send a first connection request to the main scanning terminal when the test control terminal receives a test instruction; the main scanning terminal initializes the main scanning application, establishes a connection with the main scanning application, and returns a first connection success response to the test control terminal; when the test control terminal receives the first connection success response, it sends a first login request to the main scanning terminal; the main scanning terminal controls the login to the main scanning application and sends the first connection success feedback information to the test control terminal.
9. A code scanning test device, characterized in that: The system comprises a test control terminal and a terminal to be tested; the test control terminal and the terminal to be tested are pre-installed with a local startup service application; the test control terminal is in communication with the terminal to be tested via the local startup service application; the terminal to be tested is pre-installed with an application to be tested; the application to be tested includes a main scanning application and a scanned application; the terminal to be tested includes a main scanning terminal and a scanned terminal; the main scanning application runs on the main scanning terminal, the scanned application runs on the scanned terminal, and the main scanning terminal and the scanned terminal are placed in a corresponding position to enable a code scanning operation; The test control terminal is provided with the test system according to claim 8.