A test case storage method and device, electronic equipment and storage medium
By establishing a correspondence between access paths and test statements in test cases, the problem of low reusability in test case storage is solved, enabling more efficient test case management and retrieval, and improving testing efficiency.
Patent Information
- Application Number
- CN202210657148.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-10
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2042-06-10
AI Technical Summary
Existing test case storage methods result in low reusability, affecting testing efficiency, and require a significant amount of time to search for and modify test cases during requirement iterations and changes in metric definitions.
By obtaining the access path and test statement of the metric to be tested, a corresponding relationship is established and stored in the test case, ensuring that the test statement is consistent with the access path, and supporting the standardized storage and retrieval of test cases.
It improved the reusability and efficiency of test cases, reduced the search and modification time when requirements change, and improved the execution efficiency of test tasks.
Smart Images

Figure CN114996139B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of software testing, in particular to a test case storage method and device, electronic equipment and storage medium. BACKGROUND
[0002] The existing test cases are usually stored according to the test requirements, and the written test cases are stored in a case library. When a new requirement needs to re-establish a test plan, the test cases in the case library are large in size, and due to the different writing habits of the test personnel, there are different test cases for the same index in the case library. When testing is needed, a lot of time is spent searching for test cases from the case library. In addition, with the continuous iteration of requirements, the index caliber changes, and the test cases also need to be changed, which not only leads to a low reuse rate of test cases, but also affects the test efficiency. SUMMARY
[0003] Therefore, the embodiments of the present application provide a test case storage method and device, electronic equipment and storage medium to solve the problems of low reuse rate of test cases and low test efficiency.
[0004] According to a first aspect, the embodiments of the present application provide a test case storage method, comprising:
[0005] obtaining an access path of a to-be-tested index in a target application and a test statement of the to-be-tested index;
[0006] establishing a correspondence between the access path and the test statement;
[0007] storing the test statement based on the correspondence to determine a test case of the to-be-tested index.
[0008] The test case storage method provided by the embodiments of the present application can improve the reuse rate of test cases and improve the test efficiency by obtaining the access path of the index and the test statement, establishing the correspondence between the test statement and the access path, and storing the test statement in the test case used for testing the to-be-tested index, which can ensure that the test statement corresponds to the access path.
[0009] In one embodiment, the test statement of the to-be-tested index is obtained by:
[0010] obtaining an identification number of the to-be-tested index;
[0011] obtaining a preset test statement corresponding to the to-be-tested index according to the identification number;
[0012] obtaining the test statement of the to-be-tested index in response to a modification of the preset test statement.
[0013] The method for obtaining a test statement provided by the application obtains a preset test statement according to an identification number, and modifies the test statement based on a test requirement, thereby obtaining a test statement that can be used for testing an index, and improving the efficiency of testing.
[0014] In one embodiment, the method for obtaining an access path of the index to be tested in the target application comprises:
[0015] obtaining an index path tree corresponding to the target application;
[0016] in response to an operation of adding a node to the index path tree, adding a new node to the index path tree, and the access path of the new node in the index path tree being consistent with the access path;
[0017] displaying a test case interface;
[0018] in response to a selection operation of the access path in the test case interface, determining the access path of the index to be tested in the target application.
[0019] The method for obtaining an access path provided by the embodiment of the application first obtains an index path tree corresponding to a target application, adds a node corresponding to an index to the index path tree, and the access path of the index is consistent with the access path in the index path tree, so that when a test case is added, the access path of the index to be tested is selected from the added access path, the access path can be stored in the test case, the test case is sorted, the efficiency of testing is improved.
[0020] In one embodiment, the method for establishing a corresponding relationship between the access path and the test statement comprises:
[0021] in response to an adding instruction of the test case, displaying the test case interface;
[0022] in response to an information editing operation in the test case interface, establishing a corresponding relationship between the access path and the test statement.
[0023] In one embodiment, the method for establishing a corresponding relationship between the access path and the test statement in response to the information editing operation in the test case interface comprises:
[0024] based on the information editing operation in the test case interface, determining information of the test case, the information of the test case comprising a target application name in which the index to be tested is located, an index name, an access path, a test statement, an identification number, and a test role;
[0025] based on the information of the test case, establishing a corresponding relationship between the access path and the test statement.
[0026] In one implementation, after determining the test cases for the metric to be tested, the method further includes:
[0027] Based on the instruction to favorite the test case, the test case is stored in the test case favorites folder.
[0028] According to a second aspect, embodiments of the present invention provide a test case storage device, the device comprising:
[0029] The acquisition module is used to acquire the access path of the metric to be tested in the target application and the test statement of the metric to be tested.
[0030] The relationship establishment module is used to establish the correspondence between the access path and the test statement;
[0031] A storage module is used to store the test statements based on the correspondence to determine the test cases for the metric to be tested.
[0032] In one embodiment, the apparatus further includes:
[0033] The collection module is used to store the test cases to a test case collection folder based on the collection command.
[0034] According to a third aspect, embodiments of the present invention provide an electronic device, including: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the test case storage method described in the first aspect or any embodiment of the first aspect.
[0035] According to a fourth aspect, embodiments of the present invention provide a computer-readable storage medium storing computer instructions for causing the computer to execute the test case storage method described in the first aspect or any embodiment of the first aspect. Attached Figure Description
[0036] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0037] Figure 1 This is a flowchart of a test case storage method according to an embodiment of the present invention;
[0038] Figure 2 is a method flowchart for acquiring test statements according to an embodiment of the present application;
[0039] Figure 3 is a flowchart of a test case storage method according to an embodiment of the present application;
[0040] Figure 4 is a path tree schematic diagram according to an embodiment of the present application;
[0041] Figure 5 is a test case interface schematic diagram according to an embodiment of the present application;
[0042] Figure 6 is a test case interface schematic diagram according to an embodiment of the present application;
[0043] Figure 7 is a test case library schematic diagram according to an embodiment of the present application;
[0044] Figure 8 is a test case folder schematic diagram according to an embodiment of the present application;
[0045] Figure 9 is a flowchart of a test case storage method according to an embodiment of the present application;
[0046] Figure 10 is a structural schematic diagram of a test case storage device according to an embodiment of the present application;
[0047] Figure 11 is a hardware structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0048] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0049] According to an embodiment of the present application, a test case storage method is provided. It should be noted that the steps shown in the flowchart of the drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown herein.
[0050] In the present embodiment, a test case storage method is provided, which can be used in terminals such as mobile phones, tablet computers, computers, etc. Figure 1is a flowchart of a test case storage method according to an embodiment of the present application, as shown in Figure 1 The flowchart includes the following steps:
[0051] S11, obtaining an access path of a to-be-tested index in a target application and a test statement of the to-be-tested index.
[0052] Generally, the software quality at each stage of the development process can be tracked according to test indexes, which can be offline indexes, and the target application can be application software of a mobile terminal or a PC. Each index has a corresponding position in the target application, i.e., the access path of the index in the target application. For example, the target application is an X system, the X system is the root node of the path, the path can be X system-X system homepage, and the to-be-tested index is a description of a certain feature of the X system homepage.
[0053] The tester can test the to-be-tested index according to the test statement written in the test case, which can be an SQL statement. The tester can write the test statement according to the requirements, or obtain the test statement from the development document written by the developer.
[0054] S12, establishing a corresponding relationship between the access path and the test statement.
[0055] S13, storing the test statement based on the corresponding relationship to determine the test case of the to-be-tested index.
[0056] The test statement and the access path can be written in the test case corresponding to the to-be-tested index, thereby establishing the corresponding relationship between the access path and the test statement, so that one test statement corresponds to only one access path, i.e., the access path of the test case is standardized.
[0057] When a certain index needs to be tested, it is necessary to search from the test case library whether there is a test case corresponding to the index. The test case is a description of the test task of the index, which includes the access path of the index in the target application, the test statement, and other information such as the index name and the target application name. If it exists, the test task can be performed according to the test case, and if it does not exist, the test case corresponding to the index needs to be added first.
[0058] After the access path and the test statement of the to-be-tested index are determined, the tester can add a test case according to the requirements, and fill in the information of the test case corresponding to the test index in the test case adding interface, which includes the access path and the test statement of the to-be-tested index.
[0059] One to-be-tested index corresponds to one access path, but there can be more than one index under one access path, depending on specific conditions. One index corresponds to one test case, one test case corresponds to one test statement, and one test statement corresponds to one access path.
[0060] The newly added test case can be stored in a test case library, and the test cases in the test case library can be sorted according to the access paths, so as to facilitate retrieval and use by testers.
[0061] The test case storage method provided in the embodiments of the application can ensure that the test statement corresponds to the access path, and there is only one test case for one index under one access path, thereby improving the reusability of the test case and improving the test efficiency to a certain extent.
[0062] In the embodiments, a method for obtaining a test statement is provided, which can be used for terminals such as mobile phones, tablet computers, computers, and the like, Figure 2 is a flowchart of the method for obtaining a test statement according to the embodiments of the application, that is, corresponding to the above Figure 1 According to the embodiment S11, as shown in the embodiment S11, the flowchart includes the following steps: Figure 2
[0063] S21, obtaining an identification number of a to-be-tested index.
[0064] S22, obtaining a preset test statement corresponding to the to-be-tested index according to the identification number.
[0065] S23, obtaining a test statement of the to-be-tested index in response to modification of the preset test statement.
[0066] The tester can query the identification number corresponding to the to-be-tested index on the data service platform, and the identification number is an API interface provided by the data warehouse. Each identification number has its corresponding interface logic, that is, a preset test statement corresponding to the to-be-tested index, which can be provided by a developer and can be a SQL statement. After the tester obtains the preset test statement, the input parameter is substituted into the preset test statement according to the test requirement of the index, and the test statement of the to-be-tested index is obtained, which can be used for writing into a test case for testing the corresponding index.
[0067] The method for obtaining a test statement provided in the embodiments of the application obtains a preset test statement according to an identification number, modifies the test statement based on a test requirement, and thereby obtains a test statement that can be used for testing an index, thereby improving the test efficiency.
[0068] A method for obtaining an access path is provided in the embodiment, Figure 3 is a flowchart of the method for obtaining an access path according to the embodiment of the application, that is, corresponding to the above Figure 1 As shown in the corresponding embodiment S11, Figure 3 the flowchart includes the following steps:
[0069] S31, obtaining an index path tree corresponding to a target application.
[0070] S32, in response to an operation of adding a node to the index path tree, adding a new node in the index path tree.
[0071] The access path of the new node in the index path tree is consistent with the access path.
[0072] As shown in the embodiment, Figure 4 the name of the target application is the root node of the index path tree, and the index path tree stores path nodes corresponding to existing test cases. When a path node corresponding to a to-be-tested index is not in the index path tree, a node can be added at a corresponding position in the index path tree. The access path of the new node in the index path tree is consistent with the access path. The access path is the access path of the to-be-tested index in the test case, and the access path in the index path tree takes the root node as a starting node. For example, Figure 4 take the "organization" node in the embodiment as an example. The access path of the node is "zo-zo homepage-monthly business data-organization".
[0073] S33, displaying a test case interface.
[0074] S34, in response to a selection operation on the access path in the test case interface, determining the access path of the to-be-tested index in the target application.
[0075] As shown in the embodiment, Figure 6 when a new test case needs to be added, after the access path of the index corresponding to the test case is determined, the test case is added to fill in the index information, including the access path of the index. As shown in the embodiment, Figure 5 the index path in the figure is the access path. The column can display all added paths. The access path of the index is selected from all paths. The display mode of the path can be in the form of a drop-down box. The specific form is not limited.
[0076] The method for obtaining an access path provided in the embodiment first obtains an index path tree corresponding to a target application, adds a node corresponding to an index in the index path tree, and the access path of the index is consistent with the access path in the index path tree. When a test case is added, the access path of the to-be-tested index is selected from the added access paths. The access path can be stored in the test case, facilitating the sorting of the test case and improving the efficiency of the test.
[0077] In one embodiment, Figure 1 S12 of the corresponding embodiment includes the following steps:
[0078] (1) In response to a test case addition instruction, a test case interface is displayed.
[0079] When a certain index needs to be tested, it is necessary to retrieve from the test case library whether there is a test case corresponding to the index. The test case is a description of the testing task for the index, which includes the access path of the index in the target application, test statements, and other information such as index name, target application name, etc. If it already exists, the test task can be performed according to the test case. If not, the test case corresponding to the index needs to be added first.
[0080] In response to a test case addition instruction, a test case interface is displayed, as shown in Figure 6 .
[0081] (2) In response to an information editing operation in the test case interface, an access path and a test statement are associated.
[0082] Based on the information editing operation in the test case interface, the information of the test case is determined, wherein the information of the test case includes the target application name where the index to be tested is located, the index name, the access path, the test statement, the identification number, and the test role. As shown in Figure 6 , the target application name is "APP name" in the figure, the access path is "index path", the test statement is "test SQL", and the identification number is "QueryId".
[0083] Based on the information of the test case, an access path and a test statement are associated. One index to be tested corresponds to one access path, but there can be more than one index under one access path. One index corresponds to one test case, and one test case corresponds to one test statement, that is, one test statement corresponds to one access path.
[0084] The added test case is stored in the test case library. The test cases in the test case library can be sorted according to the access path, so as to facilitate the retrieval and use of the test personnel. The test case library is shown in Figure 7 .
[0085] In one embodiment, after the test case of the index to be tested is determined, the test case is stored in the test case folder based on a collection instruction of the test case.
[0086] As shown in Figure 8 .As shown, when the tester needs to perform a test task, the tester can obtain the test case from the test case library or the test case folder. The tester can collect the required test case in the test case folder according to the required index in the index case library. Each tester has a corresponding personal folder, and the tester can directly obtain the test case from the folder when performing the test task, or can uncollect the test case that is not required. The collected test cases can be arranged in a reverse order according to the collection time, and one-key uncollection is also supported, which facilitates the tester to manage the test cases and improves the test efficiency.
[0087] Please refer to Figure 9 , Figure 9 is a flowchart of a test case storage method according to an embodiment of the present application. When the tester has a test requirement for an index, a corresponding node is first added in the path tree based on the access path of the index. The access path of the node in the path tree is the access path of the index. After the access path is determined, the test case corresponding to the index can be added. The test case can be obtained from the case library, or the test case can be directly added after editing. After the information in the test case is confirmed, the test case can be stored in the case library. The tester can add the required test case to the folder according to the current test requirement, so as to quickly find the required test case, and then perform the corresponding test task.
[0088] In the embodiment, a test case storage device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and will not be described again. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware is also possible and is contemplated.
[0089] The embodiment provides a test case storage device, as shown in Figure 10 includes an acquisition module 51 configured to acquire an access path of a to-be-tested index in a target application and a test statement of the to-be-tested index;
[0090] A relationship establishing module 52 is configured to establish a corresponding relationship between the access path and the test statement.
[0091] A storage module 53 is configured to store the test statement based on the corresponding relationship to determine a test case of the to-be-tested index.
[0092] In one embodiment, the acquisition module 51 further includes:
[0093] An identifier acquisition subunit is configured to acquire an identifier of the to-be-tested index.
[0094] The preset test statement acquisition sub-unit is configured to acquire a preset test statement corresponding to the to-be-tested index according to the identification number.
[0095] The test statement acquisition sub-unit is configured to acquire a test statement of the to-be-tested index in response to modification of the preset test statement.
[0096] In one embodiment, the acquisition module 51 further comprises:
[0097] The path tree acquisition sub-unit is configured to acquire an index path tree corresponding to the target application.
[0098] The node addition sub-unit is configured to add a node in the index path tree in response to a node addition operation on the index path tree, and the access path of the added node in the index path tree is consistent with the access path.
[0099] The display sub-unit is configured to display a test case interface.
[0100] The access path determination sub-unit is configured to determine the access path of the to-be-tested index in the target application in response to a selection operation on the access path in the test case interface.
[0101] In one embodiment, the relationship establishment module 52 further comprises:
[0102] The interface display sub-unit is configured to display a test case interface in response to a test case addition instruction.
[0103] The corresponding relationship establishment sub-unit is configured to establish a corresponding relationship between the access path and the test statement in response to an information editing operation in the test case interface.
[0104] In one embodiment, the device further comprises a collection module configured to store the test case into a test case collection folder based on a collection instruction on the test case.
[0105] The test case storage device in the embodiment is in the form of a functional unit, and the unit herein refers to an ASIC circuit, a processor and a memory executing one or more software or fixed programs, and / or other devices that can provide the above functions.
[0106] Further function descriptions of the above modules are the same as those of the above corresponding embodiments, and will not be described here.
[0107] The embodiment of the application further provides an electronic device with the above Figure 10 test case storage device.
[0108] Please refer to Figure 11 , Figure 11 is a structural schematic diagram of an electronic device provided by an optional embodiment of the application, as shown in Figure 11As shown, the electronic device can include at least one processor 601, such as a CPU (Central Processing Unit), at least one communication interface 603, a memory 604, and at least one communication bus 602. The communication bus 602 is used to realize the connection and communication between the components. The communication interface 603 can include a display, a keyboard, and can also include a standard wired interface and a wireless interface. The memory 604 can be a high-speed RAM memory, and can also be a non-volatile memory, such as at least one disk memory. The memory 604 can also be at least one storage device located away from the aforementioned processor 601. The processor 601 can be combined with Figure 10 The described device, the memory 604 stores an application program, and the processor 601 invokes the program code stored in the memory 604 to execute any of the above method steps.
[0109] The communication bus 602 can be a PCI bus or an EISA bus, etc. The communication bus 602 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 11 Only one thick line is used in the figure, but it does not mean that there is only one bus or only one type of bus.
[0110] The memory 604 can include volatile memory, such as random access memory (RAM); the memory can also include non-volatile memory, such as flash memory, a hard disk (HDD) or a solid state disk (SSD); the memory 604 can also include a combination of the above types of memory.
[0111] The processor 601 can be a central processing unit (CPU), a network processor (NP), or a combination of CPU and NP.
[0112] The processor 601 can further include a hardware chip. The hardware chip can be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0113] Optionally, the memory 604 is further configured to store program instructions. The processor 601 can invoke the program instructions to implement the test case storage method as shown in the embodiments of the present application.
[0114] The embodiments of the present application further provide a non-transitory computer storage medium storing computer executable instructions. The computer executable instructions can implement the test case storage method in any of the method embodiments described above. The storage medium can be a disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a Flash Memory, a Hard Disk Drive (HDD), a Solid-State Drive (SSD), or the like. The storage medium can also include a combination of the above-mentioned storage media.
[0115] Although the embodiments of the present application are described in conjunction with the accompanying drawings, various modifications and changes can be made by those skilled in the art without departing from the spirit and scope of the present application, and such modifications and changes are intended to fall within the scope of the appended claims.
Claims
1. A test case storage method characterized by comprising: The method comprises the following steps: acquiring an access path of a to-be-tested index in a target application and a test statement of the to-be-tested index; establishing a corresponding relationship between the access path and the test statement; storing the test statement based on the corresponding relationship to determine a test case of the to-be-tested index; the acquiring of the test statement of the to-be-tested index comprises: acquiring an identification number of the to-be-tested index; acquiring a preset test statement corresponding to the to-be-tested index according to the identification number; and acquiring the test statement of the to-be-tested index in response to a modification of the preset test statement; the acquiring of the access path of the to-be-tested index in the target application comprises: acquiring an index path tree corresponding to the target application; adding a node in the index path tree in response to an adding-node operation on the index path tree, the access path of the added node in the index path tree being consistent with an access path of the to-be-tested index in a test case; displaying a test case interface; and determining the access path of the to-be-tested index in the target application in response to a selection operation on the access path in the test case interface; the information of the test case comprises the access path and the test statement.
2. The method of claim 1, wherein, the establishing of the corresponding relationship between the access path and the test statement comprises: displaying the test case interface in response to an adding instruction of the test case; establishing the corresponding relationship between the access path and the test statement in response to an information editing operation in the test case interface.
3. The method of claim 2, wherein, the establishing of the corresponding relationship between the access path and the test statement in response to the information editing operation in the test case interface comprises: determining information of the test case based on the information editing operation in the test case interface, the information of the test case further comprising a target application name, an index name, an identification number and a test role of the to-be-tested index; establishing the corresponding relationship between the access path and the test statement based on the information of the test case.
4. The method of claim 1, wherein, after the determining of the test case of the to-be-tested index, the method further comprises: storing the test case to a test case collection folder based on a collection instruction of the test case.
5. A test case storage device characterized by comprising: The device comprises: an acquiring module, configured to acquire an access path of a to-be-tested index in a target application and a test statement of the to-be-tested index; a relationship establishing module, configured to establish a corresponding relationship between the access path and the test statement; a storing module, configured to store the test statement based on the corresponding relationship to determine a test case of the to-be-tested index; the acquiring module further comprises: an identification acquiring subunit, configured to acquire an identification number of the to-be-tested index; a preset test statement acquiring subunit, configured to acquire a preset test statement corresponding to the to-be-tested index according to the identification number; and a test statement acquiring subunit, configured to acquire the test statement of the to-be-tested index in response to a modification of the preset test statement. The path tree obtaining sub-unit is configured to obtain an index path tree corresponding to the target application; the node adding sub-unit is configured to add a node in the index path tree in response to an operation of adding a node in the index path tree, and the access path of the added node in the index path tree is consistent with the access path of the to-be-tested index in the test case; the display sub-unit is configured to display a test case interface; and the access path determining sub-unit is configured to determine the access path of the to-be-tested index in the target application in response to a selection operation of the access path in the test case interface; and the information of the test case includes the access path and a test statement.
6. The apparatus of claim 5, wherein, The device further includes: The collection module is configured to store the test case into a test case collection folder based on a collection instruction of the test case.
7. An electronic device, comprising: The device includes: A memory and a processor, which are in communication connection with each other, and the memory stores computer instructions; the processor executes the computer instructions, thereby executing the test case storage method in any one of claims 1-4.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions, and the computer instructions are used to make a computer execute the test case storage method in any one of claims 1-4.
Citation Information
Patent Citations
Method for UI traversal based on rule guidance
CN109117373A
Method and device for carrying out test verification in CBTC test analysis
CN110532179A