App-based automatic interface time consumption test method and system, medium and equipment
Through dynamic configuration and time-consuming testing methods of automation interfaces, the accuracy and flexibility of App automation interface time-consuming testing in complex production environments in the prior art are solved, and more efficient and accurate testing results are achieved.
Patent Information
- Application Number
- CN202411722750.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-03-28
AI Technical Summary
The existing time-consuming test methods for App automation interfaces are difficult to accurately reflect the real performance when facing complex and changing production environments, and are unable to handle asynchronous callbacks and code maintenance.
It provides a time-consuming test method based on the App automation interface. By receiving the startup instructions of the target terminal App, reading the App configuration file, and responding to the configuration file update notification, dynamically configure the test time-consuming method. The method includes executing a preset business method, judging preset conditions for time-consuming timing operations, and performing time-consuming timing operations and log writing of the automated interface when the conditions are established.
Improves testing efficiency and accuracy, can accurately reflect the true performance of the interface in a production environment, supports asynchronous callbacks and dynamic configuration, and enhances the flexibility and reliability of testing.
Smart Images

Figure CN119718857A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of software testing, and in particular to a method, system, medium and equipment for time-consuming testing based on an App automation interface. Background Art
[0002] In the current field of software development and testing, the performance evaluation of applications (Apps), especially the interface time-consuming test, is a crucial link. However, the existing testing methods and technologies have shown some obvious limitations when facing the complex and changeable actual production environment.
[0003] Traditional stress testing methods are mostly limited to test environments, where the interface test devices in this environment are often not the same set of codes as the devices in the actual production environment. This means that an interface that performs well in a test environment may have performance bottlenecks in a production environment due to a variety of factors. This environmental difference causes a deviation between the test results and actual usage, making it difficult to accurately reflect the true performance in a production environment. In addition, the existing time-consuming test methods for App automated interfaces are also unable to cope with the challenges of production environments, asynchronous callbacks, and code maintenance, which has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] The purpose of the present invention is to provide a time-consuming test method, system, medium and equipment based on App automation interface to solve the deficiencies in the prior art. It provides a time-consuming test method based on App automation interface, which can realize dynamic configuration test time-consuming method and has significant effect in improving test efficiency and accuracy.
[0005] An embodiment of the present application provides a time-consuming test method based on an App automation interface, the method comprising:
[0006] Receive the startup command of the target terminal App and read the App configuration file;
[0007] In response to the update instruction of the App configuration file, the server executes the update instruction and sends a notification of the dynamic modification of the target terminal configuration operation to the target terminal through the user ID;
[0008] Receive the notification of the target terminal configuration operation, and store the latest configuration file obtained; the latest configuration file is stored in the application cache Map<String,Boolean> Among them, key is String type "class name + method name", value is Boolean type, which is used to determine whether the time-consuming timing operation can be supported. If it is true, it means that the time-consuming timing operation is supported, and if it is false, it means that the time-consuming timing operation is not supported;
[0009] Execute the preset business method and determine whether the preset condition for performing the time-consuming timing operation is satisfied; wherein, the preset condition includes calling if(map.get(\"class name + method name\") is true or calling map.get(\"All\") is true) with \"class name + method name\" as the key;
[0010] In response to the preset condition for performing the time-consuming timing operation being satisfied, perform the time-consuming timing operation on the target terminal App automation interface and write it to the log.
[0011] Optionally, the App configuration file includes: an xml format file; the file format is:
[0012] <item name = \"All\" value = “true”>;
[0013] <item name = \"class name + method name\" value = “true”>.
[0014] Optionally, before executing the preset business method and determining whether the preset condition for performing the time-consuming timing operation is satisfied, the method further includes:
[0015] Obtain the implementation class one method corresponding to the preset business method and automatically generate the implementation class two method; wherein, all interface methods in the implementation class two method are completed by calling the interface methods of the implementation class one method, and the time-consuming calculation of the implementation class one method is performed using the implementation class two method.
[0016] Optionally, the performing the time-consuming calculation of the implementation class one method using the implementation class two method includes:
[0017] Determine the optional parameter ICallBack added in the interface method and determine whether the optional parameter ICallBack is empty;
[0018] If the optional parameter ICallBack is not empty, perform the asynchronous callback and perform the time-consuming calculation of the implementation class one method using the implementation class two method.
[0019] Optionally, the performing the time-consuming calculation of the implementation class one method using the implementation class two method includes:
[0020] Start the timing function, use the currently executed \"class name + method name\" as the key, and store the current start timestamp as the value in the Map; wherein, the data interface is of the type Map<\"class name + method name\", startTime>, the key is of the String type to store the method name, and the value is of the long type to store the start timestamp;
[0021] Implement the method of calling implementation class 1 and respond to the completion of the timing function execution to determine the current end timestamp endTime;
[0022] According to the start timestamp and the end timestamp, a time-consuming timestamp of executing the implementation class one method by using the implementation class two method is determined.
[0023] Optionally, the class name of the target terminal App automation interface is InterfaceManager, all preset business methods are implemented through InterfaceManager, and the InterfaceManager includes several interfaces.
[0024] Optionally, the log content includes:
[0025] Class name, function name, parameters, time before call, time after function execution is completed, and millisecond timestamp of time consumed.
[0026] Another embodiment of the present application provides a time-consuming test system based on an App automation interface, the system comprising:
[0027] The receiving module is used to receive the startup instruction of the target terminal App and read the App configuration file;
[0028] A response module, configured to respond to an update instruction of the App configuration file, the server executes the update instruction, and sends a notification of the dynamic modification of the target terminal configuration operation to the target terminal through the user ID;
[0029] The storage module is used to receive the notification of the target terminal configuration operation and store the latest configuration file obtained; the latest configuration file is stored in the application cache Map<String,Boolean> Among them, key is String type "class name + method name", value is Boolean type, which is used to determine whether the time-consuming timing operation can be supported. If it is true, it means that the time-consuming timing operation is supported, and if it is false, it means that the time-consuming timing operation is not supported;
[0030] An execution module is used to execute a preset business method and determine whether a preset condition for executing a time-consuming timing operation is met; wherein the preset condition includes calling if(map.get("class name + method name") as true or calling map.get("All") as true by using "class name + method name" as a key;
[0031] The timing module is used to execute the time-consuming timing operation of the target terminal App automation interface and write a log in response to the preset condition for executing the time-consuming timing operation being met.
[0032] Yet another embodiment of the present application provides a storage medium, wherein the storage medium stores a computer program, wherein the computer program is configured to implement any of the above methods when executed.
[0033] Another embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement any of the above methods.
[0034] Compared with the prior art, the present invention first receives the startup instruction of the target terminal App and reads the App configuration file; in response to the update instruction of the App configuration file, the server executes the update instruction and sends a notification of the dynamic modification of the target terminal configuration operation to the target terminal through the user ID; receives the notification of the target terminal configuration operation and stores the latest configuration file obtained; executes the preset business method and determines whether the preset condition for executing the time-consuming timing operation is met; in response to the preset condition for executing the time-consuming timing operation being met, the target terminal App automation interface time-consuming timing operation is executed and written into the log. It provides a time-consuming test method based on the App automation interface, which can realize the dynamic configuration test time-consuming method and has a significant effect in improving the test efficiency and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 A hardware structure block diagram of a computer terminal based on an App automation interface time-consuming test method provided in an embodiment of the present invention;
[0036] Figure 2 A flowchart of a time-consuming test method based on an App automation interface provided by an embodiment of the present invention;
[0037] Figure 3 A schematic diagram of a process of a time-consuming timing operation of a target terminal App interface provided by an embodiment of the present invention;
[0038] Figure 4 A schematic diagram of a process for automatically generating a time-consuming timing operation compilation of a target terminal App interface provided by an embodiment of the present invention;
[0039] Figure 5 A schematic diagram of a process for asynchronous time-consuming statistics of a target terminal App interface provided by an embodiment of the present invention;
[0040] Figure 6 A schematic diagram of a process of automatically generating a second implementation class of compilation provided by an embodiment of the present invention;
[0041] Figure 7 A schematic diagram of the printed content of the interface time-consuming log provided by an embodiment of the present invention;
[0042] Figure 8 A schematic diagram of a time-consuming test device based on an App automation interface provided by an embodiment of the present invention;
[0043] Fig. 9 A schematic diagram of the structure of a time-consuming test system based on an App automation interface provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0044] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, but should not be construed as limiting the present invention.
[0045] The embodiment of the present invention first provides a time-consuming test method based on App automation interface, which can be applied to electronic devices, such as computer terminals, specifically ordinary computers, tablets, etc.
[0046] The following describes it in detail by taking running on a computer terminal as an example. Figure 1 The hardware structure block diagram of a computer terminal based on an App automation interface time-consuming test method provided by an embodiment of the present invention. Figure 1 As shown, the computer device includes a processor, a memory, and a network interface connected via a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.
[0047] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any time-consuming test method based on the App automation interface.
[0048] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0049] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any time-consuming test method based on the App automation interface.
[0050] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 1 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0051] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0052] See also Figure 2 , Figure 2 A flow chart of a time-consuming test method based on an App automation interface provided in an embodiment of the present invention may include the following steps:
[0053] S201: Receive a startup instruction of the target terminal App and read the App configuration file.
[0054] In this embodiment, when the target terminal App is started, a start-up instruction is sent, the system receives the start-up instruction, and reads a configuration file related to the App.
[0055] S202: In response to the update instruction of the App configuration file, the server executes the update instruction and sends a notification of the dynamic modification of the target terminal configuration operation to the target terminal through the user ID.
[0056] In this embodiment, when the configuration file of the App is updated, the server receives an update instruction, executes the update instruction, and sends an update notification to the target terminal via the user ID.
[0057] S203: Receive notification of the configuration operation of the target terminal, and store the latest configuration file obtained.
[0058] In this embodiment, after receiving the update notification, the target terminal obtains the latest configuration file from the server. The configuration file is stored in the application cache and is mapped to the target terminal using Map.<String,Boolean> The latest configuration file is stored in the application cache map.<String,Boolean> Among them, key is String type "class name + method name", value is Boolean type, which is used to determine whether the time-consuming timing operation can be supported. If it is true, it means that the time-consuming timing operation is supported, and if it is false, it means that the time-consuming timing operation is not supported;
[0059] S204: Execute the preset business method and determine whether the preset condition for performing the elapsed time timing operation is satisfied.
[0060] In this embodiment, when the preset business method is executed, the system checks whether the preset condition for performing the elapsed time timing operation is satisfied. The preset condition includes calling if(map.get(\"class name + method name\") is true or calling map.get(\"All\") is true) with \"class name + method name\" as the key;
[0061] S205: In response to the preset condition for performing the elapsed time timing operation being satisfied, perform the elapsed time timing operation on the target terminal App automation interface and write it to the log.
[0062] In this embodiment, if the preset condition for the elapsed time timing operation is satisfied, the corresponding elapsed time timing operation is performed. The timing result will be written to the log for subsequent analysis.
[0063] See Figure 3 , Figure 3 which is a schematic flow diagram of the elapsed time timing operation for the target terminal App interface provided by the embodiment of the present invention. First, when the target terminal App application starts, read the configuration file and store it in the application cache Map<String, Boolean>, where the key is of String type \"class name + method name\", and the value is of Boolean type indicating whether the method name under a certain class supports the elapsed time timing operation, true means supporting the elapsed time timing operation, and false means not supporting the elapsed time timing operation;
[0064] If the configuration file is updated, the server supports dynamic modification of the user device configuration, which is sent to the target terminal application App with the user ID. The target terminal application App obtains the latest configuration file and stores it locally when it receives the notification. It should be noted that the configuration file can be an xml file, and the file format is: <item name = \"All\" value = “true”>; <item name = \"class name + method name\" value = “true”>.
[0065] Exemplarily, when executing a certain preset business method, call if(map.get(\"class name + method name\") == true or map.get(\"All\") == true) with \"class name + method name\" as the key. If the judgment condition is satisfied, perform the elapsed time timing operation and write it to the log (map.get(\"All\") == true means that all methods need to perform the timing operation, and map.get(\"class name + method name\") == true means that the specified method performs the timing operation).
[0066] In an optional implementation, before executing the preset business method and determining whether a preset condition for executing the time-consuming timing operation is met, the method may further include:
[0067] Obtain an implementation class one method corresponding to a preset business method, and automatically generate an implementation class two method; wherein all interface methods in the implementation class two method are completed by calling the interface method of the implementation class one method, and the implementation class two method is used to perform time-consuming calculations on the implementation class one method.
[0068] The step of using the implementation class 2 method to perform the time-consuming calculation of the implementation class 1 method may include:
[0069] 1. Determine the optional parameter ICallBack added in the interface method, and determine whether the optional parameter ICallBack is empty;
[0070] 2. If the optional parameter ICallBack is not empty, perform asynchronous callback and use the implementation class two method to perform time-consuming calculations on the implementation class one method.
[0071] In an optional implementation, the step of using the implementation class 2 method to perform the time-consuming calculation of the implementation class 1 method may include:
[0072] Step 1: Start the timing function, use the currently executed "class name + method name" as the key, and store the value as the current start timestamp in the Map; the data interface is Map<"class name + method name", startTime> type, the key is the String type to store the method name, and the value is the long type to store the start timestamp;
[0073] Step 2: Implement the method of calling implementation class 1 and respond to the completion of the timing function execution to determine the current end timestamp endTime;
[0074] Step 3: According to the start timestamp and the end timestamp, determine the time-consuming timestamp of executing the implementation class one method using the implementation class two method.
[0075] See also Figure 4 , Figure 4A flowchart of the automatic generation of the time-consuming timing operation compilation of a target terminal App interface provided by an embodiment of the present invention. During program design, the interface class must be implemented in all basic / business classes and methods. When the interface class is implemented, all methods in the interface class must be implemented. Among them, implementation class one (Implement1) can be written by developers to write specific business codes, and implementation class two (Implemen2) can be automatically generated by scripting. The generation of implementation class two is a focus of this application. When compiling and generating implementation class two, all interface methods in class two are implemented, and these methods can directly call the methods of implementation class one, and the time-consuming calculation of implementation class one is performed.
[0076] Exemplarily, an optional parameter ICallBack can be added to the interface. When the optional parameter ICallBack is not empty, it indicates that the method executes an asynchronous callback, that is, the time-consuming test device needs to perform time statistics on the asynchronous callback, and then register for monitoring. The registration and monitoring is mainly for the implementation class two (Implement2) method. The implementation class one (Implement1) method determines that the optional parameter ICallBack is not empty, and responds to the ICallBack method after executing the asynchronous callback business function. Once the ICallBack method is responded to, the location where the implementation class two (Implement2) method is registered for monitoring will receive a response notification, informing that the time-consuming asynchronous operation is completed. At this time, the time-consuming statistics will be ended, and the time-consuming statistics will be started when the method / function is just called.
[0077] See also Figure 5 , Figure 5 A flowchart of asynchronous time-consuming statistics of a target terminal App interface provided by an embodiment of the present invention. The data interface is of Map<class name+method name, startTime> type, the key is of String type to store the method name, and the value is of long type to store the start timestamp. When the timing function is started, the currently executed class name+method name is used as the key, and the value is stored in the Map as the current timestamp. When the asynchronous function is executed, the current timestamp is obtained and stored in the endTime temporary variable. If the time-consuming timestamp is needed, the start timestamp is taken out of the Map through the class name+method name and stored in the startTime temporary variable, and then the time-consuming timestamp can be obtained by subtracting the startTime from the endTime.
[0078] See also Figure 6 , Figure 6A schematic diagram of a process of compiling and automatically generating an implementation class 2 provided by an embodiment of the present invention. The class name of the target terminal App automation interface is InterfaceManager, all preset business methods are implemented through InterfaceManager, and the InterfaceManager contains several interfaces.
[0079] For example, an interface with a class name of InterfaceManager may be designed, and all services must pass through InterfaceManager; InterfaceManager has N interfaces.
[0080] When a program developer needs to instantiate a new implementation class, he encapsulates a method in the InterfaceManager class. The method name can be getInterface. For example, the method for obtaining customer information is:
[0081] getClientInterface(parameters...){
[0082] ClientImplement1clientImplement=newClientImplement1(parameter...);
[0083] ClientImplement execution method;
[0084] }
[0085] When the program is compiled, the last part of the string is automatically replaced from implementation class 1 (Implement1) to implementation class 2 (Implement2). Since ClientImplement and ClientImplement2 are in the same package, there is no need to import the package.
[0086] See also Figure 7 , Figure 7 A schematic diagram of the interface time-consuming log printing content provided in an embodiment of the present invention, each interface time-consuming log printing can be accompanied by: class name, function name, parameters, time before calling, time after function execution is completed, and time-consuming millisecond timestamp.
[0087] See also Figure 8 , Figure 8A schematic diagram of a time-consuming test device based on an App automation interface provided by an embodiment of the present invention. Among them, a time-consuming test device based on an App automation interface can realize the following functional modules: automatic compilation and generation of test interfaces to reduce the manual writing work of developers, support methods / functions in the project and design and implement InterfaceManager; realize automatic generation of implementation class shells corresponding to the interface; time-consuming test supports multiple methods to support operation in a production environment; dynamic configuration of test time-consuming methods; configuration supports hot update mechanism; timing function design to support calculation time statistics of asynchronous callback functions, and log function design.
[0088] Compared with the prior art, the present invention first receives the startup instruction of the target terminal App and reads the App configuration file; in response to the update instruction of the App configuration file, the server executes the update instruction and sends a notification of the dynamic modification of the target terminal configuration operation to the target terminal through the user ID; receives the notification of the target terminal configuration operation and stores the latest configuration file obtained; executes the preset business method and determines whether the preset condition for executing the time-consuming timing operation is met; in response to the preset condition for executing the time-consuming timing operation being met, the target terminal App automation interface time-consuming timing operation is executed and written into the log. It provides a time-consuming test method based on the App automation interface, which can realize the dynamic configuration test time-consuming method and has a significant effect in improving the test efficiency and accuracy.
[0089] Another embodiment of the present application provides a time-consuming test system based on an App automation interface, such as Fig. 9 The schematic diagram of the structure of a time-consuming test system based on an App automation interface is shown, and the system includes:
[0090] The receiving module 901 is used to receive the startup instruction of the target terminal App and read the App configuration file;
[0091] A response module 902 is used for responding to the update instruction of the App configuration file, the server executes the update instruction, and sends a notification of the dynamic modification of the target terminal configuration operation to the target terminal through the user ID;
[0092] The storage module 903 is used to receive the notification of the configuration operation of the target terminal and store the latest configuration file obtained;
[0093] An execution module 904 is used to execute a preset business method and determine whether a preset condition for executing a time-consuming timing operation is met;
[0094] The timing module 905 is used to execute the time-consuming timing operation of the target terminal App automation interface and write a log in response to the preset condition for executing the time-consuming timing operation being met.
[0095] Compared with the prior art, the present invention first receives the startup instruction of the target terminal App and reads the App configuration file; in response to the update instruction of the App configuration file, the server executes the update instruction and sends a notification of the dynamic modification of the target terminal configuration operation to the target terminal through the user ID; receives the notification of the target terminal configuration operation and stores the latest configuration file obtained; executes the preset business method and determines whether the preset condition for executing the time-consuming timing operation is met; in response to the preset condition for executing the time-consuming timing operation being met, the target terminal App automation interface time-consuming timing operation is executed and written into the log. It provides a time-consuming test method based on the App automation interface, which can realize the dynamic configuration test time-consuming method and has a significant effect in improving the test efficiency and accuracy.
[0096] An embodiment of the present invention further provides a storage medium, in which a computer program is stored, wherein the computer program is configured to implement the steps in the above method embodiment when running.
[0097] Specifically, in this embodiment, the above storage medium may be configured to store a computer program for performing the following steps:
[0098] S201: receiving a startup instruction of the target terminal App and reading the App configuration file;
[0099] S202: In response to the update instruction of the App configuration file, the server executes the update instruction and sends a notification of the dynamic modification of the target terminal configuration operation to the target terminal through the user ID;
[0100] S203: receiving a notification of the configuration operation of the target terminal, and storing the latest configuration file obtained;
[0101] S204: Execute a preset business method and determine whether a preset condition for executing a time-consuming timing operation is met;
[0102] S205: In response to the preset condition for executing the time-consuming timing operation being met, the time-consuming timing operation of the target terminal App automation interface is executed and written into a log.
[0103] Compared with the prior art, the present invention first receives the startup instruction of the target terminal App and reads the App configuration file; in response to the update instruction of the App configuration file, the server executes the update instruction and sends a notification of the dynamic modification of the target terminal configuration operation to the target terminal through the user ID; receives the notification of the target terminal configuration operation and stores the latest configuration file obtained; executes the preset business method and determines whether the preset condition for executing the time-consuming timing operation is met; in response to the preset condition for executing the time-consuming timing operation being met, the target terminal App automation interface time-consuming timing operation is executed and written into the log. It provides a time-consuming test method based on the App automation interface, which can realize the dynamic configuration test time-consuming method and has a significant effect in improving the test efficiency and accuracy.
[0104] Specifically, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0105] Compared with the prior art, the present invention first receives the startup instruction of the target terminal App and reads the App configuration file; in response to the update instruction of the App configuration file, the server executes the update instruction and sends a notification of the dynamic modification of the target terminal configuration operation to the target terminal through the user ID; receives the notification of the target terminal configuration operation and stores the latest configuration file obtained; executes the preset business method and determines whether the preset condition for executing the time-consuming timing operation is met; in response to the preset condition for executing the time-consuming timing operation being met, the target terminal App automation interface time-consuming timing operation is executed and written into the log. It provides a time-consuming test method based on the App automation interface, which can realize the dynamic configuration test time-consuming method and has a significant effect in improving the test efficiency and accuracy.
[0106] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in the above method embodiment.
[0107] Specifically, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0108] Specifically, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0109] S201: receiving a startup instruction of the target terminal App and reading the App configuration file;
[0110] S202: In response to the update instruction of the App configuration file, the server executes the update instruction and sends a notification of the dynamic modification of the target terminal configuration operation to the target terminal through the user ID;
[0111] S203: receiving a notification of the configuration operation of the target terminal, and storing the latest configuration file obtained;
[0112] S204: Execute a preset business method and determine whether a preset condition for executing a time-consuming timing operation is met;
[0113] S205: In response to the preset condition for executing the time-consuming timing operation being met, the time-consuming timing operation of the target terminal App automation interface is executed and written into a log.
[0114] Compared with the prior art, the present invention first receives the startup instruction of the target terminal App and reads the App configuration file; in response to the update instruction of the App configuration file, the server executes the update instruction and sends a notification of the dynamic modification of the target terminal configuration operation to the target terminal through the user ID; receives the notification of the target terminal configuration operation and stores the latest configuration file obtained; executes the preset business method and determines whether the preset condition for executing the time-consuming timing operation is met; in response to the preset condition for executing the time-consuming timing operation being met, the target terminal App automation interface time-consuming timing operation is executed and written into the log. It provides a time-consuming test method based on the App automation interface, which can realize the dynamic configuration test time-consuming method and has a significant effect in improving the test efficiency and accuracy.
[0115] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0116] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0117] In the several embodiments provided by the present invention, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the above units, which is only a logical function division. There may be other division methods in actual implementation, such as 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 mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0118] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0119] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0120] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the above-mentioned methods of each embodiment of the present invention. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0121] The embodiments of the present invention are described in detail above. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A time-consuming test method based on App automation interface, characterized in that: The method includes: Receiving a startup instruction of a target terminal App and reading the App configuration file; In response to an update instruction of the App configuration file, the server executes the update instruction and sends a notification of dynamically modifying the target terminal configuration operation to the target terminal through the user ID; Receiving the notification of the target terminal configuration operation and storing the obtained latest configuration file; Executing a preset business method and determining whether a preset condition for performing a time-consuming timing operation is satisfied; In response to the preset condition for performing the time-consuming timing operation being satisfied, performing a time-consuming timing operation on the target terminal App automation interface and writing it to a log.
2. The method according to claim 1, characterized in that The App configuration file includes: an xml format file; the file format is: <item name="All" value="true">; <item name="class name + method name" value="true">.
3. The method according to claim 2, characterized in that Before executing the preset business method and determining whether the preset condition for performing the time-consuming timing operation is satisfied, the method further includes: Obtaining an implementation class one method corresponding to the preset business method and automatically generating an implementation class two method; wherein, all interface methods in the implementation class two method are completed by calling the interface methods of the implementation class one method, and the time-consuming calculation of the implementation class one method is performed using the implementation class two method.
4. The method according to claim 3, characterized in that The performing the time-consuming calculation of the implementation class one method using the implementation class two method includes: Determining an optional parameter ICallBack added in the interface method and determining whether the optional parameter ICallBack is empty; If the optional parameter ICallBack is not empty, performing an asynchronous callback and performing the time-consuming calculation of the implementation class one method using the implementation class two method.
5. The method according to claim 4, characterized in that The performing the time-consuming calculation of the implementation class one method using the implementation class two method includes: Starting a timing function, using the currently executed "class name + method name" as the key, and storing the current start timestamp as the value in a Map; wherein, the data interface is of the type Map<"class name + method name", startTime>, the key is of the String type to store the method name, and the value is of the long type to store the start timestamp; Implementing the method of calling the implementation class one and determining the current end timestamp endTime in response to the completion of the timing function execution; Determining the time-consuming timestamp of the implementation class one method using the implementation class two method based on the start timestamp and the end timestamp.
6. The method according to claim 5, characterized in that The class name of the target terminal App automation interface is InterfaceManager, all preset business methods are implemented through InterfaceManager, and InterfaceManager contains several interfaces.
7. The method according to claim 6, characterized in that The content written to the log includes: Class name, function name, parameters, time before call, time after function execution completion, time-consuming millisecond-level timestamp.
8. A time-consuming test system based on App automation interface, characterized in that: The system includes: A receiving module for receiving a startup instruction of a target terminal App and reading the App configuration file; A response module, configured to respond to an update instruction of the App configuration file, the server executes the update instruction, and sends a notification of the dynamic modification of the target terminal configuration operation to the target terminal through the user ID; The storage module is used to receive the notification of the target terminal configuration operation and store the latest configuration file obtained; the latest configuration file is stored in the application cache Map<String,Boolean> Among them, key is String type "class name + method name", value is Boolean type, which is used to determine whether the time-consuming timing operation can be supported. If it is true, it means that the time-consuming timing operation is supported, and if it is false, it means that the time-consuming timing operation is not supported; An execution module, used to execute a preset business method and determine whether a preset condition for executing a time-consuming timing operation is met; wherein the preset condition includes calling if(map.get("class name + method name") as true or calling map.get("All") as true by using "class name + method name" as a key; The timing module is used to execute the time-consuming timing operation of the target terminal App automation interface and write a log in response to the preset condition for executing the time-consuming timing operation being met.
9. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to implement the method according to any one of claims 1 to 7 when executed.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the computer program to implement the method according to any one of claims 1 to 7.