Test case management method, device, equipment and computer readable storage medium
By reading and managing the queue of test case names, finding and executing test cases, it solves the problem that existing testing tools cannot manage test cases, and realizes the adjustment of the order of test cases and the simplification of the testing process.
Patent Information
- Application Number
- CN201910407749.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-05-16
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2039-05-16
AI Technical Summary
Existing testing tools cannot manage test cases, resulting in a complicated testing process and the inability to change the execution order of test cases.
By reading the test case names written in the preset test case text file according to the preset case name management rules and writing them into the queue, the test case names in the queue are read sequentially to obtain the tests to be executed in order. Case name, find and add it to the test suite, execute the test case, and manage the test case.
Effective management of test cases is achieved, the execution order of test cases can be adjusted, and the testing process is simplified.
Smart Images

Figure CN110297757B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of test management, and in particular to a test case management method, device, equipment and computer-readable storage medium. Background Art
[0002] At present, similar products for interface automation testing in the industry cannot manage test cases, such as Jmeter. Since it cannot manage test cases, it is impossible to change the order of test case execution, which makes the test process more complicated. Therefore, how to solve the problem that existing test tools cannot manage test cases has become a technical problem that needs to be solved urgently. Summary of the invention
[0003] The main purpose of the present invention is to provide a test case management method, device, equipment and computer-readable storage medium, aiming to solve the technical problem that test cases cannot be managed in the prior art.
[0004] To achieve the above object, the present invention provides a test case management method, the test case management method comprising the following steps:
[0005] Read the test case names written in the preset test case text file according to the preset case name management rules, and write the read test case names into the queue in sequence;
[0006] Read the test case names in the queue in sequence to obtain the test case names to be executed in an arranged order;
[0007] Searching for a test case in a preset test case file directory that matches the name of the test case to be executed, and adding the found test case to the test suite in the corresponding test case file directory;
[0008] Executes the test cases in the test suite.
[0009] Optionally, before the step of reading the test case names written in the preset test case text file according to the preset case name management rule and writing the read test case names into the queue in sequence, the following steps are also included:
[0010] A classification storage area for test cases is set in the test case text file, wherein names of test cases of different categories are stored in different storage areas of the test case text file.
[0011] Optionally, after the step of setting the classification storage area of the test cases in the test case text file, the following steps are also included:
[0012] Based on the case name management rule, writing each test case name into a corresponding storage area of the test case text file;
[0013] The test case names in each storage area are marked, and the marks are used to identify the execution test case names and the non-execution test case names.
[0014] Optionally, after the step of writing each test case name into a corresponding storage area of the test case text file based on the case name management rule, the method further includes the following steps:
[0015] Based on the case name management rule, the arrangement order of the test case names in the test case text file is modified to adjust the execution order of the test case.
[0016] Optionally, after the step of marking the test case names in each storage area, the following steps are also included:
[0017] Add or delete the tags to adjust the test cases to be executed.
[0018] Optionally, the step of reading the test case names written in the preset test case text file according to the preset case name management rule, and writing the read test case names into the queue in sequence comprises the following steps:
[0019] Read the test case name in the test case text file;
[0020] Based on the mark, determining whether the test case name currently read is the test case name to be executed;
[0021] If the name of the test case currently read is the name of the test case to be executed, the read test case name will be written into the queue in sequence;
[0022] If the name of the test case currently being read is not the name of a test case to be executed, it will not be processed.
[0023] Optionally, before the step of searching the preset test case file directory for a test case that matches the name of the test case to be executed and adding the found test case to the test suite under the corresponding test case file directory, the following steps are also included:
[0024] Add the preset test cases to the test case file directory.
[0025] Furthermore, in order to achieve the above object, the present invention also provides a test case management device, the test case management device comprising:
[0026] The first reading module is used to read the test case names saved in the preset test case text file according to the preset case name management rules, and write the read test case names into the queue in sequence;
[0027] A second reading module is used to read the test case names in the queue in sequence to obtain the names of the test cases to be executed in an arranged order;
[0028] A search module is used to search for a test case in a preset test case file directory that matches the name of the test case to be executed, and add the found test case to the test suite under the corresponding test case file directory;
[0029] The execution module is used to execute the test cases in the test suite.
[0030] Optionally, the test case management device further includes:
[0031] The setting module is used to set the classification storage area of the test case in the test case text file, wherein the names of the test cases of different categories are stored in different storage areas of the test case text file.
[0032] Optionally, the test case management device further includes:
[0033] A saving module, used for writing each test case name into a corresponding saving area of the test case text file based on the case name management rule;
[0034] The marking module is used to mark the test case names in each storage area, and the marks are used to identify the execution test case names and the non-execution test case names.
[0035] Optionally, the test case management device further includes:
[0036] The first modification module is used to modify the arrangement order of the test case names in the test case text file based on the case name management rule to adjust the execution order of the test case.
[0037] Optionally, the test case management device further includes:
[0038] The second modification module is used to add or delete the mark to adjust the test case to be executed.
[0039] Optionally, the first reading module is specifically used for:
[0040] Read the test case name in the test case text file;
[0041] Based on the mark, determining whether the test case name currently read is the test case name to be executed;
[0042] If the name of the test case currently read is the name of the test case to be executed, the read test case names are written into the queue in sequence.
[0043] Optionally, the test case management device further includes:
[0044] An adding module is used to add preset test cases to the test case file directory.
[0045] The present invention reads the test case names written in the preset test case text file according to the preset case name management rules, and writes the read test case names into the queue in sequence; reads the test case names in the queue in sequence to obtain the names of the test cases to be executed with an arrangement order; searches for the test cases that match the names of the test cases to be executed in the preset test case file directory, and adds the found test cases to the test suite under the corresponding test case file directory; and executes the test cases in the test suite. The present invention reads the test case names written in the preset test case text file according to the preset case name management rules, and writes the read test case names into the queue in sequence. Because the case names are written in accordance with the case name management rules, the order in which the test case names are written into the queue can be modified according to the case name management rules to change the execution order of the test cases, thereby achieving the purpose of managing test cases. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 A schematic diagram of the structure of the test case management device operating environment involved in the embodiment of the present invention;
[0047] Figure 2 A schematic diagram of a flow chart of a first embodiment of a test case management method of the present invention;
[0048] Figure 3 A flow chart of a second embodiment of the test case management method of the present invention;
[0049] Figure 4 A schematic diagram of a flow chart of a third embodiment of a test case management method of the present invention;
[0050] Figure 5 A schematic diagram of a flow chart of a fourth embodiment of a test case management method of the present invention;
[0051] Figure 6 A schematic diagram of a flow chart of a fifth embodiment of a test case management method of the present invention;
[0052] Figure 7 for Figure 2A detailed flow chart of step S10 in an embodiment;
[0053] Figure 8 A flowchart of a sixth embodiment of a test case management method according to the present invention;
[0054] Fig. 9 It is a schematic diagram of functional modules of an embodiment of a test case management device of the present invention.
[0055] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0056] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0057] The invention provides a test case management device.
[0058] Reference Figure 1 , Figure 1 It is a structural diagram of the operating environment of the test case management device involved in the embodiment of the present invention.
[0059] like Figure 1 As shown, the test case management device includes: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the network interface 1004 may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0060] Those skilled in the art will understand that Figure 1 The hardware structure of the test case management device shown in the figure does not constitute a limitation on the test case management device, and may include more or less components than shown in the figure, or combine some components, or arrange the components differently.
[0061] like Figure 1 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a test case management program. The operating system is a program for managing and controlling the test case management device and software resources, and supports the operation of the test case management program and other software and / or programs.
[0062] exist Figure 1 In the hardware structure of the test case management device shown, the network interface 1004 is mainly used to access the network; the user interface 1003 is mainly used to detect confirmation instructions and editing instructions, etc. The processor 1001 can be used to call the test case management program stored in the memory 1005 and perform the operations of the following embodiments of the test case management method.
[0063] Based on the above-mentioned hardware structure of the test case management device, various embodiments of the test case management method of the present invention are proposed.
[0064] Reference Figure 2 , Figure 2 The flowchart of the first embodiment of the test case management method of the present invention is shown in FIG. In this embodiment, the test case management method includes the following steps:
[0065] Step S10, reading the test case names written in the preset test case text file according to the preset case name management rules, and writing the read test case names into the queue in sequence;
[0066] In this embodiment, since it is necessary to obtain test case names that meet the conditions, it is necessary to first read the test case names in the preset test case text file, and judge whether the read test case names meet the preset rules. If so, the test case names are written into the queue; if not, they are not written into the queue.
[0067] For example, there are four test case names A, B, C and D in the test case text file, among which A, B and C do not contain tags, but D contains tags. The reading rule is: if a test case name without tags is read, it is written into the queue, and if a test case name with tags is read, it is not written into the queue. Therefore, A, B and C all meet the preset rules, but D does not meet the preset rules, so it is necessary to write A, B and C that meet the rules into the queue, and not write D into the queue.
[0068] Step S20, reading the test case names in the queue in sequence to obtain the names of the test cases to be executed in an arranged order;
[0069] In this embodiment, the test case names are taken out from the queue in sequence, and then a plurality of test case names with an arrangement order are obtained. For example, there are three test case names in the queue, namely A, B, and C, and the arrangement order in the queue is A, B, and C. Then, the arrangement order of the test case names obtained after taking them out from the queue is still A, B, and C.
[0070] Step S30, searching for a test case in a preset test case file directory that matches the name of the test case to be executed, and adding the found test case to the test suite in the corresponding test case file directory;
[0071] In this embodiment, since there are many test cases, it takes a lot of time to find the target test case. In order to quickly find the target test case, in this embodiment, a method of finding the test case from the test case file directory according to the test case name is adopted. In order to perform operations on the found test cases, it is necessary to add the found test cases to the corresponding test suite in sequence. In this embodiment, the test suite can be a test case or a collection of multiple test cases. The difference between a test case and a test suite is that the format of the test case is different from that of the test case in the test suite. Find the target test case (i.e., the test case file) according to the test case file directory, and then convert each found test case into a suite format according to the preset algorithm and method, and add it to the new queue, thereby obtaining the test suite.
[0072] Step S40: executing the test cases in the test suite.
[0073] In this embodiment, the test cases in the test suite are executed in sequence. For example, if the test cases in the test suite are A, B and C respectively, then the three test cases A, B and C are executed; if the test case in the test suite is A, then the test case A is executed.
[0074] First, read the test case name in the test case text file and put the read execution test case names with a certain arrangement order into the queue one by one. Then take out the execution test case name in the queue, and find the test case corresponding to the execution test case name in the test case directory according to the execution test case name. Then add the found test case to the test suite, and finally execute the test case in the test suite.
[0075] Because what is read is the execution test case name with a certain arrangement order, it can be more adaptable to actual needs. If the execution test case name read is random and not fixed, it may not meet the needs of testing in complex scenarios. In addition, in this solution, the execution test case name and the test case (i.e., the test case file) are completely independent and are not in the same file. Therefore, when looking for a specific target test case, there is no need to open the entire test case directory and then find the target execution test case from a large number of test cases. Instead, you only need to quickly find the target test case based on the execution test case name without opening the entire test case directory. Therefore, you can simplify the operation steps and quickly find the target test case.
[0076] Reference Figure 3 , Figure 3 This is a flow chart of the second embodiment of the test case management method of the present invention. In this embodiment, before the above step S10, the following steps are also included:
[0077] Step S50, setting a classification storage area for test cases in the test case text file, wherein names of test cases of different categories are stored in different storage areas of the test case text file.
[0078] In this embodiment, in order to facilitate finding the position of the test case name in the test case text file, a test case classification storage area is pre-set in this embodiment so that the test case name can be written into different test case storage areas of the test case text file. The test case module area can be set according to the execution test case name and the non-execution test case name, set to the execution test case name storage area and the non-execution test case name storage area, and can also be set according to the type of the test case name (such as login).
[0079] For example, the test case saving area can be set as a login saving area, a home page saving area, etc. If A belongs to the login type test case name, A is written to the login saving area, and if B belongs to the home page type test case name, B is written to the home page saving area.
[0080] Reference Figure 4 , Figure 4 This is a flow chart of the third embodiment of the test case management method of the present invention. In this embodiment, after the above step S50, the following steps are also included:
[0081] Step S60, based on the case name management rule, writing each test case name into the corresponding storage area of the test case text file;
[0082] In this embodiment, based on the case name management rule, each test case name is written into the corresponding storage area of the test case text file.
[0083] Step S70: Mark the test case names in each storage area, where the marks are used to identify the execution test case names and the non-execution test case names.
[0084] In this embodiment, in order to facilitate the quick search for the location of the target test case name later, the test case name needs to be written into different test case storage areas in sequence. In order to facilitate the accurate and quick search for the test case name to be executed later, the test case name in each module needs to be marked, and the executed test case name and the non-executed test case name are distinguished by marking. In this embodiment, the non-executed test case name is marked, and the specific form of the mark is to mark "#" before the non-executed test case name. In this way, the test case name that is not executed can be easily distinguished.
[0085] For example, the current test case text file contains a login test case storage area. At this time, the test case names A, B, and C are respectively written into the login test case storage area. If the test case name A does not need to be executed, the test case name A can be marked and changed to "#A" to distinguish the test cases that will not be executed.
[0086] Reference Figure 5 , Figure 5 This is a flow chart of a fourth embodiment of the test case management method of the present invention. In this embodiment, after the above step S70, the following steps are also included:
[0087] Step S80, based on the case name management rule, modify the arrangement order of the test case names in the test case text file to adjust the execution order of the test case.
[0088] In this embodiment, the writing order of different test case names can be customized. For example, there are currently three test cases, and their test case names are A, B, and C. When writing, the writing order can be selected according to actual needs, for example: A, B, C, A, C, B, A, C, B, C, A, C, B, A. If the order of the written test case names is A, B, C, after traversing the test case text file, the order of the test case names read is A, B, C, and the execution order of the test cases is also A, B, C.
[0089] Reference Figure 6 , Figure 6 This is a flow chart of the fifth embodiment of the test case management method of the present invention. In this embodiment, after the above step S70, the following steps are also included:
[0090] Step S90, adding or deleting the mark to adjust the test case to be executed.
[0091] In this embodiment, the order of marking the test case names can be modified. For example, there are 4 test cases, and the names of the test cases are 1, 2, 3, and 4 respectively. In the first case, 1 can be unmarked, 2 can be unmarked, 3 can be marked, and 4 can be unmarked. In the second case, 1 can be marked, 2 can be unmarked, 3 can be unmarked, and 4 can be marked. The set rule is to execute only the unmarked test cases. Then, the execution order in the first case is: 1, 2, 4, and the execution order in the second case is: 2, 3.
[0092] Reference Figure 7 , Figure 7 for Figure 2 Detailed flow chart of step S10 in an embodiment. In this embodiment, the above step S10 further includes the following steps:
[0093] Step S101, reading the test case name in the test case text file;
[0094] In this embodiment, the test case name in the test case text file is read.
[0095] Step S102, based on the mark, determining whether the test case name currently read is the test case name to be executed;
[0096] In this embodiment, based on the mark, it is determined whether the test case name currently read is the test case name to be executed.
[0097] Step S103, if the name of the test case currently read is the name of the test case to be executed, the read test case name is written into the queue in sequence;
[0098] In this embodiment, if the name of the test case currently read is the name of the test case to be executed, the read test case names are written into the queue in sequence.
[0099] Step S104: if the name of the test case currently read is not the name of a test case to be executed, no processing is performed.
[0100] In this embodiment, different test case name storage areas contain one or more test case names, and the test case names contain marked non-execution test case names and unmarked execution test case names. The test case names in the test case text file are read in sequence, and the read test case names are judged according to the preset rules. If they meet the preset rules (i.e., without marks), it means that the test case name is the test case name to be executed, so the test case name to be executed is written into the queue in sequence. If it is not the test case name to be executed, it will not be executed.
[0101] Reference Figure 8 , Figure 8 This is a flow chart of the sixth embodiment of the test case management method of the present invention. In this embodiment, before the above step S10, the following steps are also included:
[0102] Step S110, adding the preset test cases into the test case file directory.
[0103] In this embodiment, in order to read the test cases, it is necessary to add the preset test cases to the test case file directory, so that the test cases can be found from the test case file directory according to the test case name, and the found test cases can be added to the test suite under the corresponding test case file directory.
[0104] The invention also provides a test case management device.
[0105] Reference Fig. 9 , Fig. 9 This is a functional module diagram of an embodiment of a test case management device of the present invention. In this embodiment, the test case management device includes:
[0106] The first reading module 10 reads the test case names saved in the preset test case text file according to the preset case name management rule, and writes the read test case names into the queue in sequence;
[0107] The second reading module 20 reads the test case names in the queue in sequence to obtain the names of the test cases to be executed in an arranged order;
[0108] The search module 30 searches for a test case in a preset test case file directory that matches the name of the test case to be executed, and adds the found test case to the test suite under the corresponding test case file directory;
[0109] The execution module 40 executes the test cases in the test suite.
[0110] In this embodiment, the first reading module 10 reads the test case names saved in the preset test case text file according to the preset case name management rules, and writes the read test case names into the queue in sequence, the second reading module 20 reads the test case names in the queue in sequence, and obtains the names of the test cases to be executed with an arrangement order. The names of the test cases to be executed with an execution order can be obtained through the second reading module 20. Since the order is different, the execution order of the test cases can also be different. The search module 30 searches for the test cases that match the names of the test cases to be executed in the preset test case file directory, and adds the found test cases to the test suite under the corresponding test case file directory; the execution module 40 executes the test cases in the test suite. The management of test cases is realized through the above modules.
[0111] The present invention also provides a computer-readable storage medium.
[0112] In this embodiment, a test case management program is stored on the computer-readable storage medium, and when the test case management program is executed by the processor, the steps of the test case management method described in any one of the above embodiments are implemented.
[0113] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM) and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0114] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims. All equivalent structures or equivalent process changes made using the contents of the specification and drawings of the present invention, or directly or indirectly used in other related technical fields, are protected by the present invention.
Claims
1. A test case management method, It is characterized in that The test case management method comprises the following steps: Read the test case names written in the preset test case text file according to the preset case name management rules, and write the read test case names into the queue in sequence; The step of reading the test case names written in the preset test case text file according to the preset case name management rule, and sequentially writing the read test case names into the queue includes: Read the test case name in the test case text file; Based on the mark, determine whether the test case name currently read is the test case name to be executed, wherein the mark is used to identify the execution test case name and the non-execution test case name; If yes, the read test case names are written into the queue in sequence; Read the test case names in the queue in sequence to obtain the test case names to be executed in an arranged order; Searching for a test case in a preset test case file directory that matches the name of the test case to be executed, and adding the found test case to a test suite under the corresponding test case file directory, wherein the test suite is used to indicate a test case or a set of multiple test cases; Adding the found test case to the test suite under the corresponding test case file directory includes: Convert the test case found each time into a suite format according to a preset algorithm, and add the suite format to a new queue to obtain a test suite under the corresponding test case file directory; Execute the test cases in the test suite; Before the step of reading the test case names written in the preset test case text file according to the preset case name management rule and writing the read test case names into the queue in sequence, the following steps are also included: Setting a classification storage area for test cases in the test case text file, wherein names of test cases of different categories are stored in different storage areas of the test case text file; Based on the case name management rule, the arrangement order of the test case names in the test case text file is modified to adjust the execution order of the test case.
2. The test case management method according to claim 1, It is characterized in that After the step of setting the classification storage area of the test case in the test case text file, the following steps are also included: Based on the case name management rule, writing each test case name into a corresponding storage area of the test case text file; The test case names in each storage area are marked.
3. The test case management method according to claim 2, It is characterized in that After the step of marking the test case names in each storage area, the following steps are also included: Add or delete the tags to adjust the test cases to be executed.
4. The test case management method according to claim 1, It is characterized in that Before the step of searching the preset test case file directory for a test case that matches the name of the test case to be executed and adding the found test case to the test suite under the corresponding test case file directory, the following steps are also included: Add the preset test cases to the test case file directory.
5. A test case management device, It is characterized in that The test case management device comprises: The first reading module is used to read the test case names written in the preset test case text file according to the preset case name management rules, and write the read test case names into the queue in sequence; The step of reading the test case names written in the preset test case text file according to the preset case name management rule, and sequentially writing the read test case names into the queue includes: Read the test case name in the test case text file; Based on the mark, determine whether the test case name currently read is the test case name to be executed, wherein the mark is used to identify the execution test case name and the non-execution test case name; If yes, the read test case names are written into the queue in sequence; A second reading module is used to read the test case names in the queue in sequence to obtain the names of the test cases to be executed in an arranged order; A search module, used to search for a test case in a preset test case file directory that matches the name of the test case to be executed, and add the found test case to a test suite under the corresponding test case file directory, wherein the test suite is used to indicate a test case or a set of multiple test cases; Adding the found test case to the test suite under the corresponding test case file directory includes: Convert the test case found each time into a suite format according to a preset algorithm, and add the suite format to a new queue to obtain a test suite under the corresponding test case file directory; An execution module, used for executing the test cases in the test suite; Before the step of reading the test case names written in the preset test case text file according to the preset case name management rule and writing the read test case names into the queue in sequence, the following steps are also included: Setting a classification storage area for test cases in the test case text file, wherein names of test cases of different categories are stored in different storage areas of the test case text file; Based on the case name management rule, the arrangement order of the test case names in the test case text file is modified to adjust the execution order of the test case.
6. A test case management device, It is characterized in that The test case management device comprises a processor, a memory, and a test case management program stored in the memory and executable by the processor. When the test case management program is executed by the processor, the steps of the test case management method according to any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a test case management program, and when the test case management program is executed by a processor, the steps of the test case management method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Editing method and system of testing sequence and automatic testing system
CN104461895A
Method and system for automatic continuous running of consistency test of mobile terminal and intelligent card
CN105045699A
Integration testing method and system based on TestNG
CN105975397A
Test case management method, apparatus and device, and computer readable storage medium
CN107943695A
Test case scheduling method and device, computing device, and computer storage medium
CN109165158A
