CN107871015B - Log data processing method and device, terminal and readable storage medium - Google Patents

Log data processing method and device, terminal and readable storage medium Download PDF

Info

Publication number
CN107871015B
CN107871015B CN201711187864.9A CN201711187864A CN107871015B CN 107871015 B CN107871015 B CN 107871015B CN 201711187864 A CN201711187864 A CN 201711187864A CN 107871015 B CN107871015 B CN 107871015B
Authority
CN
China
Prior art keywords
test case
log data
execution
preset position
executed
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.)
Active
Application number
CN201711187864.9A
Other languages
Chinese (zh)
Other versions
CN107871015A (en
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.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp 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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201711187864.9A priority Critical patent/CN107871015B/en
Publication of CN107871015A publication Critical patent/CN107871015A/en
Application granted granted Critical
Publication of CN107871015B publication Critical patent/CN107871015B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • 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
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/1737Details of further file system functions for reducing power consumption or coping with limited storage space, e.g. in mobile devices

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Human Computer Interaction (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention discloses a log data processing method and device, a terminal and a readable storage medium method, wherein the log data processing method comprises the following steps: when the execution of a test case of an application program is monitored, the log data generated in the execution process of the test case is cached to a first preset position, after the completion of the execution of the test case is detected, whether the test case is successfully executed or not is determined, if the test case is successfully executed, the cached log data of the test case at the first preset position is deleted, if the test case is not successfully executed, the cached log data of the test case at the first preset position is read, and the log data of the test case is stored to a second preset position, so that only the log data of the unsuccessfully executed test case can be stored, the log data of the successfully executed test case does not need to be stored, the quantity of the stored log data can be effectively reduced, and the occupation of a storage space is greatly reduced.

Description

Log data processing method and device, terminal and readable storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a log data processing method and apparatus, a terminal, and a readable storage medium.
Background
With the wide popularization of intelligent terminals such as smart phones and tablet computers, more and more application programs can be installed on the intelligent terminals, various problems may occur to the application programs when users use the intelligent terminals, and related tests are required to determine the problems that may occur to the application programs.
At present, in the process of testing, all log data generated in the testing process are stored, and the technical problem of occupying a large amount of storage space exists.
Disclosure of Invention
The embodiments of the present invention mainly aim to provide a log data processing method and apparatus, a terminal, and a readable storage medium, which can solve the technical problem that a large amount of log data needs to be stored and a large amount of storage space is occupied in the test process in the prior art.
In order to achieve the above object, a first aspect of the embodiments of the present invention provides a log data processing method, including:
when the execution of a test case of an application program is monitored, caching log data generated in the execution process of the test case to a first preset position;
after the test case is monitored to be executed completely, determining whether the test case is executed successfully;
if the test case is successfully executed, deleting the log data of the test case cached at the first preset position;
if the test case is not successfully executed, the log data of the test case cached at the first preset position is read, and the log data of the test case is stored to a second preset position.
In order to achieve the above object, a second aspect of an embodiment of the present invention provides a log data processing apparatus, including:
the device comprises a cache module, a first storage module and a second storage module, wherein the cache module is used for caching log data generated in the test case execution process to a first preset position when the test case execution of an application program is monitored;
the determining module is used for determining whether the test case is successfully executed or not after the test case execution is monitored to be completed;
the deleting module is used for deleting the cached log data of the test case at the first preset position if the test case is successfully executed by the user;
and the reading and storing module is used for reading the cached log data of the test case at the first preset position and storing the log data of the test case to a second preset position if the test case is not successfully executed.
In order to achieve the above object, a third aspect of the present invention provides a terminal, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the steps of the log data processing method according to the first aspect when executing the computer program.
To achieve the above object, a fourth aspect of the present invention provides a readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the steps in the log data processing method according to the first aspect.
The embodiment of the invention provides a log data processing method, which comprises the following steps: when the execution of a test case of an application program is monitored, the log data generated in the execution process of the test case is cached to a first preset position, after the completion of the execution of the test case is detected, whether the test case is successfully executed or not is determined, if the test case is successfully executed, the cached log data of the test case at the first preset position is deleted, if the test case is not successfully executed, the cached log data of the test case at the first preset position is read, and the log data of the test case is stored to a second preset position. Compared with the prior art, the method has the advantages that the log data of the test case do not need to be analyzed if the test case is successfully executed, and the log data of the test case need to be analyzed to determine the problems occurring in the execution process if the test case is not successfully executed, so that whether the log data generated in the test case execution process needs to be stored or not is determined by judging whether the test case is successfully executed or not, only the log data of the test case which is not successfully executed can be stored, the log data of the test case which is successfully executed does not need to be stored, the number of the stored log data can be effectively reduced, and the occupation of storage space is greatly reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a block diagram of a mobile terminal;
FIG. 2 is a flowchart illustrating a log data processing method according to an embodiment of the present invention;
FIG. 3 is a schematic flow chart illustrating a log data processing method according to an embodiment of the present invention;
FIG. 4 is a schematic flow chart illustrating a log data processing method according to an embodiment of the present invention;
FIG. 5 is a block diagram of program modules of the log data processing apparatus according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of another structure of program modules of the log data processing apparatus according to the embodiment of the present invention;
FIG. 7 is a schematic diagram of another structure of program modules of the log data processing apparatus according to the embodiment of the present invention.
Detailed Description
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 shows a block diagram of a mobile terminal. The log data processing method provided by the embodiment of the present invention may be applied to the mobile terminal 10 shown in fig. 1, where the mobile terminal 10 may include, but is not limited to: the system is a smart phone, a notebook, a tablet computer, a wearable smart device and the like which need to maintain normal operation by depending on a battery and support network and downloading functions.
As shown in fig. 1, the mobile terminal 10 includes a memory 101, a memory controller 102, one or more processors 103 (only one shown), a peripheral interface 104, a radio frequency module 105, a key module 106, an audio module 107, and a touch screen 108. These components communicate with each other via one or more communication buses/signal lines 109.
It is to be understood that the structure shown in fig. 1 is only an illustration and does not limit the structure of the mobile terminal. The mobile terminal 10 may also include more or fewer components than shown in FIG. 1, or may have a different configuration than shown in FIG. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
The memory 101 may be used to store software programs and modules, such as program instructions/modules corresponding to the log data processing method and the mobile terminal in the embodiment of the present invention, and the processor 103 executes various functional applications and data processing by running the software programs and modules stored in the memory 101, that is, implements the log data processing method.
Memory 101 may include high speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 101 may further include memory located remotely from the processor 103, which may be connected to the mobile terminal 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. Access to the memory 101 by the processor 103 and possibly other components may be under the control of the memory controller 102.
The peripheral interface 104 couples various input/output devices to the CPU and to the memory 101. The processor 103 executes various software, instructions within the memory 101 to perform various functions of the mobile terminal 10 and to perform data processing.
In some embodiments, the peripheral interface 104, the processor 103, and the memory controller 102 may be implemented in a single chip. In other examples, they may be implemented separately from the individual chips.
The rf module 105 is used for receiving and transmitting electromagnetic waves, and implementing interconversion between the electromagnetic waves and electrical signals, so as to communicate with a communication network or other devices. The rf module 105 may include various existing circuit elements for performing these functions, such as an antenna, an rf transceiver, a digital signal processor, an encryption/decryption chip, a Subscriber Identity Module (SIM) card, memory, and so forth. The rf module 105 may communicate with various networks such as the internet, an intranet, a preset type of wireless network, or other devices through a preset type of wireless network. The preset types of wireless networks described above may include cellular telephone networks, wireless local area networks, or metropolitan area networks. The Wireless network of the above-mentioned preset type may use various communication standards, protocols and technologies, including but not limited to Global System for mobile communication (GSM), Enhanced Data GSM Environment (EDGE), Wideband Code Division Multiple Access (W-CDMA), Code Division Multiple Access (CDMA), Time Division Multiple Access (TDMA), bluetooth, Wireless Fidelity (WiFi) (e.g., IEEE802.11a, IEEE802.11 b, IEEE802.11g and/or IEEE802.11 n), Voice over internet protocol (VoIP), Global internet Access (wimax), other protocols for email, instant messaging, and short messaging, and any other suitable messaging protocol.
The key module 106 provides an interface for user input to the mobile terminal, and the user may cause the mobile terminal 10 to perform different functions by pressing different keys.
Audio module 107 provides an audio interface to a user that may include one or more microphones, one or more speakers, and audio circuitry. The audio circuitry receives audio data from the peripheral interface 104, converts the audio data to electrical information, and transmits the electrical information to the speaker. The speaker converts the electrical information into sound waves that the human ear can hear. The audio circuitry also receives electrical information from the microphone, converts the electrical information to voice data, and transmits the voice data to the peripheral interface 104 for further processing. The audio data may be retrieved from the memory 101 or through the radio frequency module 105. In addition, the audio data may also be stored in the memory 101 or transmitted through the radio frequency module 105. In some examples, audio module 107 may also include a headphone jack for providing an audio interface to headphones or other devices.
The touch screen 108 provides both an output and an input interface between the mobile terminal and the user. In particular, the touch screen 108 displays video output to the user, the content of which may include text, graphics, video, and any combination thereof. Some of the output results are for some of the user interface objects. The touch screen 108 also receives user inputs, such as user clicks, swipes, and other gesture operations, for the user interface objects to respond to these user inputs. The technique of detecting user input may be based on resistive, capacitive, or any other possible touch detection technique. Specific examples of touch screen 108 display units include, but are not limited to, liquid crystal displays or light emitting polymer displays.
The log data processing method in the embodiment of the present invention is described based on the mobile terminal.
In the prior art, a large amount of log data needs to be stored in the testing process of the application program, so that the technical problem of occupying a large amount of storage space exists.
In order to solve the above problems, the present invention provides a log data processing method, in which, considering that if a test case is successfully executed, the log data of the test case does not need to be analyzed, in which case the log data of the stored test case would cause a waste of storage space, and if the test case is not successfully executed, the log data of the test case needs to be analyzed to determine a problem occurring in the execution process, therefore, by determining whether the test case is successfully executed or not, whether the log data generated in the test case execution process is to be saved or not is determined, so that only the log data of the unsuccessfully executed test case can be stored without storing the log data of the successfully executed test case, the number of the stored log data can be effectively reduced, and the occupation of the storage space is greatly reduced.
Referring to fig. 2, a schematic flow chart of a log data processing method according to an embodiment of the present invention is shown, where the method includes:
step 201, when the execution of a test case of an application program is monitored, caching log data generated in the execution process of the test case to a first preset position;
in the embodiment of the present invention, if the application program needs to be tested, a test case needs to be set based on the functions that can be implemented by the application program, where the test case is a set of test inputs, execution conditions, and expected results that are compiled for a preset target, so as to test a certain program path of the application program or verify whether a specific requirement is met. For example, if the application includes an account registration function and a login function, test cases need to be set for the account registration function and the login function, respectively. If the output in the test case executing process is consistent with the expected result, the test case is successfully executed, and if the output in the test case executing process is inconsistent with the expected result, the test case is unsuccessfully executed.
The application program usually includes a plurality of test cases, and the plurality of test cases may be sequentially executed according to a preset sequence, or after a selection operation of a tester is detected, the test case selected by the tester is executed.
In the embodiment of the present invention, the log data processing method may be specifically implemented by a log data processing device (hereinafter, referred to as a processing device), where the processing device may specifically be a program module, stored in a readable storage medium, and called and executed by a processor, and the processing device is used to process log data of a test case.
When it is monitored that a certain test case of the application program starts to execute, the log data generated in the execution process of the test case is cached to a first preset position. The first preset position is only used for caching log data.
Step 202, after the test case is monitored to be executed completely, determining whether the test case is executed successfully; executing step 203 or step 204;
step 203, if the test case is successfully executed, deleting the cached log data of the test case at the first preset position;
step 204, if the test case is not successfully executed, reading the log data of the test case cached at the first preset position, and storing the log data of the test case to a second preset position.
In the embodiment of the invention, after the test case is monitored to be executed, whether the test case is executed successfully is determined, if the test case is executed successfully, the function of the application program tested by the test case is normal, and the log data of the test case is not required to be analyzed. If the test case is not successfully executed, the log data of the test case is needed to analyze the reason of the unsuccessful execution, so that the processing device reads the log data of the test case cached at the first preset position and stores the log data of the test case to the second preset position.
In the embodiment of the invention, when the execution of the test case of the application program is monitored, the log data generated in the execution process of the test case is cached to a first preset position, after the completion of the execution of the test case is detected, whether the test case is successfully executed or not is determined, if the test case is successfully executed, the cached log data of the test case at the first preset position is deleted, if the test case is not successfully executed, the cached log data of the test case at the first preset position is read, and the log data of the test case is stored to a second preset position. Compared with the prior art, whether the log data generated in the test case executing process needs to be stored is determined by judging whether the test case is successfully executed or not, so that only the log data of the test case which is not successfully executed can be stored, the log data of the test case which is successfully executed does not need to be stored, the number of the stored log data can be effectively reduced, and the occupation of the storage space is greatly reduced.
In the embodiment of the present invention, the log data generation function needs to be started to generate log data when the test case is executed, wherein one way is that, for a plurality of test cases which need to be executed in sequence, the log data generation function is started when the first test case is executed, and the log data generation function is closed after the last test case is executed. The other mode is that when a test case starts to be executed, the log data generation function is started, after the test case is executed, the log data generation function is closed, when the next test case starts to be executed, the log data generation function is started, after the next test case is executed, the log data generation function is closed, and the like, so that the log data generation function is started before each test case is executed, and the log data generation function is closed after the next test case is executed. The following will be described in detail based on the latter case.
Referring to fig. 3, a flow chart of a log data processing method according to an embodiment of the present invention is shown, where the method includes:
step 301, when it is monitored that the test case of the application program starts to execute, starting a log data generation function, and caching the log data generated in the test case execution process to the first preset position;
in the embodiment of the invention, when the application program is tested, if the processing device monitors that a certain test case of the application program starts to be executed, a log data generation function is started, and the log data generated in the test case execution process is cached to a first preset position.
Step 302, after the completion of the execution of the test case is monitored, closing the log data generation function;
step 303, obtaining an execution result fed back by the application program after the test case is executed; executing step 304, or executing step 305;
in the embodiment of the invention, after the completion of the execution of the test case is detected, the log data generation function is closed.
After the log data generation function is closed, the processing device acquires an execution result fed back by the application program after the test case is executed. It can be understood that, during the execution of the test case of the application program, the processing device may monitor the execution process, on one hand, obtain and cache the generated log data, and on the other hand, obtain the execution result of the test case after the execution of the test case is completed.
Step 304, if the execution result contains an execution success identifier, confirming that the test case is successfully executed; continuing to execute step 306;
step 305, if the execution result contains an execution failure identifier, confirming that the test case is not successfully executed, and continuing to execute step 307;
step 306, if the test case is successfully executed, deleting the log data of the test case cached at the first preset position;
and 307, if the test case is not successfully executed, reading the log data of the test case cached at the first preset position, and storing the log data of the test case to a second preset position.
In the embodiment of the present invention, if the execution result includes the execution success identifier, it indicates that the test case is successfully executed, and the processing device deletes the log data of the test case that has been cached at the first preset location, so as to prevent the log data from occupying the storage space.
If the execution result includes the execution failure identifier, it indicates that the test case is not successfully executed, and the processing device reads the log data of the test case cached at the first preset position and stores the log data of the test case to a second preset position.
The step of storing the log data of the test case to a second preset position may specifically be: and generating a log file of the test case by using the read log data, and storing the log file under a directory of the test case or a preset file storage path of the test case so as to associate the test case with the log file of the test case.
In the embodiment of the invention, whether the test case is successfully executed is determined based on the execution result of the test case, so that whether the log file of each test case needs to be stored can be definitely determined, only the log data of the unsuccessfully executed test case is saved, but the log data of the successfully executed test case is not saved, the size of the stored log data is effectively reduced, and the storage space needed by storage is saved.
It can be understood that, in the embodiment of the present invention, if the test case is not successfully executed, the execution result of the test case includes, in addition to the execution failure flag, an exception time range, where the exception time range refers to a time range in which an output result of the test case does not match an expected result in the execution process. Referring to fig. 4, a flow chart of the step of refining step 307 in the embodiment of the present invention is shown, which includes:
step 401, if the test case is not successfully executed, reading log data in the abnormal time range from the log data of the test case cached at the first preset position, and storing the read log data to the second preset position;
and 402, deleting the residual log data of the test case at the first preset position.
In the embodiment of the present invention, in order to further reduce the storage space required for storing the log data, the extraction of the abnormal log data may be performed based on the abnormal time range included in the execution result.
If the test case is not successfully executed, the log data in the abnormal time range is read from the log data of the test case cached in the first preset position, the read log data is stored to the second preset position, and in addition, the residual log data of the test case in the first preset position is deleted. For example, if the abnormal time range is a to B, determining that the log data with the time mark a and the log data with the time mark B are in the cached log data, reading the log data between the log data with the time mark a and the log data with the time mark B, and storing the log data to a second preset position.
In the embodiment of the invention, the corresponding data is read from the log data of the unsuccessfully executed test case based on the abnormal time range and stored, so that only the log data of the time period in which the problem really occurs needs to be stored, the log data of the whole test case does not need to be stored, and the storage space needed for storing the log data can be further reduced.
Referring to fig. 5, which is a schematic structural diagram of program modules of a log data processing apparatus according to an embodiment of the present invention, the apparatus includes:
the caching module 501 is configured to cache log data generated in a test case execution process to a first preset position when the test case execution of an application program is monitored;
in the embodiment of the present invention, if the application program needs to be tested, a test case needs to be set based on the functions that can be implemented by the application program, where the test case is a set of test inputs, execution conditions, and expected results that are compiled for a preset target, so as to test a certain program path of the application program or verify whether a specific requirement is met. For example, if the application includes an account registration function and a login function, test cases need to be set for the account registration function and the login function, respectively. If the output in the test case executing process is consistent with the expected result, the test case is successfully executed, and if the output in the test case executing process is inconsistent with the expected result, the test case is unsuccessfully executed.
The application program usually includes a plurality of test cases, and the plurality of test cases may be sequentially executed according to a preset sequence, or after a selection operation of a tester is detected, the test case selected by the tester is executed.
When it is monitored that a certain test case of the application program starts to execute, the cache module 501 caches log data generated in the execution process of the test case to a first preset position. The first preset position is only used for caching log data.
A determining module 502, configured to determine whether the test case is successfully executed after it is monitored that the test case is completely executed;
a deleting module 503, configured to delete the cached log data of the test case at the first preset location if the user successfully executes the test case;
a reading and saving module 504, configured to, if the test case is not successfully executed, read the log data of the test case that is cached at the first preset location, and save the log data of the test case to a second preset location.
In the embodiment of the present invention, after it is monitored that the test case is executed, the determining module 502 determines whether the test case is executed successfully, and if the test case is executed successfully, it indicates that the function of the application program tested by the test case is normal, and it is not necessary to analyze the log data of the test case. If the test case is not successfully executed, the log data of the test case is needed to analyze the reason of the unsuccessful execution, so the read saving module 504 reads the log data of the test case cached at the first preset position and saves the log data of the test case to the second preset position.
In the embodiment of the invention, when the execution of the test case of the application program is monitored, the log data generated in the execution process of the test case is cached to a first preset position, after the completion of the execution of the test case is detected, whether the test case is successfully executed or not is determined, if the test case is successfully executed, the cached log data of the test case at the first preset position is deleted, if the test case is not successfully executed, the cached log data of the test case at the first preset position is read, and the log data of the test case is stored to a second preset position. Compared with the prior art, whether the log data generated in the test case executing process needs to be stored is determined by judging whether the test case is successfully executed or not, so that only the log data of the test case which is not successfully executed can be stored, the log data of the test case which is successfully executed does not need to be stored, the number of the stored log data can be effectively reduced, and the occupation of the storage space is greatly reduced.
In the embodiment of the present invention, the log data generation function needs to be started to generate log data when the test case is executed, wherein one way is that, for a plurality of test cases which need to be executed in sequence, the log data generation function is started when the first test case is executed, and the log data generation function is closed after the last test case is executed. The other mode is that when a test case starts to be executed, the log data generation function is started, after the test case is executed, the log data generation function is closed, when the next test case starts to be executed, the log data generation function is started, after the next test case is executed, the log data generation function is closed, and the like, so that the log data generation function is started before each test case is executed, and the log data generation function is closed after the next test case is executed. The following will be described in detail based on the latter case.
Please refer to fig. 6, which is another schematic structural diagram of program modules of a log data processing apparatus according to an embodiment of the present invention, including a cache module 501, a determination module 502, a deletion module 503, and a read saving module 504 in the embodiment shown in fig. 5, and similar to the contents described in the embodiment shown in fig. 5, which are not repeated herein.
In the embodiment of the present invention, the cache module 501 is specifically configured to start a log data generation function when it is monitored that a test case of the application program starts to be executed, and cache the log data generated in the test case execution process to the first preset position;
the apparatus further comprises:
a closing module 601, configured to close the log data generation function after it is monitored that the test case is executed completely.
In an embodiment of the present invention, the determining module 502 includes:
an obtaining module 602, configured to obtain an execution result fed back by the application program after the test case is executed;
a first confirming module 603, configured to confirm that the test case is successfully executed if the execution result includes an execution success identifier;
a second confirming module 604, configured to confirm that the test case is not successfully executed if the execution result includes an execution failure flag.
In the embodiment of the present invention, after detecting that the test case is completely executed, the shutdown module 601 will shut down the log data generation function.
After the log data generation function is closed, the obtaining module 602 obtains an execution result fed back by the application program after the test case is executed. It can be understood that, during the execution of the test case of the application program, the processing device may monitor the execution process, on one hand, obtain and cache the generated log data, and on the other hand, obtain the execution result of the test case after the execution of the test case is completed.
In the embodiment of the present invention, if the execution result includes the execution success identifier, the first confirmation module 603 confirms that the test case is successfully executed, and the processing device deletes the log data of the test case that has been cached at the first preset location, so as to prevent the log data from occupying the storage space.
If the execution result includes the execution failure flag, the second confirmation module 604 confirms that the test case is not successfully executed, and the processing device reads the log data of the test case cached at the first preset location and stores the log data of the test case to the second preset location.
In the embodiment of the invention, whether the test case is successfully executed is determined based on the execution result of the test case, so that whether the log file of each test case needs to be stored can be definitely determined, only the log data of the unsuccessfully executed test case is saved, but the log data of the successfully executed test case is not saved, the size of the stored log data is effectively reduced, and the storage space needed by storage is saved.
It can be understood that, in the embodiment of the present invention, if the test case is not successfully executed, the execution result of the test case includes, in addition to the execution failure flag, an exception time range, where the exception time range refers to a time range in which an output result of the test case does not match an expected result in the execution process. Referring to fig. 7, a schematic structural diagram of another program module of the log data processing apparatus according to the embodiment of the present invention includes: the system includes a caching module 501, a determining module 502, a deleting module 503, and a reading and saving module 504 in the embodiment shown in fig. 5, and a closing module 601, an obtaining module 602, a first confirming module 603, and a second confirming module 604 in the embodiment shown in fig. 6, and is similar to the contents described in the embodiments shown in fig. 5 and 6, and is not described herein again.
In the embodiment of the present invention, if the execution result includes an execution failure identifier, the execution result further includes an abnormal time range;
the read save module 504 includes:
a reading module 701, configured to read log data in the abnormal time range from the log data of the test case cached at the first preset position;
a saving module 702, configured to save the read log data to the second preset location;
a deleting module 703 is configured to delete the remaining log data of the test case at the first preset position.
The saving module 702 is specifically configured to:
generating a log file of the test case by using the read log data;
and saving the log file to a directory of the test case or a preset file storage path of the test case.
In the embodiment of the present invention, in order to further reduce the storage space required for storing the log data, the extraction of the abnormal log data may be performed based on the abnormal time range included in the execution result.
If the test case is not successfully executed, the log data in the abnormal time range is read from the log data of the test case cached in the first preset position, the read log data is stored to the second preset position, and in addition, the residual log data of the test case in the first preset position is deleted. For example, if the abnormal time range is a to B, determining that the log data with the time mark a and the log data with the time mark B are in the cached log data, reading the log data between the log data with the time mark a and the log data with the time mark B, and storing the log data to a second preset position.
The saving module 702 is specifically configured to generate a log file of the test case by using the read log data, and save the log file to a directory of the test case or a preset file storage path of the test case, so as to associate the test case with the log file of the test case.
In the embodiment of the invention, the corresponding data is read from the log data of the unsuccessfully executed test case based on the abnormal time range and stored, so that only the log data of the time period in which the problem really occurs needs to be stored, the log data of the whole test case does not need to be stored, and the storage space needed for storing the log data can be further reduced.
In an embodiment of the present invention, a terminal is further provided, which includes a memory, a processor, and a computer program stored in the memory and running on the processor, and is characterized in that when the processor executes the computer program, each step in the log data processing method in the embodiments shown in fig. 2 to 4 is implemented.
In an embodiment of the present invention, a readable storage medium is further provided, on which a computer program is stored, where the computer program is executed by a processor to implement the steps in the log data processing method in the embodiments shown in fig. 2 to 4.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical division, and in actual implementation, there may be other divisions, for example, multiple modules or components may be combined or integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or modules, and may be in an electrical, mechanical or other form.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It should be noted that, for the sake of simplicity, the above-mentioned method embodiments are described as a series of acts or combinations, but those skilled in the art should understand that the present invention is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no acts or modules are necessarily required of the invention.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the above description, for a person skilled in the art, there are variations on the specific implementation and application scope according to the concepts of the embodiments of the present invention, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A method of processing log data, the method comprising:
when the execution of a test case of an application program is monitored, caching log data generated in the execution process of the test case to a first preset position; the test case comprises a group of test inputs, execution conditions and expected results compiled for a preset target;
after the test case is monitored to be executed completely, determining whether the test case is executed successfully;
if the test case is successfully executed, deleting the log data of the test case cached at the first preset position;
if the test case is not successfully executed, reading the log data of the test case cached at the first preset position, and storing the log data of the test case to a second preset position;
reading the log data of the test case cached at the first preset position, and storing the log data of the test case to a second preset position includes:
reading log data in an abnormal time range from the log data of the test case cached at the first preset position, and storing the read log data to the second preset position; the abnormal time range comprises a time range in which an output result of the test case is not matched with the expected result in the execution process;
and deleting the residual log data of the test case at the first preset position.
2. The method of claim 1, wherein caching log data generated in the test case execution process to a first preset location when the test case execution of the application program is monitored comprises:
when the test case of the application program is monitored to start to execute, starting a log data generation function, and caching the log data generated in the test case execution process to the first preset position;
the method further comprises the following steps:
and after the test case execution is monitored to be completed, closing the log data generation function.
3. The method of claim 1, wherein the determining whether the test case has executed successfully comprises:
obtaining an execution result fed back by the application program after the test case is executed;
if the execution result contains an execution success identifier, confirming that the test case is successfully executed;
and if the execution result contains an execution failure identifier, confirming that the test case is not successfully executed.
4. The method according to any one of claims 1 to 3, wherein the saving the read log data to the second preset location comprises:
generating a log file of the test case by using the read log data;
and saving the log file to a directory of the test case or a preset file storage path of the test case.
5. An apparatus for processing log data, the apparatus comprising:
the device comprises a cache module, a first storage module and a second storage module, wherein the cache module is used for caching log data generated in the test case execution process to a first preset position when the test case execution of an application program is monitored; the test case comprises a group of test inputs, execution conditions and expected results compiled for a preset target;
the determining module is used for determining whether the test case is successfully executed or not after the test case execution is monitored to be completed;
the deleting module is used for deleting the cached log data of the test case at the first preset position if the test case is successfully executed by the user;
the reading and storing module is used for reading the cached log data of the test case at the first preset position and storing the log data of the test case to a second preset position if the test case is not executed successfully;
wherein, the reading and saving module comprises:
the reading module is used for reading the log data in an abnormal time range from the log data of the test case cached at the first preset position; the abnormal time range comprises a time range in which an output result of the test case is not matched with the expected result in the execution process;
the saving module is used for saving the read log data to the second preset position;
and the deleting module is used for deleting the residual log data of the test case at the first preset position.
6. The apparatus according to claim 5, wherein the cache module is specifically configured to start a log data generation function when it is monitored that a test case of the application program starts to be executed, and cache log data generated in an execution process of the test case to the first preset location;
the apparatus further comprises:
and the closing module is used for closing the log data generation function after the test case execution is monitored to be completed.
7. The apparatus of claim 5, wherein the determining module comprises:
the acquisition module is used for acquiring an execution result fed back by the application program after the test case is executed;
the first confirmation module is used for confirming that the test case is successfully executed if the execution result contains an execution success identifier;
and the second confirmation module is used for confirming that the test case is not successfully executed if the execution result contains an execution failure identifier.
8. The apparatus according to any one of claims 5 to 7, wherein the saving module is specifically configured to:
generating a log file of the test case by using the read log data;
and saving the log file to a directory of the test case or a preset file storage path of the test case.
9. A terminal comprising a memory, a processor and a computer program stored on the memory and running on the processor, wherein the processor implements the steps of the log data processing method according to any one of claims 1 to 4 when executing the computer program.
10. A readable storage medium having stored thereon a computer program, wherein the computer program, when executed by a processor, implements the steps of the log data processing method according to any one of claims 1 to 4.
CN201711187864.9A 2017-11-24 2017-11-24 Log data processing method and device, terminal and readable storage medium Active CN107871015B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711187864.9A CN107871015B (en) 2017-11-24 2017-11-24 Log data processing method and device, terminal and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711187864.9A CN107871015B (en) 2017-11-24 2017-11-24 Log data processing method and device, terminal and readable storage medium

Publications (2)

Publication Number Publication Date
CN107871015A CN107871015A (en) 2018-04-03
CN107871015B true CN107871015B (en) 2020-08-18

Family

ID=61754388

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711187864.9A Active CN107871015B (en) 2017-11-24 2017-11-24 Log data processing method and device, terminal and readable storage medium

Country Status (1)

Country Link
CN (1) CN107871015B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110321271B (en) * 2019-06-03 2022-05-31 平安科技(深圳)有限公司 Method, device, equipment and storage medium for acquiring abnormal information based on Monkey
CN110727446A (en) * 2019-09-25 2020-01-24 光通天下网络科技股份有限公司 Automatic deployment method, device, equipment and medium
CN111078558B (en) * 2019-12-16 2023-04-07 广州品唯软件有限公司 Log storage method and device for automatic test and computer readable storage medium
CN111240974B (en) * 2020-01-06 2024-04-26 先进新星技术(新加坡)控股有限公司 Log output method and device, electronic equipment and medium
CN111666222B (en) * 2020-07-09 2024-08-06 腾讯科技(深圳)有限公司 Test method and related device
CN112363934A (en) * 2020-11-11 2021-02-12 展讯半导体(成都)有限公司 Storage method, system, equipment and storage medium for automatic test Log

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104424094A (en) * 2013-08-26 2015-03-18 腾讯科技(深圳)有限公司 Method and device for obtaining abnormal information and intelligent terminal device
CN105138606A (en) * 2015-08-03 2015-12-09 上海斐讯数据通信技术有限公司 Server log management method and system
CN105487966A (en) * 2014-09-17 2016-04-13 腾讯科技(深圳)有限公司 Program testing method, device and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9348739B2 (en) * 2014-07-10 2016-05-24 International Business Machines Corporation Extraction of problem diagnostic knowledge from test cases

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104424094A (en) * 2013-08-26 2015-03-18 腾讯科技(深圳)有限公司 Method and device for obtaining abnormal information and intelligent terminal device
CN105487966A (en) * 2014-09-17 2016-04-13 腾讯科技(深圳)有限公司 Program testing method, device and system
CN105138606A (en) * 2015-08-03 2015-12-09 上海斐讯数据通信技术有限公司 Server log management method and system

Also Published As

Publication number Publication date
CN107871015A (en) 2018-04-03

Similar Documents

Publication Publication Date Title
CN107871015B (en) Log data processing method and device, terminal and readable storage medium
CN106951521B (en) Method, device and system for reading and writing log file
CN106406940B (en) System upgrading method, device and terminal
US10659587B2 (en) Incoming call management method and apparatus
CN105701122B (en) Log collection method, device and system
CN105487966B (en) Program testing method, device and system
US9569607B2 (en) Security verification method and apparatus
US9811826B2 (en) Method and apparatus for increasing security of an electronic payment
CN104935744A (en) Verification code display method, verification code display device and mobile terminal
CN108124252A (en) A kind of method, terminal and computer readable storage medium for obtaining information
CN105657479B (en) Video processing method and device
CN107809437B (en) Converged communication login method and device and computer readable storage medium
CN108112010A (en) Access method, apparatus, terminal and the computer readable storage medium of network
CN106445743A (en) Data backup transmission method and mobile terminal
CN106598821B (en) Method and device for testing webpage loading speed
CN107484201B (en) Flow statistical method and device, terminal and computer readable storage medium
CN105933492A (en) Phone number obtaining method and device
CN107957899B (en) Screen recording method and device, computer readable storage medium and mobile terminal
CN104182331A (en) Browser performance test method, browser performance test system and terminal
CN106681670B (en) Sensor data reporting method and device
CN108460128B (en) Document management method and device, electronic device and readable storage medium
CN106304287B (en) Method for reducing standby power consumption of mobile terminal and mobile terminal
CN106776083B (en) Test control method and device and terminal equipment
CN108377298B (en) Method and device for switching answering mode, mobile terminal and computer readable storage medium
CN105787323A (en) Safety protection method for WiFi hotspot and mobile terminal

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
CB02 Change of applicant information

Address after: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Applicant after: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

Address before: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Applicant before: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant