Application program testing method and electronic equipment
By receiving target tasks and starting screen recording in application testing, automating the testing step operations and recording video data, the problems of low testing efficiency and high cost in the existing technology are solved, and efficient testing process recording and automated collection are achieved.
Patent Information
- Application Number
- CN202510361679.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-25
- Publication Date
- 2025-06-13
AI Technical Summary
Existing application testing methods cannot achieve automated sample recording and collection and detailed recording of test processes, resulting in inefficiency and increased cost.
By receiving the target task sent by the server and starting screen recording, the application is operated according to the test steps to obtain the execution results, and the screen recording is completed after the task is completed to obtain the task results, and finally upload the task results to the server.
It realizes the automated process of sample recording and collection in application testing and detailed recording of test processes, improving testing efficiency and reducing costs.
Smart Images

Figure CN120144476A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular, to a method for testing an application program and an electronic device. Background Art
[0002] With the rapid development of the mobile Internet, application program products have become an indispensable tool in people's daily life and work. Due to the continuous increase in market demand for the functions and experiences of application programs, developers of application programs need to continuously accelerate the speed of iterative product development to meet the needs of users.
[0003] This rapid iterative development model has caused a series of serious problems. For example, whenever an application program completes a function iteration and upgrade, various adverse phenomena that affect the user experience will occur when using it on some mobile phones, which will greatly reduce the user experience.
[0004] In the field of existing application program testing technology, traditional testing methods have exposed many limitations. Currently, the commonly used testing methods are manual regression testing and automated testing. Specifically, in manual regression testing, testers manually operate and verify each function of the application program according to the pre-written test cases. Although manual regression testing can verify the functions of the application program to a certain extent, the operation process is extremely cumbersome, and it is difficult for manual testing to achieve comprehensive coverage and cannot perform all-round testing. Although automated testing improves the testing efficiency and reduces the manpower input, it cannot perceive various complex scenarios and experience problems faced by users during actual use.
[0005] Therefore, in the current application testing field, there is no solution that can be automated and can record the testing process. Summary of the Invention
[0006] In view of this, embodiments of the present invention provide a method for testing an application program and an electronic device, which realizes the automation of sample recording and collection in application program testing and the detailed recording of the testing process, thereby improving the efficiency of application program testing and reducing costs.
[0007] In a first aspect, an embodiment of the present invention provides a method for testing an application program, the method comprising:
[0008] Receiving a target task sent by a server and starting screen recording, the target task including at least one test step;
[0009] Operating the application program according to the test step to obtain an execution result corresponding to each test step;
[0010] In response to the completion of the execution of the target task, stop screen recording to obtain a task result, where the task result is the recorded video data;
[0011] Send the task result to the server.
[0012] In some embodiments, the operating on the application according to the test steps to obtain the execution results corresponding to the respective test steps includes:
[0013] Execute the test step and obtain a page change event;
[0014] Detect whether the page change event matches a pre-configured auxiliary skip rule;
[0015] In response to the test step matching the pre-configured auxiliary skip rule, execute an interference skip process;
[0016] In response to the test step not matching the pre-configured auxiliary skip rule, execute a normal test process.
[0017] In some embodiments, the executing the interference skip process includes:
[0018] Obtain an auxiliary skip rule that matches the page change event;
[0019] Execute a skip operation according to the matched auxiliary skip rule;
[0020] Send a prompt message indicating that the skip operation has been executed;
[0021] Record a log.
[0022] In some embodiments, the executing the normal test process includes:
[0023] Determine the operation category corresponding to the test step, where the operation category includes device-level operations and page element-level operations;
[0024] Execute the test step according to the operation category.
[0025] In some embodiments, the executing the test step according to the operation category includes:
[0026] In response to the operation category being a device-level operation, execute the operation corresponding to the test step;
[0027] Mark the floating color block according to the operation;
[0028] Record a log.
[0029] In some embodiments, the executing the test step according to the operation category includes:
[0030] In response to the operation category being a page element-level operation, find the page element;
[0031] In response to finding the page element, perform the operation corresponding to the page element;
[0032] Mark the floating layer color block according to the operation;
[0033] Record a log.
[0034] In some embodiments, the performing the test step according to the operation category further includes:
[0035] In response to not finding the page element, record an error log.
[0036] In some embodiments, the performing the test step according to the operation category further includes:
[0037] Determine whether there is a post-execution event;
[0038] In response to having a post-execution related event, execute the post-execution related logic and record a log.
[0039] In some embodiments, the marking the floating layer color block according to the operation includes:
[0040] Mark the floating layer color block while performing the operation, where the floating layer color block is used to represent the operation content and operation type.
[0041] In a second aspect, an embodiment of the present invention provides an electronic device, including a memory and a processor, where the memory is used to store one or more computer program instructions, and wherein the one or more computer program instructions are executed by the processor to implement the method as described in the first aspect. The technical solution of the embodiment of the present invention starts screen recording by receiving a target task sent by a server, where the target task includes at least one test step, operates on the application program according to the test step to obtain the execution result corresponding to each test step, and ends the screen recording after the target task is executed to obtain a task result, and uploads the task result to the server. Thereby, it can realize the automatic progress of sample recording and collection in application program testing and the detailed recording of the test process, thus improving the efficiency of application program testing and reducing costs. Description of the Drawings
[0042] Through the following description of the embodiments of the present invention with reference to the drawings, the above and other objects, features and advantages of the present invention will become clearer. In the drawings:
[0043] Figure 1 is a schematic diagram of an application program test system according to an embodiment of the present invention;
[0044] Figure 2It is the architecture diagram of the application program testing method according to an embodiment of the present invention;
[0045] Figure 3 It is the flowchart of the application program testing method according to an embodiment of the present invention;
[0046] Figure 4 It is the flowchart of obtaining the execution result corresponding to the test step according to an embodiment of the present invention;
[0047] Figure 5 It is the flowchart of judging the operation type of the test step according to an embodiment of the present invention;
[0048] Figure 6 It is the schematic diagram of a color block change according to an embodiment of the present invention;
[0049] Figure 7 It is the schematic diagram of the application program testing device according to an embodiment of the present invention;
[0050] Figure 8 It is the schematic diagram of the electronic device according to an embodiment of the present invention. Detailed implementation manners
[0051] The following describes the present application based on embodiments, but the present application is not limited to these embodiments. In the following detailed description of the present application, some specific details are described in detail. Those skilled in the art can fully understand the present application without the description of these details. In order to avoid obscuring the essence of the present application, well-known methods, processes, procedures, components and circuits are not described in detail.
[0052] In addition, those of ordinary skill in the art should understand that the drawings provided herein are for illustrative purposes only, and the drawings are not necessarily drawn to scale.
[0053] Unless the context clearly requires otherwise, words such as "including", "comprising" and the like in the entire application document should be construed in an inclusive sense rather than an exclusive or exhaustive sense; that is, it is the meaning of "including but not limited to".
[0054] In the description of the present application, it should be understood that terms such as "first", "second" and the like are only used for descriptive purposes and cannot be construed as indicating or implying relative importance. In addition, in the description of the present application, unless otherwise specified, the meaning of "a plurality" is two or more.
[0055] Figure 1 It is the schematic diagram of the application program testing system according to an embodiment of the present invention, as Figure 1As shown, the application testing system includes a terminal 1 and a server 2. Among them, the terminal 1 is a terminal 1 installed with the application to be tested, and can be specifically implemented by devices such as mobile phones, desktop computers, laptops, and tablets. The server 2 can be implemented by a single server or a server cluster composed of multiple servers.
[0056] In the embodiment of the present invention, first, the server 2 sends a target task to the terminal 1. The target task includes several test steps. After receiving the target task, the terminal 1 starts screen recording, performs corresponding operations according to the test steps, and obtains the execution results after the operations are executed. After all the test steps are completed, the terminal 1 ends the screen recording and obtains the task result. The task result is specifically the recorded video, and is sent to the server 2. Specifically, the recorded video is used to show the change of the state of the application during the test. Relevant staff can quickly locate the problems found in the application during the test by analyzing the recorded video, and then solve the problems targeted.
[0057] In the embodiment of the present invention, by receiving the target task sent by the server side and starting screen recording, where the target task includes at least one test step, operating the application according to the test steps to obtain the execution results corresponding to each test step, ending the screen recording to obtain the task result after the target task is executed, and uploading the task result to the server side. Thus, the automation of sample recording and collection in application testing can be realized, and the test process can be recorded in detail, thereby improving the efficiency of application testing and reducing costs.
[0058] Figure 2It is the architecture diagram of the test method for the application program in the embodiment of the present invention. Specifically, before the target task starts, screen recording is started to record the change of the state of the application program during the execution of the test steps. Among them, the screen recording can be carried out through the system screen recording API (Application Programming Interface), or after casting the screen to the computer, the screen recording function of the computer can be used for screen recording. Then, the interference is eliminated through the pre-configured auxiliary skip rules, and the predetermined test steps are sequentially executed after the interference is eliminated. After all the test steps are executed, the screen recording is ended and the application program is closed, and the target task is marked as ended. During the whole process, the master control end is used to control the application program operation and the ADB (Android Debug Bridge) operation on the one hand. The ADB operation is a command-line tool that allows a computer to communicate with an Android device. On the other hand, the master control end is also used for interface capture. Among them, the test steps are specifically to perform predetermined operations on the application program and obtain the data of the application program. When the application program interface requests snapshot data, the request is intercepted through the VPN (Virtual Private Network). The VPN intercepting the request is specifically the behavior of the virtual private network to intercept, review and process the network requests sent by the user during the data transmission process.
[0059] In the embodiment of the present invention, the data obtained during the test is stored in the local database of the mobile phone. The API service includes executing tasks, obtaining task results, and performing vulnerability repair for a single operation. The API service is an important mechanism for interaction and communication between different software systems, components or application programs. Among them, obtaining the task result is specifically obtained from the local database of the mobile phone.
[0060] The embodiment of the present invention receives the target task sent by the server and starts screen recording. Among them, the target task includes at least one test step, operates on the application program according to the test step to obtain the execution result corresponding to each test step, ends the screen recording to obtain the task result after the target task is executed, and uploads the task result to the server. Thus, the automation of sample recording and collection in the application program test can be realized and the test process can be recorded in detail, thereby improving the efficiency of the application program test and reducing the cost.
[0061] Figure 3 It is the flowchart of the test method for the application program in the embodiment of the present invention. As Figure 3 shown, the test method for the application program includes the following steps:
[0062] Step S100, receive the target task sent by the server and start screen recording, and the target task includes at least one test step.
[0063] Specifically, the target task is to test a certain application program, where the target task includes at least one operation step. Specifically, the operation step can be an operation to control the application program to execute a specific function, or other types of operations, and the embodiments of the present invention do not limit this. After receiving the target task, the terminal device controls the screen recording application program to start screen recording to record the execution process of the target task for subsequent analysis and processing. Among them, the execution of the target task may specifically include opening the application program, implementing a certain function of the application program, switching the mode of the application program, etc.
[0064] Step S200: Operate the application program according to the test steps to obtain the execution results corresponding to each test step.
[0065] Specifically, when the target task includes multiple test steps, each test step needs to be executed one by one, and the execution result is obtained, where the execution result is the state of the application program when the test step is executed.
[0066] Figure 4 is a flowchart of obtaining the execution results corresponding to the test steps in the embodiments of the present invention. As Figure 4 shown, the obtaining of the execution results corresponding to the test steps includes the following steps:
[0067] Step S201: Execute the test step and obtain the page change event.
[0068] Among them, the page change event refers to an event triggered when the page state, structure, and properties of the application program change. Among them, common page change events include load events, view change events, and page change events. The load event is triggered when the page or resource is completely loaded. For example, when the page is loaded, it can be used to initialize various functions, and when the picture and other resources are loaded, specific processing can be executed. The view change event specifically means that when the window size changes, it can help with responsive design, allowing the page to adjust the layout according to the window size, and the scroll event can implement interactions such as infinite scrolling or fixed navigation bars. The page change event can be used to improve the user experience, such as implementing dynamic interactions, or for data synchronization and saving to prevent data loss.
[0069] Specifically, the occurrence of the page change event indicates that there may be a new test step, or there may be an interference event. Among them, the interference events include events such as pop-up advertisements and page jumps. Therefore, it is necessary to match the page change event with the auxiliary rules to determine whether there is a new test step.
[0070] Step S202: Detect whether the page change event matches the pre-configured auxiliary skip rule.
[0071] Specifically, the auxiliary skip rule is a setting for optimizing the application usage experience and eliminating interference from normal operations. In some embodiments, for system pop-ups, they are identified by specific visual features or code attributes of the pop-up window. For automatic page jumps, they are identified by detecting changes in the page URL (Uniform Resource Locator) or page loading behaviors without user-initiated operations.
[0072] By setting the auxiliary skip rule to identify page change events, it is ensured that during the execution of the target task, the application can smoothly enter the interface related to the test steps, preventing interference from other irrelevant events.
[0073] Specifically, in the embodiments of the present invention, by matching the pre-configured auxiliary skip rule with the page change event, it is determined whether the page change event is interference or a test step, and corresponding subsequent steps are executed according to the type of the page change event.
[0074] If so, the page change event matches the auxiliary skip rule, indicating that the page change event is interference, and proceed to step S203 to execute the matching of the auxiliary skip rule corresponding to the interference.
[0075] If not, the page change event does not match the auxiliary skip rule, indicating that the page change event is a test step, and proceed to step S206 to determine the operation type of the test step.
[0076] Step S203: Obtain the auxiliary skip rule that matches the page change event.
[0077] Among them, the auxiliary skip rule is determined according to the interference type, and the auxiliary skip rule is specifically used to perform a skip operation on the page change event. That is, the selection of the auxiliary skip rule needs to be such that when the auxiliary skip rule is executed under interference, the interference can be eliminated.
[0078] The following is an example. When the interference type is a pop-up advertisement, the auxiliary skip rule at this time can be to close the advertisement by triggering the position where the advertisement close button is located, so as to eliminate the interference. When the interference type is a page jump, the auxiliary skip rule at this time can be to handle it by blocking the jump or replacing the jump. Among them, the blocking of the jump is specifically to modify the code that triggers the jump, and the replacement of the jump is specifically to trigger a pop-up window to jump to the desired page.
[0079] Step S204: Execute the skip operation according to the matched auxiliary skip rule.
[0080] After determining the auxiliary skip rule corresponding to the interference in step S203, perform a skip operation through the auxiliary skip rule to eliminate the interference.
[0081] Step S205: Send a prompt message indicating that the skip operation has been performed.
[0082] Specifically, after performing the skip operation through the auxiliary skip rule and eliminating the interference, send a prompt message indicating that the skip operation has been performed. Specifically, the prompt message can be specifically presented by popping up a dialog box at a specific location in the application and setting words with the same or similar meaning as "the interference has been skipped" to indicate that the interference has been eliminated.
[0083] Proceed to step S215 to record the log.
[0084] Step S206: Determine whether the operation type of the test step is a device-level operation.
[0085] Specifically, the operation type of the test step includes device-level operations and page element-level operations. When the operation type of the test step is different, the subsequent steps to be executed are also different. Therefore, it is necessary to determine the operation type of the test step before performing the operation.
[0086] Among them, device-level operations involve the hardware functions of the terminal, such as turning on or off the device power, instantly starting or shutting down the entire mobile phone system, making the device go from off to on or from the running state back to a stationary state. It also includes adjusting the device volume, that is, changing the size of the sound output by the device. Device-level operations control the basic functions of the terminal from a macroscopic level and lay the foundation for the operation and interaction of the device.
[0087] Page element-level operations focus on the manipulation of specific elements in the software interface. For example, after opening an application, various buttons, text boxes, pictures, etc. in the application all belong to page elements. For example, in a text editing page, entering text in a text box, selecting specific text for copying and pasting, or in a picture display page, zooming in or out on a picture are all page element-level operations for specific elements on the page. Page element-level operations pay more attention to the interaction details between the user and the content of the application and are operations to achieve rich functions and complete tasks within the application.
[0088] Figure 5 It is a flowchart for determining the operation type of the test step in an embodiment of the present invention. As Figure 5 shown, the steps for determining the operation type of the test step include the following steps:
[0089] Step S2061: Determine the page corresponding to the test step.
[0090] First, determine the page corresponding to the test step. Specifically, the page is the interface where the application is located during the execution of the test step.
[0091] For example, when the test step is to test the settings function of the application, the page corresponding to the test step is specifically the settings interface of the application. When the test step is to test the function of switching accounts in the application, the interface corresponding to the test step is the interface for switching accounts in the application.
[0092] Step S2062: Determine the page elements corresponding to the page.
[0093] Among them, page elements refer to the basic components that make up the application interface, which carry information to enable interaction between users and the page. Each element, through visual, interactive, and functional characteristics, jointly shapes the overall experience of the page. The page elements include text elements, graphic elements, image elements, etc., and the embodiments of the present invention do not limit this.
[0094] Specifically, determining the page elements corresponding to the page can include a visual-level determination method and an interaction-level determination method. Among them, the visual-level determination method is specifically when analyzing the application interface at the visual level, using the overall layout and element details as a distinction to determine the page elements. Specifically, first pay attention to the overall layout of the page, judge whether it is an up-down structure, a left-right structure, or a card-style layout, etc., and then divide the page into different functional areas such as the top navigation bar, the content main area, and the bottom toolbar. Finally, for the recognition and detection based on element details, specifically, further obtain the details of the elements by recognizing text elements and detecting graphic elements.
[0095] The interaction-level determination method determines the page elements based on the interaction relationship between the page elements and the user. Specifically, first determine the operable elements and their corresponding operation methods, such as click operation, drag operation, zoom operation, input operation, etc., then determine the state changes of the elements during the interaction process, from the default state when the page is initially loaded to the interaction state caused by the operation, such as the color change when the button is pressed and the style change when the input box gets focus, and finally determine the page elements according to the functions at the interaction level.
[0096] Step S2063: Match the page elements through a predetermined matching rule to determine the operation category.
[0097] Specifically, the predetermined matching rule is specifically to make a predetermined setting for the corresponding relationship between the obtained matching result and the operation category, and then after matching the page elements, when the obtained matching result corresponds to a certain operation category, determine that operation category as the operation category of the test step.
[0098] Specifically, when a certain page element is used as an operation object, such as a button, a text box, an icon, etc., the operation category is determined as a page element-level operation. For example, when a button labeled "Delete" is used as a page element, since the operation directly acts on this page element, it is determined and judged as a page element-level operation. If there is no page element as the operation object, indicating that the operation object is not a specific visual element within the page but a hardware component of the terminal or a system setting of the terminal, the operation category is determined as a device-level operation.
[0099] If so, it indicates that the operation type of the test step is a device-level operation, and proceed to step S207.
[0100] If not, it indicates that the operation type of the test step is a page element-level operation, and proceed to step S208.
[0101] Step S207: Execute the operation corresponding to the test step.
[0102] When the operation type of the test step is a device-level operation, execute the operation corresponding to the test step to conduct a detailed test on the function to be tested by the test step. Here, the test of the volume keys is taken as an example for illustration.
[0103] In some embodiments, first, adjust the volume keys to the minimum value, and then continuously press the volume increase key at a uniform speed, with an interval of about 1 second between each key press, to record the changes in the device volume display icon and number after each adjustment. Then adjust the volume to the maximum value and maintain it for a period of time to detect whether there are abnormal situations such as distortion or crackling in the audio output at the maximum volume. It should be noted that the test of the volume keys may also include other steps, which are not elaborated in the embodiments of the present invention.
[0104] Proceed to step S212 to mark the floating layer color block.
[0105] Step S208: Locate the page element.
[0106] Specifically, locate the page element corresponding to the test content according to the test content corresponding to the test step to test the page element. For example, if the test content corresponding to the test step is to test the close operation and swipe operation of an application on a certain page, the page elements corresponding to the test content are specifically the close button and the swipe button on that page.
[0107] It should be noted that the page element can be located only once or multiple times. Taking the number of times of locating the page element as two for example, when the page element is not located in one attempt, continue to locate the page element once. If the page element is still not located, the location of the page element fails.
[0108] If the page element is successfully found, it indicates that the page element corresponding to the test step has been found, and the page element can be tested, then enter step S211.
[0109] If the page element search fails, it indicates that the page element corresponding to the test step has not been found, and the page element cannot be tested, then enter step S209 to continue the search.
[0110] Step S209: Search for the page element.
[0111] After the page element search fails in step S208, the page element needs to be searched again to ensure that the page element has been comprehensively searched.
[0112] If the page element is successfully found, it indicates that the page element corresponding to the test step has been found, and the page element can be tested, then enter step S211.
[0113] If the page element search fails, enter step S210 to record the error log.
[0114] Step S210: Record the error log.
[0115] When the page element corresponding to the test step is not found, an error log needs to be recorded. Specifically, the content of the error log may include at least one of a timestamp, a test environment, a test case name, a test step description, page element information, and a page screenshot.
[0116] Step S211: Execute the operation corresponding to the page element.
[0117] After the page element is found, the operation corresponding to the page element needs to be executed to implement the execution of the test step. Among them, executing the operation corresponding to the page element is to test in detail the function to be tested by the test step. Still taking the test content corresponding to the test step as an example of the close operation and the swipe operation when the test application is on a certain page. Specifically, for the test of the close operation, executing the operation corresponding to the page element is to trigger the close button corresponding to the close operation. For the test of the swipe operation, executing the operation corresponding to the page element is to continuously trigger the swipe button and move the position of the trigger point along a predetermined path.
[0118] Enter step S212, and at the same time enter step S213.
[0119] Step S212: Mark the floating layer color block.
[0120] Specifically, step S207 and step S212, step S211 and step S212, and the steps are executed simultaneously. While performing the operations corresponding to the page elements or the operations corresponding to the test steps, the operations and operation types are characterized by marking the floating layer color blocks. For example, three color blocks can be used. Among them, the first color block is used to characterize the operation type, and the second and third color blocks are used to characterize the specific operations.
[0121] Among them, a pre-set corresponding relationship is established between each specific operation and the RGB values of the color blocks. For example, the RGB values corresponding to the close operation are specifically: the RGB value of the second color block is (0, 0, 100), and the RGB value of the third color block is (0, 100, 150). It should be noted that for two different operations, the span of their RGB values needs to be set relatively large so as to distinguish the RGB values of different operations in the subsequent video data. In some embodiments, the span of the RGB values is set to 50.
[0122] Figure 6 is a schematic diagram of the change of color blocks in an embodiment of the present invention, as Figure 6 shown. When there is no operation, none of the three color blocks are filled with color. When operations 1 and 2 are performed, the filling colors of the three color blocks are changed according to the operation type and the specific operation. After the test steps are completed, since no operation is performed, the three color blocks are not filled with color.
[0123] Step S213, determine whether there is an event after execution is completed.
[0124] After performing the operation corresponding to the page element in step S211, it is necessary to determine whether there is an event after execution is completed, and perform it after determining its existence. Among them, the event after execution is completed includes at least one of performing subsequent operations, data saving, and data verification. Triggering subsequent operations specifically means triggering and performing relevant subsequent operations according to the business logic of the application program. Data saving specifically means saving the data generated during the operation or the modified data to the corresponding storage location, such as a local database, a server-side database, etc. Data verification specifically means verifying the data after the operation to ensure the accuracy and integrity of the data.
[0125] Step S214, perform the relevant logic after execution is completed.
[0126] When it is determined in step S213 that there is a task after execution is completed, perform the relevant logic after execution is completed according to the type of the task after execution is completed to ensure that all tasks are completed.
[0127] Step S215, record the log.
[0128] After completing a step execution or a skip operation, it is necessary to record the content completed this time for viewing during subsequent analysis.
[0129] In some embodiments, after recording the log, the log is bound to the floating layer color block to improve the analysis efficiency of relevant staff.
[0130] Through steps S201 - S215, the execution results corresponding to the test steps are obtained.
[0131] Step S300: In response to the completion of the target task execution, end the screen recording to obtain the task result, where the task result is the recorded video data.
[0132] After all the test steps have completed operations and recorded the corresponding floating layer changes, it indicates that the target task has been executed. At this time, end the screen recording to obtain the task result, where the task result is the recorded video data, and the video data includes the video of the floating layer color block changing with the operation when each test step is executed.
[0133] Step S400: Send the task result to the server.
[0134] Specifically, after the terminal obtains the recorded video data through step S300, the video data is sent to the server, and the server stores the recorded video data. When relevant staff needs to analyze the test results of a certain application, open the video data and analyze the test results of the application data according to the video data to obtain the test situation of the application. Since the floating layer color block in the video can qualitatively display the operations and operation categories during the use of the application, relevant staff can analyze through the video data.
[0135] It should be noted that in addition to analyzing the video data by relevant staff, the video data can also be analyzed by a pre-trained floating layer color block analysis model to obtain the analysis result. Specifically, the floating layer color block analysis model is trained with the analyzed video data as samples and the analysis results as labels.
[0136] In the embodiment of the present invention, by receiving the target task sent by the server and starting the screen recording, where the target task includes at least one test step, operating the application according to the test step to obtain the execution results corresponding to each test step, ending the screen recording to obtain the task result after the target task is executed, and uploading the task result to the server. Thus, the automation of sample recording and collection in the application test can be realized and the test process can be recorded in detail, thereby improving the efficiency of the application test and reducing the cost.
[0137] Figure 7 It is a schematic diagram of a test device for an application program according to an embodiment of the present invention. As Figure 7 shown, the device includes a receiving unit 71, a testing unit 72, an ending unit 73, and a sending unit 74. Among them, the receiving unit 71 is used to receive a target task sent by the server and start screen recording, and the target task includes at least one test step. The testing unit 72 is used to operate the application program according to the test step to obtain execution results corresponding to each test step. The ending unit 73 is used to end the screen recording to obtain a task result in response to the completion of the execution of the target task, and the task result is the recorded video data. The sending unit 74 is used to send the task result to the server.
[0138] In some embodiments, the testing unit includes:
[0139] A change event acquisition sub-unit, which is used to execute a test step and obtain a page change event;
[0140] An auxiliary skip matching sub-unit, which is used to detect whether the page change event matches a pre-configured auxiliary skip rule;
[0141] A skip sub-unit, which is used to execute an interference skip process in response to the test step matching a pre-configured auxiliary skip rule;
[0142] A test sub-unit, which is used to execute a normal test process in response to the test step not matching a pre-configured auxiliary skip rule.
[0143] In some embodiments, the skip sub-unit includes:
[0144] An acquisition module, which is used to acquire an auxiliary skip rule that matches the page change event;
[0145] A skip module, which is used to execute a skip operation according to the matching auxiliary skip rule;
[0146] A sending module, which is used to send a prompt message that the skip operation has been executed;
[0147] A log recording module, which is used to record logs.
[0148] In some embodiments, the test sub-unit includes:
[0149] An operation category determination module, which is used to determine the operation category corresponding to a test step, and the operation category includes device-level operations and page element-level operations;
[0150] An execution module, which is used to execute the test step according to the operation category.
[0151] In some embodiments, the execution module includes:
[0152] A first execution sub-module, configured to execute the operation corresponding to the test step in response to the operation category being a device-level operation;
[0153] A first annotation sub-module, configured to annotate the floating layer color block according to the operation;
[0154] A first log recording sub-module, configured to record logs.
[0155] In some embodiments, the execution module includes:
[0156] A search module, configured to search for page elements in response to the operation category being a page element-level operation;
[0157] A second execution sub-module, configured to execute the operation corresponding to the page element in response to the page element being found;
[0158] A second annotation sub-module, configured to annotate the floating layer color block according to the operation;
[0159] A second log recording sub-module, configured to record logs.
[0160] In some embodiments, the execution module further includes:
[0161] An error log recording module, configured to record error logs in response to the page element not being found.
[0162] In some embodiments, the execution module further includes:
[0163] An execution completion determination subunit, configured to determine whether there is an event after execution completion;
[0164] A logic execution subunit, configured to execute the relevant logic after execution completion and record logs in response to there being an event related to after execution.
[0165] In some embodiments, the first annotation sub-module or the second annotation sub-module is specifically configured to:
[0166] Annotate the floating layer color block while operating, where the floating layer color block is used to represent the operation content and operation type.
[0167] In an embodiment of the present invention, a target task sent by a server is received and screen recording is started. The target task includes at least one test step. The application program is operated according to the test step to obtain an execution result corresponding to each test step. After the target task is completed, the screen recording is ended to obtain a task result, and the task result is uploaded to the server. Thus, the automation of sample recording and collection in application program testing and the detailed recording of the test process can be realized, thereby improving the efficiency of application program testing and reducing costs.
[0168] Figure 8 It is a schematic diagram of an electronic device according to an embodiment of the present invention. As Figure 8 shown, Figure 8 The electronic device shown is a general address query device, which includes a general computer hardware structure and at least includes a processor 81 and a memory 82. The processor 81 and the memory 82 are connected through a bus 83. The memory 82 is suitable for storing instructions or programs executable by the processor 81. The processor 81 can be an independent microprocessor or a set of one or more microprocessors. Thus, by executing the instructions stored in the memory 82, the processor 81 executes the method flow of the embodiment of the present invention as described above to implement the processing of data and the control of other devices. The bus 83 connects the above-mentioned multiple components together and at the same time connects the above-mentioned components to a display controller 84, a display device, and an input / output (I / O) device 85. The input / output (I / O) device 85 can be a mouse, a keyboard, a modem, a network interface, a touch input device, a somatosensory input device, a printer, and other devices well known in the art. Typically, the input / output (I / O) device 85 is connected to the system through an input / output (I / O) controller 86.
[0169] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a device (equipment), or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can be implemented as a computer program product on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0170] The present application is described with reference to the flowcharts of methods, devices (equipment), and computer program products according to the embodiments of the present application. It should be understood that each process in the flowchart can be implemented by computer program instructions.
[0171] These computer program instructions can be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured article including an instruction device that implements the processFigure 1 The functions specified in one process or multiple processes.
[0172] These computer program instructions can also be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for realizing the functions specified in one process Figure 1 or multiple processes.
[0173] Another embodiment of the present invention relates to a non-volatile storage medium for storing a computer-readable program, and the computer-readable program is used for a computer to execute some or all of the above method embodiments.
[0174] That is, those skilled in the art can understand that all or part of the steps in implementing the above method embodiments can be completed by specifying relevant hardware through a program, and the program is stored in a storage medium, including several instructions for causing a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc.
[0175] The foregoing are only the preferred embodiments of the present application and are not used to limit the present application. For those skilled in the art, the present application can have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for testing an application, characterized in that: The method comprises: Receive a target task sent by the server and start screen recording, wherein the target task includes at least one test step; Operate the application according to the test steps to obtain execution results corresponding to each test step; In response to the target task being completed, ending the screen recording to obtain a task result, wherein the task result is the recorded video data; Send the task result to the server.
2. The method according to claim 1, characterized in that The operating the application according to the test steps to obtain the execution results corresponding to each test step includes: Execute test steps and obtain page change events; Detecting whether the page change event matches a pre-configured auxiliary skip rule; In response to the test step matching a pre-configured auxiliary skip rule, executing an interference skip process; In response to the test step not matching the pre-configured auxiliary skip rule, a normal test flow is performed.
3. The method according to claim 2, characterized in that The execution interference skipping process includes: Obtaining an auxiliary skip rule matching the page change event; performing a skip operation according to the matched auxiliary skip rule; Send a prompt message that the skip operation has been performed; Keep a log.
4. The method according to claim 2, characterized in that: The normal test process includes: Determine an operation category corresponding to the test step, wherein the operation category includes a device-level operation and a page element-level operation; The test step is performed according to the operation category.
5. The method according to claim 4, characterized in that The step of performing the test according to the operation category comprises: In response to the operation category being a device-level operation, executing an operation corresponding to the test step; Mark the floating layer color block according to the operation; Keep a log.
6. The method according to claim 4, characterized in that The step of performing the test according to the operation category comprises: In response to the operation category being a page element level operation, searching for a page element; In response to finding the page element, executing an operation corresponding to the page element; Mark the floating layer color block according to the operation; Keep a log.
7. The method according to claim 6, characterized in that The step of performing the test according to the operation category further comprises: In response to not finding the page element, an error log is recorded.
8. The method according to claim 6, characterized in that The step of performing the test according to the operation category further comprises: Determine if there is a post-execution completion event; In response to post-execution related events, execute the post-completion related logic and record the log.
9. The method according to claim 5 or 6, characterized in that: The marking of the floating layer color block according to the operation comprises: During the operation, a floating color block is marked, wherein the floating color block is used to represent the operation content and operation type.
10. An electronic device comprising a memory and a processor, characterized in that: The memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method according to any one of claims 1 to 9.