An automated performance testing method and related apparatus for exported files
By using a fully automated method to monitor and calculate file export performance, the problem of low testing efficiency and inaccurate data in existing technologies is solved, and efficient and accurate performance testing of batch file export is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2026-03-10
AI Technical Summary
Existing automated performance testing methods for batch file export on PCs suffer from low testing efficiency and inability to test overall product performance, and their performance data monitoring is inaccurate.
The system employs a fully automated approach, importing files in batches through import units, monitoring system performance data in real time, listening to file exports, calculating processing time periods and acquiring performance data, determining whether the average and maximum values meet expectations, and outputting a test report.
It enables efficient batch file export performance testing, improves testing efficiency, supports performance testing under multi-process parallel conditions, has high data accuracy, closely approximates user scenarios, and saves manpower.
Smart Images

Figure CN115934568B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer testing technology, and in particular to an automated performance testing method and related apparatus for exported files. Background Technology
[0002] Currently, there are two main methods for automated performance testing of batch file export on PCs:
[0003] 1. Implemented through interface testing;
[0004] 2. Through a semi-automatic approach, real-time performance data is automatically monitored, while file processing performance is manually analyzed.
[0005] The first method can only test interface performance and cannot test the overall performance of the product; the second method is not fully automated and has low execution efficiency.
[0006] Furthermore, in the field of automated testing, monitoring of PC performance data is mainly achieved through third-party open-source libraries such as psutil, which may differ from the data in the system resource manager. Summary of the Invention
[0007] The purpose of this invention is to provide an automated performance testing method and related apparatus for exporting files, aiming to solve the problems of low execution efficiency in existing testing technologies.
[0008] In a first aspect, embodiments of the present invention provide an automated performance testing method for exported files, comprising:
[0009] Import multiple files in batches according to test cases, record the import order of the multiple files and generate an import file list;
[0010] Batch export multiple files, monitor system performance data in real time, and listen for whether any of the files are exported;
[0011] When the export of the file is detected, the file is used as the target file, and the processing time period of the target file is calculated based on the mapping between the target file and time.
[0012] Obtain the corresponding performance data based on the processing time period of the target file;
[0013] Calculate the average and maximum values of the corresponding performance data, and determine whether the average and maximum values meet expectations;
[0014] If the test meets expectations, a report of test success will be output and the test will end.
[0015] Secondly, embodiments of the present invention provide an automated performance testing device for exported files, comprising:
[0016] The import unit is used to import multiple files in batches according to test cases, record the import order of the multiple files, and generate an import file list.
[0017] The export unit is used to batch export multiple files, monitor system performance data in real time, and listen for whether any of the files are exported.
[0018] The time calculation unit is used to, when the file is detected to be exported, take the file as the target file and calculate the processing time period of the target file according to the mapping between the target file and time.
[0019] The acquisition unit is used to acquire corresponding performance data based on the processing time period of the target file;
[0020] The judgment unit is used to calculate the average value and the maximum value of the corresponding performance data, and to determine whether the average value and the maximum value meet the expectations;
[0021] The report output unit is used to output a report indicating that the test has passed and to end the test if the test meets expectations.
[0022] Thirdly, embodiments of the present invention provide a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the automated performance testing method for exported files described in the first aspect.
[0023] Fourthly, embodiments of the present invention also provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, which, when executed by a processor, implements the automated performance testing method for exported files described in the first aspect.
[0024] This invention discloses an automated performance testing method and related apparatus for exporting files. The method includes: batch importing multiple files according to test cases, recording the import order of the multiple files and generating an imported file list; batch exporting multiple files, monitoring system performance data in real time and listening for any file export; when a file export is detected, using the file as a target file, and calculating the processing time period of the target file based on the mapping between the target file and time; obtaining corresponding performance data based on the processing time period of the target file; calculating the average and maximum values of the corresponding performance data, and determining whether the average and maximum values meet expectations; if they meet expectations, outputting a test pass report and ending the test. This invention employs a fully automated approach, saving manpower and improving testing efficiency. This invention also supports automated testing of batch file export performance through a user interface layer, which is closer to user scenarios than interface testing. This invention also supports file processing performance testing under multi-process parallel conditions, and it directly collects system task manager performance data, ensuring high data accuracy. This invention also provides an automated performance testing apparatus for exporting files, a computer-readable storage medium, and a computer device, all with the aforementioned beneficial effects, which will not be elaborated further here. Attached Figure Description
[0025] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 This is a flowchart of the automated performance testing method for exported files in this embodiment;
[0027] Figure 2 A schematic diagram illustrating the working principle of the file-time relationship mapping method;
[0028] Figure 3 This is a schematic block diagram of the automated performance testing device for exported files in this embodiment. Detailed Implementation
[0029] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0030] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0031] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0032] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0033] Please see Figure 1 This invention provides an automated performance testing method for exported files, comprising:
[0034] S101: Import multiple files in batches according to test cases, record the import order of the multiple files and generate an import file list;
[0035] When importing files, the order of the imported files can be obtained according to the sorting rules of the file list, i.e., the import file list.
[0036] S102: Batch export multiple files, monitor system performance data in real time, and listen for whether any of the files are exported;
[0037] Before exporting multiple files in batches, you can set the export parameters according to the test cases and record the export parameters.
[0038] Specifically, the files to be tested are placed in a specified directory. The test script obtains the order of imported files according to the program's sorting rules (such as sorting by filename), performs batch export parameter settings, and automatically generates test case script files. When the automated test program starts, it calls the corresponding test cases and parameters to execute the test.
[0039] In one embodiment, test case parameterization can be achieved by calling an automated testing framework such as pytest, and automated testing can be driven to be executed.
[0040] The export parameter settings mainly involve configuring parameters that the product's business logic supports for the export function, such as setting the file format and resolution.
[0041] After setting the export parameters according to the test cases, the system exports files in batches, and then monitors the system's performance data and listens for any file exports in real time.
[0042] Furthermore, performance data is read from the system's task manager interface at predetermined times, and the performance data is used to generate a performance data table and stored in a character sequence (CSV) file.
[0043] In one embodiment, when the batch export task starts, a performance monitoring process is initiated; the performance monitoring process reads performance data from the system task manager interface every 1 second and stores it in a CSV file.
[0044] The performance data mainly includes current time, CPU usage, GPU usage, and memory usage.
[0045] The process for monitoring file export is as follows: the exported file will be stored in the specified directory, and the export directory will be traversed every 1 second to check if any new files have been generated.
[0046] Furthermore, after detecting that a file is being exported, it is necessary to determine whether all files have been exported completely.
[0047] If so, then end the test;
[0048] If not, continue monitoring whether the file is exported.
[0049] S103: When the export of the file is detected, the file is taken as the target file, and the processing time period of the target file is calculated according to the mapping between the target file and time.
[0050] Specifically, when the file being exported is detected, the file is designated as the target file, and its export time is recorded as the task end time. The task end time is mapped to the target file using export filename rules, and the target file and task end time are associated. The import file order list is queried to obtain the target file's sequence number within the list. Based on the correspondence between the file's task end time and task start time, the task start time of the target file is obtained. Finally, the processing time period for the target file is determined using both its task end time and task start time.
[0051] The rules for exporting filenames are mainly determined based on product requirements. For example, some files use the original filename directly, while others add a prefix and / or suffix.
[0052] Furthermore, the task start time of each file is recorded sequentially and stored sequentially in a task start time list; the export time of each file is recorded sequentially and stored sequentially in a task end time list; when a file export is detected, the file is taken as the target file, and the current process count M and the position number N of the target file are obtained; it is determined whether N is greater than M; if so, the (N-M+1)th value from the task start time list is obtained as the task start time of the target file, and the Nth value from the task end time list is obtained as the task end time of the target file; if not, the start time of batch exporting multiple files is taken as the task start time of the target file, and the Nth value from the task end time list is obtained as the task end time of the target file.
[0053] In a specific application scenario, such as Figure 2 As shown, Figure 2 The diagram illustrates the working principle of a 3-process system. When it is necessary to obtain the task end time and task start time of file 4, it is known that file 4 is located in the 4th position in the file list and that the position number 4 is greater than the number of processes 3. Therefore, its task end time is the 4th position in the task end time list (list_endtime), which is the end time 4. Its task start time is the 2nd position in the task start time list, which is the start time of file 4. Therefore, the processing time of file 4 is the period from the start time of file 4 to the end time 4.
[0054] In another specific application scenario, such as Figure 2 As shown, when it is necessary to obtain the task end time and task start time of file 2, it is known that file 2 is the second position in the file list and the position number 2 is less than the number of processes 3. Therefore, its task end time is the second position in the task end time list, that is, the end time 2. Its task start time is the start time of batch execution of exporting multiple files, that is, the start time of file 1, file 2, and file 3, which are the first positions in the task start time list. Therefore, the processing time of file 2 is the period from the start time of file 1, file 2, and file 3 to the end time 2.
[0055] It should be noted that when file 1 is exported, file 4 will be exported immediately. Therefore, the end time 1 of file 1 is the same as the task start time of file 4. So when you need to get the task start time of file 4, you can choose the end time 1 in the task end time as the task start time of file 4. The task start time of other files can be obtained in the same way. That is, when the position number N is greater than the number of processes M, the task end time of the NMth position in the task end list is selected as the task start time of the Nth position. Therefore, you only need to record the file export time to obtain the file processing time, which can save server resources.
[0056] S104: Obtain the corresponding performance data based on the processing time period of the target file;
[0057] S105: Calculate the average and maximum values of the corresponding performance data, and determine whether the average and maximum values meet expectations;
[0058] The expected threshold values are mainly set based on product requirements. For example, the expected threshold values can be set as CPU usage not exceeding 80%, GPU usage not exceeding 90%, and memory usage not exceeding 3GB.
[0059] S106: If the test meets expectations, output a report indicating that the test has passed and end the test.
[0060] Furthermore, if the average value and the maximum value do not meet expectations, a test failure report is output, and the test ends.
[0061] Please see Figure 3 This embodiment provides an automated performance testing device 300 for exported files, including:
[0062] Import unit 301 is used to import multiple files in batches according to test cases, record the import order of the multiple files and generate an import file list;
[0063] The export unit 302 is used to batch export multiple files, monitor the system's performance data in real time, and listen for whether any of the files are exported.
[0064] The time calculation unit 303 is used to, when the file is detected to be exported, take the file as the target file and calculate the processing time period of the target file according to the mapping between the target file and time.
[0065] The acquisition unit 304 is used to acquire corresponding performance data based on the processing time period of the target file;
[0066] The judgment unit 305 is used to calculate the average value and the maximum value of the corresponding performance data, and to determine whether the average value and the maximum value meet expectations;
[0067] The report output unit 306 is used to output a test pass report and end the test if the test meets expectations.
[0068] Furthermore, the export unit 302 includes:
[0069] The export parameter setting subunit is used to set export parameters according to test cases and record the export parameters.
[0070] Furthermore, the time calculation unit 303 includes:
[0071] The association subunit is used to, when monitoring the export of the file, use the file as the target file, record the export time of the target file as the task end time of the target file, map the task end time to the target file according to the export file name rules, associate the target file and the task end time, query the import file order list to obtain the sequence number of the target file in the import file list, and obtain the task start time of the target file according to the correspondence between the file task end time and the task start time.
[0072] The time acquisition subunit is used to obtain the processing time period of the target file through the task end time and task start time of the target file.
[0073] Furthermore, the associated subunit includes:
[0074] The import time recording subunit is used to record the task start time of each file in sequence and store the task start times in sequence into the task start time list;
[0075] The export time recording subunit is used to record the export time of each file in sequence and store the export time in sequence to the task end time list;
[0076] The position number acquisition subunit is used to, when the file is detected to be exported, take the file as the target file and obtain the current process number M and the position number N of the target file;
[0077] The position number determination subunit is used to determine whether N is greater than M;
[0078] The first subunit is acquired, and if so, the N-M+1th value is obtained from the task start time list as the task start time of the target file, and the Nth value is obtained from the task end time list as the task end time of the target file.
[0079] The second time acquisition subunit is used to, if not, take the start time of batch execution of exporting multiple files as the task start time of the target file, and obtain the Nth value from the task end time list as the task end time of the target file.
[0080] Furthermore, the export unit 302 includes:
[0081] The performance data reading subunit is used to read performance data from the system's task manager interface at predetermined times, generate a performance data table from the performance data, and store it in a character sequence file.
[0082] Furthermore, it also includes:
[0083] The export judgment unit is used to determine whether all files have been exported successfully.
[0084] End unit, used to end the test if the condition is met;
[0085] The monitoring unit is used to continue monitoring whether the file is exported if not.
[0086] Furthermore, the determination unit 305 includes:
[0087] The test termination subunit is used to output a test failure report and terminate the test if the average value and the maximum value do not meet expectations.
[0088] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described apparatus and unit can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0089] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed, can implement the methods provided in the above embodiments. The storage medium may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0090] The present invention also provides a computer device, which may include a memory and a processor. The memory stores a computer program, and when the processor calls the computer program in the memory, it can implement the methods provided in the above embodiments. Of course, the computer device may also include various network interfaces, power supplies, and other components.
[0091] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make various improvements and modifications to this invention without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this invention.
[0092] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusivity.
[0093] The term "comprises" implies that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprises a..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A method of performance automated testing of an exported file, characterized by, The application relates to a method for testing the performance of a system, comprising: Importing a plurality of files according to a test case batch, recording the import order of the plurality of files and generating an import file list; Batch exporting the plurality of files, monitoring the performance data of the system in real time and listening whether any of the files is exported; When it is listened that any of the files is exported, the file is taken as a target file, and the processing time period of the target file is calculated according to the mapping of the target file and time relationship; According to the processing time period of the target file, corresponding performance data is obtained; The average value and the maximum value of the corresponding performance data are calculated, and whether the average value and the maximum value meet the expectation is judged; If the expectation is met, a test passing report is outputted and the test is ended; Before the batch exporting of the plurality of files, the method comprises: Setting an export parameter according to a test case, and recording the export parameter; When it is listened that any of the files is exported, the file is taken as a target file, and the processing time period of the target file is calculated according to the mapping of the target file and time relationship; When it is listened that any of the files is exported, the file is taken as a target file, the export time of the target file is recorded as the task end time of the target file, the task end time is mapped to the target file through an export file name rule, the target file and the task end time are associated, the import file order list is inquired, the serial number of the target file in the import file list is obtained, and the task start time of the target file is obtained according to the corresponding relationship between the file task end time and the task start time; The processing time period of the target file is obtained through the task end time and the task start time of the target file; When the position serial number N is greater than the process number M, the task end time of the N-Mth position in the task end list is selected as the task start time of the Nth position.
2. The performance automation test method of derived files as claimed in claim 1, wherein, When it is listened that any of the files is exported, the file is taken as a target file, the export time of the target file is recorded as the task end time of the target file, the task end time is mapped to the target file through an export file name rule, the target file and the task end time are associated, the import file order list is inquired, the serial number of the target file in the import file list is obtained, and the task start time of the target file is obtained according to the corresponding relationship between the file task end time and the task start time; The processing time period of the target file is obtained through the task end time and the task start time of the target file; When the position serial number N is greater than the process number M, the task end time of the N-Mth position in the task end list is selected as the task start time of the Nth position. When it is listened that any of the files is exported, the file is taken as a target file, the export time of the target file is recorded as the task end time of the target file, the task end time is mapped to the target file through an export file name rule, the target file and the task end time are associated, the import file order list is inquired, the serial number of the target file in the import file list is obtained, and the task start time of the target file is obtained according to the corresponding relationship between the file task end time and the task start time; The processing time period of the target file is obtained through the task end time and the task start time of the target file; When the position serial number N is greater than the process number M, the task end time of the N-Mth position in the task end list is selected as the task start time of the Nth position. If not, the start time of the batch export of the plurality of files is taken as the task start time of the target file, and the Nth value in the task end time list is taken as the task end time of the target file.
3. The performance automation testing method of derived files as claimed in claim 1 wherein, The monitoring performance data comprises: Reading performance data from the task manager interface of the system at a predetermined time, generating a performance data table from the performance data, and storing the performance data table into a character sequence file.
4. The performance automation test method of derived files as claimed in claim 1 wherein, Further comprising: Determining whether all files are exported; If yes, ending the test; If not, continuing to monitor whether the files are exported.
5. The performance automation testing method of derived files as claimed in claim 1 wherein, The determining whether the average value and the maximum value are expected further comprises: If the average value and the maximum value are not expected, outputting a report of test failure, and ending the test.
6. A performance automation testing apparatus for deriving a file, characterized by, Comprising: An import unit for importing a plurality of files in batches according to a test case, recording the import order of the plurality of files, and generating an import file list; An export unit for exporting a plurality of files in batches, monitoring performance data of the system in real time, and monitoring whether any of the files is exported; A time calculation unit for, when it is monitored that any of the files is exported, taking the file as a target file, and calculating a processing time period of the target file according to a mapping of the target file and time; An acquisition unit for acquiring corresponding performance data according to the processing time period of the target file; A determination unit for calculating an average value and a maximum value of the corresponding performance data, and determining whether the average value and the maximum value are expected; A report output unit for, if the average value and the maximum value are expected, outputting a report of test pass, and ending the test; The export unit comprises: An export parameter setting subunit for setting export parameters according to a test case, and recording the export parameters; The time calculation unit comprises: An association subunit for, when it is monitored that any of the files is exported, taking the file as a target file, recording the export time of the target file as a task end time of the target file, mapping the task end time to the target file through an export file name rule, associating the target file and the task end time, querying an import file order list, acquiring a serial number of the target file in the import file list, and acquiring a task start time of the target file according to a corresponding relationship between file task end time and task start time; A time acquisition subunit for obtaining the processing time period of the target file through the task end time and the task start time of the target file; A selection unit for, when the position serial number N is greater than the process number M, selecting the task end time at the N-Mth position in the task end list as the task start time at the Nth position.
7. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the performance automated test method of the exported file when executing the computer program.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program causes the processor to execute the performance automated test method of the exported file when the processor executes the computer program.
Citation Information
Patent Citations
File reading performance test method and device, equipment and storage medium
CN111986726A