An automated test case reuse method and system

By transforming and parsing the data in the test case keyword model, the problems of operational complexity and maintenance cost in the reuse of automated test cases are solved, and efficient and easy-to-use test case management is achieved.

CN115934530BActive Publication Date: 2026-11-24CHINA CITIC BANK CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211548956.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-05
Publication Date
2026-11-24
Estimated Expiration
2042-12-05

AI Technical Summary

Technical Problem

Existing methods for reusing automated test cases are complex to operate, difficult to write and maintain, and costly. In particular, the maintenance cost increases significantly when the functions of the system under test are modified.

Method used

By adopting a test case keyword model, test case data is transformed into a dictionary. Through key name retrieval and parsing execution, real-time data exchange and precise matching between test cases are achieved, reducing the complexity of writing and maintaining the test cases.

Benefits of technology

It reduces the difficulty of writing and maintaining test cases, improves writing efficiency and ease of use, reduces maintenance costs caused by system function modifications, and enhances the flexibility and maintainability of test cases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115934530B_ABST
    Figure CN115934530B_ABST
Patent Text Reader

Abstract

This invention relates to an automated test case reuse method and system. The method includes: reading all test case data from a test case set and converting it into a test case keyword model for storage to form a test case dictionary; using the keyword model of the test cases to be executed to perform key name retrieval, obtaining the dictionary of the keyword model of the test cases to be executed, and passing it to the test execution framework; obtaining the test data in the keyword model of the test cases to be executed and parsing the test steps; obtaining each operation element and the value of each operation element, and determining the type of the operation element; if the operation element is a regular category, then performing regular test execution; if the operation element is a call test case, then obtaining the value of the operation element, retrieving the corresponding test case keyword model, and parsing and executing it. This technical solution can reduce the difficulty and cost of writing and maintaining test cases.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of software testing technology, and in particular to an automated test case reuse method and system. Background Technology

[0002] Currently available automated test case reuse technologies include the following two:

[0003] 1. Using the export and import functions, existing test cases are exported to a file for editing, and then imported into new test cases using the import function. This approach involves many steps, and the exported test steps cannot be dynamically stored or transferred. Furthermore, the test step data for each imported test case needs to be edited and maintained separately, increasing the difficulty and cost of test case writing.

[0004] 2. Using the copy function to copy all steps of the automated test case to the new test case and then modify them. This approach requires editing the test step data of each copied test case individually, increasing the difficulty and cost of test case writing. When the relevant functions of the system under test are modified, each copied test case needs to be modified and maintained individually during test case maintenance, resulting in high maintenance costs and reducing the overall usability of automated testing. When the functional modules involved in the copied test cases need to be maintained or modified, all locations where the test case was copied must be modified, which can easily lead to incomplete test case maintenance, increase the maintenance cost of automated testing, and thus greatly reduce maintainability.

[0005] The above methods for reusing automated test cases all fail to fully address the issues of test case complexity and difficulty in writing and maintaining test cases that arise from this process. Summary of the Invention

[0006] To address the shortcomings of existing technologies, this invention proposes an automated test case reuse method and system, which aims to reduce the complexity of reuse operations between test cases and support real-time data exchange between reused test cases and the reused test cases.

[0007] To achieve the above objectives, the technical solution adopted by the present invention includes:

[0008] The first aspect of this invention discloses an automated test case reuse method, comprising:

[0009] Step S1: Read all test case data in the test case set and convert it into test case keyword models for storage to form a test case dictionary. Each test case corresponds to one keyword model.

[0010] Step S2: Use the keyword model of the test cases to be executed to perform key name retrieval, obtain the dictionary of keyword models of the test cases to be executed, and pass it to the test execution framework;

[0011] Step S3: Obtain the test data from the keyword model of the test cases to be executed and parse the test steps;

[0012] Step S4: Obtain each operation element and its value, and determine the type of the operation element;

[0013] Step S5: If the operation element is a regular category, then perform regular test execution; if the operation element is a call test case, then obtain the value of the operation element, retrieve the corresponding test case keyword model, and parse and execute it.

[0014] Step S6: Perform all test steps in the keyword model of the test cases to be executed in sequence.

[0015] Furthermore, the test case keyword model includes test case names and test steps, which exist in the form of key-value pairs.

[0016] Furthermore, the key name retrieval using the keyword model of the test case to be executed in step S2 includes retrieval using the test case name.

[0017] Furthermore, the test steps in the test case keyword model are stored in the form of an array.

[0018] Furthermore, in step S5, the conventional operation element categories include conventional operation categories, verification categories, or data processing categories.

[0019] Furthermore, the conventional operation classes include page clicks, inputs, and API automated test request message sending for UI automated testing; the conventional verification classes include correctness judgment of the test process; and the conventional data processing classes include test data assignment and test data processing.

[0020] A second aspect of this invention discloses an automated test case reuse system, comprising:

[0021] The test case dictionary module is used to read all test case data in the test case set and convert it into test case keyword models for storage to form a test case dictionary. Each test case corresponds to a keyword model.

[0022] The retrieval module uses the keyword model of the test cases to be executed to perform key name retrieval, obtains the dictionary of the keyword model of the test cases to be executed, and passes it to the test execution framework;

[0023] The parsing module is used to obtain test data from the keyword model of the test cases to be executed and parse the test steps;

[0024] The processing module is used to obtain each operation element and its value, and to determine the type of the operation element. If the operation element is a regular category, then regular test execution is performed. If the operation element is a call test case, then the value of the operation element is obtained, the corresponding test case keyword model is retrieved, and the test case is parsed and executed.

[0025] The execution module is used to sequentially execute all test steps in the keyword model of the test cases to be executed.

[0026] A third aspect of the present invention discloses a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described above.

[0027] A fourth aspect of the present invention discloses an electronic device, including a processor and a memory;

[0028] The memory is used to store operation instructions;

[0029] The processor is configured to execute the method described above by invoking the operation instructions.

[0030] The fifth aspect of the present invention discloses a computer program product, including a computer program and / or instructions, characterized in that the computer program and / or instructions, when executed by a processor, implement the steps of the method described above.

[0031] The beneficial effects of this invention are as follows:

[0032] The automated test case reuse method and system described in this invention can reduce the difficulty and cost of test case writing and maintenance. The reuse of automated test cases is implemented as a single test step. Precise matching is performed using a test case keyword model to directly read the test steps of the reused test case, reducing the complexity and data volume of test case writing and improving the efficiency and usability of automated test case writing. When the functional modules involved in the reused test case are modified, only the reused test case needs to be maintained separately; other locations that reuse the test case do not require maintenance or modification. This significantly reduces the test script maintenance cost caused by functional modifications to the system under test, achieving high maintainability of test cases. During execution, a common test case dictionary is dynamically built, achieving data sharing between test cases and between test cases and called test cases, increasing the flexibility of test case reuse and improving overall usability. Attached Figure Description

[0033] Figure 1This is a schematic diagram of the automated test case reuse method provided in an embodiment of the present invention.

[0034] Figure 2 This is a schematic diagram of the automated test case reuse system structure provided in an embodiment of the present invention. Detailed Implementation

[0035] To better understand the content of this invention, a detailed description will be provided in conjunction with the accompanying drawings and embodiments.

[0036] The first aspect of this invention relates to a process flow as follows: Figure 1 The automated test case reuse method shown includes:

[0037] Step S1: Read all test case data in the test case set and convert it into test case keyword models for storage to form a test case dictionary. Each test case corresponds to one keyword model.

[0038] Step S2: Use the keyword model of the test cases to be executed to perform key name retrieval, obtain the dictionary of keyword models of the test cases to be executed, and pass it to the test execution framework;

[0039] Step S3: Obtain the test data from the keyword model of the test cases to be executed and parse the test steps;

[0040] Step S4: Obtain each operation element and its value, and determine the type of the operation element;

[0041] Step S5: If the operation element is a regular category, then perform regular test execution; if the operation element is a call test case, then obtain the value of the operation element, retrieve the corresponding test case keyword model, and parse and execute it.

[0042] Step S6: Perform all test steps in the keyword model of the test cases to be executed in sequence.

[0043] In this preferred embodiment, the test case dictionary consists of multiple test case keyword models.

[0044] In this preferred embodiment, the test case keyword model includes test case names and test steps, which exist in the form of key-value pairs, thereby ensuring the efficiency of data reading during execution.

[0045] For example, the test case keyword model consists of key:value pairs, i.e., {test case name: [{test step 1}, {test step 2}, {test step 3}, ...]}. The test case dictionary consists of key:value pairs, key:value pairs, key:value pairs, ...}.

[0046] In this preferred embodiment, the test steps in the test case keyword model are stored in the form of an array.

[0047] In this embodiment, step S2, which uses the keyword model of the test cases to be executed for key name retrieval, includes retrieval using the test case name.

[0048] In this preferred embodiment, in step S5, the conventional operation element categories include conventional operation categories, verification categories, or data processing categories.

[0049] In this embodiment, the conventional operation classes include page clicks, inputs, and API automated test request message sending for UI automated testing; the conventional verification classes include the correctness judgment of the test process; and the conventional data processing classes include test data assignment and test data processing.

[0050] In this preferred embodiment, each test step in the test case keyword model is executed before the next test step is executed. If the operation element is a calling test case, the value of the operation element is obtained, the corresponding test case keyword model is retrieved and parsed and executed according to the methods shown in steps S2 to S5, until the called test case keyword model has completed the loop execution of all the test steps it contains, indicating that the current step has been completed, and the next test step is executed.

[0051] This invention implements the reuse of automated test cases as a single test step. It uses a test case keyword model for precise matching, directly reading the test steps of the reused test cases. This reduces the complexity and data volume of test case writing, improving the efficiency and usability of automated test case development. When the functional modules involved in the reused test cases are modified, only the reused test cases need to be maintained; other locations where the test cases are reused do not require maintenance or modification. This significantly reduces the maintenance cost of test scripts due to functional modifications of the system under test, achieving high maintainability of test cases. During execution, a common test case dictionary is dynamically built, enabling data sharing between test cases and between test cases and called test cases. This increases the flexibility of test case reuse and improves overall usability.

[0052] Another aspect of the present invention relates to an automated test case reuse system, the structure of which is as follows: Figure 2 As shown, it includes:

[0053] The test case dictionary module is used to read all test case data in the test case set and convert it into test case keyword models for storage to form a test case dictionary. Each test case corresponds to a keyword model.

[0054] The retrieval module uses the keyword model of the test cases to be executed to perform key name retrieval, obtains the dictionary of the keyword model of the test cases to be executed, and passes it to the test execution framework;

[0055] The parsing module is used to obtain test data from the keyword model of the test cases to be executed and parse the test steps;

[0056] The processing module is used to obtain each operation element and its value, and to determine the type of the operation element. If the operation element is a regular category, then regular test execution is performed. If the operation element is a call test case, then the value of the operation element is obtained, the corresponding test case keyword model is retrieved, and the test case is parsed and executed.

[0057] The execution module is used to sequentially execute all test steps in the keyword model of the test cases to be executed.

[0058] By using this system, the aforementioned computational processing methods can be executed and the corresponding technical effects can be achieved.

[0059] Embodiments of the present invention also provide a computer-readable storage medium capable of implementing all the steps of the methods in the above embodiments, wherein the computer-readable storage medium stores a computer program that, when executed by a processor, implements all the steps of the methods in the above embodiments.

[0060] Embodiments of the present invention also provide an electronic device for performing the above-described method. As an implementation device for the method, the electronic device includes at least a processor and a memory. In particular, the memory stores data and related computer programs required for performing the method. The processor calls the data and programs in the memory to execute all the steps of the method and obtain the corresponding technical effect.

[0061] Preferably, the electronic device may include a bus architecture, which may include any number of interconnected buses and bridges. The bus will include various circuits linked together by one or more processors and memories. The bus may also link together various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. The bus interface provides an interface between the bus and the receiver and transmitter. The receiver and transmitter may be the same element, i.e., a transceiver, providing a unit for communicating with various other systems over a transmission medium. The processor is responsible for managing the bus and general processing, while the memory may be used to store data used by the processor during operation.

[0062] Additionally, the electronic device may further include components such as a communication module, an input unit, an audio processor, a display, and a power supply. The processor (or controller, operating control) used may include a microprocessor or other processor device and / or logic device, which receives input and controls the operation of various components of the electronic device; the memory may be one or more of a buffer, flash memory, hard drive, removable media, volatile memory, non-volatile memory, or other suitable devices, which can store the aforementioned data information, and may also store programs for executing the information, and the processor can execute the program stored in the memory to achieve information storage or processing, etc.; the input unit is used to provide input to the processor, for example, it can be a button or touch input device; the power supply is used to provide power to the electronic device; the display is used to display images and text, for example, it can be an LCD display. The communication module is a transmitter / receiver that transmits and receives signals via an antenna. The communication module (transmitter / receiver) is coupled to the processor to provide input signals and receive output signals, which can be the same as in conventional mobile communication terminals. Based on different communication technologies, multiple communication modules can be incorporated into the same electronic device, such as cellular network modules, Bluetooth modules, and / or wireless LAN modules. The communication module (transmitter / receiver) is also coupled to a speaker and microphone via an audio processor to provide audio output through the speaker and receive audio input from the microphone, thereby enabling typical telecommunications functions. The audio processor can include any suitable buffer, decoder, amplifier, etc. Furthermore, the audio processor is coupled to a central processing unit, enabling on-device recording via the microphone and on-device playback of stored sound via the speaker.

[0063] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0064] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A system that specifies functions in one or more boxes.

[0065] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including an instruction set implemented in a process. Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0066] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the functions specified in one or more boxes. Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the invention.

[0067] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. An automated test case reuse method, characterized in that, include: Step S1: Read all test case data in the test case set and convert it into test case keyword models for storage to form a test case dictionary. Each test case corresponds to one keyword model. Step S2: Use the keyword model of the test cases to be executed to perform key name retrieval, obtain the dictionary of keyword models of the test cases to be executed, and pass it to the test execution framework; Step S3: Obtain the test data from the keyword model of the test cases to be executed and parse the test steps; Step S4: Obtain each operation element and its value, and determine the type of the operation element; Step S5: If the operation element is a regular category, then perform regular test execution; if the operation element is a call test case, then obtain the value of the operation element, retrieve the corresponding test case keyword model, and parse and execute it according to the methods shown in steps S2 to S5; only after the called test case keyword model has completed the loop execution of all the test steps it contains, does it indicate that the current step has been completed, and the next test step continues to be executed. Step S6: After each test step in the keyword model of the test cases to be executed is completed, the next test step is executed, and so on, until all test steps in the keyword model of the test cases to be executed are completed. The test case keyword model includes test case names and test steps, and the test case names and test steps exist in the form of key-value pairs; The test case dictionary consists of multiple test case keyword models, which are in the form of key:value pairs.

2. The method as described in claim 1, characterized in that, Step S2 uses the keyword model of the test cases to be executed to perform key name retrieval, including retrieval using the test case name.

3. The method as described in claim 1, characterized in that, The test steps in the test case keyword model are stored in the form of an array.

4. The method according to any one of claims 1 to 3, characterized in that, In step S5, the common operation element categories include common operation categories, verification categories, or data processing categories.

5. The method as described in claim 4, characterized in that, The conventional operation classes include page clicks, inputs, and API automated test request message sending for UI automated testing; the conventional verification classes include correctness judgment of the test process; and the conventional data processing classes include test data assignment and test data processing.

6. An automated test case reuse system, characterized in that, include: The test case dictionary module is used to read all test case data in the test case set and convert it into test case keyword models for storage to form a test case dictionary. Each test case corresponds to a keyword model. The retrieval module uses the keyword model of the test cases to be executed to perform key name retrieval, obtains the dictionary of the keyword model of the test cases to be executed, and passes it to the test execution framework; The parsing module is used to obtain test data from the keyword model of the test cases to be executed and parse the test steps; The processing module is used to obtain each operation element and its value, and to determine the type of the operation element. If the operation element is a regular category, then regular test execution is performed. If the operation element is a test case, then the value of the operation element is obtained, the corresponding test case keyword model is retrieved, and the called test case keyword model is parsed and executed according to the processing procedures corresponding to the test case keyword model to be executed by the retrieval module, parsing module, and processing module. The current execution is considered complete only after the called test case keyword model has completed all the test steps it contains in a loop, and the next test is executed. The execution module executes each test step in the keyword model of the test cases to be executed, and then continues to execute the next test step after each test step is completed. This is used to sequentially complete the execution of all test steps in the keyword model of the test cases to be executed. The test case keyword model includes test case names and test steps, and the test case names and test steps exist in the form of key-value pairs; The test case dictionary consists of multiple test case keyword models, which are in the form of key:value pairs.

7. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the method of any one of claims 1 to 5.

8. An electronic device, characterized in that, Including processor and memory; The memory is used to store operation instructions; The processor is configured to execute the method of any one of claims 1 to 5 by invoking the operation instructions.

9. A computer program product, comprising a computer program and / or instructions, characterized in that, When the computer program and / or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Automatic testing method and device

    CN106201879A

  • Testing case management method and device

    CN107729251A

  • Test case execution method and device, terminal and computer readable storage medium

    CN109815128A