Application testing methods and apparatus, electronic devices, computer-readable storage media

By acquiring real-time page screenshots and terminal device logs, the problem of long testing times for cloud phones has been solved, achieving efficient automated compatibility testing suitable for various applications.

CN116069665BActive Publication Date: 2026-03-06BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-24
Publication Date
2026-03-06

AI Technical Summary

Technical Problem

When testing the compatibility of multiple game applications, cloud phones suffer from low testing efficiency due to the time-consuming manual testing and the lack of a general testing framework.

Method used

This paper provides an application testing method that detects the main test page by acquiring real-time page screenshots and determines the test results by combining them with the test logs of the terminal device, thereby achieving automated compatibility testing.

Benefits of technology

It improves testing efficiency, simplifies operation processes, and provides a universal testing framework for various applications, enabling the completion of compatibility tests for hundreds of applications in a short time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116069665B_ABST
    Figure CN116069665B_ABST
Patent Text Reader

Abstract

This disclosure provides an application testing method and apparatus, specifically relating to the technical fields of information security, application testing, and cloud computing. The specific implementation scheme is as follows: in response to the application under test being running on the terminal device, real-time screenshots of the application under test's pages are acquired; based on the page screenshots, it is detected whether the application under test is consistently located on the main test page during the test period; in response to detecting that the application under test is consistently located on the main test page during the test period, test logs from the terminal device are acquired; based on the test logs, the test results of the application under test are determined. This implementation method improves the efficiency of application testing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer application technology, specifically to the fields of information security and application testing, and particularly to an application testing method and apparatus, electronic equipment, computer-readable medium, and computer program product. Background Technology

[0002] Cloud phones need to test the compatibility of hundreds of game applications. Manual testing is time-consuming, and developing automated tests for each game application individually would require a huge amount of development work.

[0003] Furthermore, the testing methods for various game applications mostly involve using testing tools. However, the entire testing process of these tools requires testers to write code from scratch, and there is no universal testing framework available, resulting in low testing efficiency. Summary of the Invention

[0004] An application testing method and apparatus, an electronic device, a computer-readable storage medium, and a computer program product are provided.

[0005] According to the first aspect, an application testing method is provided, the method comprising: in response to the application under test being running on a terminal device, acquiring page screenshots of the application under test in real time; based on the page screenshots, detecting whether the application under test is located on the main test page throughout the test time; in response to detecting that the application under test is located on the main test page throughout the test time, acquiring test logs of the terminal device; and based on the test logs, determining the test results of the application under test.

[0006] According to a second aspect, an application testing apparatus is provided, comprising: a screenshot acquisition unit configured to acquire screenshots of the application under test in real time in response to the application under test running on a terminal device; a main page detection unit configured to detect, based on the screenshots, whether the application under test is consistently located on the main test page during the testing period; a log acquisition unit configured to acquire test logs from the terminal device in response to the detection that the application under test is consistently located on the main test page during the testing period; and a determination unit configured to determine the test result of the application under test based on the test logs.

[0007] According to a third aspect, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform a method as described in any implementation of the first aspect.

[0008] According to a fourth aspect, a non-transitory computer-readable storage medium is provided that stores computer instructions for causing a computer to perform the method described in any implementation of the first aspect.

[0009] According to a fifth aspect, a computer program product is provided, including a computer program that, when executed by a processor, implements the method as described in any implementation of the first aspect.

[0010] The application testing method and apparatus provided in this disclosure firstly acquire page screenshots of the application under test in real time, in response to the application under test running on the terminal device; secondly, based on the page screenshots, detect whether the application under test is consistently located on the main test page during the test period; thirdly, in response to detecting that the application under test is consistently located on the main test page during the test period, acquire the test logs of the terminal device; and finally, based on the test logs, determine the test results of the application under test. Thus, since the main test page is the most frequently used page in the application, detecting whether the application under test is consistently located on the main test page through page screenshots, combined with the test logs of the terminal device, allows for compatibility performance testing of the application under test. The operation is simple, improving the testing efficiency of the application under test. Furthermore, the testing method of this application is applicable to various applications, providing a universal application testing framework for multiple applications.

[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0012] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0013] Figure 1 This is a flowchart of an embodiment of the application testing method according to this disclosure;

[0014] Figure 2 This is a flowchart of another embodiment of the application testing method according to this disclosure;

[0015] Figure 3 This is a schematic diagram of the structure for running the application testing method disclosed herein;

[0016] Figure 4 This is a schematic diagram of the structure of an embodiment of the application testing apparatus according to the present disclosure;

[0017] Figure 5 This is a block diagram of an electronic device used to implement the application testing method of the embodiments of this disclosure. Detailed Implementation

[0018] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0019] In this embodiment, "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" and "second" may explicitly or implicitly include at least one of those features.

[0020] This disclosure provides an application testing method. Figure 1 A flow 100 is shown as an embodiment of the application testing method according to this disclosure, the application testing method comprising the following steps:

[0021] Step 101: In response to the application under test already running on the terminal device, obtain a screenshot of the application under test's page in real time.

[0022] In this embodiment, the application under test is an application adapted to the operating system of the terminal device. The operator installs the application under test on the terminal device. After the application under test runs on the terminal device, a screenshot of the application under test's running interface is captured on the terminal device to obtain a screenshot of the application under test's page. The running interface of the application under test is the content displayed by the application under test on the terminal device.

[0023] In this embodiment, the terminal device can be hardware or software. When the terminal device is hardware, it can be various electronic devices with a display screen, including but not limited to smartphones and tablets. When the terminal device is software, it can be installed in the aforementioned electronic devices and can be implemented as multiple software programs or software modules, such as a cloud phone.

[0024] In this embodiment, obtaining a screenshot of the application page can be achieved through a screenshot saving thread. Compared with other screenshot tools, the screenshot saving thread can support multi-threaded control. Therefore, while the screenshot saving thread is running, other control threads can also be run simultaneously.

[0025] In this embodiment, the acquired page screenshots can be saved in real time on the local terminal in the order of acquisition, forming a page screenshot consisting of multiple image sequences.

[0026] Step 102: Based on the page screenshot, check whether the application under test is always on the main test page during the test period.

[0027] In this embodiment, the main test page is the page that runs the most times in the application under test, or the page with the largest percentage of runs in the application under test. The pop-up subpage is a page in the application under test other than the main test page. For example, if the application under test is a game application, the game application has a main test page with an object running scenario, and a pop-up subpage that publishes advertisements. Compared with the main test page, the pop-up subpage is completely unrelated to the game scenario.

[0028] For different applications under test, a set of subpage icons and a set of main page icons are pre-stored. Each subpage icon in the subpage icon set includes an image and / or text, used to identify the content displayed on the pop-up subpage (such as advertising information) or control indicators (exit sign). For example, when a game application is opened, images of "Update", "OK", "X" or other markers or text will pop up; these are subpage icons. The marker images are obtained by taking a small screenshot from a large image on the phone screen. Each main page icon in the main page icon set includes an image and / or text, used to identify the content displayed on the main test page (such as game instructions) or control indicators (object movement indicators).

[0029] After the application under test is running, the page screenshot is compared with the subpage icons in the subpage icon set. If the page screenshot does not contain the pattern or text in the subpage icon, it is determined that the page currently running in the application under test is the main test page.

[0030] Step 103: In response to the detection that the application under test is located on the main test page throughout the test period, obtain the test logs of the terminal device.

[0031] In this embodiment, the test time refers to the time spent testing the main test page. It can be a single time period or a set of multiple time points. The test time is a period of observation of the application under test, and its specific value can be set according to the application testing requirements.

[0032] In this embodiment, the test time can be all the time during which the application under test is tested. By taking screenshots of the page, it can be confirmed that the application under test is always on the main test page during the test time, which can ensure that the test of the application under test maintains the core information of the application under test.

[0033] In this embodiment, once the test time is complete, the test of the application under test is stopped, and the test log of the terminal device is obtained and downloaded. The test log of the terminal device is also the execution log of the terminal device. The execution log of the terminal device can be obtained through machine commands corresponding to the system of the terminal device.

[0034] Step 104: Based on the test logs, determine the test results of the application under test.

[0035] In this embodiment, the test log is the execution log of the terminal device. The execution log can reflect the running status of all applications or systems running on the terminal. Information related to the application under test is extracted from the test log, and the relevant information is analyzed to obtain the test results of the application under test.

[0036] The test results for the application under test include whether the application experiences ANR (Application Not Responding) or crashes. ANR indicates that the application is unresponsive and cannot be used normally; a crash indicates that the application will crash and become unusable.

[0037] Optionally, the test results may also include whether the application under test experiences a black screen. The test results can determine whether the application under test has compatibility issues, thus providing a reliable basis for the application's operation on terminal devices.

[0038] The method disclosed herein can quickly develop a large number of compatibility test cases for applications under test. If the terminal device is a cloud phone, after the cloud phone releases a version, a round of compatibility testing of hundreds of applications under test can be performed in a few hours (with sufficient testing equipment), which greatly improves the efficiency of version verification.

[0039] The application testing method provided in this disclosure firstly acquires a screenshot of the application under test's page in real time, assuming the application under test is already running on the terminal device; secondly, based on the screenshot, it detects whether the application under test remains on the main test page throughout the test period; thirdly, in response to detecting that the application under test remains on the main test page throughout the test period, it acquires the terminal device's test log; and finally, based on the test log, it determines the test result of the application under test. Thus, since the main test page is the most frequently used page in the application, detecting whether the application under test remains on the main test page through screenshots, combined with the terminal device's test log, allows for compatibility performance testing of the application under test. The operation is simple, improving the testing efficiency of the application under test. Furthermore, the testing method of this application is applicable to various applications, providing a universal application testing framework for multiple applications.

[0040] In this embodiment, the test time can be the entire test time (total time) of the application under test, or it can be a portion of the total test time. For some applications under test (e.g., video viewing applications), the entire test time can be used to check whether the application is on the main test page. For some applications under test (e.g., game applications), only a portion of the test time is needed to check whether the application is on the main test page, while the other portion of the test time (control time) is used to control the main test page. In other words, the total test time equals the test time plus the control time.

[0041] In some disclosed embodiments, the above application testing method includes: in response to the application under test running on a terminal device, acquiring a screenshot of the application under test's page in real time; based on the screenshot, detecting whether the application under test is always on the main test page during the test period; in response to detecting that the application under test is always on the main test page during the test period, based on the screenshot, operating on controls on the main test page within a controlled time period to acquire test logs of the terminal device; and based on the test logs, determining the test result of the application under test.

[0042] In this embodiment, after obtaining the page screenshot, all controls on the main test page are identified, and random or timed operations (click, swipe, close, etc.) are performed on all controls. After all the testing time for the application under test has been completed, the test log is obtained.

[0043] In this embodiment, the test time plus the control time equals the total time spent testing the application under test. After the total time spent testing the application under test has elapsed, the application under test can be closed, logs related to the application under test can be obtained from the test logs of the terminal device, a test report can be generated, and the test report can be used to detect whether there are any compatibility issues with the application under test on the terminal device.

[0044] The application testing method provided in this embodiment monitors the main test page of the application under test while simultaneously manipulating the controls on the main test page, enabling comprehensive testing of the controllable application under test and improving the comprehensiveness of the test.

[0045] Optionally, the above application testing method further includes: detecting whether the application under test is a game application; in response to detecting that the application under test is a game application, determining a control time, and based on a page screenshot, operating the controls on the main test page of the game application within the control time.

[0046] Optionally, the above application testing method further includes: detecting whether the application under test is a game application; in response to detecting that the application under test is a game application, determining the control time and the control object, and controlling the control object in the application under test to be in motion within the control time.

[0047] In some optional implementations of this embodiment, the above-mentioned operation on the controls on the main test page based on the page screenshot within the control time includes: in response to any main page icon in the preset main page icon set in the page screenshot, determining the control on the main test page corresponding to the main page icon and the control information; and operating the control based on the control information within the control time.

[0048] In this embodiment, the control information describes the control and includes: control name, number, and the operation that triggers the control. The operation when the control is triggered can be determined through the control information. For example, if the control is a button, the control information is the button name, button number, and the operation that triggers the button (click).

[0049] In this embodiment, the control information also includes: operation time and operation sequence. The above-mentioned operation on the control within the control time based on the control information includes: determining all operable controls, dividing the control time into multiple sub-times based on the operation time, and triggering the operation of the control in the multiple sub-times according to the operation sequence corresponding to each control.

[0050] Optionally, the above-mentioned operation on the control based on the control information within the control time includes: randomly or periodically clicking multiple controls within the control time based on the control information.

[0051] This optional implementation provides a method for manipulating controls on the main test page. By comparing a screenshot of the page with the main page icons in a preset set of main page icons, the operable controls and their information on the main test page are determined. Based on the control information, the controls on the main test page are manipulated, thus enabling convenient and quick operation of the main test page.

[0052] In some embodiments of this disclosure, the application under test is a game application, and the application testing method includes: in response to the application under test being running on a terminal device, acquiring a screenshot of the page of the application under test in real time; based on the screenshot, detecting whether the application under test is always located on the main test page during the test time; in response to detecting that the application under test is always located on the main test page during the test time, controlling the objects in the game application to be in a motion state within a control time, and acquiring the test log of the terminal device; and based on the test log, determining the test result of the application under test.

[0053] When the application under test is a game, the movement of objects on the screen is achieved by manipulating the game's directional control controls (such as the directional control button in the lower left corner of the game interface). Here, screen coordinates (up, down, left, right) are marked, and commands are used to control these coordinates. In this embodiment, the objects in the application under test can be virtual characters, virtual animals, virtual plants, etc.

[0054] This optional implementation provides a method for manipulating controls on the main test page. By controlling the objects in the game application to be in motion within the control time, it is possible to comprehensively test the controllable application under test during its operation, thereby improving the comprehensiveness of the test.

[0055] Optionally, in some embodiments of this disclosure, the above-described test application method may further include: in response to the application under test being running on a terminal device, acquiring a screenshot of the page of the application under test in real time; based on the screenshot, detecting whether the application under test is located on the main test page throughout the test time; in response to detecting that the application under test is located on the main test page throughout the test time, based on the screenshot, operating on the controls on the main test page within a control time, while controlling the objects displayed in the application under test to be in a running state; after the control time is reached, acquiring the test log of the terminal device; and based on the test log, determining the test result of the application under test.

[0056] Figure 2 A flow 200 is shown according to another embodiment of the application testing method of this disclosure, the application testing method comprising the following steps:

[0057] Step 201: In response to the application under test already running on the terminal device, obtain a screenshot of the page of the application under test in real time.

[0058] Step 202: Based on the page screenshot, check whether the application under test is located on the main test page throughout the test period; if the application under test is located on the main test page throughout the test period, proceed to step 203; if the application under test is not located on the main test page, proceed to step 206.

[0059] Step 203: In response to the detection that the application under test is located on the main test page throughout the test period, obtain the test logs of the terminal device.

[0060] Step 204: Based on the test logs, determine the test results of the application under test, and then proceed to step 205.

[0061] It should be understood that the operations and features in steps 201-204 correspond to the operations and features in steps 101-104, respectively. Therefore, the descriptions of the operations and features in steps 101-104 also apply to steps 201-204, and will not be repeated here.

[0062] Step 205, End.

[0063] Step 206: Based on the page screenshot, detect whether the application under test has pop-up subpages; if pop-up subpages are detected, proceed to step 207; if no pop-up subpages are detected, proceed to step 205.

[0064] Step 207: Close the pop-up subpage and continue to step 201.

[0065] In this embodiment, when the application under test is a multimedia playback application, the test time can be the entire time for testing the application under test. For this type of playback application, if it is determined from the page screenshot that the application under test has pop-up subpages within the test time, the pop-up subpages are closed directly. After the test time ends, the test logs of the terminal device running the application under test are obtained, and the performance of the application under test is detected through the test logs.

[0066] In this embodiment, when the application under test is a game application, the test time is not the total time for testing the application under test. After the total time for testing the application under test has elapsed, the test logs of the terminal device running the application under test are obtained, and the performance of the application under test is detected through the test logs.

[0067] The application testing method provided in this embodiment closes the pop-up subpage when it is detected that the application under test has a pop-up subpage, which can ensure that the application under test is always on the main test page, thus improving the effectiveness of the test.

[0068] Optionally, in response to the application under test not popping up a subpage, based on the page screenshot, it is detected whether the application under test has exited. If the application under test has exited, the application under test continues to run and is brought to the foreground of the terminal device.

[0069] In some optional implementations of this embodiment, the above-mentioned response to detecting whether the application under test has a pop-up subpage based on the page screenshot includes: in response to the page screenshot having any subpage icon from a preset subpage icon set, determining that the application under test has a pop-up subpage.

[0070] The above response to the application under test having a pop-up subpage, closing the pop-up subpage includes: operating on the area corresponding to the subpage icon in the pop-up subpage to close the pop-up subpage.

[0071] In this optional implementation, the subpage icons in the subpage icon set are closing indicators that can pop up subpages. By operating (e.g., clicking or triggering) the area corresponding to the subpage icon in the actual pop-up subpage, the purpose of closing the pop-up subpage can be achieved.

[0072] The application testing method provided in this embodiment determines the pop-up subpage by selecting the subpage icon from the subpage icon set, and operates on the area corresponding to the subpage icon in the pop-up subpage to close the pop-up subpage, which saves operation steps compared to full image comparison.

[0073] Optionally, the above response to detecting that the application under test is not located on the main test page, based on the page screenshot, includes: in response to the page screenshot not having any main page icon from the preset main page icon set, determining that the application under test has a pop-up subpage.

[0074] The above response to the application under test having a pop-up subpage, closing the pop-up subpage includes: identifying the pop-up subpage corresponding to the screenshot of the page; recognizing the exit control of the pop-up subpage; and using the corresponding operation to control the exit control to close the pop-up subpage.

[0075] In this embodiment, the exit control can be a button, an exit icon, etc., and the pop-up subpage can be closed by clicking the button or the exit icon.

[0076] In some embodiments of this disclosure, before obtaining the test logs of the terminal device, the above application testing method includes: detecting whether the application under test freezes or crashes; and exiting the test of the application under test in response to the application under test freezing or crashing.

[0077] In this embodiment, "freezing" means that the homepage of the application under test is fixed on a fixed page and cannot be switched at will. "Freezing" means that the application under test is unresponsive for an extended period of time.

[0078] In this embodiment, the above-mentioned detection of whether the application under test is frozen or stuck includes: based on real-time acquired page screenshots, continuously comparing whether a set of page screenshots are the same; in response to the continuous comparison of a set of page screenshots being the same, determining that the application under test is frozen; after the application under test freezes, sending any trigger command to the application under test, and the application under test being unable to respond, determining that the application under test is stuck.

[0079] The application testing method provided in this embodiment exits the test of the application after detecting that the application under test freezes or crashes, thereby improving the reliability of the test of the application under test.

[0080] Optionally, the above application testing method also includes: detecting whether the application under test crashes based on page screenshots, and exiting the test of the application under test in response to the crash of the application under test function.

[0081] The above-mentioned detection of whether the application under test crashes based on page screenshots includes: comparing the page screenshot with a preset screen image of the terminal device, and determining that the page screenshot and the screen image are the same, thus determining that the application under test has crashed.

[0082] In some embodiments of this disclosure, the application testing method includes: acquiring performance parameters of the terminal device in real time. The method of determining the test result of the application under test based on test logs includes: determining the test result of the application under test based on performance parameters and test logs.

[0083] In this embodiment, the performance parameters of the terminal device refer to the parameters that characterize the operating status of the terminal device. Specifically, the performance parameters include: CPU (Central Processing Unit), memory, GPU (Graphics Processing Unit), battery temperature, frame rate, network traffic, etc.

[0084] The application testing method provided in this embodiment obtains the performance parameters of the terminal device when testing the application under test, and adds the performance parameters to the test results of the application under test. This can effectively indicate the test results of the application under test under different performance states and improve the comprehensiveness of the test results.

[0085] In some embodiments of this disclosure, the application testing method further includes: detecting whether the application under test is in the foreground of the terminal device; and in response to the application under test not being in the foreground of the terminal device, pulling the application under test to the foreground of the terminal device.

[0086] In this embodiment, the foreground is the software application of the application under test. During the testing of the application under test, the page of the application under test will be clicked (a subpage or the main test page will pop up). Therefore, there is a certain probability that the application under test will exit. This embodiment can promptly launch the application under test to the foreground after monitoring the exit of the application under test.

[0087] Optionally, in response to the detection of a crash in the application under test, the method of this embodiment can also be used to bring the application under test to the foreground. At this time, launching the application under test on the terminal device allows the testing of the application under test to continue without stopping the testing. For example, if the total testing time for the application under test is 20 hours, bringing the application under test to the foreground will show how many times the application crashed.

[0088] The application testing method provided in this embodiment can bring the application under test to the foreground of the terminal device when the application under test is not in the foreground of the terminal device, which can effectively support the restart of the application under test and improve the comprehensiveness of application testing.

[0089] In some embodiments of this disclosure, the above application testing method further includes: simultaneously initiating a stress test on the terminal device.

[0090] In this embodiment, for non-game applications under test, when testing the random behavior of the application under test in any scenario, stress testing on the terminal device can effectively determine the compatibility between the terminal device and the application under test.

[0091] In this embodiment, different threads are used to perform stress tests on the terminal devices for different operating systems. For example, for Android or HarmonyOS systems, a Monkey test thread can be used to perform stress tests on the terminal devices. The Monkey test thread performs stability tests on the application client by sending pseudo-random user event streams (such as key input, touch screen input, gesture input, etc.) to the system. The Monkey test thread operates relatively randomly and may exhibit undesirable behaviors such as turning off Wi-Fi or exiting the application.

[0092] The application testing method provided in this embodiment initiates stress testing on the terminal device during the testing process of the application under test, which can reflect the operating environment's resilience in multiple ways and improve the overall effectiveness of application testing.

[0093] Optionally, for applications under test that are custom-designed, the above application testing method may further include: starting a custom control thread for the application under test to comprehensively test its performance. For example, the custom control thread may include a random navigation thread and a robot control thread.

[0094] In some optional implementations of this embodiment, the above-mentioned detection of whether the application under test is located on the main test page during the test time based on the page screenshot includes: comparing the page screenshot with the subpage icons in the preset subpage icon set one by one; and determining that the application under test is located on the main test page in response to the page screenshot not having any subpage icon in the subpage icon set.

[0095] This optional implementation provides a method for determining whether the application under test is located on the main test page. By comparing a screenshot of the page with the subpage icons in a preset subpage marker image set, it detects whether the application under test is located on the main test page, thus conveniently and quickly determining the main test page.

[0096] Optionally, the above-mentioned detection of whether the application under test is located on the main test page during the test time based on page screenshots includes: comparing the page screenshots with the main page icons in the preset main page icon set one by one; and determining that the application under test is located on the main test page in response to any main page icon in the main page icon set in the page screenshots.

[0097] For testing game applications, the main focus is on the interaction with specific buttons on the game interface after logging in. During this interaction, pop-up windows may appear, interfering with the automation process. Therefore, multiple threads need to be designed to handle pop-up windows, game screens, exceptions, performance monitoring, and other situations in parallel. The application testing method provided in this embodiment can be implemented using multiple threads.

[0098] See Figure 3 As shown, in actual operation, the application testing method provided in this disclosure can include four steps: preparing image materials, starting worker threads, obtaining test logs, and obtaining test results. The image materials can include: the main page icon set and the subpage icon set. When preparing image materials, the main page icon set and the subpage icon set are categorized. The categorization criteria include: the operating system to which the icon belongs, and the function corresponding to the icon (real-time close class, main page operation class).

[0099] Figure 3 In this context, worker threads include: machine performance monitoring thread, screenshot saving thread, interface frequency / freeze monitoring thread, stress testing thread, pop-up subpage monitoring thread, application not in the foreground monitoring thread, game click control thread, game movement control thread, etc. Figure 3 In this test, only the screenshot saving thread is mandatory; other threads can be selected based on the testing requirements of the application under test.

[0100] The above screenshot saves the specific operation content of the thread: after the application under test has been running on the terminal device, the page screenshots of the application under test are obtained in real time; based on the page screenshots, it is detected whether the application under test is always on the main test page during the test time.

[0101] The specific operations of the aforementioned machine performance monitoring thread are as follows: obtain the performance parameters of the terminal device in real time, and send the performance parameters.

[0102] The specific operations of the interface freeze / freeze monitoring thread are as follows: detect whether the application under test freezes or freezes; in response to the application under test freezing or freezing, exit the test of the application under test.

[0103] The specific operations of the stress test thread are as follows: start a stress test on the terminal device and send the stress test results.

[0104] The pop-up subpage monitoring thread performs the following operations: Based on a screenshot of the page, it detects whether the application under test has a pop-up subpage; in response to the application under test having a pop-up subpage, it closes the pop-up subpage.

[0105] The specific operations of the application not in the foreground monitoring thread are as follows: detect whether the application under test is in the foreground of the terminal device; in response to the application under test not being in the foreground of the terminal device, pull the application under test to the foreground of the terminal device.

[0106] The specific operations of the game click control thread are as follows: Based on the page screenshot, operate on the controls on the main test page of the game within the controlled time.

[0107] The specific operations of the game movement control thread are: to control the objects in the game application to be in motion within the control time.

[0108] The specific steps for obtaining test logs mentioned above include: obtaining the test logs from the terminal device after all the testing time for the test application has elapsed.

[0109] The test results obtained above include: based on the test logs, detecting whether the application under test has ANR or crash issues.

[0110] Further reference Figure 4 As an implementation of the methods shown in the above figures, this disclosure provides an embodiment of an application testing apparatus, which is similar to... Figure 1 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.

[0111] like Figure 4 As shown, the application testing device 400 provided in this embodiment includes: a screenshot acquisition unit 401, a main page detection unit 402, a log acquisition unit 403, and a determination unit 404. The screenshot acquisition unit 401 can be configured to acquire screenshots of the application under test in real time in response to the application under test running on the terminal device. The main page detection unit 402 can be configured to detect whether the application under test is consistently located on the main test page during the test period based on the screenshots. The log acquisition unit 403 can be configured to acquire test logs from the terminal device in response to detecting that the application under test is consistently located on the main test page during the test period. The determination unit 404 can be configured to determine the test results of the application under test based on the test logs.

[0112] In this embodiment, the specific processing and technical effects of the screenshot acquisition unit 401, main page detection unit 402, log acquisition unit 403, and determination unit 404 in the application testing device 400 can be found in the following references. Figure 1 The relevant descriptions of steps 101, 102, 103, and 104 in the corresponding embodiments will not be repeated here.

[0113] In some optional implementations of this embodiment, the device 400 further includes an operation unit (not shown in the figure), which can be configured to operate on controls on the main test page within a control time based on a page screenshot.

[0114] In some optional implementations of this embodiment, the above-mentioned operation unit is further configured to: in response to any homepage icon in the preset homepage icon set in the page screenshot, determine the control on the main test page corresponding to the homepage icon and the control information; and operate on the control within the control time based on the control information.

[0115] In some optional implementations of this embodiment, the device 400 further includes a control unit (not shown in the figure), which is configured to control an object in the game application to be in motion during a control time.

[0116] In some optional implementations of this disclosure, the apparatus 400 further includes a subpage detection unit (not shown in the figure), which can be configured to detect whether the application under test has a pop-up subpage based on a page screenshot in response to detecting that the application under test is not located on the main test page; and to close the pop-up subpage in response to the application under test having a pop-up subpage.

[0117] In some optional implementations of this disclosure, the aforementioned subpage detection unit is further configured to: determine that the application under test has a pop-up subpage in response to any subpage icon in a preset subpage icon set in the page screenshot; and operate on the area in the pop-up subpage corresponding to the subpage icon to close the pop-up subpage.

[0118] In some alternative implementations of this disclosure, the apparatus 400 further includes: a stuttering unit (not shown in the figure), configured to detect whether the application under test freezes or crashes; and to exit the test of the application under test in response to the application under test freezing or crashing.

[0119] In some optional implementations of this disclosure, the apparatus 400 further includes: a parameter acquisition unit (not shown in the figure), which is configured to acquire the performance parameters of the terminal device in real time; the determination unit is further configured to: determine the test results of the application under test based on the performance parameters and test logs.

[0120] In some optional implementations of this disclosure, the apparatus 400 further includes: a foreground detection unit (not shown in the figure), which can be configured to detect whether the application under test is in the foreground of the terminal device; and in response to the application under test not being in the foreground of the terminal device, to pull the application under test to the foreground of the terminal device.

[0121] In some alternative implementations of this disclosure, the apparatus 400 further includes a pressure testing unit (not shown in the figure), which is configured to simultaneously initiate a pressure test on the terminal device.

[0122] In some optional implementations of this disclosure, the main page detection unit 402 is configured to: compare the page screenshot with the subpage icons in the preset subpage icon set one by one; and determine that the application under test is located on the main test page in response to the page screenshot not having any subpage icon in the subpage icon set.

[0123] The application testing apparatus provided in the embodiments of this disclosure firstly, in response to the application under test running on the terminal device, the screenshot acquisition unit 401 acquires a screenshot of the application under test's page in real time; secondly, the main page detection unit 402, based on the page screenshot, detects whether the application under test is consistently located on the main test page during the test period; thirdly, the log acquisition unit 403, in response to detecting that the application under test is consistently located on the main test page during the test period, acquires the test log of the terminal device; finally, the determination unit 404, based on the test log, determines the test result of the application under test. Therefore, based on the fact that the main test page is the most frequently used page in the application, detecting whether the application under test is consistently located on the main test page through page screenshots, combined with the test log of the terminal device, allows for compatibility performance testing of the application under test. The operation is simple, improving the testing efficiency of the application under test. Furthermore, the testing method of this application is applicable to various applications, providing a universal application testing framework for multiple applications.

[0124] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0125] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0126] Figure 5 A schematic block diagram of an example electronic device 500 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0127] like Figure 5 As shown, device 500 includes a computing unit 501, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 502 or a computer program loaded into random access memory (RAM) 503 from storage unit 508. RAM 503 may also store various programs and data required for the operation of device 500. The computing unit 501, ROM 502, and RAM 503 are interconnected via bus 504. Input / output (I / O) interface 505 is also connected to bus 504.

[0128] Multiple components in device 500 are connected to I / O interface 505, including: input unit 506, such as keyboard, mouse, etc.; output unit 507, such as various types of monitors, speakers, etc.; storage unit 508, such as disk, optical disk, etc.; and communication unit 509, such as network card, modem, wireless transceiver, etc. Communication unit 509 allows device 500 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0129] The computing unit 501 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 501 performs the various methods and processes described above, such as application testing methods. For example, in some embodiments, the application testing method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on device 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by the computing unit 501, one or more steps of the application testing method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform application testing methods by any other suitable means (e.g., by means of firmware).

[0130] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0131] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to the processor or controller of a general-purpose computer, special-purpose computer, or other programmable application test apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0132] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0133] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0134] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0135] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.

[0136] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0137] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A method for testing an application, the method comprising: acquiring a page screenshot of a to-be-tested application in real time in response to the to-be-tested application having been run on a terminal device; detecting whether the to-be-tested application is located on a main test page at a test time based on the page screenshot; acquiring a test log of the terminal device in response to detecting that the to-be-tested application is located on the main test page at the test time; determining a test result of the to-be-tested application based on the test log. 2.The method of claim 1, the method further comprising: operating a control on the main test page within a control time based on the page screenshot.

3. The method of claim 2, wherein, The operating the control on the main test page within the control time based on the page screenshot comprises: determining the control on the main test page corresponding to a main page icon and control information in response to the page screenshot having any one of a preset main page icon set; operating the control within the control time based on the control information. 4.The method of claim 1, the to-be-tested application being a game application, the method further comprising: controlling an object in the game application to be in a motion state within a control time. 5.The method of claim 1, the method further comprising: detecting whether the to-be-tested application has a pop-up sub-page based on the page screenshot in response to detecting that the to-be-tested application is not located on the main test page; closing the pop-up sub-page in response to the to-be-tested application having the pop-up sub-page.

6. The method of claim 5, wherein, The detecting whether the to-be-tested application has the pop-up sub-page based on the page screenshot in response to detecting that the to-be-tested application is not located on the main test page comprises: determining that the to-be-tested application has the pop-up sub-page in response to the page screenshot having any one of a preset sub-page icon set; The closing the pop-up sub-page in response to the to-be-tested application having the pop-up sub-page comprises: operating an area in the pop-up sub-page corresponding to the sub-page icon to close the pop-up sub-page. 7.The method of claim 1, the method further comprising, before the acquiring the test log of the terminal device: detecting whether the to-be-tested application appears to be stuck or dead; quitting the test of the to-be-tested application in response to the to-be-tested application appearing to be stuck or dead. 8.The method of claim 1, the method further comprising: acquiring a performance parameter of the terminal device in real time; The determining the test result of the to-be-tested application based on the test log comprises: determining the test result of the to-be-tested application based on the performance parameter and the test log. 9.The method of claim 1, the method further comprising: detecting whether the to-be-tested application is located on a foreground of the terminal device; pulling the to-be-tested application to the foreground of the terminal device in response to the to-be-tested application not being located on the foreground of the terminal device. 10.The method of claim 1, the method further comprising: simultaneously starting a stress test of the terminal device.

11. The method according to one of claims 1-10, wherein, The detecting whether the application under test is located on the main test page during the test time based on the page screenshot comprises: comparing the page screenshot with sub-page icons in a preset sub-page icon set one by one; in response to the page screenshot not having any sub-page icon in the sub-page icon set, determining that the application under test is located on the main test page.

12. An application testing device, comprising: a screenshot obtaining unit configured to obtain a page screenshot of an application under test in real time in response to the application under test having been running on a terminal device; a main page detecting unit configured to detect whether the application under test is located on a main test page during a test time based on the page screenshot; a log obtaining unit configured to obtain a test log of the terminal device in response to detecting that the application under test is located on the main test page during the test time; a determining unit configured to determine a test result of the application under test based on the test log.

13. The device of claim 12, further comprising: an operation unit configured to operate a control on the main test page within a control time based on the page screenshot.

14. The device of claim 13, wherein the operation unit is further configured to: in response to the page screenshot having any main page icon in a preset main page icon set, determine a control corresponding to the main page icon on the main test page and control information; and operate the control within the control time based on the control information.

15. The apparatus of claim 12, wherein the application under test is a gaming application, the apparatus further comprising: a control unit configured to control an object in the game application to be in a motion state within the control time.

16. The apparatus of claim 12, further comprising: a sub-page detecting unit configured to detect, in response to detecting that the application under test is not located on the main test page, whether the application under test has a pop-up sub-page based on the page screenshot; and in response to the application under test having the pop-up sub-page, close the pop-up sub-page.

17. The apparatus of claim 16, wherein, The sub-page detecting unit is further configured to: in response to the page screenshot having any sub-page icon in a preset sub-page icon set, determine that the application under test has the pop-up sub-page; and operate an area in the pop-up sub-page corresponding to the sub-page icon to close the pop-up sub-page.

18. The device of claim 12, further comprising: a freezing unit configured to detect whether the application under test is frozen or dead; in response to the application under test being frozen or dead, exit the test of the application under test.

19. The device of claim 12, further comprising: a parameter obtaining unit configured to obtain a performance parameter of the terminal device in real time; the determining unit is further configured to determine the test result of the application under test based on the performance parameter and the test log.

20. The device of claim 12, further comprising: a foreground detecting unit configured to detect whether the application under test is located on a foreground of the terminal device; in response to the application under test not being located on the foreground of the terminal device, pull the application under test to the foreground of the terminal device.

21. The device of claim 12, further comprising: The pressure testing unit is configured to simultaneously initiate pressure testing of the terminal device.

22. The apparatus of one of claims 12-21, wherein, The main page detection unit is configured to: compare the page screenshot with sub-page icons in a preset sub-page icon set one by one; and determine that the application under test is located at a main test page in response to the page screenshot not having any sub-page icon in the sub-page icon set.

23. An electronic device, comprising: Comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-11.

24. A non-transitory computer-readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to enable the computer to perform the method of any one of claims 1-11.

25. A computer program product comprising a computer program which, when executed by a processor, implements the method of any one of claims 1-11.

Citation Information

Patent Citations

  • Page picture testing method and device and electronic equipment

    CN113886745A

  • Visual assertion testing method, device, system and medium

    CN114510416A