Test task processing method and device

By automatically selecting test cases and assembling pipeline execution file, GitLab-CI tool is used for batch testing and processing, and the results are automatically analyzed after the test is completed, solving the problem of manual processing of pipeline testing tools in the first and second stages, improving the execution efficiency of test tasks.

CN119829439APending Publication Date: 2025-04-15BEIJING DP TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411895890.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

In the first and second stages of using pipeline testing tools, there are still a large number of manual processing processes, which affect the execution efficiency of the test task.

Method used

By receiving test task information, the preset test case library and pipeline configuration template library is configured automatically, the test case selection and pipeline execution file assembly are automatically completed, batch testing is used to use GitLab-CI tool to perform batch testing, and the results are automatically analyzed and a test report is generated after the test is completed.

Benefits of technology

It improves the automation level of test case selection and test result analysis, reduces manual intervention, and improves the execution efficiency of the overall test task.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829439A_ABST
    Figure CN119829439A_ABST
Patent Text Reader

Abstract

Embodiments of the invention relate to a test task processing method and apparatus. The method comprises the steps of receiving test task information sent by a first client and recording the test task information as corresponding first task information; screening the test cases based on a preset test case library and the first task information to obtain a corresponding first case filename sequence; performing assembly line execution file assembly based on a preset assembly line configuration template library, the first task information and the first use case file name sequence to obtain a corresponding first execution file name; performing batch test processing by the assembly line test tool according to the first execution file name; and after the batch test is finished, analyzing the test result according to the first task information to obtain a corresponding first test report, and sending the first test report back to the first client. According to the invention, the automation level and the execution efficiency of the whole test task can be further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a method and device for processing a test task. Background Art

[0002] In the field of automated testing, the use of pipeline testing tools (such as GitLab-CI tools) can build automated batch testing tasks and achieve the purpose of improving batch testing efficiency. However, we found in the actual testing process that there are still some manual processing processes in the two stages before and after the use of pipeline testing tools: 1) Before using the pipeline testing tool, it is necessary to process the test case selection through manual operation; 2) After using the pipeline testing tool, it is also necessary to process the test result analysis and test report distribution through manual operation. Affected by many factors such as manual work efficiency and manual experience limitations, the manual processing process of the two stages before and after is bound to have an adverse effect on the execution efficiency of the overall test task. Therefore, how to improve the automation level of the two-stage processing process is the technical problem that the present invention needs to solve. Summary of the invention

[0003] The purpose of the present invention is to provide a method, device, electronic device and computer-readable storage medium for processing test tasks in view of the defects of the prior art. The present invention receives the test task information sent by the first client and records it as the corresponding first task information; based on the preset test case library and the first task information, the test case is screened to obtain the corresponding first case file name sequence; and based on the preset pipeline configuration template library, the first task information and the first case file name sequence, the pipeline execution file is assembled to obtain the corresponding first execution file name; and the pipeline test tool performs batch test processing according to the first execution file name; and after the batch test is completed, the test results are analyzed according to the first task information to obtain the corresponding first test report and send it back to the first client. The present invention can automatically complete the test case selection work based on the task configuration information before using the pipeline test tool, and can automatically complete the test result analysis and test report distribution work based on the task configuration information after using the pipeline test tool; through the present invention, the automation level of the above-mentioned two-stage processing process can be effectively improved, and the execution efficiency of the overall test task can be effectively improved.

[0004] To achieve the above object, a first aspect of an embodiment of the present invention provides a method for processing a test task, the method comprising:

[0005] The test task information received from the first client is recorded as the corresponding first task information;

[0006] Based on the preset test case library and the first task information, the test case is screened to obtain a corresponding first test case file name sequence; and based on the preset pipeline configuration template library, the first task information and the first test case file name sequence, the pipeline execution file is assembled to obtain a corresponding first execution file name;

[0007] The pipeline testing tool performs batch testing according to the first executable file name; the pipeline testing tool at least includes the GitLab-CI tool;

[0008] After the batch test is completed, the test results are analyzed according to the first task information to obtain a corresponding first test report which is sent back to the first client.

[0009] Preferably, the first task information includes task name, test target operating environment type, test target compilation type, coverage data storage directory address, test log storage directory address, test target project name, test target business name set, test report distribution interface set and pipeline configuration template identifier;

[0010] The test target operating environment type is the current operating environment type of the test target, including at least the development phase operating environment type, the test phase operating environment type and the production phase operating environment type;

[0011] The test target compilation type includes at least a first type and a second type; when the test target compilation type is the first type, it means that all target programs of the test target are compiled by a compiler integrated with a code coverage analysis tool; when the test target compilation type is the second type, it means that all target programs of the test target are compiled by a compiler that does not integrate a code coverage analysis tool; the code coverage analysis tools include at least Gocover, Gorched, GCC, JaCoCo, Istanbul, and VS Code;

[0012] When the compilation type of the test target is the first type, the coverage data storage directory address is the storage directory address of the coverage data file output by this test process; the data content of the coverage data file is a tree structure data; the tree structure data includes multiple tree node data elements; each of the tree node data elements corresponds to a compiled code in all target programs of this test target; each of the tree node data elements includes a data element access status, and the data element access status includes accessed and not accessed; the data element access status of all the tree node data elements is set to not accessed at initialization; on the premise that all target programs of the test target are compiled by a compiler integrated with the code coverage analysis tool, the code coverage analysis tool will track the execution status of each compiled code segment during the running process of the test target and set the data element access status of the tree node data element corresponding to the currently executed compiled code in the tree structure data of the coverage data file to accessed when any compiled code segment is executed;

[0013] When the test target compilation type is the second type, the coverage data storage directory address is empty;

[0014] The test log storage directory address is the storage directory address of the test log file output by this test; each of the test log files corresponds to a test case; the data content of the test log file includes at least the test case name and the test status; the test case name is the file name of the current test case; the test status is the test feedback status of the current test case, including success and failure;

[0015] The test target project name is the project name corresponding to this test target;

[0016] The test target service name set is a service name set that needs to be covered by the test target of this test, and is composed of one or more test service names;

[0017] The test report distribution interface set is composed of one or more test report distribution interfaces; the interface types of the test report distribution interface at least include an email interface, a voice notification interface, a multimedia SMS interface, an office system interface, and an office platform interface;

[0018] The pipeline configuration template identifier is a file template identifier of the pipeline execution file used for this test;

[0019] The test case library includes a plurality of first use case records; each of the first use case records corresponds to a test case; each test case is an executable program for testing; the first use case record includes a first use case identifier, a first use case file name, a first use case storage address, a first belonging project name, a first use case adaptation environment and a first use case adaptation service set;

[0020] The first test case identifier is a unique identifier of the current test case;

[0021] The first test case file name is the file name of the current test case;

[0022] The first test case storage address is the storage address of the current test case;

[0023] The first belonging project name is the project name of the current test case belonging project;

[0024] The first use case adaptation environment is used to mark all running environments that can be tested by the current test case, and the first use case adaptation environment includes multiple first environment marking items; the first environment marking item includes a first environment type and a first marking state, the first environment type includes at least development, testing and production, and the first marking state includes marked and unmarked;

[0025] The first use case adaptation service set is used to mark all services that can be tested by the current test case, and the first use case adaptation service set includes one or more first service names;

[0026] The pipeline configuration template library includes multiple first template records; each of the first template records corresponds to a pipeline execution file template; the first template record includes a first template identifier and a first template storage address; all the pipeline execution file templates are identifiable file templates of the pipeline testing tool.

[0027] Preferably, the screening of the test cases based on the preset test case library and the first task information line to obtain the corresponding first test case file name sequence specifically includes:

[0028] The test target running environment type, the test target project name and the test target business name set of the first task information are used as the corresponding current environment type, current project name and current business name set;

[0029] And the first use case records whose first belonging project names match the current project name in the test case library form a corresponding first record set;

[0030] And identify the current environment type; if the current environment type is a development stage operating environment type, then the first use case record in the first record set whose first environment type is development and whose first marking state is marked is recorded as the corresponding second use case record; if the current environment type is a test stage operating environment type, then the first use case record in the first record set whose first environment type is test and whose first marking state is marked is recorded as the corresponding second use case record; if the current environment type is a production stage operating environment type, then the first use case record in the first record set whose first environment type is production and whose first marking state is marked is recorded as the corresponding second use case record; and all the obtained second use case records constitute the corresponding second record set;

[0031] and recording the second use case records in the second record set, in which each of the first use case adaptation service sets includes the current service name set, as corresponding third use case records; and forming a corresponding third record set from all the obtained third use case records;

[0032] And initialize an empty sequence as the corresponding first use case file name sequence; and perform a round of traversal on all the third records of the third record set; and in this round of traversal, use the third record currently traversed as the corresponding current record; and download the test case stored at the first use case storage address of the current record to the default test case storage directory of the pipeline testing tool; and add the first use case file name of the current record to the first use case file name sequence; and at the end of this round of traversal, output the final first use case file name sequence as the test case screening result.

[0033] Preferably, the assembling of the pipeline execution file based on the preset pipeline configuration template library, the first task information and the first use case file name sequence to obtain the corresponding first execution file name specifically includes:

[0034] Step 41, using the test log storage directory address and the pipeline configuration template identifier of the first task information as the corresponding first test log storage directory address and first pipeline configuration template identifier;

[0035] Step 42: taking the first template record in the pipeline configuration template library whose first template identifier matches the first pipeline configuration template identifier as the corresponding current template record; and downloading the pipeline execution file template stored at the first template storage address of the current template record to obtain the corresponding first pipeline execution file template;

[0036] The first pipeline execution file template includes at least two data configuration items, namely, a log directory data item and a test case sequence data item of the pipeline test tool;

[0037] Step 43, based on the first test log storage directory address and the first use case file name sequence, data configuration is performed on the corresponding log directory data item and the test case sequence data item in the first pipeline execution file template; and the first pipeline execution file template that has completed data configuration is recorded as the corresponding first pipeline execution file;

[0038] Step 44, based on the preset pipeline execution file naming rules, generate a unique pipeline execution file name for the first pipeline execution file as the corresponding first execution file name; and set the file name of the first pipeline execution file based on the first execution file name; and store the first pipeline execution file with the completed file name setting into the default pipeline execution file storage directory of the pipeline testing tool.

[0039] Preferably, the batch testing process performed by the pipeline testing tool according to the first executable file name specifically includes:

[0040] Step 51, the pipeline test tool extracts the first pipeline execution file whose file name matches the first execution file name in the tool's default pipeline execution file storage directory as the corresponding current loading file; and uses the tool's default test case storage directory as the corresponding first case directory; and extracts the data configuration content of the log directory data item and the test case sequence data item of the currently loaded file as the corresponding first log directory and first case sequence;

[0041] Wherein, the first use case sequence includes a plurality of first use case names;

[0042] Step 52, using the first use case name of the first use case sequence as the corresponding current use case file name;

[0043] Step 53, taking the test case whose test case file name matches the current test case file name in the first test case directory as the corresponding current test case; and executing the current test case program; and at the end of the current test case program execution, taking the test feedback status of success or failure output by the current test case as the corresponding current test feedback status; and taking the current test case file name and the current test feedback status as a set of corresponding test case names and tested status to form a corresponding test log file and storing it in the first log directory;

[0044] Step 54, identify whether the current use case file name is the last first use case name in the first use case sequence; if not, extract the next first use case name in the first use case sequence as the new current use case file name and return to step 53; if so, confirm that this batch test is completed.

[0045] Preferably, analyzing the test result according to the first task information to obtain a corresponding first test report and sending it back to the first client specifically includes:

[0046] Step 61, taking the task name of the first task information, the test target compilation type, the coverage data storage directory address, the test log storage directory address and the test report distribution interface set as the corresponding current task name, current compilation type, current coverage data directory, current log directory and current distribution interface set;

[0047] Step 62, identifying the current compilation type; if the current compilation type is the first type, extracting the tree structure data in the coverage data file stored in the current coverage data directory as the corresponding current tree structure data, and counting the total number of the tree node data elements of the current tree structure data to obtain the corresponding first total number, and counting the total number of the tree node data elements in the current tree structure data whose data element access status is accessed to obtain the corresponding second total number, and calculating the corresponding current code coverage based on the first and second total numbers = (second total number / first total number) × 100%; if the current compilation type is the second type, setting the corresponding current code coverage to null;

[0048] Step 63, counting the total number of the test log files stored in the current log directory to obtain a corresponding third total number; and counting the total number of the test log files in the current log directory whose test status is successful to obtain a corresponding fourth total number; and subtracting the difference between the third total number and the fourth total number as the corresponding fifth total number; and calculating the corresponding current success rate and current failure rate based on the third, fourth and fifth total numbers, the current success rate = (fourth total number / third total number) × 100%, the current failure rate = (fifth total number / third total number) × 100%; and using the third, fourth and fifth total numbers as the corresponding current total number of test cases, the current total number of successful cases and the current total number of failed cases;

[0049] Step 64, bringing the obtained current task name, the current code coverage, the current total number of test cases, the current total number of successful cases, the current total number of failed cases, the current success rate and the current failure rate into a preset test report graphic template to assemble the test report to obtain the corresponding first test report;

[0050] Wherein, the test report graphic template includes at least seven data configuration items, namely, a task name data item, a code coverage data item, a total number of test cases data item, a total number of successful cases data item, a total number of failed cases data item, a test success rate data item and a test failure rate data item; when assembling the test report, the task name data item is data configured based on the current task name, the code coverage data item is data configured based on the current code coverage, the total number of test cases data item is data configured based on the current total number of test cases, the total number of successful cases data item is data configured based on the current total number of successful cases, the total number of failed cases data item is data configured based on the current total number of failed cases, the test success rate data item is data configured based on the current success rate, and the test failure rate data item is data configured based on the current failure rate;

[0051] Step 65: Send the first test report to all the test report distribution interfaces in the current distribution interface set.

[0052] A second aspect of an embodiment of the present invention provides a device for implementing the method for processing the test task described in the first aspect, the device comprising: a task information receiving module, a batch test pre-stage processing module, a batch test processing module, and a batch test post-stage processing module;

[0053] The task information receiving module is used to receive the test task information sent by the first client and record it as the corresponding first task information;

[0054] The batch test pre-stage processing module is used to screen the test cases based on the preset test case library and the first task information to obtain the corresponding first test case file name sequence; and to assemble the pipeline execution file based on the preset pipeline configuration template library, the first task information and the first test case file name sequence to obtain the corresponding first execution file name;

[0055] The batch test processing module is used for the pipeline test tool to perform batch test processing according to the first execution file name; the pipeline test tool at least includes the GitLab-CI tool;

[0056] The batch test post-stage processing module is used to analyze the test results according to the first task information after the batch test is completed, obtain a corresponding first test report and send it back to the first client.

[0057] A third aspect of an embodiment of the present invention provides an electronic device, including: a memory, a processor, and a transceiver;

[0058] The processor is used to be coupled to the memory, read and execute instructions in the memory, so as to implement the method steps described in the first aspect above;

[0059] The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.

[0060] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are executed by a computer, the computer executes the instructions of the method described in the first aspect above.

[0061] The embodiment of the present invention provides a method, device, electronic device and computer-readable storage medium for processing a test task. As can be seen from the above content, the embodiment of the present invention receives the test task information sent by the first client and records it as the corresponding first task information; based on the preset test case library and the first task information, the test case is screened to obtain the corresponding first case file name sequence; and based on the preset pipeline configuration template library, the first task information and the first case file name sequence, the pipeline execution file is assembled to obtain the corresponding first execution file name; and the pipeline test tool performs batch test processing according to the first execution file name; and after the batch test is completed, the test results are analyzed according to the first task information to obtain the corresponding first test report and send it back to the first client. The embodiment of the present invention can automatically complete the test case selection work based on the task configuration information before using the pipeline test tool, and can automatically complete the test result analysis and test report distribution work based on the task configuration information after using the pipeline test tool; through the embodiment of the present invention, on the one hand, the automation level of the above-mentioned two-stage processing process is effectively improved, and on the other hand, the execution efficiency of the overall test task is further improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] Figure 1 A schematic diagram of a method for processing a test task provided in the first embodiment of the present invention;

[0063] Figure 2 A module structure diagram of a test task processing device provided in Embodiment 2 of the present invention;

[0064] Figure 3A schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0065] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0066] Embodiment 1 of the present invention provides a method for processing a test task, such as Figure 1 As shown in the schematic diagram of a method for processing a test task provided in the first embodiment of the present invention, the method mainly includes the following steps:

[0067] Step 1: Receive test task information sent by the first client and record it as corresponding first task information.

[0068] Here, the first task information of the embodiment of the present invention includes a task name, a test target operating environment type, a test target compilation type, a coverage data storage directory address, a test log storage directory address, a test target project name, a test target service name set, a test report distribution interface set, and a pipeline configuration template identifier; wherein:

[0069] 1) Task name:

[0070] The task name of the embodiment of the present invention is the name of the test task corresponding to the current first task information;

[0071] 2) Test target operating environment type:

[0072] The test target operating environment type of the embodiment of the present invention is the current operating environment type of the test target, which at least includes a development phase operating environment type, a test phase operating environment type, and a production phase operating environment type;

[0073] 3) Test target compilation type, coverage data storage directory address:

[0074] The test target compilation type of the embodiment of the present invention includes at least a first type and a second type; when the test target compilation type is the first type, it means that all target programs of the test target are compiled by a compiler integrated with a code coverage analysis tool; when the test target compilation type is the second type, it means that all target programs of the test target are compiled by a compiler that does not integrate a code coverage analysis tool; here, the code coverage analysis tools mentioned in the embodiment of the present invention include at least Gocover, Gorched, GCC, JaCoCo, Istanbul, and VS Code;

[0075] It should be noted that when the compilation type of the test target is the first type, the coverage data storage directory address is the storage directory address of the coverage data file created and updated by the code coverage analysis tool during this test process; the data content of the coverage data file is a tree structure data; this tree structure data includes multiple tree node data elements; each tree node data element corresponds to a section of compiled code in all target programs of this test target; each tree node data element includes a data element access status, and the data element access status includes accessed and not accessed; the data element access status of all tree node data elements is set to not accessed during initialization;

[0076] On the premise that all target programs of the test target are compiled by a compiler integrated with a code coverage analysis tool, the code coverage analysis tool will track the execution status of each compiled code segment during the running process of the test target and set the data element access status of the tree node data element corresponding to the currently executed compiled code in the tree structure data of the coverage data file to have been accessed when any compiled code segment is executed;

[0077] It should also be noted that when the test target compilation type is the second type, the coverage data storage directory address is empty;

[0078] 4) Test log storage directory address:

[0079] The test log storage directory address of the embodiment of the present invention is the storage directory address of the test log file output by this test; each test log file corresponds to a test case; the data content of the test log file includes at least the test case name and the test status; wherein the test case name is the file name of the current test case; the test status is the test feedback status of the current test case, including success and failure;

[0080] 5) Test target project name:

[0081] The test target project name of the embodiment of the present invention is the project name corresponding to the current test target;

[0082] 6) Test target business name set:

[0083] The test target service name set of the embodiment of the present invention is a service name set that needs to be covered by the test target of this test, and is composed of one or more test service names;

[0084] 7)Test report distribution interface collection:

[0085] The test report distribution interface set of the embodiment of the present invention is composed of one or more test report distribution interfaces; the interface types of the test report distribution interface include at least an email interface, a voice notification interface, a multimedia SMS interface, an office system interface, and an office platform interface;

[0086] 8) Pipeline configuration template identification:

[0087] The pipeline configuration template identifier of the embodiment of the present invention is the file template identifier of the pipeline execution file used for this test.

[0088] Step 2: Screen the test cases based on the preset test case library and the first task information to obtain the corresponding first test case file name sequence; and assemble the pipeline execution file based on the preset pipeline configuration template library, the first task information and the first test case file name sequence to obtain the corresponding first execution file name;

[0089] Specifically comprising: step 21, based on the preset test case library and the first task information line test case screening to obtain the corresponding first test case file name sequence;

[0090] Here, the test case library of the embodiment of the present invention includes multiple first use case records; each first use case record corresponds to a test case; each test case is an executable program for testing; the first use case record includes a first use case identifier, a first use case file name, a first use case storage address, a first belonging project name, a first use case adaptation environment and a first use case adaptation service set; wherein: 1) the first use case identifier is the unique identifier of the current test case; 2) the first use case file name is the file name of the current test case; 3) the first use case storage address is the storage address of the current test case; 4) the first belonging project name is the project name of the current test case belonging project; 5) the first use case adaptation environment is used to mark all operating environments that can be tested by the current test case, and the first use case adaptation environment includes multiple first environment marking items; the first environment marking item includes a first environment type and a first marking state, the first environment type includes at least development, testing and production, and the first marking state includes marked and unmarked; 6) the first use case adaptation service set is used to mark all services that can be tested by the current test case, and the first use case adaptation service set includes one or more first service names;

[0091] The specific implementation steps of the current step 21 include:

[0092] Specifically, it includes: step 211, taking the test target running environment type, test target project name and test target business name set of the first task information as the corresponding current environment type, current project name and current business name set;

[0093] Step 212, forming a corresponding first record set from all first case records in the test case library whose first belonging project names match the current project name;

[0094] Step 213, and identify the current environment type; if the current environment type is the development stage operating environment type, then the first use case record in the first record set whose first environment type is development and whose first marking state is marked is recorded as the corresponding second use case record; if the current environment type is the test stage operating environment type, then the first use case record in the first record set whose first environment type is test and whose first marking state is marked is recorded as the corresponding second use case record; if the current environment type is the production stage operating environment type, then the first use case record in the first record set whose first environment type is production and whose first marking state is marked is recorded as the corresponding second use case record; and all the obtained second use case records constitute the corresponding second record set;

[0095] Step 214, and record the second use case record in which each first use case adaptation service set in the second record set includes the current service name set as a corresponding third use case record; and form a corresponding third record set with all the obtained third use case records;

[0096] Step 215, initialize an empty sequence as the corresponding first use case file name sequence; perform a round of traversal on all third records of the third record set; and in this round of traversal, use the third record currently traversed as the corresponding current record; and download the test case stored at the first use case storage address of the current record to the default test case storage directory of the pipeline test tool; and add the first use case file name of the current record to the first use case file name sequence; and at the end of this round of traversal, output the first use case file name sequence finally obtained as the test case screening result of this time;

[0097] Here, the pipeline testing tool mentioned in the embodiment of the present invention includes at least the GitLab-CI tool;

[0098] Step 22, assembling the pipeline execution file based on the preset pipeline configuration template library, the first task information and the first use case file name sequence to obtain the corresponding first execution file name;

[0099] Here, the pipeline configuration template library of the embodiment of the present invention includes multiple first template records; each first template record corresponds to a pipeline execution file template; the first template record includes a first template identifier and a first template storage address; all pipeline execution file templates are identifiable file templates of the pipeline test tool, for example, when the pipeline test tool is the GitLab-CI tool, the corresponding identifiable file template is actually a formatted YML file;

[0100] The specific implementation steps of the current step 22 include:

[0101] Specifically comprising: step 221, taking the test log storage directory address and the pipeline configuration template identifier of the first task information as the corresponding first test log storage directory address and the first pipeline configuration template identifier;

[0102] Step 222: taking the first template record whose first template identifier in the pipeline configuration template library matches the first pipeline configuration template identifier as the corresponding current template record; and downloading the pipeline execution file template stored at the first template storage address of the current template record to obtain the corresponding first pipeline execution file template;

[0103] The first pipeline execution file template includes at least two data configuration items, namely, a log directory data item and a test case sequence data item of the pipeline test tool;

[0104] Step 223, data configuration is performed on the corresponding log directory data items and test case sequence data items in the first pipeline execution file template based on the first test log storage directory address and the first test case file name sequence; and the first pipeline execution file template that has completed data configuration is recorded as the corresponding first pipeline execution file;

[0105] Step 224, based on the preset pipeline execution file naming rules, generate a unique pipeline execution file name for the first pipeline execution file as the corresponding first execution file name; and set the file name of the first pipeline execution file based on the first execution file name; and store the first pipeline execution file with the completed file name setting into the default pipeline execution file storage directory of the pipeline testing tool.

[0106] Here, the pipeline execution file naming rule is a preset file naming rule that can be customized based on actual application requirements. The embodiment of the present invention does not impose technical restrictions on the pipeline execution file naming rule.

[0107] Step 3, the pipeline test tool performs batch test processing according to the first execution file name;

[0108] Specifically comprising: step 31, the pipeline test tool extracts the first pipeline execution file whose file name matches the first execution file name in the tool's default pipeline execution file storage directory as the corresponding current loading file; and uses the tool's default test case storage directory as the corresponding first case directory; and extracts the data configuration content of the log directory data item and the test case sequence data item of the current loading file as the corresponding first log directory and first case sequence;

[0109] Wherein, the first use case sequence includes a plurality of first use case names;

[0110] Step 32, using the first use case name of the first use case sequence as the corresponding current use case file name;

[0111] Step 33, taking the test case whose test case file name matches the current test case file name in the first test case directory as the corresponding current test case; and executing the current test case program; and at the end of the current test case program execution, taking the test feedback status of success or failure output by the current test case as the corresponding current test feedback status; and taking the current test case file name and the current test feedback status as a set of corresponding test case names and tested status to form a corresponding test log file and storing it in the first log directory;

[0112] Step 34, identify whether the current use case file name is the last first use case name of the first use case sequence; if not, extract the next first use case name of the first use case sequence as the new current use case file name and return to step 33; if so, confirm that this batch test is completed.

[0113] Step 4: After the batch test is completed, the test results are analyzed according to the first task information to obtain a corresponding first test report and send it back to the first client;

[0114] Specifically comprising: step 41, taking the task name, test target compilation type, coverage data storage directory address, test log storage directory address and test report distribution interface set of the first task information as the corresponding current task name, current compilation type, current coverage data directory, current log directory and current distribution interface set;

[0115] Step 42, identifying the current compilation type; if the current compilation type is the first type, extracting the tree structure data in the coverage data file stored in the current coverage data directory as the corresponding current tree structure data, and counting the total number of tree node data elements of the current tree structure data to obtain the corresponding first total number, and counting the total number of tree node data elements in the current tree structure data whose data element access status is accessed to obtain the corresponding second total number, and calculating the corresponding current code coverage based on the first and second total numbers = (second total number / first total number) × 100%; if the current compilation type is the second type, setting the corresponding current code coverage to null;

[0116] Step 43, counting the total number of test log files stored in the current log directory to obtain a corresponding third total number; and counting the total number of test log files with a successful test status in the current log directory to obtain a corresponding fourth total number; and using the difference between the third total number and the fourth total number as the corresponding fifth total number; and calculating the corresponding current success rate and current failure rate based on the third, fourth and fifth total numbers, the current success rate = (fourth total number / third total number) × 100%, the current failure rate = (fifth total number / third total number) × 100%; and using the third, fourth and fifth total numbers as the corresponding current total number of test cases, the current total number of successful cases and the current total number of failed cases;

[0117] Step 44, bringing the obtained current task name, current code coverage, current total number of test cases, current total number of successful cases, current total number of failed cases, current success rate and current failure rate into a preset test report graphic template to assemble the test report to obtain a corresponding first test report;

[0118] Here, the test report graphic template of the embodiment of the present invention includes at least seven data configuration items, namely, task name data item, code coverage data item, total number of test cases data item, total number of successful cases data item, total number of failed cases data item, test success rate data item and test failure rate data item;

[0119] It should be noted that the specific assembly process of bringing the obtained current task name, current code coverage, current total number of test cases, current total number of successful cases, current total number of failed cases, current success rate and current failure rate into the preset test report graphic template for test report assembling is a data configuration process, specifically: data configuration of the task name data item based on the current task name, data configuration of the code coverage data item based on the current code coverage, data configuration of the total number of test cases data item based on the current total number of test cases, data configuration of the total number of successful cases data item based on the current total number of successful cases, data configuration of the total number of failed cases data item based on the current total number of failed cases, data configuration of the test success rate data item based on the current success rate, and data configuration of the test failure rate data item based on the current failure rate;

[0120] Step 45: Send the first test report to all test report distribution interfaces in the current distribution interface set.

[0121] Figure 2 This is a module structure diagram of a test task processing device provided in the second embodiment of the present invention. The device is a terminal device or server that implements the aforementioned method embodiment, and can also be a device that enables the aforementioned terminal device or server to implement the aforementioned method embodiment. For example, the device can be a device or chip system of the aforementioned terminal device or server. Figure 2 As shown, the device includes: a task information receiving module 201, a batch test pre-stage processing module 202, a batch test processing module 203 and a batch test post-stage processing module 204.

[0122] The task information receiving module 201 is used to receive the test task information sent by the first client and record it as the corresponding first task information.

[0123] The batch test pre-stage processing module 202 is used to screen the test cases based on the preset test case library and the first task information line to obtain the corresponding first use case file name sequence; and to assemble the pipeline execution file based on the preset pipeline configuration template library, the first task information and the first use case file name sequence to obtain the corresponding first execution file name.

[0124] The batch test processing module 203 is used to perform batch test processing according to the first execution file name by the pipeline test tool; the pipeline test tool at least includes the GitLab-CI tool.

[0125] The batch test post-stage processing module 204 is used to analyze the test results according to the first task information after the batch test is completed, obtain a corresponding first test report and send it back to the first client.

[0126] A test task processing device provided in an embodiment of the present invention can execute the method steps in the above method embodiment. Its implementation principle and technical effects are similar and will not be repeated here.

[0127] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. For example, the task information receiving module can be a separately established processing element, or it can be integrated in a chip of the above device. In addition, it can also be stored in the memory of the above device in the form of program code, and called by a processing element of the above device to execute the function of the above-mentioned determined module. The implementation of other modules is similar. In addition, these modules can be fully or partially integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.

[0128] For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital signal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module above is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0129] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the above method embodiments are generated. The above computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The above-mentioned computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the above-mentioned computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, Bluetooth, microwave, etc.) methods. The above-mentioned computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. The above-mentioned available medium can be a magnetic medium (such as a floppy disk, a hard disk, a tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)), etc.

[0130] Figure 3 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. The electronic device may be a terminal device or a server for implementing the method of the aforementioned embodiment, or may be a terminal device or a server for implementing the method of the aforementioned embodiment connected to the aforementioned terminal device or server. Figure 3 As shown, the electronic device may include: a processor 301 (such as a CPU), a memory 302, and a transceiver 303; the transceiver 303 is coupled to the processor 301, and the processor 301 controls the transceiver 303. Various instructions may be stored in the memory 302 to complete various processing functions and implement the processing steps described in the aforementioned embodiment method. Preferably, the electronic device involved in the embodiment of the present invention also includes: a power supply 304, a system bus 305 and a communication port 306. The system bus 305 is used to realize the communication connection between components. The above-mentioned communication port 306 is used for connecting and communicating between the electronic device and other peripherals.

[0131] exist Figure 3The system bus 305 mentioned in the figure can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface is used to realize the communication between the database access device and other devices (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM), and may also include non-volatile memory (Non-Volatile Memory), such as at least one disk storage.

[0132] The above-mentioned processor can be a general-purpose processor, including a central processing unit CPU, a network processor (Network Processor, NP), a graphics processing unit (Graphics Processing Unit, GPU), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0133] It should be noted that an embodiment of the present invention further provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the method and processing process provided in the above embodiments.

[0134] The embodiment of the present invention provides a method, device, electronic device and computer-readable storage medium for processing a test task. As can be seen from the above content, the embodiment of the present invention receives the test task information sent by the first client and records it as the corresponding first task information; based on the preset test case library and the first task information, the test case is screened to obtain the corresponding first case file name sequence; and based on the preset pipeline configuration template library, the first task information and the first case file name sequence, the pipeline execution file is assembled to obtain the corresponding first execution file name; and the pipeline test tool performs batch test processing according to the first execution file name; and after the batch test is completed, the test results are analyzed according to the first task information to obtain the corresponding first test report and send it back to the first client. The embodiment of the present invention can automatically complete the test case selection work based on the task configuration information before using the pipeline test tool, and can automatically complete the test result analysis and test report distribution work based on the task configuration information after using the pipeline test tool; through the embodiment of the present invention, on the one hand, the automation level of the above-mentioned two-stage processing process is effectively improved, and on the other hand, the execution efficiency of the overall test task is further improved.

[0135] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0136] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for processing a test task, characterized in that: The method comprises: The test task information received from the first client is recorded as the corresponding first task information; Based on the preset test case library and the first task information, the test case is screened to obtain a corresponding first test case file name sequence; and based on the preset pipeline configuration template library, the first task information and the first test case file name sequence, the pipeline execution file is assembled to obtain a corresponding first execution file name; The pipeline testing tool performs batch testing according to the first executable file name; the pipeline testing tool at least includes a GitLab-CI tool; After the batch test is completed, the test results are analyzed according to the first task information to obtain a corresponding first test report which is sent back to the first client.

2. The method for processing a test task according to claim 1, characterized in that: The first task information includes task name, test target operating environment type, test target compilation type, coverage data storage directory address, test log storage directory address, test target project name, test target business name set, test report distribution interface set and pipeline configuration template identifier; The test target operating environment type is the current operating environment type of the test target, including at least the development phase operating environment type, the test phase operating environment type and the production phase operating environment type; The test target compilation type includes at least a first type and a second type; when the test target compilation type is the first type, it means that all target programs of the test target are compiled by a compiler integrated with a code coverage analysis tool; when the test target compilation type is the second type, it means that all target programs of the test target are compiled by a compiler that does not integrate a code coverage analysis tool; the code coverage analysis tools include at least Gocover, Gorched, GCC, JaCoCo, Istanbul, and VS Code; When the test target compilation type is the first type, the coverage data storage directory address is the storage directory address of the coverage data file output by this test process; the data content of the coverage data file is a tree structure data; the tree structure data includes a plurality of tree node data elements; each of the tree node data elements corresponds to a section of compiled code in all target programs of this test target; each of the tree node data elements includes a data element access status, and the data element access status includes accessed and not accessed; the data element access status of all the tree node data elements is set to not accessed during initialization; On the premise that all target programs of the test target are compiled by a compiler integrated with the code coverage analysis tool, the code coverage analysis tool tracks the execution status of each compiled code segment during the running process of the test target and sets the data element access status of the tree node data element corresponding to the currently executed compiled code in the tree structure data of the coverage data file to have been accessed when any compiled code segment is executed; When the test target compilation type is the second type, the coverage data storage directory address is empty; The test log storage directory address is the storage directory address of the test log file output by this test; each of the test log files corresponds to a test case; the data content of the test log file includes at least the test case name and the test status; The test case name is the file name of the current test case; The test status is the test feedback status of the current test case, including success and failure; The test target project name is the project name corresponding to this test target; The test target service name set is a service name set that needs to be covered by the test target of this test, and is composed of one or more test service names; The test report distribution interface set is composed of one or more test report distribution interfaces; the interface types of the test report distribution interface at least include an email interface, a voice notification interface, a multimedia SMS interface, an office system interface, and an office platform interface; The pipeline configuration template identifier is a file template identifier of the pipeline execution file used for this test; The test case library includes a plurality of first use case records; each of the first use case records corresponds to a test case; each test case is an executable program for testing; the first use case record includes a first use case identifier, a first use case file name, a first use case storage address, a first belonging project name, a first use case adaptation environment and a first use case adaptation service set; The first test case identifier is a unique identifier of the current test case; The first test case file name is the file name of the current test case; The first test case storage address is the storage address of the current test case; The first belonging project name is the project name of the current test case belonging project; The first use case adaptation environment is used to mark all running environments that can be tested by the current test case, and the first use case adaptation environment includes multiple first environment marking items; the first environment marking item includes a first environment type and a first marking state, the first environment type includes at least development, testing and production, and the first marking state includes marked and unmarked; The first use case adaptation service set is used to mark all services that can be tested by the current test case, and the first use case adaptation service set includes one or more first service names; The pipeline configuration template library includes multiple first template records; each of the first template records corresponds to a pipeline execution file template; the first template record includes a first template identifier and a first template storage address; all the pipeline execution file templates are identifiable file templates of the pipeline testing tool.

3. The method for processing a test task according to claim 2, characterized in that: The screening of the test cases based on the preset test case library and the first task information line to obtain the corresponding first test case file name sequence specifically includes: The test target running environment type, the test target project name and the test target business name set of the first task information are used as the corresponding current environment type, current project name and current business name set; And the first use case records whose first belonging project names match the current project name in the test case library form a corresponding first record set; And identify the current environment type; if the current environment type is a development stage operating environment type, then the first use case record in the first record set whose first environment type is development and whose first marking state is marked is recorded as the corresponding second use case record; if the current environment type is a test stage operating environment type, then the first use case record in the first record set whose first environment type is test and whose first marking state is marked is recorded as the corresponding second use case record; if the current environment type is a production stage operating environment type, then the first use case record in the first record set whose first environment type is production and whose first marking state is marked is recorded as the corresponding second use case record; and all the obtained second use case records constitute the corresponding second record set; and recording the second use case records in the second record set, in which each of the first use case adaptation service sets includes the current service name set, as corresponding third use case records; and forming a corresponding third record set from all the obtained third use case records; And initialize an empty sequence as the corresponding first use case file name sequence; and perform a round of traversal on all the third records of the third record set; and in this round of traversal, use the third record currently traversed as the corresponding current record; and download the test case stored at the first use case storage address of the current record to the default test case storage directory of the pipeline testing tool; and add the first use case file name of the current record to the first use case file name sequence; and at the end of this round of traversal, output the final first use case file name sequence as the test case screening result.

4. The method for processing a test task according to claim 2, characterized in that: The step of assembling the pipeline execution file based on the preset pipeline configuration template library, the first task information and the first use case file name sequence to obtain the corresponding first execution file name specifically includes: Step 41, using the test log storage directory address and the pipeline configuration template identifier of the first task information as the corresponding first test log storage directory address and first pipeline configuration template identifier; Step 42: taking the first template record in the pipeline configuration template library whose first template identifier matches the first pipeline configuration template identifier as the corresponding current template record; and downloading the pipeline execution file template stored at the first template storage address of the current template record to obtain the corresponding first pipeline execution file template; The first pipeline execution file template includes at least two data configuration items, namely, a log directory data item and a test case sequence data item of the pipeline test tool; Step 43, based on the first test log storage directory address and the first use case file name sequence, data configuration is performed on the corresponding log directory data item and the test case sequence data item in the first pipeline execution file template; and the first pipeline execution file template that has completed data configuration is recorded as the corresponding first pipeline execution file; Step 44, based on the preset pipeline execution file naming rules, generate a unique pipeline execution file name for the first pipeline execution file as the corresponding first execution file name; and set the file name of the first pipeline execution file based on the first execution file name; and store the first pipeline execution file with the completed file name setting into the default pipeline execution file storage directory of the pipeline testing tool.

5. The method for processing a test task according to claim 4, characterized in that: The batch testing process performed by the pipeline testing tool according to the first executable file name specifically includes: Step 51, the pipeline test tool extracts the first pipeline execution file whose file name matches the first execution file name in the tool's default pipeline execution file storage directory as the corresponding current loading file; and uses the tool's default test case storage directory as the corresponding first case directory; and extracts the data configuration content of the log directory data item and the test case sequence data item of the currently loaded file as the corresponding first log directory and first case sequence; Wherein, the first use case sequence includes a plurality of first use case names; Step 52, using the first use case name of the first use case sequence as the corresponding current use case file name; Step 53, taking the test case whose test case file name matches the current test case file name in the first test case directory as the corresponding current test case; and executing the current test case program; and at the end of the current test case program execution, taking the test feedback status of success or failure output by the current test case as the corresponding current test feedback status; and taking the current test case file name and the current test feedback status as a set of corresponding test case names and tested status to form a corresponding test log file and storing it in the first log directory; Step 54, identify whether the current use case file name is the last first use case name in the first use case sequence; if not, extract the next first use case name in the first use case sequence as the new current use case file name and return to step 53; if so, confirm that this batch test is completed.

6. The method for processing a test task according to claim 2, characterized in that: The analyzing the test result according to the first task information to obtain a corresponding first test report and sending it back to the first client specifically includes: Step 61, taking the task name of the first task information, the test target compilation type, the coverage data storage directory address, the test log storage directory address and the test report distribution interface set as the corresponding current task name, current compilation type, current coverage data directory, current log directory and current distribution interface set; Step 62, identifying the current compilation type; if the current compilation type is the first type, extracting the tree structure data in the coverage data file stored in the current coverage data directory as the corresponding current tree structure data, and counting the total number of the tree node data elements of the current tree structure data to obtain the corresponding first total number, and counting the total number of the tree node data elements in the current tree structure data whose data element access status is accessed to obtain the corresponding second total number, and calculating the corresponding current code coverage based on the first and second total numbers = (second total number / first total number) × 100%; if the current compilation type is the second type, setting the corresponding current code coverage to null; Step 63, counting the total number of the test log files stored in the current log directory to obtain a corresponding third total number; and counting the total number of the test log files in the current log directory whose test status is successful to obtain a corresponding fourth total number; and subtracting the difference between the third total number and the fourth total number as the corresponding fifth total number; and calculating the corresponding current success rate and current failure rate based on the third, fourth and fifth total numbers, the current success rate = (fourth total number / third total number) × 100%, the current failure rate = (fifth total number / third total number) × 100%; and using the third, fourth and fifth total numbers as the corresponding current total number of test cases, the current total number of successful cases and the current total number of failed cases; Step 64, bringing the obtained current task name, the current code coverage, the current total number of test cases, the current total number of successful cases, the current total number of failed cases, the current success rate and the current failure rate into a preset test report graphic template to assemble the test report to obtain the corresponding first test report; Wherein, the test report graphic template includes at least seven data configuration items, namely, a task name data item, a code coverage data item, a total number of test cases data item, a total number of successful cases data item, a total number of failed cases data item, a test success rate data item and a test failure rate data item; when assembling the test report, the task name data item is data configured based on the current task name, the code coverage data item is data configured based on the current code coverage, the total number of test cases data item is data configured based on the current total number of test cases, the total number of successful cases data item is data configured based on the current total number of successful cases, the total number of failed cases data item is data configured based on the current total number of failed cases, the test success rate data item is data configured based on the current success rate, and the test failure rate data item is data configured based on the current failure rate; Step 65: Send the first test report to all the test report distribution interfaces in the current distribution interface set.

7. A device for executing the processing method of the test task according to any one of claims 1 to 6, characterized in that: The device comprises: a task information receiving module, a batch test pre-stage processing module, a batch test processing module and a batch test post-stage processing module; The task information receiving module is used to receive the test task information sent by the first client and record it as the corresponding first task information; The batch test pre-stage processing module is used to screen the test cases based on the preset test case library and the first task information to obtain the corresponding first test case file name sequence; and to assemble the pipeline execution file based on the preset pipeline configuration template library, the first task information and the first test case file name sequence to obtain the corresponding first execution file name; The batch test processing module is used for the pipeline test tool to perform batch test processing according to the first executable file name; the pipeline test tool at least includes a GitLab-CI tool; The batch test post-stage processing module is used to analyze the test results according to the first task information after the batch test is completed, obtain a corresponding first test report and send it back to the first client.

8. An electronic device, characterized in that: include: memory, processors, and transceivers; The processor is used to couple with the memory, read and execute instructions in the memory, so as to implement the method according to any one of claims 1 to 6; The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a computer, the computer is enabled to execute the method according to any one of claims 1 to 6.