Testing method and terminal for time consumption of cold start of PC softwareTechnical Field
The invention relates to the technical field of testing, in particular to a testing method and a testing terminal for the time consumption of cold start of PC software.
Background
The starting of the PC software is divided into cold starting and hot starting, wherein the cold starting means that when the PC software is started, a background does not have any related process and service of the software, at the moment, the software needs to additionally start some service and resident process, and the first starting of the software after the PC is started belongs to the cold starting; the hot start means that the background starts related services and processes already during the start, and the operations for starting the services and the processes are not needed, so that the software is not started for the first time and belongs to the hot start. Therefore, the performance data of the cold start and the performance data of the hot start of the PC software are different, and the test needs to be performed by distinguishing the cold start scene from the hot start scene.
At present, all cold start test modes are functional tests, and the following test procedures are repeated manually: the test mode of 'restarting the PC, starting the timer, starting timing while starting the software, stopping timing while successfully starting the software, and recording the starting time consumption of the test in the round' needs to consume a large amount of manpower and time, and when an abnormal condition occurs, the reason of the abnormality is difficult to be checked.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: the testing method and the terminal for the time consumption of the cold start of the PC software can improve the efficiency of the time consumption test of the cold start.
In order to solve the technical problems, the invention adopts a technical scheme that:
a test method for the time consumption of the cold start of PC software comprises the following steps:
s1, configuring a command for starting a test consuming cold start in the PC starting item;
s2, starting a PC;
s3, starting a test consuming cold start;
s4, starting the software to be tested on the PC, and acquiring the starting time consumption of the software to be tested;
and S5, judging whether the test frequency reaches a preset threshold value, if so, ending the test, otherwise, calling a restart command to automatically restart the PC, and returning to S3.
In order to solve the technical problem, the invention adopts another technical scheme as follows:
a PC software cold start time consuming test terminal, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
s1, configuring a command for starting a test consuming cold start in the PC starting item;
s2, starting a PC;
s3, starting a test consuming cold start;
s4, starting the software to be tested on the PC, and acquiring the starting time consumption of the software to be tested;
and S5, judging whether the test frequency reaches a preset threshold value, if so, ending the test, otherwise, calling a restart command to automatically restart the PC, and returning to S3.
The invention has the beneficial effects that: the method comprises the steps of configuring a command for starting a time-consuming test of cold start in a PC starting item, automatically starting the time-consuming test of the cold start after the PC is started, obtaining the time-consuming start of software to be tested on the PC, finishing the test when the test frequency reaches a preset threshold value, calling a restart command to automatically restart the PC when the test frequency does not reach the preset threshold value, automatically starting the time-consuming test of the cold start after the PC is restarted due to the fact that the command for starting the time-consuming test of the cold start is configured in the PC starting item, entering the next round of test, and circulating until the test frequency reaches the preset threshold value, so that the time-consuming test of the cold start of the software to be tested can be automatically realized, the manual test pressure is reduced, and the.
Drawings
FIG. 1 is a flowchart illustrating steps of a method for testing the time consumed by a cold boot of PC software according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of a test terminal consuming a cold boot of PC software according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating steps of a method for testing the time consumed by a cold boot of PC software according to an embodiment of the present invention;
description of reference numerals:
1. a test terminal consuming time for cold start of PC software; 2. A memory; 3. A processor.
Detailed Description
In order to explain technical contents, achieved objects, and effects of the present invention in detail, the following description is made with reference to the accompanying drawings in combination with the embodiments.
The most key concept of the invention is that a command for starting a cold start time-consuming test is configured in a PC starting item, the cold start time-consuming test is automatically started after the PC is started to obtain the cold start time-consuming of the software to be tested, and when the test frequency does not reach a preset threshold value, a restart command is called to automatically restart the PC for the next round of test.
Referring to fig. 1, a method for testing the time consumed by the cold boot of PC software includes the steps of:
s1, configuring a command for starting a test consuming cold start in the PC starting item;
s2, starting a PC;
s3, starting a test consuming cold start;
s4, starting the software to be tested on the PC, and acquiring the starting time consumption of the software to be tested;
and S5, judging whether the test frequency reaches a preset threshold value, if so, ending the test, otherwise, calling a restart command to automatically restart the PC, and returning to S3.
From the above description, the beneficial effects of the present invention are: the method comprises the steps of configuring a command for starting a time-consuming test of cold start in a PC starting item, automatically starting the time-consuming test of the cold start after the PC is started, obtaining the time-consuming start of software to be tested on the PC, finishing the test when the test frequency reaches a preset threshold value, calling a restart command to automatically restart the PC when the test frequency does not reach the preset threshold value, automatically starting the time-consuming test of the cold start after the PC is restarted due to the fact that the command for starting the time-consuming test of the cold start is configured in the PC starting item, entering the next round of test, and circulating until the test frequency reaches the preset threshold value, so that the time-consuming test of the cold start of the software to be tested can be automatically realized, the manual test pressure is reduced, and the.
Further, the step S4 includes:
detecting a test environment, judging whether the test environment is normal or not, and if not, recording abnormal information and reporting an error; if yes, starting the software to be tested on the PC, judging whether the software to be tested is started successfully, if yes, acquiring the starting time consumption of the software to be tested, and if not, recording abnormal information.
According to the description, the test environment is detected firstly when the test is started, errors caused by environmental problems in the test are avoided, the software to be tested is started when the test environment is normal, the time-consuming test is started after the software to be tested is started successfully, and the reliability is improved.
Further, the step S4 of obtaining the time consumed for starting the software to be tested includes:
s401, acquiring a time point for starting the software to be tested, and taking the time point as a starting time point;
s402, monitoring a drawing ending function of the PC in real time, and recording the called time point of the drawing ending function to obtain a calling time point set;
s403, judging whether the drawing end function is called within preset time or not, and if not, acquiring a time point with the minimum interval with the current time point from the calling time point set as an end time point;
and S404, calculating to obtain the starting time consumption of the software to be tested according to the ending time point and the starting time point.
According to the description, the cold start time consumption of the software to be tested is calculated by utilizing the system function of the PC, only if the drawing ending function is not monitored within the preset time and is called, the software to be tested is started, and then the time point with the minimum interval with the current time point is selected from the calling time point set and is used as the ending time point, so that the starting ending time can be accurately obtained, and the accuracy and the efficiency of recording the cold start time consumption of the software to be tested are improved.
Further, the step S4 of obtaining the time consumed for starting the software to be tested includes:
s411, acquiring a time point for starting the software to be tested as a starting time point;
s412, regularly judging whether the interface of the PC screen is matched with a preset interface or not, and taking the current time point as an end time point when the interface of the current PC screen is matched with the preset interface for the first time;
and S413, calculating to obtain the starting time consumption of the software to be tested according to the starting time point and the ending time point.
According to the description, the PC screen interface is judged to be compared with the preset interface of the software to be tested after being started at regular time through image recognition, when the PC screen interface and the preset interface of the software to be tested are matched for the first time, the current time point is obtained as the end time point, and the time-consuming record of cold starting can be simply, conveniently and quickly realized.
Further, after the end of the test in step S5, the method includes:
analyzing an operation process log and starting time-consuming data generated in the test process of the software to be tested to obtain an analysis result;
and outputting the analysis result, and automatically generating a test report according to the analysis result.
According to the description, after the test is finished, the operation process logs and the starting time-consuming data generated in the test process are automatically analyzed, and the test report is automatically generated according to the analysis result, so that the manual operation is reduced, and the working efficiency and the test convenience are improved.
Referring to fig. 2, a test terminal consuming cold boot of PC software includes a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the following steps when executing the computer program:
s1, configuring a command for starting a test consuming cold start in the PC starting item;
s2, starting a PC;
s3, starting a test consuming cold start;
s4, starting the software to be tested on the PC, and acquiring the starting time consumption of the software to be tested;
and S5, judging whether the test frequency reaches a preset threshold value, if so, ending the test, otherwise, calling a restart command to automatically restart the PC, and returning to S3.
From the above description, the beneficial effects of the present invention are: the method comprises the steps of configuring a command for starting a time-consuming test of cold start in a PC starting item, automatically starting the time-consuming test of the cold start after the PC is started, obtaining the time-consuming start of software to be tested on the PC, finishing the test when the test frequency reaches a preset threshold value, calling a restart command to automatically restart the PC when the test frequency does not reach the preset threshold value, automatically starting the time-consuming test of the cold start after the PC is restarted due to the fact that the command for starting the time-consuming test of the cold start is configured in the PC starting item, entering the next round of test, and circulating until the test frequency reaches the preset threshold value, so that the time-consuming test of the cold start of the software to be tested can be automatically realized, the manual test pressure is reduced, and the.
Further, the step S4 includes:
detecting a test environment, judging whether the test environment is normal or not, and if not, recording abnormal information and reporting an error; if yes, starting the software to be tested on the PC, judging whether the software to be tested is started successfully, if yes, acquiring the starting time consumption of the software to be tested, and if not, recording abnormal information.
According to the description, the test environment is detected firstly when the test is started, errors caused by environmental problems in the test are avoided, the software to be tested is started when the test environment is normal, the time-consuming test is started after the software to be tested is started successfully, and the reliability is improved.
Further, the step S4 of obtaining the time consumed for starting the software to be tested includes:
s401, acquiring a time point for starting the software to be tested, and taking the time point as a starting time point;
s402, monitoring a drawing ending function of the PC in real time, and recording the called time point of the drawing ending function to obtain a calling time point set;
s403, judging whether the drawing end function is called within preset time or not, and if not, acquiring a time point with the minimum interval with the current time point from the calling time point set as an end time point;
and S404, calculating to obtain the starting time consumption of the software to be tested according to the ending time point and the starting time point.
According to the description, the cold start time consumption of the software to be tested is calculated by utilizing the system function of the PC, only if the drawing ending function is not monitored within the preset time and is called, the software to be tested is started, and then the time point with the minimum interval with the current time point is selected from the calling time point set and is used as the ending time point, so that the starting ending time can be accurately obtained, and the accuracy and the efficiency of recording the cold start time consumption of the software to be tested are improved.
Further, the step S4 of obtaining the time consumed for starting the software to be tested includes:
s411, acquiring a time point for starting the software to be tested as a starting time point;
s412, regularly judging whether the interface of the PC screen is matched with a preset interface or not, and taking the current time point as an end time point when the interface of the current PC screen is matched with the preset interface for the first time;
and S413, calculating to obtain the starting time consumption of the software to be tested according to the starting time point and the ending time point.
According to the description, the PC screen interface is judged to be compared with the preset interface of the software to be tested after being started at regular time through image recognition, when the PC screen interface and the preset interface of the software to be tested are matched for the first time, the current time point is obtained as the end time point, and the time-consuming record of cold starting can be simply, conveniently and quickly realized.
Further, after the end of the test in step S5, the method includes:
analyzing an operation process log and starting time-consuming data generated in the test process of the software to be tested to obtain an analysis result;
and outputting the analysis result, and automatically generating a test report according to the analysis result.
According to the description, after the test is finished, the operation process logs and the starting time-consuming data generated in the test process are automatically analyzed, and the test report is automatically generated according to the analysis result, so that the manual operation is reduced, and the working efficiency and the test convenience are improved.
Example one
Referring to fig. 1 and 3, a method for testing the time consumed by the cold boot of PC software includes the steps of:
packaging the test tool into a jar package;
setting a preset threshold value of the test times, and selecting a PC to be tested;
s1, configuring a test command for starting cold start in the tested PC starting item;
specifically, a task is created in a task planning program of a windows system tool of a PC to be tested, a trigger is newly created, operation is newly created when a task starting item is selected to start, a bat script written with a test tool starting command is added in a script item when a task starting item is selected to start a program, so that the PC to be tested can run the bat script every time the PC is started, the effect of starting the test tool is achieved, and the test tool can be normally started after the PC is restarted every time;
s2, starting a PC;
s3, starting a test consuming cold start;
specifically, after the PC is started, a command java-jar test.java.nd.manager.main.main of a starting test tool is automatically run;
s4, starting the software to be tested on the PC, and acquiring the starting time consumption of the software to be tested;
specifically, the testing tool automatically detects a testing environment, judges whether the testing environment is normal, that is, whether the performance monitoring tool is started successfully, whether a CPU and a memory of the PC to be tested are normal, and the like, if not, an abnormality that the performance monitoring tool is not started or the CPU and the memory of the PC to be tested occupy too high due to system upgrade and the like may occur, records abnormal information and a screenshot, pushes the abnormal information and the screenshot to a relevant tester to report an error, adds one to the testing times, and executes step S5; if yes, the test tool starts the software to be tested on the PC to perform a start test through a code running cmd command, for example, when the software to be tested is the PC software which runs on a windows system and is 101 education PPT, the code running cmd command ' start ' C: \ Program Files (x86) \101PPT \101PPT.exe ' is used for starting the 101 education PPT on the PC;
judging whether the software to be tested is started successfully, namely whether the test is started successfully, if not, recording abnormal information such as time points, logs, screenshots and the like of abnormal occurrence, adding one to the test times, and executing the step S5; if yes, acquiring data such as starting time consumption of the software to be tested;
the performance data monitored by the performance monitoring tool not only comprises the starting time consumption of the software to be tested, but also comprises related process data of the software to be tested, such as parameters of a CPU (central processing unit), a memory, a video memory, a read-write IO (input/output), thread number, handle number, network and the like;
by means of the performance monitoring and screenshot, the test condition can be recorded in real time, the problems in the test can be acquired in time, and the abnormal problems in the test can be conveniently checked and reproduced;
the method specifically comprises the following steps of acquiring the starting time consumption of the software to be tested:
s401, acquiring a time point for starting the software to be tested, and taking the time point as a starting time point;
specifically, the time point of starting the to-be-tested software command is taken as a starting time point;
s402, monitoring a drawing ending function of the PC in real time, and recording the called time point of the drawing ending function to obtain a calling time point set;
specifically, a code DLL monitored in real time is injected into the process of the software to be tested by using a third-party library Detours, so that a drawing ending function of the PC can be monitored in real time;
s403, judging whether the drawing end function is called within preset time or not, and if not, acquiring a time point with the minimum interval with the current time point from the calling time point set as an end time point;
specifically, when it is monitored that the drawing end function is called, the drawing end function is not started completely, and perhaps the drawing end function is also monitored to be called at the next moment, so that the interface rendering of the PC is considered to be finished only when the drawing end function is not monitored to be called within the preset time, that is, the software to be tested is started completely, and then a time point with the minimum interval with the current time point is obtained from the calling time point set as an end time point;
s404, calculating to obtain the starting time consumption of the software to be tested according to the ending time point and the starting time point;
subtracting the starting time point from the ending time point to obtain the cold start time consumption of the software to be tested;
s5, judging whether the test frequency reaches a preset threshold value, if not, calling a restart command to automatically restart the PC, specifically, restarting the tested PC operation by running a cmd command 'shutdown-r' through a code, returning to S3 to start the next round of test, and realizing the automatic test consuming the cold start time of the PC software by the circulation;
if yes, ending the test, and uploading the test data compression packet obtained by the test to a system server by the tested PC;
the test data compression packet comprises configuration information of a tested PC, a screenshot of an operation process, a corresponding time point, an operation process log, starting time-consuming data and the like, and if an abnormal condition exists in the test process, the abnormal log is attached;
the configuration information of the PC comprises information such as an IP address, a system name, a system version, a system digit, a memory size, a processor and the like of the tested PC;
analyzing an operation process log and starting time-consuming data generated in the test process of the software to be tested to obtain an analysis result;
outputting the analysis result, and automatically generating a test report according to the analysis result;
the test report comprises the name of the tested software, the test times, the configuration information of the tested PC, the version and the cold start time consumption data of the tested software of the test, the cold start time consumption data of the tested software of the last several versions, abnormal information and test results in the test process and the like;
the test report arranges all cold start time-consuming data of the software to be tested in the tested PC into a table, can compare data of multiple versions of the software to be tested, knows the cold start time-consuming condition of each version of the software to be tested, is convenient to provide a subsequent start optimization direction, and is convenient to locate abnormal problems by attaching the test report after abnormal log analysis if abnormal messages exist.
Example two
The difference between the present embodiment and the first embodiment is that the time consumed for acquiring the software to be tested in step S4 specifically includes:
s411, acquiring a time point for starting the software to be tested as a starting time point;
specifically, the time point of starting the to-be-tested software command is taken as a starting time point;
s412, regularly judging whether the interface of the PC screen is matched with a preset interface or not in an image recognition mode, and taking the current time point as an end time point when the interface of the current PC screen is firstly matched with the preset interface;
the preset interface is an interface when the software to be tested is started;
s413, calculating to obtain the starting time consumption of the software to be tested according to the starting time point and the ending time point;
specifically, the cold start time of the software to be tested is obtained by subtracting the start time from the end time.
EXAMPLE III
Referring to fig. 2, atest terminal 1 for PC software cold start consuming includes amemory 2, aprocessor 3, and a computer program stored in thememory 2 and capable of running on theprocessor 3, where theprocessor 3 implements the steps in the first embodiment when executing the computer program.
Example four
Referring to fig. 2, atest terminal 1 for PC software cold start consuming includes amemory 2, aprocessor 3 and a computer program stored in thememory 2 and capable of running on theprocessor 3, wherein theprocessor 3 implements the steps of the second embodiment when executing the computer program.
In summary, according to the test method and terminal for the time consumption of the cold start of the PC software provided by the present invention, by configuring a command for starting the time consumption test of the cold start in a PC start item, starting the time consumption test of the cold start after the PC is started, starting the software to be tested on the PC after the test environment is detected to be normal, obtaining the time consumption for the start of the software to be tested, ending the test when the test frequency reaches a preset threshold, and calling a restart command to automatically restart the PC when the test frequency does not reach the preset threshold, because the command for starting the time consumption test of the cold start is configured in the PC start item, automatically starting the time consumption test of the cold start after the PC, entering the next round of test, circulating until the test frequency reaches the preset threshold, outputting a result obtained by analyzing an operation process log and time consumption data generated in the test process of the software to be tested, and automatically generating a test report according to the analysis result, the method can avoid test mistakes caused by environmental problems, improve the reliability of the test, automatically realize the time-consuming test of the cold start of the software to be tested, reduce the manual test pressure, and improve the efficiency and the convenience of the time-consuming test of the cold start.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all equivalent changes made by using the contents of the present specification and the drawings, or applied directly or indirectly to the related technical fields, are included in the scope of the present invention.