Application fault detection method, device and computer readable storage medium
By identifying the focus window of the display interface, sending analog control signals and recording the event duration, generating response fault sub-events, and updating the record table, the problems of low detection efficiency and poor accuracy in the existing technology are solved, and timely detection and high efficiency and accuracy of application faults are achieved.
Patent Information
- Application Number
- CN202210061997.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-19
- Publication Date
- 2026-03-17
- Estimated Expiration
- 2042-01-19
AI Technical Summary
Existing technologies rely on user operation when detecting application faults in terminal devices, resulting in low detection efficiency and poor accuracy, and failing to detect application faults in a timely manner.
By identifying the focus window in the display interface, sending simulated control signals and recording the event duration, generating response fault sub-events, updating to the preset record table, and determining application fault information based on the record table.
It enables timely detection of application faults, improves detection efficiency and accuracy, reduces reliance on real control signals, and enhances the timeliness and accuracy of detection.
Smart Images

Figure CN114490155B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and specifically to an application fault detection method, apparatus, and computer-readable storage medium. Background Technology
[0002] With the development of terminal device technology, users can control related applications (APPs) on their devices, such as video and music applications, to meet their corresponding experience needs. However, when users control these applications, delays in processing control signals can cause the device to lag. To detect application malfunctions, related technologies detect lag scenarios on the terminal device and, upon detecting such scenarios, identify the running applications, thereby inferring the faulty application causing the lag.
[0003] However, when detecting application faults, the relevant technologies mainly rely on device lag scenarios that occur when users operate terminal devices to determine whether there is a fault in the application. This makes it impossible to detect application faults in a timely manner, reducing the efficiency of application fault detection. Furthermore, due to the influence of the terminal device itself or other factors, the accuracy of application fault detection will be reduced. Summary of the Invention
[0004] This application provides an application fault detection method, apparatus, and computer-readable storage medium. It can detect application faults in a timely manner, improving the efficiency and accuracy of application fault detection.
[0005] This application provides an application fault detection method, including:
[0006] Identify the target application indicated by the focused window in the display interface;
[0007] Record the time when sending the analog control signal to the target application, the analog control signal being used to instruct the target application to run the preset analog logic corresponding to the focus window;
[0008] If the target application returns a notification of completion corresponding to the preset simulation logic, the receiving time of the notification is recorded, and the duration of the simulated event when the target application processes the simulated control signal is calculated based on the sending time and receiving time.
[0009] If the duration of the simulated event exceeds a preset time threshold, a response fault sub-event for the focus window is generated, and the response fault sub-event is updated to the preset record table corresponding to the target application.
[0010] Based on the updated preset record table, the fault information of the target application is determined.
[0011] Accordingly, embodiments of this application provide an application fault detection device, including:
[0012] The identification unit is used to identify the target application marked by the focused window in the display interface;
[0013] A recording unit is used to record the transmission time when an analog control signal is sent to the target application, wherein the analog control signal is used to instruct the target application to run the preset analog logic corresponding to the focus window;
[0014] The calculation unit is configured to, if the target application returns a running completion notification corresponding to the preset simulation logic, record the receiving time of the running completion notification, and calculate the duration of the simulation event when the target application processes the simulation control signal based on the sending time and receiving time.
[0015] The update unit, if the duration of the simulated event exceeds a preset time threshold, generates a response fault sub-event for the focus window and updates the response fault sub-event to the preset record table corresponding to the target application;
[0016] The determining unit is used to determine the fault information of the target application based on the updated preset record table.
[0017] In some embodiments, the identification unit is further configured to:
[0018] Get the position information of the focused window in the display interface;
[0019] The target application identified by the focus window is determined based on the position information of the focus window.
[0020] In some embodiments, the application fault detection device further includes a transmitting unit, which is also used for:
[0021] Obtain the focus control channel of the target application for the focused window;
[0022] Identify the number of signal tasks in the waiting queue corresponding to the focus control channel, and determine whether to send an analog control signal to the target application based on the number of signal tasks.
[0023] In some embodiments, the transmitting unit is further configured to:
[0024] If the detected signal workload is less than a preset workload threshold, then an analog control signal is sent to the target application based on the focus control channel.
[0025] In some embodiments, the transmitting unit is further configured to:
[0026] If the detected signal task volume is greater than a preset task volume threshold, then the signal type corresponding to the signal task in the waiting queue is identified;
[0027] If the signal type is identified as a real control signal, the sending of analog control signals to the target application is stopped, and the processing time of the target application in processing the real control signal is obtained, so as to determine whether the target application has an application fault based on the processing time of the real control signal.
[0028] In some embodiments, the determining unit is further configured to:
[0029] Identify the fault time of each response fault sub-event in the updated preset record table;
[0030] Based on the fault time of each response fault sub-event, determine the fault time sequence corresponding to the updated preset record table;
[0031] Based on the fault time sequence, the fault information of the target application is determined.
[0032] In some embodiments, the determining unit is further configured to:
[0033] Obtain the number of response fault sub-events contained in each focus window of the target application within a preset time period in the fault time sequence;
[0034] The focus window containing multiple response fault sub-events within the preset time period is determined as the fault focus window, and fault information corresponding to the fault focus window is generated for the target application.
[0035] In some embodiments, the application fault detection device further includes an application update unit, which is also used for:
[0036] A fault handling request is generated based on the fault information of the target application, and the fault handling request is sent to the server. The fault handling request is used to instruct the server to return the target logic packet of the fault information.
[0037] When the server returns the target logic packet, the preset simulation logic of the target application is updated according to the target logic packet.
[0038] Furthermore, this application also provides a computer device, including a processor and a memory, wherein the memory stores an application program, and the processor is used to run the application program in the memory to implement the steps in the application fault detection method provided in this application.
[0039] Furthermore, embodiments of this application also provide a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute steps in any of the application fault detection methods provided in embodiments of this application.
[0040] Furthermore, embodiments of this application also provide a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps in any of the application fault detection methods provided in embodiments of this application.
[0041] This application embodiment can identify the target application marked in the focus window of the display interface; record the sending time when sending a simulated control signal to the target application, the simulated control signal being used to instruct the target application to run the preset simulated logic corresponding to the focus window; if a running completion notification corresponding to the preset simulated logic is received from the target application, the receiving time of the running completion notification is recorded, and the simulated event duration of the target application when processing the simulated control signal is calculated based on the sending time and receiving time; if the simulated event duration is greater than a preset time threshold, a response fault sub-event of the focus window is generated, and the response fault sub-event is updated to the preset record table corresponding to the target application; based on the updated preset record table, the fault information of the target application is determined. Therefore, this solution detects the target application marked in the focus window to determine the currently running target application, then detects it by sending a simulated control signal to determine the simulated event duration of the target application when processing the simulated control signal, and then, when it is determined that the target application has a response fault based on the simulated event duration, the fault is recorded in the preset record table, and the fault information of the target application is determined based on the information in the preset record table; thus, application faults can be detected in a timely manner, improving the detection efficiency and accuracy of application faults. Attached Figure Description
[0042] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0043] Figure 1 This is a schematic diagram of a scenario for the application fault detection system provided in an embodiment of this application;
[0044] Figure 2 This is a flowchart illustrating the steps of the application fault detection method provided in the embodiments of this application;
[0045] Figure 3 This is a flowchart illustrating another step of the application fault detection method provided in this application embodiment;
[0046] Figure 4 This is a block flowchart illustrating the application fault detection method provided in the embodiments of this application;
[0047] Figure 5 This is a schematic diagram of the application fault detection device provided in the embodiments of this application;
[0048] Figure 6 This is a schematic diagram of the structure of the computer device provided in the embodiments of this application. Detailed Implementation
[0049] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0050] This application provides an application fault detection method, apparatus, and computer-readable storage medium. This application will be described from the perspective of the application fault detection apparatus, which can be integrated into a computer device, such as a terminal. The terminal can be a television, smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The terminal and server can be directly or indirectly connected via wired or wireless communication, which is not limited herein.
[0051] For example, see Figure 1 This is a schematic diagram of a scenario for the application fault detection method provided in this application embodiment. The scenario includes a terminal or a server.
[0052] The terminal or server can identify the target application marked in the focus window of the display interface; record the sending time when sending a simulated control signal to the target application, which is used to instruct the target application to run the preset simulated logic corresponding to the focus window; if a completion notification corresponding to the preset simulated logic is received from the target application, the receiving time of the completion notification is recorded, and the duration of the simulated event when the target application processes the simulated control signal is calculated based on the sending and receiving times; if the duration of the simulated event is greater than a preset time threshold, a response fault sub-event for the focus window is generated, and the response fault sub-event is updated to the preset record table corresponding to the target application; based on the updated preset record table, the fault information of the target application is determined.
[0053] Application fault detection can include processing methods such as identifying the target application, recording the sending and receiving times, calculating the duration of simulated events, updating the preset record table, and determining fault information.
[0054] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the preferred order of the embodiments.
[0055] In this embodiment, the description will focus on an application fault detection device, which can be integrated into a computer device such as a terminal. See also Figure 2 , Figure 2 This is a flowchart illustrating the steps of an application fault detection method provided in an embodiment of this application. When the processor on the terminal executes the program corresponding to the application fault detection method, the specific process of the application fault detection method is as follows:
[0056] 101. Identify the target application indicated by the focused window in the display interface.
[0057] It should be noted that the embodiments of this application will be described with a terminal as the execution subject. The terminal integrates an application fault detection device and has an application installed on it. When the terminal executes the application fault detection method, it can perform fault detection on the relevant application.
[0058] The display interface can be a screen on a terminal display, which can display one or more applications and some text.
[0059] The focus window is an attribute of the application window, representing the "focus state" of the application within the display interface. It indicates the application currently being controlled by the user / target object on the display interface; the application indicated by the focus window is the active application. It's worth noting that the focus window can indicate the entire application or only a specific button component within the application. For example, taking a television as a terminal device, if a video application is installed on the television, and the user controls the video application using a remote control, when the user sends one or more button signals to the television, the television will respond to the received button signals and control the focus window to move towards the corresponding button component or target area on the video application, fixing the focus window (focus state) on that button component or target area. In this case, the video application is the target application indicated by the focus window. For example, taking a mobile phone as a terminal, when a music application is being opened on the phone's display screen, the phone detects the user's touch signal on the "My Music" button component in the music application, and marks the focus window on the "My Music" button area in the music application. The phone's processor can then determine the music application as the target application based on the information displayed in the focus window.
[0060] The target application is the application that can currently be controlled on the terminal's display interface.
[0061] In order to determine the target application that can be detected by the terminal, the terminal in this application embodiment can identify the focus window on the terminal display interface, thereby determining the application marked by the focus window, so as to obtain the target application that can be controlled on the terminal, so as to facilitate subsequent fault detection of the controllable target application.
[0062] It should be noted that at any given time, there is usually only one controllable application on the terminal; the embodiments of this application may be to actively detect faults in the target application that the user / target object is using, such as detecting the application's response / processing control signals, in order to know the health status of the target application.
[0063] In some implementations, the step "identifying the target application marked by the focus window in the display interface" may include: obtaining the position information of the focus window in the display interface; and determining the target application marked by the focus window based on the position information of the focus window.
[0064] The location information can be the position of the focus window on the display screen. Specifically, this location information can be coordinate information, interface area information, etc. Furthermore, this location information can also be determined in conjunction with the target application's interface. For example, if the target application's interface layout is generally full-screen or has the largest screen-to-body ratio, the position of the focus window on the display screen can be combined with its area position on the application's display screen to determine the focus window's location information.
[0065] Specifically, to determine the target application that the terminal can currently control, this embodiment of the application can obtain the location information of the focus window in the display interface, and determine the display status of the application interface (application window screen) of the relevant application in the terminal's display interface, such as full-screen display or screen occupancy. Based on the location information, the relationship between the focus window and the application interface (application window screen) can be determined, such as determining whether the focus is displayed on which application interface in the display interface, thereby identifying the application containing the focus window as the target application. Since this target application is currently the only application on the terminal's display interface that can directly respond to or process the received control signals, the target application that the terminal can currently control is determined, facilitating subsequent fault detection of the target application.
[0066] By using the above methods, the target application that can be manipulated on the terminal can be identified, so as to facilitate subsequent fault detection of the target application.
[0067] 102. Record the transmission time when sending analog control signals to the target application.
[0068] It should be noted that, after determining the target application that can directly respond to / process the control signal, the terminal in this application embodiment generates a simulated control signal for application fault detection and sends the simulated control signal to the target application, so that the target application can perform corresponding processing, such as executing the preset simulation logic corresponding to the simulated control signal, and returning the running completion notification corresponding to the preset simulation logic after execution.
[0069] It should be noted that the fault detection in this application mainly focuses on the response fault detection of the focused window on the target application. This application can determine whether a fault exists by the duration of the event when the target application processes the simulated control signal. Therefore, when sending the simulated control signal to the target application, the corresponding sending time needs to be recorded so as to combine it with the notification reception time after the target application completes the response to the simulated control signal to determine the duration of the simulated event when the target application processes the simulated control signal.
[0070] The simulated control signal can be a signal that controls the target application, instructing the target application to run the preset simulated logic corresponding to the focused window. It should be noted that this simulated control signal differs from a real control signal; it can be an empty signal that the target application can respond to. In this case, the target application can process the simulated control signal upon receiving it, and the specific processing logic depends on the application's preset simulated logic. For example, to handle fault detection, the target application can pre-add the code file for the preset simulated logic to its installation package (SDK), so that the target application can execute the corresponding preset simulated logic when processing the simulated control signal.
[0071] The preset simulation logic can be the logic of an empty implementation method, which means that it is implemented by default in the framework code of the target application. It should be noted that the logic of this empty implementation method means that the target application responds to / processes the analog control signal, but no specific strategy is required in the processing. That is, the analog control signal only needs to be responded to by the target application.
[0072] In this embodiment, fault detection of a target application can be performed by detecting the response of the focus window on the target application to determine whether the focus window is responsive. Therefore, to avoid interference between the test signals and other real control signals, and to improve the efficiency of detecting the target application's response, this embodiment uses a terminal-generated simulated control signal and sends it to the target application. This causes the target application to execute preset simulated logic (such as an empty implementation method) when responding to the simulated control signal, thereby saving detection time and improving the efficiency of fault detection. Furthermore, this embodiment does not rely on user-triggered real control signals for fault detection, allowing the terminal to perform autonomous testing via simulated control signals, making the fault detection process timely and efficient.
[0073] In some implementations, since the target application is one that the user can directly control, it needs to respond to real control signals triggered by the user. When performing fault testing on the target application, it needs to respond to multiple signals within a short period, including real control signals triggered by the user and simulated control signals generated autonomously by the terminal. This increases the response burden on the target application and affects the progress of autonomous terminal detection. To avoid these issues and improve the efficiency of fault detection on the target application, the embodiments of this application may include the following before the step "recording the transmission time when sending simulated control signals to the target application":
[0074] (1) Obtain the focus control channel of the target application for the focused window;
[0075] (2) Identify the number of signal tasks in the waiting queue corresponding to the focus control channel, and determine whether to send an analog control signal to the target application based on the number of signal tasks.
[0076] The focus control channel can be a signal channel for transmitting control signals. These control signals are used to control the focus window on the target application, such as moving the focus window to the next button component or component area on the target application. It should be noted that in this embodiment, when performing fault detection on the target application, fault detection is mainly performed by simulating the response of the focus window to the control signals. However, since the preset simulation logic (such as the "implementable method" logic) does not perform specific processing, the target application only needs to respond after receiving the simulation control signals; that is, the focus window on the target application will not move. Therefore, the focus control channel can also be used to transmit simulated control signals generated by the terminal to the target application.
[0077] The waiting queue contains control signals that the target application needs to respond to and process. When a control signal is transmitted to the target application through the focus control channel, the control signal (such as a real control signal or an analog control signal) will be added to the waiting queue, so that the target application can respond to and process the signals in sequence according to the reception timing of each signal.
[0078] The signal task quantity refers to the number of signals that the target application will need to respond to and process.
[0079] Specifically, in order to reduce the response burden of the target application and improve the efficiency of fault detection of the target application, this embodiment first obtains the focus control channel of the target application for the focus window before performing fault detection of the target application through analog control signals, and identifies the signal task volume in the waiting queue corresponding to the focus control channel to determine the number of signal tasks to be processed by the target application for the focus window. Then, based on the signal task volume, it is determined whether to send an analog control signal to the target application at the current time.
[0080] In some implementations, the step "determine whether to send an analog control signal to the target application based on the signal workload" can specifically include two cases:
[0081] 1. If the detection signal workload is less than the preset workload threshold, then an analog control signal is sent to the target application based on the focus control channel.
[0082] 2. If the number of detected signal tasks is greater than or equal to the preset task threshold, the signal type corresponding to the signal task in the waiting queue is identified. If the signal type is identified as a real control signal, the sending of simulated control signals to the target application is stopped, and the processing time of the target application in processing the real control signal is obtained, so as to determine whether the target application has an application failure based on the processing time of the real control signal.
[0083] To avoid requiring the target application to respond to multiple signals in a short period, a preset task load threshold can be set to determine whether to send a simulated control signal to the target application for detection. For example, the preset task load threshold can be 1, meaning that if there is only one signal waiting to be responded to, no simulated control signal will be sent to the target application for detection, thus reducing the pressure on the target application when responding to control signals.
[0084] Specifically, in determining whether to send an analog control signal to the target application, this embodiment can limit only the real control signals in the waiting queue corresponding to the focus control channel. If the number of signal tasks in the waiting queue is greater than or equal to a preset task volume threshold, and the signal type corresponding to the signal task in the waiting queue is a real control signal, then the analog control signal will not be sent to the target application. Furthermore, to determine whether the target application has a fault when processing the real control signal, specifically, the sending time of the real control signal is obtained, and after the target application completes its response and processing of the real control signal, its completion processing time is determined. Based on the sending time and completion processing time, the processing duration of the real control signal by the target application is determined. Then, the processing duration of the real control signal is compared with a preset processing duration threshold. For example, if the preset processing duration threshold is set to 100ms, if the processing duration of the real control signal is greater than 100ms, it is determined that the target application has a fault; otherwise, there is no fault.
[0085] In this way, when sending a simulated control signal to the target application, the terminal's processor first records the corresponding sending time, so as to combine it with the notification receiving time after the target application completes the response to the simulated control signal, and determine the duration of the simulated event when the target application processes the simulated control signal.
[0086] 103. If a completion notification corresponding to the preset simulation logic is received from the target application, the receiving time of the completion notification is recorded, and the duration of the simulation event when the target application is processing the simulation control signal is calculated based on the sending time and receiving time.
[0087] The receiving time refers to the time when the target application sends a completion notification after responding to the analog control signal, and this receiving time is the same as or similar to the completion response time.
[0088] The duration of the simulated event can be the time taken by the target application to complete the response / processing of the simulated control signal.
[0089] Specifically, in order to determine the duration of the simulated event consumed by the target application in processing the simulated control signal, this embodiment of the application, upon receiving a completion notification corresponding to the preset simulation logic from the target application, records the reception time of receiving the completion notification. Then, based on the previous sending and receiving times, it calculates the duration of the simulated event consumed by the target application in processing the simulated control signal. This facilitates subsequent determination of whether the target application has a response failure based on the duration of the simulated event.
[0090] 104. If the duration of the simulated event exceeds the preset time threshold, a response fault sub-event will be generated for the focus window, and the response fault sub-event will be updated to the preset record table corresponding to the target application.
[0091] Specifically, after obtaining the duration of the simulated event when the target application is processing the simulated control signal, the duration of the simulated event is compared with a preset time threshold. When the duration of the simulated event is greater than the preset time threshold, it indicates that the target application has a response fault when processing the simulated control signal. At this time, a response fault sub-event is generated in the focus window, and the response fault sub-event is updated to the preset record table corresponding to the target application to obtain the updated preset record table.
[0092] The preset record table can be a signal processing record table for the target application's current focus window, used to statistically analyze the response fault sub-events of analog control signals. It can contain event records of the target application's response faults over a historical period. It should be noted that this preset record table can be an arithmetic linear list, for example, a stack-based record table. When the target application responds to and processes the delay of the analog control signal, it generates a response fault sub-event for that analog control signal, i.e., a response fault sub-event for the target application's focus window, and pushes this response fault sub-event onto the stack for recording.
[0093] 105. Determine the fault information of the target application based on the updated preset record table.
[0094] This fault information can reflect the fault conditions existing in the target application, and it is not limited to the response fault conditions of the target application, such as response delay, focus window control error, etc.
[0095] In order to determine whether the target application has fault information, this embodiment of the application can determine the fault information of the target application based on the response fault sub-events recorded in the preset record table after obtaining the updated preset record table.
[0096] In some implementations, the step "determine the fault information of the target application based on the updated preset record table" may include:
[0097] (1) Identify the fault time of each response fault sub-event in the updated preset record table;
[0098] (2) Determine the fault time sequence corresponding to the updated preset record table based on the fault time of each response fault sub-event;
[0099] (3) Determine the fault information of the target application based on the fault time sequence.
[0100] After each update of the preset record table based on the response fault sub-events, it can be determined whether to generate fault information for the target application by combining multiple response fault sub-events in the updated preset record table. Specifically, the fault time of each response fault sub-event in the updated preset record table is identified. This fault time can be the time when it is determined that the target application has a corresponding response fault, or it can be the time when the response fault sub-event is generated. Then, based on the fault time of each response fault sub-event, all response fault sub-events in the updated preset record table are sorted to determine the fault time sequence of all response fault sub-events. Furthermore, the fault information of the target application is determined based on the fault time sequence, such as determining the fault status of the most recent response fault sub-events based on the sequence information in the fault time sequence, and then determining the fault information of the target application based on the fault status of the most recent response fault sub-events.
[0101] In some implementations, the step "determine the fault information of the target application based on the fault time sequence" may include: obtaining the number of response fault sub-events contained in each focus window of the target application within a preset time period in the fault time sequence; determining the focus window containing multiple response fault sub-events within the preset time period as the fault focus window, and generating the fault information of the target application corresponding to the fault focus window.
[0102] The preset duration can be a historical duration prior to the current time, such as 500ms, 1 second, or 5 seconds in the past. Furthermore, when setting the preset duration, it can be determined based on the processing cycle (duration) of the target application in responding to and processing a real control signal, or several times the processing cycle. For example, if the processing cycle of a real control signal is 100ms, the preset duration can be set to 500ms; no specific limitation is made here.
[0103] Specifically, in order to determine the fault information of the target application, after obtaining the fault time sequence of all response fault sub-events, this embodiment of the application determines the number of response fault sub-events within a preset time period based on the fault time sequence; when it is identified that the number of response fault sub-events within the preset time period is multiple, such as 3, it is determined that the focus window corresponding to the multiple response fault sub-events is abnormal, specifically that the analog control signal of the target application for the focus window is abnormal in response / processing. Therefore, fault information of the target application for the faulty focus window is generated to determine that a fault has been detected in the target application.
[0104] Furthermore, when a fault is detected in the target application, an update package can be requested from the target application's server to repair the fault. Specifically, after the step "determine the fault information of the target application based on the fault time sequence," the following can be included:
[0105] A fault handling request is generated based on the fault information of the target application, and the fault handling request is sent to the server. The fault handling request is used to instruct the server to return the target logic packet containing the fault information. When the server returns the target logic packet, the preset simulation logic of the target application is updated according to the target logic packet.
[0106] As can be seen from the above, the embodiments of this application can identify the target application marked in the focus window of the display interface; record the sending time when sending a simulated control signal to the target application, the simulated control signal being used to instruct the target application to run the preset simulated logic corresponding to the focus window; if a running completion notification corresponding to the preset simulated logic is received from the target application, the receiving time of the running completion notification is recorded, and the duration of the simulated event when the target application processes the simulated control signal is calculated based on the sending time and receiving time; if the duration of the simulated event is greater than a preset time threshold, a response fault sub-event of the focus window is generated, and the response fault sub-event is updated to the preset record table corresponding to the target application; based on the updated preset record table, the fault information of the target application is determined. Therefore, this solution identifies the currently running target application by detecting the target application marked in the focus window. Then, it detects the target application by sending simulated control signals to determine the duration of simulated events when the target application processes the simulated control signals. If a response fault is detected in the target application based on the duration of the simulated events, the fault is recorded in a preset record table, and the fault information of the target application is determined based on the information in the preset record table. In this way, application faults can be detected in a timely manner, improving the efficiency and accuracy of application fault detection.
[0107] In this application embodiment, the description will focus on the application fault detection device, which can be specifically integrated into computer devices such as terminals and servers. See also Figure 3 and Figure 4 , Figure 3 This is a schematic flowchart illustrating another step of the application fault detection method provided in this application embodiment. Figure 4 This is a block flowchart illustrating the application fault detection method provided in this embodiment. For ease of understanding, this embodiment will be combined with... Figure 3 and Figure 4 To narrate.
[0108] When the processor on the server executes the program corresponding to the application fault detection method, the specific process of the application fault detection method is as follows:
[0109] 201. Obtain the position information of the focus window in the display interface.
[0110] The focus window is an attribute of the application window, which belongs to the "focus state" of the application in the display interface. It is used to indicate the application that is currently being manipulated by the user / target object on the display interface.
[0111] The location information can be the position of the focused window on the display interface. Specifically, the location information can be coordinate information, interface area information, etc.
[0112] 202. Determine the target application identified by the focus window based on the position information of the focus window.
[0113] In order to determine the target application that the terminal can currently control, the embodiments of this application can obtain the location information of the focus window in the display interface, and determine the display status of the application interface (application window screen) of the relevant application in the terminal's display interface, such as full-screen display or screen occupancy. Based on the location information, the relationship between the focus window and the application interface (application window screen) can be determined, such as determining whether the focus is displayed on which application interface in the display interface, thereby identifying the application where the focus window is located as the target application.
[0114] 203. Obtain the focus control channel of the target application for the focused window.
[0115] The focus control channel can be a signal channel for transmitting control signals. The control signals transmitted by the focus control channel are used to control the focus window on the target application, such as controlling the focus window to move to the next button component or component area on the target application.
[0116] 204. Identify the signal task volume in the waiting queue corresponding to the focus control channel, and determine whether to send an analog control signal to the target application based on the signal task volume.
[0117] It should be noted that since the target application currently identified is one that users can directly control, it needs to respond to real control signals triggered by users. When conducting fault testing on the target application, the target application needs to respond to multiple signals in a short period of time, including real control signals triggered by users and simulated control signals generated by the terminal itself. This will increase the response burden of the target application and affect the progress of the terminal's autonomous detection.
[0118] To avoid the above phenomena, this embodiment of the application determines the amount of signal tasks to be processed by the target application for the focus window before performing fault detection on the target application using analog control signals. Based on the signal task volume, it determines whether to send an analog control signal to the target application at the current moment. This improves the efficiency of fault detection for the target application.
[0119] It should be noted that fault detection of the target application can include two situations: First, when the target application does not currently have other control signals to be processed, the terminal generates a simulated control signal to perform fault detection on the target application, specifically executing steps 205-210; Second, when the target application currently has other real control signals to be processed, specifically executing steps 211-212.
[0120] 205. If the detection signal workload is less than the preset workload threshold, then an analog control signal is sent to the target application based on the focus control channel.
[0121] The analog control signal can be a signal that controls the target application, and it is used to instruct the target application to run the preset analog logic corresponding to the focus window.
[0122] It should be noted that the simulated control signal can be an empty signal that the target application can respond to. In this case, after receiving the simulated control signal, the target application can process the simulated control signal. The specific processing logic depends on the application's preset simulation logic. For example, in order to deal with fault detection, the target application can pre-add the code file of the preset simulation logic to the target application's installation package (SDK) so that the target application can execute the corresponding preset simulation logic when processing the simulated control signal.
[0123] Specifically, a simulated control signal for application fault detection is generated and sent to the target application, causing the target application to perform corresponding processing, such as executing the preset simulated logic corresponding to the simulated control signal, and returning the running completion notification corresponding to the preset simulated logic after execution.
[0124] 206. Record the transmission time when sending analog control signals to the target application.
[0125] 207. If a run completion notification corresponding to the preset simulation logic is received from the target application, the receiving time of the run completion notification is recorded, and the duration of the simulation event when the target application is processing the simulation control signal is calculated based on the sending time and receiving time.
[0126] It should be noted that the fault detection in this application mainly focuses on the response fault detection of the focused window on the target application. This application can determine whether a fault exists by the duration of the event when the target application processes the simulated control signal. Therefore, when sending a simulated control signal to the target application, the corresponding sending time needs to be recorded, and when the target application sends a notification after completing the response to the simulated control signal, the receiving time of the notification needs to be recorded. Then, the duration of the simulated event when the target application processes the simulated control signal is determined based on the time difference between the sending time and the receiving time.
[0127] 208. If the duration of the simulated event exceeds the preset time threshold, a response fault sub-event is generated for the focus window, and the response fault sub-event is updated to the preset record table corresponding to the target application.
[0128] For example, the preset record table can be an arithmetic linear list, such as a stack. When the target application responds to and processes the delay of the analog control signal, it generates a response fault sub-event for the current analog control signal, that is, a response fault sub-event for the target application to the focus window, and pushes the response fault sub-event onto the stack to record the response fault sub-event.
[0129] 209. Identify the fault time of each response fault sub-event in the updated preset record table, and determine the fault time sequence corresponding to the updated preset record table based on the fault time of each response fault sub-event.
[0130] 210. Identify the fault focus window in the fault time series that contains multiple response fault sub-events within a preset duration, and generate the fault information corresponding to the fault focus window for the target application.
[0131] The preset duration can be a historical duration prior to the current time, determined by a factor of several times the processing cycle of a real control signal in response to and processing by the target application. For example, if the processing cycle of a real control signal is 100ms, the preset duration can be set to 500ms.
[0132] For example, based on the fault time series, if it is determined that there are 3 response fault sub-events in the past 500ms, the focus window corresponding to the response fault sub-event is determined as the fault focus window, and then the fault information of the target application is generated, such as the number of response delays and frequency.
[0133] 211. If the number of detected signal tasks is greater than or equal to the preset task volume threshold, then identify the signal type corresponding to the signal task in the waiting queue.
[0134] 212. If the signal type is identified as a real control signal, the processing time of the target application in processing the real control signal is obtained, so as to determine whether there is an application fault in the target application based on the processing time of the real control signal.
[0135] Combination Figure 4 The above is a block flowchart illustrating the application fault detection method provided in this embodiment. By executing steps 201-212, the following can be achieved:
[0136] This scenario uses a television as the terminal device. The television has video applications or other target applications installed, and the user can control these applications via remote control. The scenario primarily simulates the user sending one or more button signals (real control signals) to the television via the remote control. The target application on the television responds to and processes these signals, and the processing time is used to determine if the target application is malfunctioning. It should be noted that in this simulation scenario, simulated control signals generated by the terminal can replace the user-triggered "button signals," as shown in the following specific scenario:
[0137] (1) Obtain the focus communication channel (focus control channel) corresponding to the focus window, and determine whether the waiting queue corresponding to the focus communication channel is not empty and does not contain simulated key signals (simulated control signals). If it does, it means that the target application is processing other key signals (real control signals). To avoid increasing the pressure on key distribution, application fault detection is performed through ANR detection logic, and fault detection in the simulated scenario is paused. Otherwise, fault detection of the target application is performed through the simulated scenario.
[0138] (2) In the simulated scene, every 100 milliseconds, send a simulated button signal to the focus window and record the time T1. After sending, add the simulated button to the waiting queue.
[0139] (3) After receiving the simulated button signal, the target application (app) determines that the event is a simulated button based on the button code, and then executes the empty implementation method. This method is implemented by default in the framework code, and the target application does not need to override it. The empty method does not perform any business logic, so there is no execution time. Then, after the app finishes execution, it notifies the TV system distribution thread to remove the event from the waiting queue and records the time T2.
[0140] (4) When the TV system is removed from the waiting queue, it is determined whether the key processing takes time (T2-T1>100 milliseconds). If the processing takes time, the main thread stack is obtained and the stutter (fault sub-event) count is increased by 1.
[0141] (5) Determine whether the number of stutters in the same focus window is greater than 3 within 500 milliseconds. If it is, report the stack of the most frequent stutters; otherwise, do not process it.
[0142] As can be seen from the above, the embodiments of this application can identify the target application marked in the focus window of the display interface; record the sending time when sending a simulated control signal to the target application, the simulated control signal being used to instruct the target application to run the preset simulated logic corresponding to the focus window; if a running completion notification corresponding to the preset simulated logic is received from the target application, the receiving time of the running completion notification is recorded, and the duration of the simulated event when the target application processes the simulated control signal is calculated based on the sending time and receiving time; if the duration of the simulated event is greater than a preset time threshold, a response fault sub-event of the focus window is generated, and the response fault sub-event is updated to the preset record table corresponding to the target application; based on the updated preset record table, the fault information of the target application is determined. Therefore, this solution identifies the currently running target application by detecting the target application marked in the focus window. Then, it detects the target application by sending simulated control signals to determine the duration of simulated events when the target application processes the simulated control signals. If a response fault is detected in the target application based on the duration of the simulated events, the fault is recorded in a preset record table, and the fault information of the target application is determined based on the information in the preset record table. In this way, application faults can be detected in a timely manner, improving the efficiency and accuracy of application fault detection.
[0143] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0144] To better implement the above methods, this application embodiment also provides an application fault detection device, which can be integrated into computer equipment, such as servers and other computer equipment.
[0145] For example, such as Figure 5 As shown, the application fault detection device may include an identification unit 501, a recording unit 502, a calculation unit 503, an update unit 504, and a determination unit 505.
[0146] The identification unit 501 is used to identify the target application marked by the focus window in the display interface;
[0147] The recording unit 502 is used to record the transmission time when sending the analog control signal to the target application. The analog control signal is used to instruct the target application to run the preset analog logic corresponding to the focus window.
[0148] The calculation unit 503 is used to record the receiving time of the running completion notification if the target application returns a running completion notification corresponding to the preset simulation logic, and calculate the duration of the simulation event when the target application processes the simulation control signal based on the sending time and receiving time.
[0149] Update unit 504: If the duration of the simulated event exceeds the preset time threshold, generate a response fault sub-event for the focus window and update the response fault sub-event to the preset record table corresponding to the target application.
[0150] The determination unit 505 is used to determine the fault information of the target application based on the updated preset record table.
[0151] In some embodiments, the identification unit 501 is further configured to:
[0152] Obtain the position information of the focus window in the display interface; determine the target application identified by the focus window based on the position information of the focus window.
[0153] In some embodiments, the application fault detection device further includes a transmitting unit, which is also used for:
[0154] Obtain the focus control channel of the target application for the focus window; identify the signal task volume in the waiting queue corresponding to the focus control channel, and determine whether to send an analog control signal to the target application based on the signal task volume.
[0155] In some embodiments, the transmitting unit is further configured to:
[0156] If the detection signal workload is less than the preset workload threshold, then an analog control signal is sent to the target application based on the focus control channel.
[0157] In some embodiments, the transmitting unit is further configured to:
[0158] If the number of detected signal tasks exceeds a preset task threshold, the signal type corresponding to the signal task in the waiting queue is identified. If the signal type is identified as a real control signal, the sending of simulated control signals to the target application is stopped, and the processing time of the target application in processing the real control signal is obtained to determine whether the target application has an application failure based on the processing time of the real control signal.
[0159] In some embodiments, the determining unit 505 is further configured to:
[0160] Identify the fault time of each response fault sub-event in the updated preset record table; determine the fault time sequence corresponding to the updated preset record table based on the fault time time of each response fault sub-event; determine the fault information of the target application based on the fault time sequence.
[0161] In some embodiments, the determining unit is further configured to:
[0162] Obtain the number of response fault sub-events contained in each focus window of the target application within a preset time period in the fault time series; determine the focus window containing multiple response fault sub-events within the preset time period as the fault focus window, and generate the fault information corresponding to the fault focus window for the target application.
[0163] In some embodiments, the application fault detection device further includes an application update unit, which is also used for:
[0164] A fault handling request is generated based on the fault information of the target application, and the fault handling request is sent to the server. The fault handling request is used to instruct the server to return the target logic packet containing the fault information. When the server returns the target logic packet, the preset simulation logic of the target application is updated according to the target logic packet.
[0165] As can be seen from the above, the embodiments of this application can identify the target application marked in the focus window of the display interface through the identification unit 501; record the sending time when sending the analog control signal to the target application through the recording unit 502, the analog control signal is used to instruct the target application to run the preset analog logic corresponding to the focus window; calculate the receiving time of the running completion notification if the target application returns the running completion notification corresponding to the preset analog logic, and calculate the duration of the analog event when the target application processes the analog control signal based on the sending time and receiving time; update the response fault sub-event of the focus window if the duration of the analog event is greater than the preset time threshold, and update the response fault sub-event to the preset record table corresponding to the target application; and determine the fault information of the target application based on the updated preset record table through the determination unit 505. Therefore, this solution identifies the currently running target application by detecting the target application marked in the focus window. Then, it detects the target application by sending simulated control signals to determine the duration of simulated events when the target application processes the simulated control signals. If a response fault is detected in the target application based on the duration of the simulated events, the fault is recorded in a preset record table, and the fault information of the target application is determined based on the information in the preset record table. In this way, application faults can be detected in a timely manner, improving the efficiency and accuracy of application fault detection.
[0166] This application also provides a computer device, such as... Figure 6 As shown, it illustrates a structural schematic diagram of the computer device involved in the embodiments of this application, specifically:
[0167] The computer device may include components such as a processor 601 with one or more processing cores, a memory 602 with one or more computer-readable storage media, a power supply 603, and an input unit 604. Those skilled in the art will understand that... Figure 6 The computer device structure shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:
[0168] The processor 601 is the control center of the computer device. It connects various parts of the computer device via various interfaces and lines, and performs various functions and processes data by running or executing software programs and / or modules stored in the memory 602, and by calling data stored in the memory 602, thereby providing overall monitoring of the computer device. Optionally, the processor 601 may include one or more processing cores; preferably, the processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 601.
[0169] The memory 602 can be used to store software programs and modules. The processor 601 executes various functional applications and application fault detection by running the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 602 may also include a memory controller to provide the processor 601 with access to the memory 602.
[0170] The computer device also includes a power supply 603 that supplies power to the various components. Preferably, the power supply 603 can be logically connected to the processor 601 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 603 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0171] The computer device may also include an input unit 604, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0172] Although not shown, the computer device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 601 in the computer device loads the executable files corresponding to the processes of one or more application programs into the memory 602 according to the following instructions, and the processor 601 runs the application programs stored in the memory 602 to realize various functions, as follows:
[0173] Identify the target application marked in the focus window of the display interface; record the sending time when sending a simulated control signal to the target application, which is used to instruct the target application to run the preset simulated logic corresponding to the focus window; if a completion notification corresponding to the preset simulated logic is received from the target application, record the receiving time of the completion notification, and calculate the duration of the simulated event when the target application is processing the simulated control signal based on the sending and receiving times; if the duration of the simulated event is greater than a preset time threshold, generate a response fault sub-event for the focus window, and update the response fault sub-event to the preset record table corresponding to the target application; determine the fault information of the target application based on the updated preset record table.
[0174] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0175] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0176] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the application fault detection methods provided in embodiments of this application. For example, the instructions can execute the following steps:
[0177] Identify the target application marked in the focus window of the display interface; record the sending time when sending a simulated control signal to the target application, which is used to instruct the target application to run the preset simulated logic corresponding to the focus window; if a completion notification corresponding to the preset simulated logic is received from the target application, record the receiving time of the completion notification, and calculate the duration of the simulated event when the target application is processing the simulated control signal based on the sending and receiving times; if the duration of the simulated event is greater than a preset time threshold, generate a response fault sub-event for the focus window, and update the response fault sub-event to the preset record table corresponding to the target application; determine the fault information of the target application based on the updated preset record table.
[0178] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0179] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0180] This application also provides a computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the application fault detection method provided in the various optional implementations of the above embodiments.
[0181] Since the instructions stored in the computer-readable storage medium can execute the steps in any of the application fault detection methods provided in the embodiments of this application, the beneficial effects that any of the application fault detection methods provided in the embodiments of this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0182] The above provides a detailed description of an application fault detection method, apparatus, and computer-readable storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for application fault detection, characterized in that, The method comprises the following steps: identifying a target application indicated by a focus window in a display interface; recording a sending time when a simulation control signal is sent to the target application, the simulation control signal being used to instruct the target application to run preset simulation logic corresponding to the focus window; if a running completion notification corresponding to the preset simulation logic is received from the target application, recording a receiving time of the running completion notification, and calculating a simulation event duration of the target application when processing the simulation control signal according to the sending time and the receiving time; if the simulation event duration is greater than a preset time threshold, generating a response failure sub-event of the focus window, and updating the response failure sub-event to a preset record table corresponding to the target application; determining failure information of the target application according to the updated preset record table.
2. The method of claim 1, wherein, The step of identifying the target application indicated by the focus window in the display interface comprises the following steps: obtaining position information of the focus window in the display interface; determining the target application indicated by the focus window according to the position information of the focus window.
3. The method of claim 1, wherein, Before the step of recording the sending time when the simulation control signal is sent to the target application, the method further comprises the following steps: obtaining a focus control channel of the target application for the focus window; identifying a signal task amount in a waiting queue corresponding to the focus control channel, and determining whether to send the simulation control signal to the target application according to the signal task amount.
4. The method of claim 3, wherein, The step of determining whether to send the simulation control signal to the target application according to the signal task amount comprises the following steps: if the signal task amount is detected to be less than a preset task amount threshold, sending the simulation control signal to the target application based on the focus control channel.
5. The method of claim 3, wherein, The step of determining whether to send the simulation control signal to the target application according to the signal task amount further comprises the following steps: if the signal task amount is detected to be greater than or equal to the preset task amount threshold, identifying a signal type corresponding to a signal task in the waiting queue; if the signal type is identified to be a real control signal, stopping sending the simulation control signal to the target application, and obtaining a processing duration of the target application when processing the real control signal, so as to determine whether the target application has an application failure according to the processing duration of the real control signal.
6. The method of claim 1, wherein, The step of determining the running failure information of the target application according to the updated preset record table comprises the following steps: identifying a failure time of each response failure sub-event in the updated preset record table; determining a failure time sequence corresponding to the updated preset record table according to the failure time of each response failure sub-event; determining the failure information of the target application according to the failure time sequence.
7. The method of claim 6, wherein, The step of determining the failure information of the target application according to the failure time sequence comprises the following steps: obtaining a number of focus windows of the target application containing response failure sub-events within a preset duration in the failure time sequence; determining a focus window containing multiple response failure sub-events within the preset duration as a failure focus window, and generating failure information of the target application corresponding to the failure focus window.
8. The method of claim 1, wherein, The method further comprises: generating a fault processing request according to the fault information of the target application, and sending the fault processing request to a server, the fault processing request being used to instruct the server to return a target logic package of the fault information; updating preset simulation logic of the target application according to the target logic package when it is detected that the server returns the target logic package.
9. An application failure detection apparatus characterized by comprising: The method further comprises: an identifying unit configured to identify a target application indicated by a focus window in a display interface; a recording unit configured to record a sending time when a simulation control signal is sent to the target application, the simulation control signal being used to instruct the target application to run preset simulation logic corresponding to the focus window; a calculating unit configured to, if a running completion notification corresponding to the preset simulation logic is received from the target application, record a receiving time of the running completion notification, and calculate a simulation event duration of the target application in processing the simulation control signal according to the sending time and the receiving time; an updating unit configured to, if the simulation event duration is greater than a preset time threshold, generate a response fault sub-event of the focus window, and update the response fault sub-event to a preset record table corresponding to the target application; a determining unit configured to determine fault information of the target application according to the updated preset record table.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium is computer readable and stores a plurality of instructions, the instructions being adapted to be loaded by a processor to perform the steps in the application fault detection method of any one of claims 1 to 8.
Citation Information
Patent Citations
Testing method, testing device, terminal equipment and computer readable storage medium
CN110633192A
Frozen screen detection method and device, terminal equipment and computer storage medium
CN113568801A