A method, system, device and product for generating and running concurrent test cases

By using timing tags in concurrent testing to define the execution order of concurrent tasks, the problem of unstable test results in traditional concurrent testing is solved, automatic generation and stable reproduction of test cases are realized, and the accuracy and reliability of testing are improved. , to meet diverse testing needs.

CN118467396BActive Publication Date: 2024-10-29JIANGSU HUAKU DATA TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410902973.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-08
Publication Date
2024-10-29
Estimated Expiration
2044-07-08

AI Technical Summary

Technical Problem

Traditional concurrency testing methods lead to unstable test results due to the randomness of tasks, and the artificially constructed stable concurrency use cases are single and unable to meet complex and changeable testing requirements.

Method used

Timing tags are used to define the execution order of concurrent tasks, and configuration file parameters and execution logs are combined to achieve automated generation and stable reproduction of test cases.

Benefits of technology

By clearly defining the execution order of concurrent tasks, the accuracy and reliability of testing are improved, the problem of unreliable reproducibility caused by the randomness of tasks is solved, and the diversified testing needs are met, avoiding the manual construction of stable concurrent use cases. Unity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118467396B_ABST
    Figure CN118467396B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of software testing technology, and specifically discloses a method, system, device and product for generating and running concurrent test cases, the method comprising: obtaining configuration file parameters; generating a logic execution plan using test cases according to the configuration file parameters; adding a timing tag to the test task of the logic execution plan in combination with the configuration file parameters and the current timestamp, running the test tasks in sequence according to the timing tag, tracking the test process until the logic execution plan completes the test, and recording the execution log. The present invention designs a timing tag, which can clearly define the execution order of concurrent tasks, and can conveniently locate the test case in combination with the execution log, thereby realizing the automatic generation and stable reproduction of the test case.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of software testing technology, and in particular to a method, system, device and product for generating and running concurrent test cases. Background Art

[0002] In the process of software development and testing, concurrent testing is a key link to ensure that the software runs stably in a multi-user, multi-task environment. However, the number and execution order of concurrent tasks in traditional concurrent testing methods are usually random or based on a certain probability distribution, which leads to different system states and behaviors each time the test is run. Even if the same test case is used, it is difficult to ensure that each test can get completely consistent results, resulting in unstable and unpredictable test results. In addition, the way of manually constructing stability concurrent test cases is single and cannot meet complex and changeable testing requirements. Therefore, how to automatically generate stability concurrent test cases and achieve their stable reproduction has become an urgent problem to be solved in the current software testing field. Summary of the invention

[0003] The present invention aims to solve the problem of the inability to stably reproduce the execution process of the test case due to the randomness of the task in the stability concurrent test and the singleness of the artificially constructed stability concurrent test case. To this end, the present invention provides a method, system, device and product for generating and running concurrent test cases, and designs a timing label to clearly define the execution order of concurrent tasks. In combination with the execution log, the test case can be conveniently located to realize the automatic generation and stable reproduction of the test case.

[0004] The present invention provides a method for generating and running concurrent test cases, and the technical solution adopted is as follows: comprising:

[0005] Get configuration file parameters;

[0006] Generate a logical execution plan using the test case according to the configuration file parameters;

[0007] Combine the configuration file parameters and the current timestamp, add a timing tag to the test task of the logic execution plan, run the test tasks sequentially according to the timing tag, track the test process until the logic execution plan completes the test, and record the execution log.

[0008] Furthermore, the configuration file parameters include test tasks, concurrent interval duration, task parallelism, overall running time of concurrent test tasks and timeout mechanism.

[0009] Furthermore, according to the configuration file parameters, the process of generating a logic execution plan using the test case is as follows:

[0010] Obtaining a test case corresponding to the test task, and establishing an association relationship between the test task and the test case;

[0011] Arrange and combine the test tasks in a full arrangement manner to obtain an execution plan;

[0012] The execution plan is screened according to the task parallelism to obtain a logical execution plan.

[0013] Furthermore, the configuration file parameters also include one or both of a single task execution position and a fixed task combination;

[0014] According to the configuration file parameters, the process of generating a logical execution plan using test cases is as follows:

[0015] Obtaining a test case corresponding to the test task, and establishing an association relationship between the test task and the test case;

[0016] Fix the position of the test task corresponding to the single task execution position in the permutation and combination; permutate and combine the other test tasks in a full permutation manner to obtain an execution plan sequence, and the multiple test tasks corresponding to the fixed task combination are regarded as one test task participating in the permutation and combination;

[0017] The execution plan is screened according to the task parallelism to obtain a logical execution plan.

[0018] Further, in combination with the configuration file parameters and the current timestamp, a timing tag is added to the test task of the logic execution plan, and according to the timing tag, the test task is sequentially run, and the test process is tracked until the logic execution plan completes the test process:

[0019] According to the concurrent order of the test tasks in the logical execution plan, combined with the current timestamp and the concurrent interval duration, adding timing tags to the test tasks whose number is the task parallelism;

[0020] According to the timing labels, the test tasks are sequentially pulled up, and the test cases corresponding to the test tasks are run;

[0021] When the test task is finished, according to the concurrent order, combined with the current timestamp and the concurrent interval duration, a timing tag is added to the next test task, and then the test task is started;

[0022] When all the test tasks of the logic execution plan have been started and the next test task needs to be started, a new round of test tasks is started according to the concurrent order of the logic execution plan;

[0023] The actual running time of the logic execution plan is continuously tracked, and when the actual running time reaches the overall running time of the concurrent test task, the timeout mechanism is executed to complete the test of the logic execution plan.

[0024] Furthermore, the structure of the time series label is Casex_{datetime}_{num}_{c},

[0025] Casex indicates the name of the test task, {datetime} indicates the time when the test task is started, {datetime} is determined by the current timestamp, {num}, and the concurrency interval, {num} indicates the order of starting and joining the concurrency, and {c} indicates the number of times the test task is started.

[0026] Furthermore, after one of the logic execution plans completes the test, another logic execution plan is executed until all of the logic execution plans complete the test.

[0027] The present invention also provides a concurrent test case generation and operation system, which adopts the following technical solution: comprising: a concurrent scenario construction device, a test case library and a case operation device, wherein the concurrent scenario construction device is connected to the test case library and the case operation device respectively,

[0028] The concurrent scenario construction device is used to obtain configuration file parameters and generate a logical execution plan using test cases according to the configuration file parameters;

[0029] The test case library is used to store test cases;

[0030] The use case running device is used to combine the configuration file parameters and the current timestamp to add a timing tag to the test task of the logic execution plan, run the test task sequentially according to the timing tag, track the test process until the logic execution plan completes the test, and record the execution log.

[0031] The present invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned method for generating and running a concurrent test case when executing the computer program.

[0032] The present invention also provides a computer program product, including a computer program, which implements the above-mentioned method for generating and running concurrent test cases when executed by a processor.

[0033] The above one or more technical solutions in the embodiments of the present invention have at least one of the following technical effects:

[0034] 1. The present invention introduces timing labels and their automatic generation mechanism, adds timing labels to test tasks, and runs test tasks in sequence according to the timing labels, which can clearly define the execution order of concurrent test tasks. Combined with the execution log, the test cases that cause problems can be easily located, thereby meeting the needs of stable reproduction and diversified testing of test cases, improving the accuracy and reliability of the test, and solving the problem of being unable to stably reproduce the execution process of test cases due to task randomness in stability concurrent testing.

[0035] 2. The present invention designs a single-task execution position and a fixed task combination. Testers can use these two parameters to customize the concurrent order as needed. The remaining test tasks adopt a random concurrent order, which is combined with the task parallelism requirements to ultimately generate an effective logic test plan that can meet diverse testing needs, avoid the exhaustive enumeration of manual test scenarios, and solve the problem of the singleness of manually constructed stable concurrent use cases.

[0036] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0038] Figure 1 It is a flow chart of the method provided by the present invention.

[0039] Figure 2 It is a structural block diagram of the system provided by the present invention.

[0040] Reference numerals:

[0041] 1. Concurrent scenario construction device; 2. Test case library; 3. Test case running device. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical scheme and advantages of the present invention clearer, the technical scheme of the present invention will be clearly and completely described below in conjunction with the drawings in the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present invention. The following embodiments are used to illustrate the present invention, but cannot be used to limit the scope of the present invention.

[0043] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiment of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0044] Combine the following Figure 1 and Figure 2 The present invention is further described in detail, and a method, system, device and product for generating and running concurrent test cases of the present invention are described as follows:

[0045] In this embodiment, Figure 1 As shown, a method for generating and running concurrent test cases is provided, comprising the following steps:

[0046] Step 1: Obtain configuration file parameters, including test tasks, concurrent interval duration, task parallelism, overall running time of concurrent test tasks, timeout mechanism, single task execution position, and fixed task combination.

[0047] Test task [case1, case2, ... casen]: indicates the test task involved in concurrent testing. Its name is the same as the test case required for concurrent testing.

[0048] Concurrency interval duration dt: indicates the time interval between the start of execution of two test tasks. The default is no interval, that is, the concurrent interval duration is 0.

[0049] Task parallelism para_degree: indicates the parallelism of concurrent tasks.

[0050] Total_runtime: indicates the total time required for all test tasks from start to finish.

[0051] Timeout mechanism run_timeout: indicates whether to force the test to terminate the task or continue to complete the currently called test task when the actual running time of the concurrent test reaches Total_runtime. When the timeout mechanism is cancel, the test task is forced to terminate; when the running timeout mechanism is current_finish, the called test task is terminated when it is completed.

[0052] Single task execution position exec_pos: indicates the starting position of a test task or fixed task combination within a set of concurrent tasks. This test item is optional and defaults to any position. When it is required to be filled in, its format is: [1, 1], indicating that the first test task must be started first.

[0053] Fixed task combination case_group: represents a list of use cases with a fixed concurrent order. This item is optional and defaults to all permutations and combinations.

[0054] Step 2: Generate a logical execution plan using the test case according to the configuration file parameters. The specific process is:

[0055] Step 2.1: Obtain the test case corresponding to the test task, and establish an association relationship between the test task and the test case.

[0056] This step obtains all the test cases corresponding to the test task according to the test task, and establishes an association between the test task and the test case, so that the test case can be run in time when the test task is pulled up later. At the same time, this step also checks whether the test case exists.

[0057] Step 2.2: Combining the single task execution position and the fixed task combination, the test tasks are arranged and combined in a full arrangement manner to obtain an execution plan, specifically:

[0058] Fixing the position of the test task corresponding to the single task execution position in the permutation and combination;

[0059] The other test tasks are arranged and combined in a full arrangement manner to obtain an execution plan sequence; the multiple test tasks corresponding to the fixed task combination are regarded as one test task participating in the arrangement and combination; and each arrangement and combination of the test tasks is regarded as an execution plan.

[0060] Single task execution position and fixed task combination are two options that can limit the concurrent order of one or more test tasks. Testers can use these two parameters to customize the concurrent order as needed.

[0061] If the tester does not set a single task execution position and a fixed task combination, all the test tasks are directly arranged in this step, and the arrangement and combination of each test task obtained is used as an execution plan.

[0062] Since the test tasks are randomly combined in a full permutation manner, generally, this step will obtain a large number of execution plans.

[0063] Step 2.3: Some of the execution plans cannot meet the task parallelism requirement. Therefore, according to the task parallelism, select the execution plans that can meet the task parallelism requirement as logical execution plans. Generally, the number of logical execution plans is much smaller than the number of execution plans. Each logical execution plan determines a concurrent sequence combination of the test tasks.

[0064] In step 2, the concurrent order of some test tasks is fixed through single-task execution positions and fixed task combinations, while other test tasks adopt random concurrent order. A large number of execution plans are obtained, and then combined with the parallelism requirements, an effective logical test plan is generated to meet diverse testing needs.

[0065] In step 2, a configuration description fragment may be generated according to the configuration file parameters, and then a logical execution plan may be generated according to the configuration description fragment. In this way, the same test task can be tested multiple times using different parameters, simplifying the operation of the tester inputting the configuration file parameters. For example, two concurrent tests differ only in that the task parallelism is set to 2 and 3 respectively. Another example: two concurrent tests differ only in that one has a single task execution position requirement and the other does not.

[0066] Step 3: Combine the configuration file parameters and the current timestamp to add a timing tag to the test task of the logic execution plan, run the test task in sequence according to the timing tag, track the test process until the logic execution plan completes the test, and record the execution log. After one logic execution plan completes the test, execute another logic execution plan until all the logic execution plans complete the test.

[0067] The structure of the timing label is Casex_{datetime}_{num}_{c}, where Casex represents the name of the test task; {datetime} represents the time when the test task is started, accurate to microseconds, and {datetime} is determined by the current timestamp, {num}, and the duration of the concurrent interval; {num} represents the order of starting and joining the concurrency, which is determined according to the concurrent order of the test tasks in the logical execution plan; {c} represents the number of times the test task is started. The timing label serves as an identifier to ensure that each concurrent test task has a unique execution order and position, thereby achieving stable reproduction of test cases.

[0068] A specific test process of the logic execution plan is as follows:

[0069] According to the concurrent order of the test tasks in the logical execution plan, combined with the current timestamp and the concurrent interval duration, add timing tags to the test tasks with the number of task parallelism; the current timestamp here is the time when the first test task is started. According to the timing tags, pull up the test tasks in sequence and run the test cases corresponding to the test tasks. It should be noted that when the concurrent interval duration is 0, the test tasks with added timing tags will be pulled up at the same time.

[0070] When the test task ends, add a timing tag to the next test task according to the concurrent order, combined with the current timestamp and the concurrent interval length, and then pull up the test task; the current timestamp here is the end time of the test task. When all the test tasks of the logical execution plan have been pulled up and the next test task needs to be pulled up, pull up a new round of test tasks according to the concurrent order of the logical execution plan.

[0071] During the test of the logic execution plan, the execution process and the execution result are recorded in the execution log so as to track and trace the test process. At the same time, the actual running time is continuously tracked. When the actual running time reaches the overall running time of the concurrent test task, the timeout mechanism is executed to complete the test of the logic execution plan.

[0072] The working process of this method is explained below with a specific example. The specific steps are as follows:

[0073] Step 1: Get the configuration file parameters, which are as follows: the test tasks are [case1, case2, case3, case4, case5]; the concurrency interval is 1 microsecond; the task parallelism is 3; the single task execution position is [1,1], indicating that case1 must be pulled up first; the overall running time of the concurrent test tasks is 120,000 microseconds; the fixed task combination is [case2, case3], indicating that case2 and case3 must be pulled up at the same time; the timeout mechanism is cancel.

[0074] Step 2: Perform format verification and logic verification on the content of the configuration file parameters, and then generate a configuration description fragment, the content of which is as follows:

[0075] "testConfiguration": {

[0076] test_cases:[case1, case2, case3, case4, case5],

[0077] runtime_rules[

[0078] {

[0079] rule_id:”1”,

[0080] dt:”1”

[0081] total_runtime:"120000",

[0082] run_timeout:"cancel"

[0083] para_degree:”3”

[0084] exec_pos:”[1,1]”,

[0085] exec_q:[

[0086] case 1,

[0087] [case2,case3],

[0088] Case 4,

[0089] Case 5, ]

[0091] } ]

[0093] }.

[0094] Perform the following steps according to the configuration description fragment:

[0095] Step 2.1: Obtain the test cases corresponding to the five test tasks, and establish an association relationship between the test tasks and the test cases.

[0096] Step 2.2: The single task execution position [1,1] constrains case 1 to appear only in the first position.

[0097] The fixed task combination [case2, case3] constrains [case2, case3] to be considered as one element to participate in the permutation and combination.

[0098] At this time, it is equivalent to arranging and combining 3 elements in a full permutation manner, so the number of execution plans is 3!=6: specifically:

[0099] Plan1:case1,[case2,case3],case4,case5;

[0100] Plan2: case1,[case2,case3],case5,case4;

[0101] Plan3: case1, case4, [case2, case3], case5;

[0102] Plan4: case1, case5, [case2, case3], case4;

[0103] Plan5: case1, case4, case5, [case2, case3];

[0104] Plan6: case1, case5, case4, [case2, case3].

[0105] Step 2.3: The task parallelism is 3, that is, a maximum of 3 test tasks can be pulled up at the same time. For Plan3, after case1 and case4 are pulled up, [case2, case3] need to be pulled up at the same time. At this time, the number of test tasks pulled up exceeds 3, so Plan3 cannot meet the task parallelism requirements. The situation of Plan4 is similar to Plan3. For Plan5, after case1, case4 and case5 are pulled up, when one of the test tasks is completed, for example, case1 is completed, another test task needs to be pulled up, but [case2, case3] need to be pulled up at the same time. At this time, the number of test tasks pulled up exceeds 3, so Plan5 cannot meet the task parallelism requirements. The situation of Plan6 is similar to Plan5. Therefore, the resulting logical execution plan is:

[0106] Plan1:case1,[case2,case3],case4,case5;

[0107] Plan2: case1,[case2,case3],case5,case4.

[0108] Step 3: Test Plan 1 first, with a task parallelism of 3. Add timing labels to the first three test tasks of Plan 1, which are:

[0109] case1_{current_datetime}_{1}_{1}, case2_{current_datetime+dt}_{2}_{1}, case3_{current_datetime+2dt}_{3}_{1}.

[0110] current_datetime is the time when the first test task (case1) is started, that is, the current timestamp.

[0111] According to the above three timing labels, case 1, case 2 and case 3 are pulled up in sequence for testing. During the test, the execution process and results are recorded in the execution log. At the same time, the actual running time is continuously tracked.

[0112] When one of case1, case2, and case3 ends, for example, case1 ends, you need to add a timing label to the next test task, that is, add a timing label to case4, with the content case4_{current_datetime'+dt}_{4}_{1}, where current_datetime' is the current timestamp when case1 ends.

[0113] When all the test tasks of the logic execution plan have been started and the next test task needs to be started, for example, case1, case2 and case3 have all been completed, and case4 and case5 are running, according to the task parallelism requirement, another test task needs to be started at this time, then a new round of the test tasks is started, and a timing label is added to case1 again in the concurrent order, the value of {c} in the timing label is +1, {num} is reset, and the timing label is: case1_{current_datetime2}_{1}_{2}, and then case1 is started again.

[0114] When the actual running time reaches the overall running time of the concurrent test task, that is, the actual running time reaches 120 microseconds, the timeout mechanism is executed. The timeout mechanism is cancel, which forcibly terminates the test task. The test of Plan 1 is completed.

[0115] Then, the same method is used to test Plan 2. The Plan 2 test is completed and this test ends.

[0116] In addition, when the concurrency interval is 0, that is, dt = 0, the time series labels added to the first three test tasks of Plan1 are: case1_{current_datetime}_{1}_{1}, case2_{current_datetime}_{1}_{1}, case3_{current_datetime}_{1}_{1}. Case1, case2, and case3 will be pulled up at the same time.

[0117] After case1 is finished running, the content of the time series label added to case4 is case4_{current_datetime'}_{4}_{1}.

[0118] In this embodiment, Figure 2As shown, a concurrent test case generation and operation system is also provided, and the technical solution adopted is as follows: it includes: a concurrent scenario construction device 1, a test case library 2 and a case running device 3, and the concurrent scenario construction device 1 is connected to the test case library 2 and the case running device 3 respectively.

[0119] The concurrent scenario construction device 1 is used to obtain configuration file parameters and generate a logic execution plan using test cases according to the configuration file parameters.

[0120] The test case library 2 is used to store test cases. Test cases are executed serially, which ensures the consistency and predictability of test cases and provides a basis for automatically generating stable concurrent test cases.

[0121] The use case running device 3 is used to combine the configuration file parameters and the current timestamp to add a timing tag to the test task of the logic execution plan, run the test task sequentially according to the timing tag, track the test process until the logic execution plan completes the test, and record the execution log.

[0122] The working process of this system is:

[0123] The concurrent scenario construction device 1 obtains the test-related configuration file parameters input by the tester. The configuration file parameters include test tasks, concurrent interval duration, task parallelism, single task execution position, concurrent test task overall running time, fixed task combination and timeout mechanism. Test tasks, concurrent interval duration, task parallelism, concurrent test task overall running time and timeout mechanism are required items. Single task execution position and fixed task combination are optional. The concurrent scenario construction device 1 searches for the corresponding test task from the test case library 2 according to the test task, caches the test case in the concurrent scenario construction device 1, and establishes an association relationship between the test task and the test case. Then fix the position of the test task corresponding to the single task execution position in the permutation and combination; permutate and combine the other test tasks in a full permutation manner to obtain an execution plan sequence; the multiple test tasks corresponding to the fixed task combination are regarded as one test task participating in the permutation and combination; and each permutation and combination of the test tasks is regarded as an execution plan. Finally, according to the task parallelism, the execution plan that can meet the requirements of task parallelism is screened as a logical execution plan. The logic execution plan and configuration file parameters are transmitted to the use case running device 3 .

[0124] The use case running device 3 tests all the logic execution plans in sequence. When testing each logic execution plan, according to the concurrent order of the test tasks in the logic execution plan, combined with the current timestamp and the concurrent interval duration, a timing tag is added to the test tasks whose number is the task parallelism; the current timestamp here is the time when the first test task is pulled up and starts running. According to the timing tag, the test tasks are pulled up in sequence, and the test cases corresponding to the test tasks are run. When the test task ends, according to the concurrent order, combined with the current timestamp and the concurrent interval duration, a timing tag is added to the next test task, and then the test task is pulled up; the current timestamp here is the end time of the test task. When all the test tasks of the logic execution plan have been pulled up, and the next test task needs to be pulled up, a new round of the test tasks is pulled up according to the concurrent order of the logic execution plan. During the testing process of the logic execution plan, the execution process and execution results are recorded in the execution log so as to track and trace the test process. At the same time, the actual running time is continuously tracked, and when the actual running time reaches the overall running time of the concurrent test task, the timeout mechanism is executed to complete the test of the logic execution plan.

[0125] The use case running device 3 adds a timing tag to each test task, records the detailed process of the use case call running, and ensures the controllability, traceability and traceability requirements of the concurrent test cases.

[0126] The present invention uses the timing tag as an identifier to ensure that each concurrent test task has a unique execution order, thereby achieving stable reproduction of test cases. Through the present invention, testers can easily design concurrent scenarios, automatically generate stability concurrent test cases, and achieve stable reproduction of test cases. At the same time, the present invention solves the singleness problem of manually constructing stability concurrent test cases and provides a more flexible and diversified testing method.

[0127] This embodiment also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned method for generating and running concurrent test cases when executing the computer program.

[0128] This embodiment also provides a computer program product, including a computer program, which implements the above-mentioned method for generating and running concurrent test cases when executed by a processor.

[0129] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for generating and running concurrent test cases, characterized in that: include: Obtain configuration file parameters; the configuration file parameters include test tasks, concurrent interval duration, task parallelism, overall running time of concurrent test tasks and timeout mechanism; Generate a logical execution plan using the test case according to the configuration file parameters; Combine the configuration file parameters and the current timestamp, add a timing tag to the test task of the logic execution plan, run the test task in sequence according to the timing tag, track the test process until the logic execution plan completes the test, and record the execution log; The process of adding a timing tag to the test task of the logic execution plan in combination with the configuration file parameters and the current timestamp, and sequentially running the test tasks according to the timing tag, and tracking the test process until the logic execution plan completes the test is as follows: According to the concurrent order of the test tasks in the logical execution plan, combined with the current timestamp and the concurrent interval duration, adding timing tags to the test tasks whose number is the task parallelism; The structure of the time series label is Casex_{datetime}_{num}_{c}, Casex indicates the name of the test task, {datetime} indicates the time when the test task is started, {datetime} is determined by the current timestamp, {num}, and the concurrency interval, {num} indicates the order of starting and joining the concurrency, and {c} indicates the number of times the test task is started. According to the timing labels, the test tasks are sequentially pulled up, and the test cases corresponding to the test tasks are run; When the test task is finished, according to the concurrent order, combined with the current timestamp and the concurrent interval duration, a timing tag is added to the next test task, and then the test task is started; When all the test tasks of the logic execution plan have been started and the next test task needs to be started, a new round of test tasks is started according to the concurrent order of the logic execution plan; The actual running time of the logic execution plan is continuously tracked, and when the actual running time reaches the overall running time of the concurrent test task, the timeout mechanism is executed to complete the test of the logic execution plan.

2. A method for generating and running concurrent test cases as claimed in claim 1, characterized in that: According to the configuration file parameters, the process of generating a logical execution plan using test cases is as follows: Obtaining a test case corresponding to the test task, and establishing an association relationship between the test task and the test case; Arrange and combine the test tasks in a full arrangement manner to obtain an execution plan; The execution plan is screened according to the task parallelism to obtain a logical execution plan.

3. A method for generating and running concurrent test cases as claimed in claim 1, characterized in that: The configuration file parameters also include one or both of a single task execution position and a fixed task combination; According to the configuration file parameters, the process of generating a logical execution plan using test cases is as follows: Obtaining a test case corresponding to the test task, and establishing an association relationship between the test task and the test case; Fix the position of the test task corresponding to the single task execution position in the permutation and combination; permutate and combine the other test tasks in a full permutation manner to obtain an execution plan sequence, and the multiple test tasks corresponding to the fixed task combination are regarded as one test task participating in the permutation and combination; The execution plan is screened according to the task parallelism to obtain a logical execution plan.

4. A method for generating and running concurrent test cases as claimed in claim 1, characterized in that: After one of the logic execution plans has completed testing, another logic execution plan is executed until all of the logic execution plans have completed testing.

5. A concurrent test case generation and execution system, characterized in that: A method for generating and running a concurrent test case according to any one of claims 1 to 4, comprising: a concurrent scenario construction device, a test case library and a test case running device, wherein the concurrent scenario construction device is connected to the test case library and the test case running device respectively, The concurrent scenario construction device is used to obtain configuration file parameters and generate a logical execution plan using test cases according to the configuration file parameters; the configuration file parameters include test tasks, concurrent interval duration, task parallelism, overall running time of concurrent test tasks and timeout mechanism; The test case library is used to store test cases; The use case running device is used to add a timing tag to the test task of the logic execution plan in combination with the configuration file parameters and the current timestamp, and sequentially run the test tasks according to the timing tag, track the test process until the logic execution plan completes the test, and record the execution log; The process of adding a timing tag to the test task of the logic execution plan in combination with the configuration file parameters and the current timestamp, and sequentially running the test tasks according to the timing tag, and tracking the test process until the logic execution plan completes the test is as follows: According to the concurrent order of the test tasks in the logical execution plan, combined with the current timestamp and the concurrent interval duration, adding timing tags to the test tasks whose number is the task parallelism; The structure of the time series label is Casex_{datetime}_{num}_{c}, Casex indicates the name of the test task, {datetime} indicates the time when the test task is started, {datetime} is determined by the current timestamp, {num}, and the concurrency interval, {num} indicates the order of starting and joining the concurrency, and {c} indicates the number of times the test task is started. According to the timing labels, the test tasks are sequentially pulled up, and the test cases corresponding to the test tasks are run; When the test task is finished, according to the concurrent order, combined with the current timestamp and the concurrent interval duration, a timing tag is added to the next test task, and then the test task is started; When all the test tasks of the logic execution plan have been started and the next test task needs to be started, a new round of test tasks is started according to the concurrent order of the logic execution plan; The actual running time of the logic execution plan is continuously tracked, and when the actual running time reaches the overall running time of the concurrent test task, the timeout mechanism is executed to complete the test of the logic execution plan.

6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the method for generating and running concurrent test cases described in any one of claims 1 to 4 is implemented.

7. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for generating and running a concurrent test case described in any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Test case execution method and system and test equipment

    CN114691494A

  • Software testing method and device, computer equipment and computer readable storage medium

    CN117290236A