Industrial software anomaly detection and information extraction method and system
By performing UI control identification, file detection and resource monitoring in industrial software, the screen recording cache during abnormal times is obtained and saved, which solves the problem of difficulty in reproducing abnormal scenes and excessive resource occupation, and achieves rapid restoration and efficient storage.
Patent Information
- Application Number
- CN202410683334.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2024-08-27
AI Technical Summary
In industrial software testing, abnormal scenarios are difficult to reproduce. The existing technology takes up too many resources and is tight on storage resources, resulting in long recovery times for abnormal on-site recovery and affecting the stable operation of the software.
Using industrial software anomaly detection and information extraction methods, by receiving user requests, it performs UI control recognition, file detection, image recognition and resource monitoring, obtains target logs, and performs continuous screen recording to generate a screen recording cache of a preset duration to determine abnormalities. Obtain and save the screen recording cache at any time to reduce unnecessary resource usage.
Quickly restore the abnormal scene and improve test efficiency. Only the preset duration of the abnormal occurrence is recorded in the screen recording cache, which minimizes storage space occupation and solves the problems of resource waste and difficulty in locating information.
Smart Images

Figure CN118550826A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of industrial software technology, and in particular to an industrial software anomaly detection and information extraction method and system. Background Art
[0002] In daily industrial software testing, when an abnormal scenario occurs in the software or the tester determines that the scenario is an abnormal scenario, it is necessary to reproduce the steps and resource usage information of the abnormal scenario. However, due to the tight project schedule and high testing pressure, it is difficult to recall the steps of the abnormal scenario and the software resource usage information at this time, which makes it difficult to reproduce or test the abnormal scenario. Stable operation is the core of industrial software. The lack of effective information on abnormal scenarios makes it impossible to reproduce them. This will pose a great hidden danger to the stable operation of industrial software and is difficult to tolerate.
[0003] Moreover, the existing software that can monitor steps and resource usage records in real time and stores all content from the beginning to the end. Storage will take up a lot of resources, and storage resources are relatively tight during testing. Storage resources are often used to record on-site alarms, operation records, etc., and it is impossible to leave too many resources for other uses. Moreover, whenever an abnormal scene is located, since the existing software records from the beginning to the end, the span is too large, and the browsing often freezes or even crashes, so a lot of time is required to restore the abnormal scene.
[0004] Therefore, there is an urgent need for an industrial software anomaly detection and information extraction method and system. Summary of the invention
[0005] 1. Technical issues to be resolved
[0006] In view of the above-mentioned shortcomings and deficiencies of the prior art, the present invention provides an industrial software anomaly detection and information extraction method and system, which solves the technical problems that a lot of time is required to restore the anomaly scene when an anomaly occurs in industrial software, and anomaly detection occupies too many resources.
[0007] (II) Technical solution
[0008] In order to achieve the above object, the main technical solutions adopted by the present invention include:
[0009] In a first aspect, an embodiment of the present invention provides an industrial software anomaly detection and information extraction method, comprising:
[0010] S100, receiving a first instruction from a user requesting feedback on whether an abnormality occurs in a target object, and performing UI control recognition, file detection, image recognition, and resource monitoring on the target object according to the first instruction to obtain a target log; and simultaneously performing continuous screen recording on the target object, and continuously generating a screen recording cache of a preset duration;
[0011] The target log includes:
[0012] The GUI monitors target information, file index content of the target object, image-specified feature information of the target object, and resource usage information of the target object;
[0013] S200. Determine whether there is an exception in the target log according to the target log. If yes, obtain the screen recording cache of the preset duration when the exception exists, and send and save the screen recording cache of the preset duration when the exception exists to the local end.
[0014] Optionally, the method further comprises:
[0015] If there is no abnormality, the new screen recording cache is automatically appended to the screen recording cache of the preset length, and the old screen recording cache that exceeds the preset length is deleted.
[0016] Optionally, the performing UI control recognition, file detection, image recognition, and resource monitoring on the target object and obtaining the target log includes:
[0017] S1 10. Initialize the UI control object interface of the target object by using uiautomation according to the target object, and generate GUI monitoring target information;
[0018] S120: Initialize the files and file paths of the target object using Glob according to the target object, and obtain file monitoring index content.
[0019] Optionally, the step of performing UI control recognition, file detection, image recognition, and resource monitoring on the target object and obtaining the target log further includes:
[0020] S130, according to the target object, obtaining an image of the target object, and using open-cv to obtain image-specified feature information of the target object;
[0021] S140. According to the target object, use psutil to obtain resource usage information of the target object.
[0022] Optionally, in S200, judging whether the target log has an abnormality according to the target log includes:
[0023] S21 0. Determine whether there is an unexpected window in the GUI monitoring target information. If so, an abnormality occurs.
[0024] S220, determining whether there is a dump file in the file monitoring index content, and if so, an exception occurs;
[0025] S230, determining whether the image-specified feature information of the target object is consistent with the image-specified feature information under normal circumstances, and if not, an abnormality exists;
[0026] S240: Determine whether a mutation occurs in the resource usage information. If a mutation occurs, an abnormality occurs.
[0027] Optionally, in S230,
[0028] The image-specifying characteristic information under normal conditions is preset in the target log.
[0029] Optionally, the preset duration is set in advance according to a specific application scenario.
[0030] Optionally, the screen recording cache of the preset duration includes operation steps within the preset duration and resource occupancy records within the preset duration.
[0031] Optionally, the method further comprises:
[0032] According to the first instruction, the target object is manually captured, and when there is an abnormality with the target object, a second instruction is received by the user pressing the capture shortcut key, and according to the second instruction, the screen recording cache of the preset length when the abnormality occurs is obtained, and the screen recording cache of the preset length when the abnormality occurs is sent and saved to the local end.
[0033] In a second aspect, an embodiment of the present invention provides an industrial software anomaly detection and information extraction system, including:
[0034] An information acquisition module is used to receive a first instruction from a user requesting feedback on an abnormal situation of a target object, and according to the first instruction, perform UI control recognition, file detection, image recognition, and resource monitoring on the target object to obtain a target log; at the same time, continuously perform screen recording on the target object and continuously generate a screen recording cache of a preset duration;
[0035] The target log includes:
[0036] The GUI monitors target information, file index content of the target object, image-specified feature information of the target object, and resource usage information of the target object;
[0037] The judgment module is used to judge whether there is an exception in the target log according to the target log. If so, obtain the screen recording cache of the preset time length when the exception exists, and send and save the screen recording cache of the preset time length when the exception exists to the local end.
[0038] (III) Beneficial effects
[0039] The beneficial effect of the present invention is that the present invention is an industrial software anomaly detection and information extraction method and system, because when it is detected that an unexpected window appears in the GUI monitoring target information, a dump file appears in the file monitoring index content, the image specified feature information of the target object is inconsistent with the image specified feature information under normal circumstances, or a sudden change occurs in the resource usage information, a screen recording cache of a preset duration when an anomaly exists is obtained. Compared with the prior art, it can quickly restore the abnormal scene and improve the test efficiency. At the same time, it only records the screen recording cache of the preset duration when the abnormality occurs, and occupies very little storage space. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A flowchart of an industrial software anomaly detection and information extraction method according to Embodiment 1 of the present invention;
[0041] Figure 2 This is a flowchart of an industrial software anomaly detection and information extraction method in Example 1 of the present invention. DETAILED DESCRIPTION
[0042] Dump file: memory image of the process.
[0043] UI controls: Various visual elements on the user interface, such as buttons, text, labels, check boxes, sliders, progress bars, etc.
[0044] Image recognition: Computer technology analyzes and understands images, thereby achieving functions such as automatic identification, classification, positioning, and tracking.
[0045] In order to better explain the present invention and facilitate understanding, the present invention is described in detail below through specific implementation modes in conjunction with the accompanying drawings.
[0046] The embodiment of the present invention proposes an industrial software anomaly detection and information extraction method and system, when detecting that an unexpected window appears in the GUI monitoring target information, a dump file appears in the file monitoring index content, the image specified feature information of the target object is inconsistent with the image specified feature information under normal circumstances, or a sudden change occurs in the resource usage information, a screen recording cache of a preset duration when an anomaly exists is obtained. The present invention can quickly restore the abnormal scene, improve the test efficiency, and at the same time only record the screen recording cache of the preset duration when the abnormality occurs, occupying very little storage space.
[0047] In order to better understand the above technical solution, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a clearer and more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.
[0048] Specific embodiment description part
[0049] Example 1
[0050] See also Figure 1 , an industrial software anomaly detection and information extraction method according to an embodiment of the present invention comprises:
[0051] Step S100: receiving a first instruction from a user requesting feedback on whether an abnormality occurs in a target object, and performing UI control recognition, file detection, image recognition, and resource monitoring on the target object according to the first instruction to obtain a target log; and simultaneously performing continuous screen recording on the target object, and continuously generating a screen recording cache of a preset duration;
[0052] Target logs include:
[0053] The GUI monitors target information, file index content of the target object, image-specified feature information of the target object, and resource usage information of the target object;
[0054] Step S200: determine whether there is an exception in the target log according to the target log. If so, obtain the screen recording cache of the preset duration when the exception exists, and send and save the screen recording cache of the preset duration when the exception exists to the local end.
[0055] If there is no abnormality, the new screen recording cache is automatically appended to the screen recording cache of the preset length, and the old screen recording cache that exceeds the preset length is deleted.
[0056] This embodiment is implemented using Python.
[0057] In this embodiment, after the screen recording cache of the preset duration when an abnormality occurs is sent and saved to the local end, abnormality detection continues until the industrial software is closed.
[0058] In this embodiment, UI control recognition, file detection, image recognition, and resource monitoring are performed on the target object, and obtaining the target log includes:
[0059] Step S1 1 0, according to the target object, use uiautomation to initialize the UI control object interface of the target object and generate GUI monitoring target information;
[0060] In software testing and automation, UIAutomation is a technique for identifying and manipulating user interface elements.
[0061] In this embodiment, when uiautomation is used to initialize the UI control object interface of the target object, it is first necessary to make sure that the application where the target object is located has been started, and then use the traversal method provided by uiautomation to gradually access the UI controls of the target object, obtain the UI control information, and save the UI control information to generate GUI monitoring target information.
[0062] Step S120: According to the target object, Glob is used to initialize the file and file path of the target object to obtain the file monitoring index content.
[0063] In the specific implementation process, the functions provided by the Glob module are used to obtain the target object's file and file path, and the target object's file is initialized. During the initialization process, the relevant information of the file is collected, and a file monitoring index is created to track file changes or monitor the status of specific files in the file system. The file monitoring index includes information such as the file's path, size, and modification time.
[0064] Optionally, UI control recognition, file detection, image recognition, and resource monitoring are performed on the target object, and obtaining the target log also includes:
[0065] Step S130, according to the target object, obtaining an image of the target object, and using open-cv to obtain image-specified feature information of the target object;
[0066] Open-cv is an open source computer vision library that provides a wealth of image processing and computer vision algorithms for processing, analyzing, and understanding digital image and video data. In this embodiment, the feature extraction method provided by Open-cv is used to extract feature information of the image of the target object, such as the color, texture, shape, etc. of the target object image.
[0067] Step S140: According to the target object, use psutil to obtain the target object resource usage information.
[0068] In actual application, psutil is a cross-platform Python library used to obtain and manage system resources and perform process management.
[0069] In this embodiment, Figure 2 As shown, in step S200, judging whether the target log has an abnormality according to the target log includes:
[0070] Step S210, determining whether there is an unexpected window in the GUI monitoring target information, if so, an abnormality occurs;
[0071] Step S220: determine whether there is a dump file in the file monitoring index content, if so, there is an exception;
[0072] Step S230, determining whether the image-specified feature information of the target object is consistent with the image-specified feature information under normal circumstances, if not, an abnormality exists;
[0073] Normally, image-specified feature information is preset in the target log.
[0074] Step S240: determine whether there is a sudden change in the resource usage information. If there is a sudden change, there is an abnormality.
[0075] For example, when a UI control object with an abnormal assertion pops up, that is, an unexpected window appears in the GUI monitoring target information, an exception occurs at this time.
[0076] When a dump file appears in the file monitoring index content, that is, the file monitoring index content changes, it is an exception.
[0077] In the actual implementation process, the preset duration is set in advance according to the specific application scenario. When the preset duration is exceeded and there is no abnormality within the preset duration, the screen recording content is deleted to ensure that resource usage is always within a controllable range.
[0078] For example, when the preset duration is 10s, a dump file is found in the target log at 14s, that is, an exception occurs in the industrial software at 14s. At this time, the screen recording cache of 4 to 14s is retained, and the screen recording cache of 4 to 14s is sent and saved to the local end. After saving, the exception detection continues.
[0079] Optionally, the screen recording cache of a preset duration includes operation steps within the preset duration and resource usage records within the preset duration.
[0080] Optionally, the method further comprises:
[0081] According to the first instruction, the target object is manually captured. When an abnormality occurs in the target object, a second instruction is received by the user pressing the capture shortcut key. According to the second instruction, the screen recording cache of the preset length when the abnormality occurs is obtained, and the screen recording cache of the preset length when the abnormality occurs is sent and saved to the local end.
[0082] For example, when the tester believes that the current scene is an abnormal scene, he or she performs manual capture, that is, presses the preset capture shortcut key. At this time, the computer obtains the screen recording cache of the preset length when the abnormality occurs, and saves the screen recording cache to the local end to complete the abnormal scene information recording.
[0083] An industrial software anomaly detection and information extraction method in this embodiment detects and records abnormal scenario information based on UI control objects, dump file objects, target images with specified features, and abnormal scenarios of resource abnormal mutations, and provides a method for backtracking abnormal scenarios during industrial software testing, which solves the problem that abnormal scenarios are difficult to detect and locate in a timely manner, and greatly reduces the storage resources occupied. While improving efficiency, it also reduces the pressure on storage resources during testing.
[0084] Example 2
[0085] An industrial software anomaly detection and information extraction system according to an embodiment of the present invention includes:
[0086] The information acquisition module is used to receive a first instruction from a user requesting feedback on an abnormal situation of a target object, and according to the first instruction, perform UI control recognition, file detection, image recognition, and resource monitoring on the target object to obtain a target log; at the same time, continuously perform screen recording on the target object and continuously generate a screen recording cache of a preset duration;
[0087] Target logs include:
[0088] The GUI monitors target information, file index content of the target object, image-specified feature information of the target object, and resource usage information of the target object;
[0089] The judgment module is used to judge whether there is an exception in the target log according to the target log. If so, obtain the screen recording cache of the preset time length when the exception exists, and send and save the screen recording cache of the preset time length when the exception exists to the local end.
[0090] An industrial software anomaly detection and information extraction system in an embodiment of the present invention solves the problems of excessive storage resources occupied during testing and difficulty in locating valid information from recorded information. It can quickly restore the abnormal scene and improve test efficiency. At the same time, it only records the screen recording cache of the preset time when the abnormality occurs, occupying very little storage space.
[0091] In the description of the present invention, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0092] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium; it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0093] In the present invention, unless otherwise clearly specified and limited, when a first feature is “on” or “below” a second feature, it may be that the first and second features are in direct contact, or that the first and second features are in indirect contact through an intermediate medium. Moreover, when a first feature is “above”, “above” or “above” a second feature, it may be that the first feature is directly above or obliquely above the second feature, or it may simply mean that the first feature is higher in level than the second feature. When a first feature is “below”, “below” or “below” a second feature, it may be that the first feature is directly below or obliquely below the second feature, or it may simply mean that the first feature is lower in level than the second feature.
[0094] In the description of this specification, the description of the terms "one embodiment", "some embodiments", "embodiment", "example", "specific example" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0095] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may alter, modify, replace and modify the above embodiments within the scope of the present invention.
Claims
1. A method for detecting anomalies and extracting information from industrial software, characterized in that: include: S100, receiving a first instruction from a user requesting feedback on whether an abnormality occurs in a target object, performing UI control recognition, file detection, image recognition, and resource monitoring on the target object according to the first instruction, and obtaining a target log; At the same time, the screen of the target object is continuously recorded, and a screen recording buffer of a preset duration is continuously generated; The target log includes: The GUI monitors target information, file index content of the target object, image-specified feature information of the target object, and resource usage information of the target object; S200. Determine whether there is an exception in the target log according to the target log. If yes, obtain the screen recording cache of the preset duration when the exception exists, and send and save the screen recording cache of the preset duration when the exception exists to the local end.
2. The method for detecting and extracting anomalies in industrial software according to claim 1, characterized in that: The method further comprises: If there is no abnormality, the new screen recording cache is automatically appended to the screen recording cache of the preset length, and the old screen recording cache that exceeds the preset length is deleted.
3. The method for detecting and extracting anomalies in industrial software according to claim 1, characterized in that: The target object is subjected to UI control recognition, file detection, image recognition, and resource monitoring, and the target log is obtained, including: S11 0. According to the target object, initialize the UI control object interface of the target object by using uiautomation to generate GUI monitoring target information; S120: Initialize the files and file paths of the target object using Glob according to the target object, and obtain file monitoring index content.
4. The method for detecting and extracting anomalies in industrial software according to claim 1, characterized in that: The UI control recognition, file detection, image recognition and resource monitoring of the target object and obtaining the target log also include: S130, according to the target object, obtaining an image of the target object, and using open-cv to obtain image-specified feature information of the target object; S140. According to the target object, use psutil to obtain resource usage information of the target object.
5. The method for detecting anomalies and extracting information from industrial software according to claim 1, characterized in that: In S200, judging whether the target log has an abnormality according to the target log includes: S21 0. Determine whether there is an unexpected window in the GUI monitoring target information. If so, an abnormality occurs. S220, determining whether there is a dump file in the file monitoring index content, and if so, an exception occurs; S230, determining whether the image-specified feature information of the target object is consistent with the image-specified feature information under normal circumstances, and if not, an abnormality exists; S240: Determine whether a mutation occurs in the resource usage information. If a mutation occurs, an abnormality occurs.
6. The method for detecting anomalies and extracting information from industrial software according to claim 5, characterized in that: In the S230, The image-specifying characteristic information under normal conditions is preset in the target log.
7. The method for detecting anomalies and extracting information from industrial software according to claim 1, characterized in that: The preset duration is set in advance according to a specific application scenario.
8. The method for detecting anomalies and extracting information from industrial software according to claim 1, characterized in that: The screen recording cache of the preset duration includes the operation steps within the preset duration and the resource occupancy records within the preset duration.
9. The method for detecting anomalies and extracting information from industrial software according to claim 1, characterized in that: The method further comprises: According to the first instruction, the target object is manually captured, and when there is an abnormality with the target object, a second instruction is received by the user pressing the capture shortcut key, and according to the second instruction, the screen recording cache of the preset length when the abnormality occurs is obtained, and the screen recording cache of the preset length when the abnormality occurs is sent and saved to the local end.
10. An industrial software anomaly detection and information extraction system, characterized in that: include: An information acquisition module, configured to receive a first instruction from a user requesting feedback on an abnormal situation of a target object, and perform UI control recognition, file detection, image recognition, and resource monitoring on the target object according to the first instruction to obtain a target log; At the same time, the screen of the target object is continuously recorded, and a screen recording buffer of a preset duration is continuously generated; The target log includes: The GUI monitors target information, file index content of the target object, image-specified feature information of the target object, and resource usage information of the target object; The judgment module is used to judge whether there is an exception in the target log according to the target log. If so, obtain the screen recording cache of the preset time length when the exception exists, and send and save the screen recording cache of the preset time length when the exception exists to the local end.
