CN117033237A - Log test method and device, electronic equipment and storage medium - Google Patents

Log test method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN117033237A
CN117033237A CN202311093594.0A CN202311093594A CN117033237A CN 117033237 A CN117033237 A CN 117033237A CN 202311093594 A CN202311093594 A CN 202311093594A CN 117033237 A CN117033237 A CN 117033237A
Authority
CN
China
Prior art keywords
log
path
target
under
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311093594.0A
Other languages
Chinese (zh)
Inventor
黄赞群
蒋灿
喻昱
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hunan Happly Sunshine Interactive Entertainment Media Co Ltd
Original Assignee
Hunan Happly Sunshine Interactive Entertainment Media Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hunan Happly Sunshine Interactive Entertainment Media Co Ltd filed Critical Hunan Happly Sunshine Interactive Entertainment Media Co Ltd
Priority to CN202311093594.0A priority Critical patent/CN117033237A/en
Publication of CN117033237A publication Critical patent/CN117033237A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3065Monitoring arrangements determined by the means or processing involved in reporting the monitored data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/865Monitoring of software
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Computer Hardware Design (AREA)
  • Mathematical Physics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application discloses a log test method, a log test device, electronic equipment and a storage medium, wherein test cases are executed on a target application so that the target application can generate a log; obtaining a log path list corresponding to a target application; traversing the log path list, and reading the log file and attribute information thereof under any log path when traversing the log path; comparing the log file and the attribute information thereof under any one of the log paths with the target log file and the attribute information thereof corresponding to any one of the log paths so as to obtain a comparison result corresponding to any one of the log paths; and unloading the target application after the log path list is traversed, so as to check whether the log file corresponding to the target application is deleted or not. According to the method and the system, the problems of the log can be found in the test stage, so that the log related strategy of the target application is optimized in the test stage, and the target application abnormality caused by the log abnormality after the target application is online is avoided.

Description

Log test method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of testing technologies, and in particular, to a method and apparatus for testing logs, an electronic device, and a storage medium.
Background
Various application software is typically tested before being online, but is currently tested for the functionality of the application software, and not for the log of the application software.
Disclosure of Invention
The application aims to provide a log testing method and device, electronic equipment and storage medium, and the method and device comprise the following technical scheme:
a method of log testing, the method comprising:
executing a test case on a target application so that the target application generates a log;
obtaining a log path list corresponding to the target application;
traversing the log path list, and reading a log file and attribute information thereof under any log path when traversing the log path;
comparing the read log files and the attribute information thereof under any log path with the target log files and the attribute information thereof corresponding to any log path to obtain a comparison result corresponding to any log path;
and unloading the target application after the log path list is traversed, so as to check whether the log file corresponding to the target application is deleted or not.
In the above method, optionally, the attribute information of any log file includes: the authority of any log file, the user and the file size;
the comparing the read log file and the attribute information thereof under any log path with the target log file and the attribute information thereof corresponding to any log path comprises:
comparing the read log files under any log path with target log files corresponding to any log path to determine whether the target log files exist under any path and whether the log files which do not belong to the target log files exist under any path;
comparing the attribute information of the log file under any one log path with the attribute information of the target log file corresponding to the any log path to determine whether the authority of the log file under any path is consistent with the authority of the target log file, whether the user to which the log file under any path belongs is consistent with the user to which the target log file belongs, and whether the size of the log file under any path is smaller than or equal to the size of the target log file.
The method, optionally, further comprises:
and for any log file under any log path, when traversing to any log path, performing sensitive information retrieval on the content of any log file so as to judge whether the any log file contains sensitive information.
The method, optionally, includes executing the test case on the target application, including:
executing a first type of test case and a second type of test case on the target application; wherein,
the first test case is a test case under a normal operation scene corresponding to the target application;
the second test case is a test case under an abnormal operation scene corresponding to the target application.
The method, optionally, further comprises:
corresponding to any abnormal operation scene, and obtaining target log content corresponding to any abnormal operation scene;
when traversing to any log path, if the specified log file corresponding to the abnormal operation scene is contained in any log path, carrying out target log content retrieval on the content of the specified log file so as to judge whether the specified log file contains the target log content or not;
the target log content is log content which the target application should generate in the abnormal operation scene.
A log testing device, the device comprising:
the operation module is used for executing the test case on the target application so that the target application can generate a log;
the obtaining module is used for obtaining a log path list corresponding to the target application;
the reading module is used for traversing the log path list, and when any log path is traversed, the log file and the attribute information thereof under any log path are read;
the checking module is used for comparing the read log files and the attribute information thereof under any log path with the target log files and the attribute information thereof corresponding to any log path so as to obtain a comparison result corresponding to any log path;
the unloading module is used for unloading the target application after the log path list is traversed;
and the checking module is also used for checking whether the log file corresponding to the target application is deleted or not after the target application is unloaded.
The above device, optionally, the attribute information of any log file includes: the authority of any log file, the user and the file size;
the checking module compares the log file and the attribute information thereof under any one of the log paths with the target log file and the attribute information thereof corresponding to any one of the log paths, and is used for:
comparing the read log files under any log path with target log files corresponding to any log path to determine whether the target log files exist under any path and whether the log files which do not belong to the target log files exist under any path;
comparing the attribute information of the log file under any one log path with the attribute information of the target log file corresponding to the any log path to determine whether the authority of the log file under any path is consistent with the authority of the target log file, whether the user to which the log file under any path belongs is consistent with the user to which the target log file belongs, and whether the size of the log file under any path is smaller than or equal to the size of the target log file.
The above apparatus, optionally, the inspection module is further configured to:
and for any log file under any log path, when traversing to any log path, performing sensitive information retrieval on the content of any log file so as to judge whether the any log file contains sensitive information.
The above device, optionally, when the operation module executes the test case on the target application, is configured to:
executing a first type of test case and a second type of test case on the target application; wherein,
the first test case is a test case under a normal operation scene corresponding to the target application;
the second test case is a test case under an abnormal operation scene corresponding to the target application.
The above apparatus, optionally, the inspection module is further configured to:
corresponding to any abnormal operation scene, and obtaining target log content corresponding to any abnormal operation scene;
when traversing to any log path, if the specified log file corresponding to the abnormal operation scene is contained in any log path, carrying out target log content retrieval on the content of the specified log file so as to judge whether the specified log file contains the target log content or not;
the target log content is log content which the target application should generate in the abnormal operation scene.
An electronic device, comprising:
a memory for storing a program;
a processor for calling and executing the program in the memory, by executing the program, to implement the respective steps of the log test method as set forth in any one of the above.
A readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the log testing method as claimed in any one of the preceding claims.
According to the scheme, the log testing method, the log testing device, the electronic equipment and the storage medium can execute the test case on the target application so that the target application can generate the log; obtaining a log path list corresponding to a target application; traversing the log path list, and reading the log file and attribute information thereof under any log path when traversing the log path; comparing the log file and the attribute information thereof under any one of the log paths with the target log file and the attribute information thereof corresponding to any one of the log paths so as to obtain a comparison result corresponding to any one of the log paths; and unloading the target application after the log path list is traversed, so as to check whether the log file corresponding to the target application is deleted or not. The application provides a log testing method, which can find problems existing in a log in a testing stage, optimize a log related strategy of a target application in the testing stage and avoid target application abnormality caused by log abnormality after the target application is online.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed for the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of an implementation of a log testing method according to an embodiment of the present application;
FIG. 2 is an exemplary diagram of attribute information of a portion of log files under a certain log path according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a log testing device according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in other sequences than those illustrated herein.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without any inventive effort, are intended to be within the scope of the application.
In the research process, application software (hereinafter referred to as application for short) is found to print an application log in order to record the running condition of the application or be used for a technician to debug the application according to the log when running, but if log related information such as the size of a log file is not restrained in the log printing process, the situation that the log file is unlimited to be increased in the application running process can be caused, so that the log file occupies excessive storage resources in the application running process, the storage resources of equipment are insufficient, the log storage is unsafe to be multiplied organically by a hacker, and the problems such as application breakdown can occur.
In order to avoid an application abnormality caused by an application log abnormality, it is necessary to test the application log.
As shown in fig. 1, a flowchart for implementing a log testing method according to an embodiment of the present application may include:
step S101: the test cases are executed on the target application so that the target application generates a log.
As an example, the target application may be application software for a mobile terminal, or may be application software for a computer terminal.
The UI automation tool can simulate the operation of a user on the target application so as to automatically execute the test case on the target application. Taking the example that the target application is application software for a mobile terminal, the UI automation tool may include, but is not limited to: appium (for ios systems or android systems), calabash (for ios systems or android systems), robotium (for android systems), frank (for ios systems), uiacomoter (for android systems), and the like.
The device for installing the target application can be connected with the testing device, and the testing case is executed on the target application through a UI automation tool in the testing device. As an example, a device that installs a target application may be connected to a test device through a USB interface.
Step S102: and obtaining a log path list corresponding to the target application.
The log path list corresponding to the target application is preconfigured, and after all test cases are executed on the target application or the duration of the continuous test on the target application reaches the target duration, the log path list corresponding to the target application can be read. As an example, the log path list corresponding to the unique identification of the target application may be read using the unique identification of the target application and the correspondence of the application identification to the log path list.
An example of a log path list provided by an embodiment of the present application is as follows:
LogDict=[‘/dev/log/main’:‘drwxr-xr-x hzq 4096’,‘/data/local/log’:‘drwxr-
xr-x hzq 4096’]
in the above example log path list, two log paths are shown, respectively '/dev/log/main' and '/data/local/log'. Corresponding attribute information (file authority, affiliated user and file size) is respectively set corresponding to each log path, and the log path and the corresponding attribute information are in key: value is stored in the form of a value. Wherein, the 'drwxr-xr-x' represents the authority of the file, and can also represent the authority level on the basis, the 'hzq' represents the user to which the file belongs, and the '4096' represents the file size.
Step S103: traversing the log path list, and reading the log file and the attribute information thereof under any log path when traversing any log path.
As an example, attributes of a log file may include, but are not limited to: rights of the log file, the user to which the log file belongs, the size of the log file, and the like.
A prepackaged command may be invoked to read the log file and its attributes under either log path. Taking the device for installing the target application as an android device as an example, after obtaining the administrator authority (that is, root authority) of the android device system by using the "adb root" command in the pre-packaged adb command, the log file and the attribute thereof under the log path data can be read by using the "adb shell ls-al/data" command in the pre-packaged adb command, that is, when the test case is executed on the target application, the "data" is replaced with any log path in the log path list.
It should be noted that if the authority of the system administrator of the android device cannot be obtained, the system log file of the target application cannot be read, and only the log file created in the running process of the target application can be read. If the file acquisition fails due to the authority problem, only other log files with authority are read.
Fig. 2 is a diagram illustrating attribute information of a portion of log files under a certain log path according to an embodiment of the present application. Where "total usage 31568" represents the total file size of each log file under the certain log path. Each subsequent line corresponds to a log file, and the attribute information of each line includes other information, such as creation time, besides the authority, the user to which the attribute information belongs, and the size of the log file. In the example shown in fig. 2, for comparison, the user to which the target of each log file belongs (user to which the dotted box marks belongs) is shown together with the user to which each log file actually acquired belongs (user to which the right side of the dotted box belongs) for comparison.
Step S104: and comparing the read log file and the attribute information thereof under any log path with the target log file and the attribute information thereof corresponding to any log path to obtain a comparison result corresponding to any log path.
If the comparison result shows that the log files and the attribute information thereof under any log path are different from the target log files and the attribute information thereof corresponding to any log path, determining that the log files under any log path are abnormal.
In an alternative embodiment, the log file under any one of the log paths may be compared with the target log file corresponding to the any one of the log paths, so as to determine whether the target log file exists under any one of the paths and whether the log file not belonging to the target log file exists under any one of the paths. That is, by comparing, it is determined whether all the target log files corresponding to any one of the log paths are included in the any one of the log paths, and whether the other log files except the target log file corresponding to any one of the log paths are included in the any one of the log paths, and the comparison result is recorded. If the comparison result represents that all the target log files corresponding to the arbitrary log path are contained in the arbitrary log path, and no other log files except the target log files corresponding to the arbitrary log path are contained in the arbitrary log path, determining that the storage position of the log files in the arbitrary log path is normal, otherwise, determining that the storage position of the log files in the arbitrary log path is abnormal.
Comparing the attribute information of the log file under any one of the log paths with the attribute information of the target log file corresponding to the any one of the log paths to determine whether the authority of the log file under any one of the paths is consistent with the authority of the target log file, whether the user belonging to the log file under any one of the paths is consistent with the user belonging to the target log file, whether the size of the log file under any one of the paths is smaller than or equal to the size of the target log file, and recording the comparison result. If the comparison result shows that the authority of the log file under any path is consistent with the authority of the target log file, the user to which the log file under any path belongs is consistent with the user to which the target log file belongs, the size of the log file under any path is smaller than or equal to the size of the target log file, the attribute information of the log file under any path is determined to be correct, otherwise, the attribute information of the log file under any path is determined to be abnormal.
In an alternative embodiment, when traversing any log path, for any log file in any log path, the content of any log file may be further searched for sensitive information, so as to determine whether the any log file contains sensitive information. In order to ensure the safety of the target application, the log of the target application should not contain appointed sensitive information (specifically, the appointed sensitive information can be a sensitive word related to the safety of the target application), therefore, when traversing any log path, the application searches the sensitive information of the content of the log file under any path, and if the sensitive information is searched, the any log path, any log file and the sensitive information searched in any log file can be recorded.
As an example, the log file under the log path file may be copied to the test device using the "adb pull path1 path2" command among the prepackaged adb commands, and then sensitive information retrieval is performed on the log file in the test device. Where "path1" is a folder in the test device, and "path2" is a log file path in the device where the target application is located, that is, a file under the log file path2 is copied into the folder path1 of the test device.
Step S105: and unloading the target application after the log path list is traversed, so as to check whether the log file corresponding to the target application is deleted or not.
And if the target application is unloaded, determining that at least part of the log files corresponding to the target application still exist, and determining that the log files of the target application are abnormal.
Optionally, if all the comparison results corresponding to the log paths indicate that the log files are normal, and after the target application is unloaded, the log files corresponding to the target application are deleted, and the log of the target application is determined to be normal, otherwise, the log of the target application is determined to be abnormal.
According to the log test method provided by the embodiment of the application, the test case is executed on the target application so that the target application can generate a log; obtaining a log path list corresponding to a target application; traversing the log path list, and reading the log file and attribute information thereof under any log path when traversing the log path; comparing the log file and the attribute information thereof under any one of the log paths with the target log file and the attribute information thereof corresponding to any one of the log paths so as to obtain a comparison result corresponding to any one of the log paths; and unloading the target application after the log path list is traversed, so as to check whether the log file corresponding to the target application is deleted or not. The application provides a log testing method, which can find problems existing in a log in a testing stage, optimize a log related strategy of a target application in the testing stage and avoid target application abnormality caused by log abnormality after the target application is online.
In an alternative embodiment, an implementation manner of executing the test case on the target application may be:
executing a first type of test case and a second type of test case on the target application; wherein,
the first test case is a test case under a normal operation scene corresponding to the target application.
The second type of test cases are test cases under an abnormal operation scene corresponding to the target application. Each second type of test case corresponds to one abnormal operation scene, and different second types of test cases correspond to the same or different abnormal operation scenes. As an example, an abnormal operation scenario may include, but is not limited to, the following: off-line, call interface anomalies (e.g., network interface return 404 error, network interface return timeout, network interface return incomplete, etc.), etc.
As an example, in the case where the device where the target application is located is accessing to the network through wifi, the network disconnection may be simulated by closing wifi. For example, wifi may be turned off by the encapsulated adb command (adb shell svc wifi disable), and after the off-grid simulation is completed, wifi needs to be turned on, and at this time, wifi may be turned on by the encapsulated adb command (adb shell svc wifi enable).
As an example, a proxy service encapsulation packet capture tool mitxproxy (open source http network request proxy api) may be used to simulate different interface returns.
As an example, the first type of test case may be executed first, and after the first type of test case is executed, the second type of test case may be executed.
As an example, a portion of the first type of test cases may be executed first, then the second type of test cases may be executed, and after the execution of the second type of test cases is completed, the first type of test cases that are not executed may be executed.
As an example, the second type of test case may be executed first, and after the second type of test case is executed, the first type of test case may be executed.
As an example, a portion of the second type of test cases may be executed first, then after the first type of test cases are executed, the second type of test cases that are not executed are executed after the first type of test cases are tested.
That is, the present application performs a test in an abnormal operation scenario on the target application in addition to a test in a normal operation scenario on the target application.
Based on this, the log testing method provided by the embodiment of the application may further include:
and corresponding to any abnormal operation scene, and obtaining target log content corresponding to any abnormal operation scene. The target log content is the log content which is generated by the target application in any abnormal operation scene and is used for representing the operation error of the target application.
The target log content corresponding to any abnormal operation scene can be obtained according to the corresponding relation between the pre-configured abnormal operation scene and the target log content.
When any log path is traversed, if any log path contains a specified log file corresponding to any abnormal operation scene, target log content retrieval is carried out on the content of the specified log file so as to judge whether the specified log file contains target log content or not.
If the target log content is retrieved from the specified log files contained in any log path, the log files in any abnormal operation scene are indicated to be normal; otherwise, the log file under any abnormal operation scene is abnormal.
Corresponding to the method embodiment, the present application further provides a log testing device, and a schematic structural diagram of the log testing device provided by the embodiment of the present application is shown in fig. 3, which may include:
an operation module 301, an acquisition module 302, a reading module 303, an inspection module 304 and an unloading module 305; wherein,
the operation module 301 is configured to execute a test case on a target application, so that the target application generates a log;
the obtaining module 302 is configured to obtain a log path list corresponding to the target application;
the reading module 303 is configured to traverse the log path list, and when any log path is traversed, read a log file and attribute information thereof under any log path;
the checking module 304 is configured to compare the log file and the attribute information thereof under the read any log path with the target log file and the attribute information thereof corresponding to the any log path, so as to obtain a comparison result corresponding to the any log path;
the uninstalling module 305 is configured to uninstall the target application after the log path list is traversed;
the checking module 304 is further configured to check whether the log file corresponding to the target application is deleted after the target application is uninstalled.
The log testing device provided by the embodiment of the application executes the test case on the target application so that the target application can generate a log; obtaining a log path list corresponding to a target application; traversing the log path list, and reading the log file and attribute information thereof under any log path when traversing the log path; comparing the log file and the attribute information thereof under any one of the log paths with the target log file and the attribute information thereof corresponding to any one of the log paths so as to obtain a comparison result corresponding to any one of the log paths; and unloading the target application after the log path list is traversed, so as to check whether the log file corresponding to the target application is deleted or not. Based on the method and the system, the problems of the log can be found in the test stage, so that the log related strategy of the target application is optimized in the test stage, and the target application abnormality caused by the log abnormality after the target application is online is avoided.
In an optional embodiment, the attribute information of any log file includes: the authority of any log file, the user and the file size;
the checking module 304 is configured to, when comparing the log file and the attribute information thereof under the read log path with the target log file and the attribute information thereof corresponding to the read log path, compare:
comparing the read log files under any log path with target log files corresponding to any log path to determine whether the target log files exist under any path and whether the log files which do not belong to the target log files exist under any path;
comparing the attribute information of the log file under any one log path with the attribute information of the target log file corresponding to the any log path to determine whether the authority of the log file under any path is consistent with the authority of the target log file, whether the user to which the log file under any path belongs is consistent with the user to which the target log file belongs, and whether the size of the log file under any path is smaller than or equal to the size of the target log file.
In an alternative embodiment, the inspection module 304 is further configured to:
and for any log file under any log path, when traversing to any log path, performing sensitive information retrieval on the content of any log file so as to judge whether the any log file contains sensitive information.
In an alternative embodiment, when the operation module 301 executes the test case on the target application, the operation module is configured to:
executing a first type of test case and a second type of test case on the target application; wherein,
the first test case is a test case under a normal operation scene corresponding to the target application;
the second test case is a test case under an abnormal operation scene corresponding to the target application.
In an alternative embodiment, the inspection module 304 is further configured to:
obtaining target log content corresponding to the abnormal operation scene;
for any log file under any log path, when traversing to the any log path, searching target log content of the content of any log file to judge whether the target log content is contained in any log file;
the target log content is log content which the target application should generate in the abnormal operation scene.
Corresponding to the method embodiment, the application further provides an electronic device, and a schematic structural diagram of the electronic device is shown in fig. 4, which may include: at least one processor 1, at least one communication interface 2, at least one memory 3 and at least one communication bus 4.
In the embodiment of the present application, the number of the processor 1, the communication interface 2, the memory 3 and the communication bus 4 is at least one, and the processor 1, the communication interface 2 and the memory 3 complete communication with each other through the communication bus 4.
The processor 1 may be a central processing unit CPU, or a specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement embodiments of the present application, etc.
The memory 3 may comprise a high-speed RAM memory, and may also comprise a non-volatile memory (non-volatile memory) or the like, such as at least one disk memory.
Wherein the memory 3 stores a program, the processor 1 may call the program stored in the memory 3, the program being for:
executing a test case on a target application so that the target application generates a log;
obtaining a log path list corresponding to the target application;
traversing the log path list, and reading a log file and attribute information thereof under any log path when traversing the log path;
comparing the read log files and the attribute information thereof under any log path with the target log files and the attribute information thereof corresponding to any log path to obtain a comparison result corresponding to any log path;
and unloading the target application after the log path list is traversed, so as to check whether the log file corresponding to the target application is deleted or not.
Alternatively, the refinement function and the extension function of the program may be described with reference to the above.
The embodiment of the present application also provides a storage medium storing a program adapted to be executed by a processor, the program being configured to:
executing a test case on a target application so that the target application generates a log;
obtaining a log path list corresponding to a target application;
traversing the log path list, and reading a log file and attribute information thereof under any log path when traversing the log path;
comparing the read log files and the attribute information thereof under any log path with the target log files and the attribute information thereof corresponding to any log path to obtain a comparison result corresponding to any log path;
and unloading the target application after the log path list is traversed, so as to check whether the log file corresponding to the target application is deleted or not.
Alternatively, the refinement function and the extension function of the program may be described with reference to the above.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the several embodiments provided by the present application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
It should be understood that in the embodiments of the present application, the claims, the various embodiments, and the features may be combined with each other, so as to solve the foregoing technical problems.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method of log testing, the method comprising:
executing a test case on a target application so that the target application generates a log;
obtaining a log path list corresponding to the target application;
traversing the log path list, and reading a log file and attribute information thereof under any log path when traversing the log path;
comparing the read log files and the attribute information thereof under any log path with the target log files and the attribute information thereof corresponding to any log path to obtain a comparison result corresponding to any log path;
and unloading the target application after the log path list is traversed, so as to check whether the log file corresponding to the target application is deleted or not.
2. The method according to claim 1, wherein the attribute information of any one of the log files includes: the authority of any log file, the user and the file size;
the comparing the read log file and the attribute information thereof under any log path with the target log file and the attribute information thereof corresponding to any log path comprises:
comparing the read log files under any log path with target log files corresponding to any log path to determine whether the target log files exist under any path and whether the log files which do not belong to the target log files exist under any path;
comparing the attribute information of the log file under any one log path with the attribute information of the target log file corresponding to the any log path to determine whether the authority of the log file under any path is consistent with the authority of the target log file, whether the user to which the log file under any path belongs is consistent with the user to which the target log file belongs, and whether the size of the log file under any path is smaller than or equal to the size of the target log file.
3. The method as recited in claim 1, further comprising:
and for any log file under any log path, when traversing to any log path, performing sensitive information retrieval on the content of any log file so as to judge whether the any log file contains sensitive information.
4. The method of claim 1, wherein the executing test cases on the target application comprises:
executing a first type of test case and a second type of test case on the target application; wherein,
the first test case is a test case under a normal operation scene corresponding to the target application;
the second test case is a test case under an abnormal operation scene corresponding to the target application.
5. The method as recited in claim 4, further comprising:
corresponding to any abnormal operation scene, and obtaining target log content corresponding to any abnormal operation scene;
when traversing to any log path, if the specified log file corresponding to the abnormal operation scene is contained in any log path, carrying out target log content retrieval on the content of the specified log file so as to judge whether the specified log file contains the target log content or not;
the target log content is log content which the target application should generate in the abnormal operation scene.
6. A log testing device, the device comprising:
the operation module is used for executing the test case on the target application so that the target application can generate a log;
the obtaining module is used for obtaining a log path list corresponding to the target application;
the reading module is used for traversing the log path list, and when any log path is traversed, the log file and the attribute information thereof under any log path are read;
the checking module is used for comparing the read log files and the attribute information thereof under any log path with the target log files and the attribute information thereof corresponding to any log path so as to obtain a comparison result corresponding to any log path;
the unloading module is used for unloading the target application after the log path list is traversed;
and the checking module is also used for checking whether the log file corresponding to the target application is deleted or not after the target application is unloaded.
7. The apparatus of claim 6, wherein the attribute information of any one of the log files includes: the authority of any log file, the user and the file size;
the checking module compares the log file and the attribute information thereof under any one of the log paths with the target log file and the attribute information thereof corresponding to any one of the log paths, and is used for:
comparing the read log files under any log path with target log files corresponding to any log path to determine whether the target log files exist under any path and whether the log files which do not belong to the target log files exist under any path;
comparing the attribute information of the log file under any one log path with the attribute information of the target log file corresponding to the any log path to determine whether the authority of the log file under any path is consistent with the authority of the target log file, whether the user to which the log file under any path belongs is consistent with the user to which the target log file belongs, and whether the size of the log file under any path is smaller than or equal to the size of the target log file.
8. The apparatus of claim 6, wherein the inspection module is further to:
and for any log file under any log path, when traversing to any log path, performing sensitive information retrieval on the content of any log file so as to judge whether the any log file contains sensitive information.
9. The apparatus of claim 6, wherein the operation module, when executing the test case on the target application, is to:
executing a first type of test case and a second type of test case on the target application; wherein,
the first test case is a test case under a normal operation scene corresponding to the target application;
the second test case is a test case under an abnormal operation scene corresponding to the target application.
10. The apparatus of claim 6, wherein the inspection module is further to:
corresponding to any abnormal operation scene, and obtaining target log content corresponding to any abnormal operation scene;
when traversing to any log path, if the specified log file corresponding to the abnormal operation scene is contained in any log path, carrying out target log content retrieval on the content of the specified log file so as to judge whether the specified log file contains the target log content or not;
the target log content is log content which the target application should generate in the abnormal operation scene.
CN202311093594.0A 2023-08-28 2023-08-28 Log test method and device, electronic equipment and storage medium Pending CN117033237A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311093594.0A CN117033237A (en) 2023-08-28 2023-08-28 Log test method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311093594.0A CN117033237A (en) 2023-08-28 2023-08-28 Log test method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117033237A true CN117033237A (en) 2023-11-10

Family

ID=88637258

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311093594.0A Pending CN117033237A (en) 2023-08-28 2023-08-28 Log test method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117033237A (en)

Similar Documents

Publication Publication Date Title
CN108829593B (en) Code coverage rate calculation and analysis method, device, equipment and storage medium
CN112256558B (en) Test case generation method and device, computer equipment and storage medium
RU2571726C2 (en) System and method of checking expediency of installing updates
CN110992992B (en) Hard disk test method, device and storage medium
CN111611021B (en) Log data transmission method, device, computer equipment and storage medium
CN104360920A (en) Automatic testing method and device for interface
CN110287696B (en) Detection method, device and equipment for rebound shell process
CN115080398A (en) Automatic interface test system and method
WO2017017691A1 (en) Testing computing devices
CN104036193B (en) Local cross-domain vulnerability detection method and device for application program
CN116166525A (en) Method and device for generating test script
CN112269697B (en) Equipment storage performance testing method, system and related device
CN113868041B (en) Method and device for processing stability test data of server and storage medium
CN117033237A (en) Log test method and device, electronic equipment and storage medium
CN106709338A (en) Program detection method and device
CN106330595A (en) Heartbeat detection method and apparatus of distributed platform
CN114780412A (en) Page testing method, system, device and medium
EP3912040A1 (en) Input/output control code filter
US20240095153A1 (en) Test code generator, test code generation method, and, test code generaration program
CN116414722B (en) Fuzzy test processing method and device, fuzzy test system and storage medium
CN114020350B (en) Android system-based terminal off-load equipment detection method, system and medium
CN112800005B (en) Deep inspection method, system, terminal and storage medium for file system
CN109901799B (en) Log reading and writing method and device
CN118069503A (en) Method and system for testing driving file, storage medium and electronic equipment
CN115687129A (en) Coverage rate report generation method and device, storage medium and computer equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination