Application program testing method and device, equipment, storage medium and program product

By implementing circular testing programs and preset communication protocols on mobile clients, the test cases are automatically generated and executed, and the inconvenience of testing that needs to be connected to the computer in the existing technology is solved, and efficient and convenient application testing is achieved.

CN120162270APending Publication Date: 2025-06-17SHANGHAI SHIZHUANG INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510362139.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-26
Publication Date
2025-06-17

AI Technical Summary

Technical Problem

The prior art requires connection with the computer when testing mobile client applications, so the test is inconvenient.

Method used

By implementing a circular test program on the client, using preset communication protocols (such as URL Scheme) to communicate with the server, automatically generate and execute test cases, judge whether the application is started normally, and generate test results.

Benefits of technology

It enables the application to be tested without a computer connection, which improves the convenience and efficiency of testing, and can discover the reasons for the application startup failure in advance and repair it in time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120162270A_ABST
    Figure CN120162270A_ABST
Patent Text Reader

Abstract

The invention provides an application program testing method and device, equipment, a storage medium and a program product, and relates to the technical field of computers. The method comprises the following steps: sending a test request to a server; receiving a test case returned by the server; the test case is generated by modifying the response information by the server; the response information is original information generated by the server based on the test request; and judging whether the management application program is opened through the URL Scheme or not within a preset duration, and generating a test result based on a judgment result. The device is used for executing the method. In the test process of the application program, whether the application program is normally started or not is judged by judging whether the loop test program can open the management application program or not, then whether the test is passed or not is determined, connection with a computer is not needed, and the test is more convenient and faster.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more particularly, to a test method, device, equipment, storage medium and program product for an application program. Background Art

[0002] An application program (App) refers to a software program developed to complete a certain or multiple specific tasks. These programs can run on various devices such as computers, mobile phones, and tablets to meet different needs of users. The testing of application programs is a key link in the software development cycle, aiming to ensure that the software meets the specified requirements and standards in terms of expected functions, performance, security, etc.

[0003] When testing an APP on a mobile client, it is mostly necessary to connect the mobile client to a computer, where there is a test script, and the testing of the APP is achieved by executing the test script. Summary of the Invention

[0004] The purpose of the embodiments of this application is to provide a test method, device, equipment, storage medium and program product for an application program, which can achieve the testing of the application program without connecting to a computer.

[0005] In a first aspect, the embodiments of this application provide a test method for an application program, which is applied to test an application program on a client. The application program includes an application program installation package and a loop test program; the loop test program is used to open a test management application program through a preset communication protocol; the client is communicatively connected to the server; the method includes:

[0006] Sending a test request to the server;

[0007] Receiving a test case returned by the server; the test case is generated by the server modifying the response information; the response information is the original information generated by the server based on the test request;

[0008] Judging whether the management application program is opened through the preset communication protocol within a preset time period, and generating a test result based on the judgment result.

[0009] In the process of testing the application program in the embodiments of this application, it is judged whether the application program starts normally by judging whether the loop test program can open the management application program, and then it is determined whether the test passes. There is no need to connect to a computer, and the testing is more convenient.

[0010] In any embodiment, the preset communication protocol is URL Scheme; generating a test result based on the judgment result includes:

[0011] If the judgment result indicates that the management application is successfully opened through the URL Scheme within the preset duration, it is determined that the test passes;

[0012] If the judgment result indicates that the management application is not successfully opened through the URL Scheme within the preset duration, it is determined that the test fails.

[0013] In the embodiments of the present application, if the URL Scheme successfully opens the management application within the preset duration, it indicates that the application starts normally. Therefore, the test passes; otherwise, the test fails. By using the URL Scheme and the management application to replace the execution script on the computer, the convenience of the test is improved.

[0014] In any embodiment, the server includes an application server and a proxy server, and the client communicates with the application server through the proxy server; receiving the test cases returned by the server, including:

[0015] Receiving the test cases returned by the proxy server; the test cases are generated by the proxy server modifying the target fields in the response information sent by the received application server; the response information is the original information generated by the application server based on the test request.

[0016] In the embodiments of the present application, the proxy server automatically modifies the target fields in the response information to obtain multiple test cases, and uses the test cases to test the application, so that the reasons for the failure of the application to start can be discovered in advance and repaired in time.

[0017] In any embodiment, a test policy is pre-stored in the proxy server; the test cases are generated by the proxy server generating the values corresponding to the target fields based on the test policy and replacing the values in the response information with the values corresponding to the target fields.

[0018] In the embodiments of the present application, the test policy in the proxy server automatically generates the values that the target fields can take, and generates the corresponding test cases, and uses the test cases to test the application, thereby improving the test efficiency and test comprehensiveness.

[0019] In any embodiment, the format of the response information is JSON format, and the target fields are the data types and / or data values in the response information.

[0020] In the embodiments of the present application, the data types and / or data values in the JSON-format response information are automatically modified, realizing the testing of multiple data types and data values.

[0021] In any embodiment, after generating the test result based on the judgment result, the method further includes:

[0022] Send the test result to the server so that the server stores the test result and determines whether there are unfinished test cases. If there are, return an instruction to continue the test to the client.

[0023] In the embodiment of the present application, by querying whether there are unfinished test cases and continuing the test if there are, through multiple loop tests, a more comprehensive test is achieved. By testing in a timely manner, the reasons for the failure of the application software to start are discovered and repaired, improving the user experience.

[0024] In a second aspect, an embodiment of the present application provides a test device for an application program. The device is used to test the application program on the client. The application program includes an application installation package and a loop test program; the loop test program is used to open the test management application program through a preset communication protocol; the client is communicatively connected to the server; the device includes:

[0025] A request sending module, configured to send a test request to the server;

[0026] A test case receiving module, configured to receive the test cases returned by the server; the test cases are generated by the server modifying the response information; the response information is the original information generated by the server based on the test request;

[0027] A test result generating module, configured to determine whether the management application program is opened through the preset communication protocol within a preset duration, and generate a test result based on the determination result.

[0028] In a third aspect, an embodiment of the present application provides an electronic device, including: a processor, a memory, and a bus, where

[0029] The processor and the memory communicate with each other through the bus;

[0030] The memory stores program instructions executable by the processor, and the processor can execute the method of the first aspect by invoking the program instructions.

[0031] In a fourth aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium, including:

[0032] The non-transitory computer-readable storage medium stores computer instructions, and the computer instructions cause the computer to execute the method of the first aspect.

[0033] In a fifth aspect, an embodiment of the present application provides a computer program product, including computer program instructions. When the computer program instructions are read and run by a processor, the method of the first aspect is executed.

[0034] Other features and advantages of the present application will be described in the subsequent specification, and in part will be obvious from the specification, or will be understood by implementing the embodiments of the present application. The objectives and other advantages of the present application can be achieved and obtained by the structures specifically pointed out in the written specification, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required to be used in the embodiments of the present application. It should be understood that the following drawings only show some embodiments of the present application, and thus should not be regarded as limiting the scope. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.

[0036] Figure 1 Schematic diagram of the process of a test method for an application program provided by an embodiment of the present application;

[0037] Figure 2 Schematic diagram of the process of another test method for an application program provided by an embodiment of the present application;

[0038] Figure 3 Schematic diagram of the process of yet another test method for an application program provided by an embodiment of the present application;

[0039] Figure 4 Schematic diagram of the process of still another test method provided by an embodiment of the present application;

[0040] Figure 5 Schematic diagram of the structure of a test device for an application program provided by an embodiment of the present application;

[0041] Figure 6 Schematic diagram of the physical structure of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0042] The following will describe in detail the embodiments of the technical solutions of the present application with reference to the drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the present application, and thus are only examples and should not be used to limit the protection scope of the present application.

[0043] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which this application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" and any variations thereof in the specification and claims of this application and the above description of the drawings are intended to cover non-exclusive inclusion.

[0044] In the description of the embodiments of the present application, technical terms such as "first" and "second" are only used to distinguish different objects, and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity, specific order, or primary-secondary relationship of the indicated technical features. In the description of the embodiments of the present application, the meaning of "a plurality of" is more than two, unless otherwise specifically defined.

[0045] Reference to "embodiment" herein means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The phrase appears in various places in the specification and does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0046] In the description of the embodiments of the present application, the term "and / or" is merely a description of the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. Additionally, the character " / " in this document generally represents an "or" relationship between the associated objects before and after.

[0047] In the description of the embodiments of the present application, the term "a plurality of" refers to more than two (including two). Similarly, "a plurality of groups" refers to more than two groups (including two groups), and "a plurality of pieces" refers to more than two pieces (including two pieces).

[0048] In the description of the embodiments of the present application, unless otherwise clearly specified and limited, technical terms such as "install", "connect", "couple", "fix", etc. should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or integrated; it can also be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and can be the internal communication of two components or the interaction relationship between two components. For those of ordinary skill in the art, the specific meanings of the above terms in the embodiments of the present application can be understood according to specific circumstances.

[0049] For e-commerce and community-based APPs, after the number of users reaches a certain level, in order to ensure the stability of the application during daily use by users, reduce fault losses and impacts, an in-built APP security mode is usually selected. The APP security mode is a fault recovery mechanism designed to handle serious errors or crashes that may occur during the operation of the APP. When the APP encounters serious problems such as continuous crashes, the security mode can be activated and the APP can be restored to a known and stable state, thus avoiding the loss of user data and the unavailability of the APP. When the application undergoes a configuration change and the user triggers continuous crashes, it supports the APP to recover from the continuously crashed state to the initial state, ensuring the availability of the APP.

[0050] However, the response of the APP security mode is slow and will only be triggered after a certain number of consecutive crashes. It is very likely that users will lose patience and give up using the APP before the APP security mode is triggered. Moreover, the APP security mode can only solve the crash problems caused by local caches and cannot recover the crashes caused by externally incoming data such as network requests.

[0051] Based on this, the embodiments of the present application provide a method for testing an application program. Before the application program is released, it is tested to find the possible reasons for the APP startup crash and improve it, thereby reducing the possibility of the APP startup crash from the source.

[0052] The current testing method usually connects the client loaded with the application program to a computer. There is a test execution script on the computer, and the application program is tested by running the script. If there is no computer, the testing of the application program on the client cannot be achieved. Therefore, this testing method is not convenient enough.

[0053] Therefore, in the method for testing an application program provided by the embodiments of the present application, the client does not need to be connected to a computer, but communicates wirelessly with the server, and determines whether the management application program can be opened in the way of URL Scheme during the testing process to determine whether the APP startup crashes. This improves the convenience of testing.

[0054] The following introduces the specific testing method of the application program:

[0055] Figure 1 It is a schematic flow chart of a method for testing an application program provided by the embodiments of the present application, as Figure 1As shown, this method is applied to a client on which an application to be tested is installed. The application includes an application installation package and a loop test program. The loop test program is used to open a test management application through a preset communication protocol. Here, the management application refers to an application on a mobile device that is used to start the APP to be tested through the URL Scheme and receive test results. Its main execution logic includes: 1. Start a test on the management APP. 2. Receive the current test case. 3. Start the application to be tested. 4. Wait for the application to be tested to wake up the management application through the URL Scheme. 5. After receiving the wake-up event, upload the test success or failure result to the server and record a copy on the local machine as well. 6. Obtain the next test case and repeat the execution from step 1 until all the test cases on the server are executed, and then end the test. In addition, the management application may also have one or more of the following functions: 1. View the device ID to facilitate verifying the attribution of the test cases with the server and determining which device conducted the test. 2. View the current test progress, which can be directly viewed on the local machine without having to check the web version of the management background. 3. Detect the proxy server currently connected to the mobile phone to prevent the test from being executed when the mobile phone is not connected to the proxy server, etc. The client can be a mobile phone, a tablet computer, a smart watch, etc. This method includes:

[0056] Step 101: Send a test request to the server.

[0057] Among them, the test request is sent from the client to the server. The test request is different from the requests sent during the normal use of the application. Specifically, an identifier can be added to the test request to indicate that this is a test request. After receiving this request (which may be a test request or a request for the normal operation of the application), the server parses the request. If the request includes a test identifier, it indicates that this is a test request; otherwise, it indicates that this is a request for the normal operation of the application. Based on the received test request and the requests for the normal operation of the program, the server will have different processing methods. For details, refer to step 102.

[0058] Step 102: Receive the test cases returned by the server; the test cases are generated by the server modifying the response information; the response information is the original information generated by the server based on the test request.

[0059] After receiving a test request, the server first generates corresponding response information based on the test request. Here, the response information refers to the data that can enable the client to start normally generated by the server based on the test request, that is, the original information. Then, the values corresponding to some fields in the response information are modified, and the modified response information is returned to the client as a test case. It should be noted that which fields in the response information are modified and what values they are modified to can be pre-configured.

[0060] It can be understood that the test scenario of this application can be for the startup phase of the application program. Therefore, the test request sent by the client to the server is a request during the startup process of the application program.

[0061] Step 103: Determine whether the management application program is opened through a preset communication protocol within a preset duration, and generate a test result based on the judgment result.

[0062] Among them, the preset duration can be a reasonable time range set by the tester based on experience, and is used to determine whether the call to the application to attempt to start the management application program is successful. This time is usually based on the expectation of the user experience. For example, the user will not wait for more than a few seconds to start the application program.

[0063] During the test process, the calling application program will attempt to start the management application program through a predefined communication protocol, and this communication protocol is defined and compiled into the application installation package during the development of the management application program. The preset communication protocol can be URL Scheme, system broadcast, inter-process communication, etc. The client will monitor the result of this startup attempt. Specifically, it will check whether the management application program is successfully started within the preset duration. A test result is generated based on the judgment result, and this test result is used to represent whether the test case sent by the server to test the application program passes the test.

[0064] In the process of testing the application program in the embodiment of the present application, it is determined whether the application program starts normally by judging whether the loop test program can open the management application program, and then it is determined whether the test passes. There is no need to connect to a computer, and the test is more convenient.

[0065] On the basis of the above embodiment, the communication protocol can be URL Scheme; generating a test result based on the judgment result includes:

[0066] If the judgment result indicates that the management application program is successfully opened through the URL Scheme within the preset duration, it is determined that the test passes;

[0067] If the judgment result indicates that the management application program is not successfully opened through the URL Scheme within the preset duration, it is determined that the test fails.

[0068] In a specific implementation process, if the management application is successfully opened within a preset time period, it indicates that the application has been normally started. In the case of the normal startup of the application, the loop test program will open the management application through the URL Scheme. Therefore, the test result is passed. If the application fails to start normally, then the loop test program will not open the management application through the URL Scheme. Therefore, if the management application is not successfully opened within the preset time period, it indicates that the application has not been normally started and the test fails.

[0069] In the embodiment of the present application, if the URL Scheme successfully opens the management application within the preset time period, it indicates that the application starts normally. Therefore, the test passes; otherwise, the test fails. By using the URL Scheme and the management application to replace the execution script on the computer, the convenience of the test is improved.

[0070] Based on the above embodiments, the server includes an application server and a proxy server. The client communicates with the application server through the proxy server; receiving the test cases returned by the server, including:

[0071] Receiving the test cases returned by the proxy server; the test cases are generated by the proxy server modifying the target fields in the response information sent by the received application server; the response information is the original information generated by the application server based on the test request.

[0072] In a specific implementation process, the application server is a software framework used to build, deploy, and manage applications. Its core functions include request processing, business logic execution, database interaction, session management, and security control, etc. It acts as a mediator between the client and the backend data, handling various tasks such as business logic, database interaction, and security control.

[0073] The proxy server is an intermediate device in the network, used to request resources from other servers on behalf of the client and return the results. It acts as an intermediary between the client and the application server. Its main functions include improving the access speed, hiding the real IP address of the client, protecting user privacy and security, etc. In the embodiment of the present application, the proxy server is used to generate test cases.

[0074] The client usually comes with the setting function of the proxy server, sets the specified proxy server for the currently connected network, and makes the requests of the application pass through the proxy server. The proxy server can automatically modify the return value of the original information (Response).

[0075] During the testing process, the client sends a request to the proxy server. After receiving the request, the proxy server determines whether the request is a test request and forwards the request to the application server. If it is a test request, for this test request, the proxy server obtains the response information corresponding to the test request from the application server. Through the JSON parsing algorithm, the JSON key-value path in the response information is recorded as KeyPath, and its data value (Value) and data type (Type) are associated. The storage format can be: KeyPath Value Type. A data set of KeyPath, Value, and Type is generated. For example, if the response information returned by the application server is: {"A":1,"B":{"C":"2"}}, then after parsing, we can obtain: [{"KeyPath":"A","Value":1,"Type":"int"},{"KeyPath":"B / C","Value":"2","Type":"string"}]. The proxy server can modify the value of Value among them. For example, it can be set to -1, 0, 10, 100, 1000, or it can also be set to a null value, etc. Each time a setting is made, a test case is generated, and the generated test case is sent to the client to test the application program on the client.

[0076] It should be noted that the data type Type can also be modified, changing the int type to a boolean type, and then changing the data value Value to true or false. It is also possible to delete a certain field or add a new field, etc.

[0077] In addition, the application server and the proxy server can be the same server, which has both the ability to handle application logic and proxy functions. Of course, they can also be two independent servers.

[0078] In the embodiment of this application, the proxy server automatically modifies the target fields in the response information to obtain multiple test cases, and uses the test cases to test the application program, so that the reasons for the failure of the application program to start can be discovered in advance and repaired in time.

[0079] In the above implementation process, in order to achieve the automatic generation of test cases, test policies can be preset in the proxy server. For example: according to different Types, different test case rules are supported to be configured in the proxy server. For example, for the Type of int, the test cases can be set to three integers: -1, 0, and 1; different Types are supported to be set to test the performance of the application when the types do not match; deleting a certain field is supported to test the performance of the application when the field is missing; adding a field is supported to test the performance of the application when the field is redundant; then, according to the KeyPath, the original Value is replaced with a new test case, and a new JSON is regenerated. The configuration referred to in this step is: configuring the test values required for each type, including but not limited to testing -1, 0, 1, 100, 1000, etc. for the int type, true or false for the boolean type, and very long strings or empty strings for the string type. Assume that the possible values for the configured int type are five values: -1, 0, 1, 100, 1000. Replace the KeyPath A with the test case. Since the Type of KeyPath A is int, the following four test cases are generated (1 is the original value and does not enter the test case): {"A": -1, "B": {"C": "2"}}, {"A": 0, "B": {"C": "2"}}, {"A": 100, "B": {"C": "2"}}, {"A": 1000, "B": {"C": "2"}}.

[0080] After generating the new test cases, restart the application of the client. The application will initiate the same request through the proxy server. When the request of the restarted application enters the proxy server, the proxy server determines whether it is a test request according to the method in the above embodiment. If it is, the newly generated JSON above is taken as the new request response and returned to the client. It should be noted that each time the application is started, only the Response of one request is modified to avoid interference. Without this restriction, when the tested application is started once, dozens of requests will be sent simultaneously. The contents of the Response are modified simultaneously for these dozens of requests, causing the application to crash, and it is impossible to lock which one of these dozens of requests causes the application to crash, and each request needs to be tested again one by one.

[0081] Specifically, the server can maintain a test case queue, and each time only one unfinished test case is taken out from the queue to generate the corresponding tampered response and return it to the client. During the same application startup cycle, the proxy server only allows the response tampering of the request associated with the current test case, and the original response is directly returned for the rest of the requests.

[0082] This application can also modify non-JSON data to generate test cases.

[0083] It should be noted that in addition to being pre-set in the proxy server, the test policy can also be dynamically obtained by the proxy server.

[0084] In the embodiment of the present application, the values that the target field can take are automatically generated through the test policy in the proxy server, and corresponding test cases are generated. The application program is tested using the test cases, thereby improving the test efficiency and comprehensiveness.

[0085] Based on the above embodiment, after generating the test result based on the judgment result, the method further includes:

[0086] Sending the test result to the server, so that the server stores the test result and determines whether there are unfinished test cases. If so, an instruction to continue the test is returned to the client.

[0087] In the specific implementation process, after obtaining the test result, the client sends the test result to the server. After receiving the test result, the server stores it for the tester to view on the one hand, and on the other hand, it can be used to record which test cases have completed the test. Thus, in the next test, the unfinished test cases are selected for testing. After receiving the test result, the server queries whether there are still test cases that have not been completed. If so, the application program of the client is continued to be tested. If not, the test is ended.

[0088] In the embodiment of the present application, by querying whether there are unfinished test cases and continuing the test if there are, more comprehensive testing is achieved through multiple loop tests. The reasons for the failure of the application software to start are timely discovered and repaired through testing, improving the user experience.

[0089] Figure 2 It is a schematic flowchart of another application program testing method provided by the embodiment of the present application, as Figure 2 shown. This process is the steps of testing from the perspective of the server side, including:

[0090] Step 201: The proxy server captures the request; after the client starts the application program to be tested, it sends a test request to the server, and the proxy server will capture the test request.

[0091] Step 202: Filter the requests to be tested according to the URL; the proxy server parses the URL in the test request and determines whether it is a test request through the RUL.

[0092] Step 203: Whether testing is required; if it is a test request, step 205 is executed, otherwise step 204 is executed.

[0093] Step 204: Return the original Response; for requests that are not the ones to be tested, after the proxy server obtains the original Response from the application server, it returns the original Response to the client.

[0094] Step 205: Generate a data set of KeyPath, Value, and Type based on the JSON data in the original Response; for test requests, after the proxy server obtains the original Response returned by the application server, it extracts the JSON data in the original Response to obtain a data set of KeyPath, Value, and Type.

[0095] Step 206: Generate a set of test cases according to the configured test strategy; the method for generating the set of test cases can refer to the above embodiments and will not be elaborated here.

[0096] Step 207: Obtain a test case that has not been completed, regenerate the Response and return it. From the generated set of test cases, select a test case that has not been completed, generate a Response in the format of the original Response, and return the generated Response to the client.

[0097] Figure 3 It is a schematic flow diagram of another test method for an application provided by an embodiment of the present application. As Figure 3 shown, this method includes actions performed by the client and the server, including:

[0098] Step 301: Download the application to be tested; after an application of a certain version is built, it is downloaded and installed on the mobile terminal. In the embodiment of the present application, the mobile terminal is described as a mobile phone.

[0099] Step 302: Configure the proxy server; use the proxy server setting function built into iOS and Android mobile phones to set a specified proxy server for the currently connected network, so that all requests of the mobile application pass through the proxy server, and this proxy server is the server that can automatically modify the returned value of the interface Response implemented by the present invention.

[0100] Step 303: Start the application and initiate a request; start the application to be tested. At this time, the application will initiate a test request to the server.

[0101] Step 304: The proxy server captures the request;

[0102] Step 305: Filter the requests to be tested according to the URL;

[0103] Step 306: Whether testing is required;

[0104] Step 307: Return the original Response;

[0105] Step 308: Generate a data set of KeyPath, Value, and Type based on the JSON data in the original Response;

[0106] Step 309: Generate a set of test cases according to the configured test strategy;

[0107] Step 310: Obtain the test cases with unfinished tests, regenerate the Response and return it;

[0108] It should be noted that for the specific implementation methods of steps 304 - 310, refer to the relevant descriptions in Figure 2 and will not be elaborated here.

[0109] Step 311: The application obtains test cases; the application obtains the test cases returned by the proxy server and performs the corresponding application startup operation.

[0110] Step 312: Whether the application crashes; monitor whether the application crashes. If it crashes, execute step 314; otherwise, execute step 313. Among them, the method for monitoring whether the application crashes is: determine whether the management application is opened through the URL Scheme within a preset time period. If so, it means the application has not crashed; otherwise, it means the application has crashed.

[0111] Step 313: The test is completed, and the test case is marked as successful;

[0112] Step 314: The test is completed, and the test case is marked as failed.

[0113] Figure 4 Another schematic diagram of the test method flow provided by the embodiment of the present application is shown in Figure 4 as follows, including:

[0114] Step 401: Download the application to be tested; download the application to be tested to the mobile phone.

[0115] Step 402: Inject a loop test program; after a certain version of the application is built, through the method of repackaging, compile the code for loop testing into the application installation package. The main function of the loop test code is to open the test management application Manager through the URLScheme and install the application to be tested on the mobile phone.

[0116] Step 403: Install the management application; the mobile phone installs the test management application Manager, and Manager can open the application to be tested through the URL Scheme method.

[0117] Step 404: Set the preset duration and start the test through the management application;

[0118] Step 405: Wake up the application to be tested;

[0119] Step 406: Wait for the test to complete; among them, for the specific process of the test in Step 406, reference can be made to the above embodiments, for example Figure 2 and Figure 3 the relevant introduction.

[0120] Step 407: Whether the preset duration is exceeded; if the preset duration is exceeded and the management application is not opened by the URL Scheme, then execute Step 408; otherwise, execute Step 409.

[0121] Step 408: The test fails and the management application starts automatically;

[0122] Step 409: The test is successful and the test management application is opened through the URL Scheme;

[0123] Step 410: The management application starts;

[0124] Step 411: Report the test result;

[0125] Step 412: Query whether there are test cases with unfinished tests. If so, execute Step 405, otherwise end the test.

[0126] The embodiments of the present application can perform automated tests without a computer, and during the test process, the server can automatically generate test cases to achieve full-scenario coverage and reduce manual participation.

[0127] Figure 5 It is a schematic structural diagram of a test device for an application provided by an embodiment of the present application. The device can be a module, a program segment, or code on an electronic device. It should be understood that the device corresponds to the above Figure 1 method embodiment and can execute Figure 1 each step involved in the method embodiment. The specific functions of the device can be referred to the description above. To avoid repetition, the detailed description is appropriately omitted here. The device includes: a request sending module 501, a test case receiving module 502, and a test result generating module 503, where:

[0128] The request sending module 501 is used to send a test request to the server;

[0129] The test case receiving module 502 is used to receive the test cases returned by the server; the test cases are generated by the server by modifying the response information; the response information is the original information generated by the server based on the test request.

[0130] The test result generating module 503 is used to determine whether the management application is opened through a preset communication protocol within a preset time period, and generate a test result based on the determination result.

[0131] Based on the above embodiment, the preset communication protocol is URL Scheme; specifically, the test result generating module 503 is used for:

[0132] If the determination result indicates that the management application is successfully opened through the URL Scheme within the preset time period, it is determined that the test passes;

[0133] If the determination result indicates that the management application is not successfully opened through the URL Scheme within the preset time period, it is determined that the test fails.

[0134] Based on the above embodiment, the server includes an application server and a proxy server, and the client is communicatively connected to the application server through the proxy server; specifically, the test case receiving module 502 is used for:

[0135] Receiving the test cases returned by the proxy server; the test cases are generated by the proxy server by modifying the target fields in the response information sent by the received application server; the response information is the original information generated by the application server based on the test request.

[0136] Based on the above embodiment, the proxy server pre-stores a test policy; the test cases are generated by the proxy server based on the test policy to generate the values corresponding to the target fields, and replacing the values in the response information with the values corresponding to the target fields.

[0137] Based on the above embodiment, the format of the response information is JSON format, and the target fields are the data types and / or data values in the response information.

[0138] Based on the above embodiment, the device further includes a result returning module, which is used for:

[0139] Sending the test result to the server, so that the server stores the test result and determines whether there are unfinished test cases. If so, it returns an instruction to continue the test to the client.

[0140] Figure 6 This is a schematic diagram of the physical structure of the electronic device provided by the embodiments of the present application. As Figure 6 shown, the electronic device includes: a processor 601, a memory 602, and a bus 603; wherein,

[0141] The processor 601 and the memory 602 communicate with each other through the bus 603;

[0142] The processor 601 is used to call program instructions in the memory 602 to execute the methods provided by the above method embodiments, for example, including: sending a test request to the server; receiving a test case returned by the server; the test case is generated by the server modifying the response information; the response information is the original information generated by the server based on the test request; determining whether the management application is opened through a preset communication protocol within a preset time period, and generating a test result based on the determination result.

[0143] The processor 601 may be an integrated circuit chip with signal processing capabilities. The above-mentioned processor 601 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0144] The memory 602 may include, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc.

[0145] This embodiment discloses a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the methods provided in the above method embodiments, for example, including: sending a test request to the server; receiving a test case returned by the server; the test case is generated by the server modifying the response information; the response information is the original information generated by the server based on the test request; determining whether the management application program is opened through a preset communication protocol within a preset time period, and generating a test result based on the determination result.

[0146] This embodiment provides a non-transitory computer-readable storage medium, which stores computer instructions. The computer instructions cause the computer to execute the methods provided in the above method embodiments, for example, including: sending a test request to the server; receiving a test case returned by the server; the test case is generated by the server modifying the response information; the response information is the original information generated by the server based on the test request; determining whether the management application program is opened through a preset communication protocol within a preset time period, and generating a test result based on the determination result.

[0147] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For another example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections between each other can be through some communication interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical or other forms.

[0148] In addition, the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place, or they can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0149] Furthermore, in each embodiment of the present application, the functional modules can be integrated together to form an independent part, or each module can exist alone, or two or more modules can be integrated to form an independent part.

[0150] In this document, relational terms such as first and second are used solely to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations.

[0151] The above description is only for the embodiments of this application and is not intended to limit the protection scope of this application. For those skilled in the art, this application can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this application shall be included within the protection scope of this application.

Claims

1. A method for testing an application, characterized in that: The method is applied to test an application on a client, wherein the application includes an application installation package and a loop test program; The loop test program is used to open the test management application program through a preset communication protocol; The client is connected to the server for communication; the method comprises: Sending a test request to the server; Receive a test case returned by the server; the test case is generated by the server modifying the response information; the response information is original information generated by the server based on the test request; It is determined whether the management application is opened through the preset communication protocol within a preset time period, and a test result is generated based on the determination result.

2. The method according to claim 1, characterized in that The preset communication protocol is URL Scheme; and the generating of the test result based on the judgment result includes: If the judgment result indicates that the management application is successfully opened through the URL Scheme within the preset time period, then the test is determined to be passed; If the determination result indicates that the management application is not successfully opened through the URL Scheme within the preset time period, it is determined that the test fails.

3. The method according to claim 1, characterized in that The server includes an application server and a proxy server, and the client is connected to the application server through the proxy server; and receiving the test case returned by the server includes: Receive the test case returned by the proxy server; the test case is generated by the proxy server modifying the target field in the response information sent by the application server; the response information is the original information generated by the application server based on the test request.

4. The method according to claim 3, characterized in that The proxy server has a test strategy pre-stored therein; the test case is generated by the proxy server generating a value corresponding to the target field based on the test strategy, and replacing the value in the response information with the value corresponding to the target field.

5. The method according to claim 1, characterized in that The format of the response information is JSON format, and the target field is the data type and / or data value in the response information.

6. The method according to any one of claims 1 to 5, characterized in that: After generating the test result based on the determination result, the method further includes: The test result is sent to the server so that the server stores the test result and determines whether there are unfinished test cases. If so, an instruction to continue the test is returned to the client.

7. A testing device for an application, characterized in that: The device is used to test an application on a client, wherein the application includes an application installation package and a loop test program; The loop test program is used to open the test management application program through a preset communication protocol; The client is connected to the server for communication; the device comprises: A request sending module, used for sending a test request to the server; A test case receiving module, used to receive a test case returned by the server; the test case is generated by the server modifying the response information; the response information is the original information generated by the server based on the test request; The test result generating module is used to determine whether the management application is opened through the preset communication protocol within a preset time period, and to generate a test result based on the determination result.

8. An electronic device, characterized in that: include: processor, memory and bus, wherein, The processor and the memory communicate with each other via the bus; The memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the method according to any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium stores computer instructions, which, when executed by a computer, cause the computer to perform the method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The method comprises computer program instructions, and when the computer program instructions are read and executed by a processor, the method according to any one of claims 1 to 6 is executed.