Automatic test case generation method, test method, electronic equipment and storage medium

By using standardized format storage and associated operation steps to generate test cases in the graph database, the problems of high cost and instability in graph automated testing are solved, efficient and stable automatic generation of test cases is achieved, and testing efficiency and accuracy are improved.

CN118550838APending Publication Date: 2024-08-27FUZHOU CHANGXIN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410840473.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-27
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

Existing graphical automated testing technology is expensive, impractical, and unstable, and cannot accurately determine the scope of impact of data model and interface modifications. Manually written automation scenarios are limited, and the execution process is error-prone, resulting in incomplete testing and low efficiency.

Method used

Find the starting point of the test scenario through the graph database, store data in a standardized format, associate operation steps to generate path use cases, input data or obtain verification values ​​according to rules, generate scenario use cases, and use the relationship query features of the graph database to achieve efficient and stable testing Use cases are automatically generated.

Benefits of technology

It achieves more accurate and efficient generation of graphical automation test cases containing business scenarios, reduces the possibility of execution errors, improves the stability and efficiency of the testing process, and solves the high cost and instability problems of traditional graphical automation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550838A
    Figure CN118550838A
Patent Text Reader

Abstract

The invention relates to the field of software testing, and provides a test case automatic generation method, a test method, electronic equipment and a storage medium, the generation method comprises the following steps: searching a starting point of a test scene through a graph database; wherein the data of the graph database is stored in a standardized format, and the data comprises a test output parameter, an input parameter and a verification rule; associating operation steps through the scene starting point to generate a corresponding path use case; and searching a corresponding rule according to association of each operation entity, inputting data or obtaining a verification value according to the rule, and generating a scene case. According to the scheme, the graph database relation query characteristic is utilized, the graph automation test case containing the business scene is generated more accurately and more efficiently, and the problems that traditional graph automation is high in cost, not practical and unstable are solved; when the graph database is set, the data is stored and updated in a standardized format mode, the problem that errors are prone to occurring in execution is avoided, and testing is more efficient and stable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software testing technology, and in particular to a test case automatic generation method, a testing method, an electronic device and a storage medium. Background Art

[0002] A test case is a description of a test task for a specific software product, reflecting the test plan, method, technology and strategy. Its content includes test objectives, test environment, input data, test steps, expected results, test scripts, etc., which are finally documented. Simply put, a test case is a set of test inputs, execution conditions and expected results compiled for a special goal, which is used to verify whether a specific software requirement is met. The design and compilation of test cases is the most important in software testing activities. Test cases are the guidance of testing work, the criteria that must be followed in software testing, and the fundamental guarantee for the stability of software testing quality.

[0003] In recent years, some testers have combined graph databases with test cases in an attempt to improve the efficiency of test case construction. However, existing graph automation has the following drawbacks: after the data model, interface, and front-end are modified, it is impossible to accurately determine the scope of impact, and there may be incomplete testing; the manually written automation scenarios are limited and can only perform regression testing, with low input-output ratio; the execution process is prone to errors and instability. Summary of the invention

[0004] In order to help improve the problems of incomplete testing and error-prone execution in existing technologies, the present application provides a test case automatic generation method, a testing method, an electronic device and a storage medium.

[0005] In a first aspect, the present application provides a method for automatically generating test cases for use in the field of software testing technology, the method comprising:

[0006] Find the starting point of the test scenario through a graph database; wherein the data of the graph database is stored in a standardized format, and the data includes test output parameters, input parameters, and verification rules;

[0007] Through the scenario starting point, associate its operation steps and generate the corresponding path use case;

[0008] Find the corresponding rules according to each operation entity association, input data or obtain verification values ​​according to the rules, and generate scenario use cases.

[0009] By adopting the above technical solution, efficient, stable and automatic generation of test cases can be achieved.

[0010] In a second aspect, the present invention further proposes a testing method, wherein the test cases used in the testing of the testing method are generated by the test case automatic generation method as described above.

[0011] In a third aspect, the present application provides an electronic device, which adopts the following technical solution:

[0012] An electronic device, comprising:

[0013] at least one processor;

[0014] Memory;

[0015] At least one application program, wherein the at least one application program is stored in a memory and configured to be executed by at least one processor, and the at least one application program is configured to: execute a test case automatic generation method.

[0016] Fourthly, the present application provides a computer-readable storage medium, which adopts the following technical solution:

[0017] A computer-readable storage medium stores a computer program, which, when executed in a computer, causes the computer to execute any one of the test case automatic generation methods provided in the first aspect.

[0018] To sum up, the technical solution of the present invention utilizes the characteristics of relational query of graph database to generate graphical automation test cases containing business scenarios more accurately and efficiently, solving the problems of high cost, impracticality and instability of traditional graphical automation; at the same time, when setting up the graph database, a standardized format is used for data storage and update, avoiding the problem of error-prone execution and making the testing process more efficient and stable. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 It is a flowchart of a method for automatically generating test cases provided in an embodiment of the present application;

[0020] Figure 2 It is an initial tree structure diagram of a test case automatic generation method provided in an embodiment of the present application;

[0021] Figure 3 It is a tree diagram of the associated steps, rules and data of a test case automatic generation method provided in an embodiment of the present application;

[0022] Figure 4 It is the final tree diagram of the test case automatic generation method provided in the embodiment of the present application;

[0023] Figure 5 It is a module schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0024] In order to make the purpose, technical solutions and advantages of this application more clear, the following Figure 1-5 It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0025] An embodiment of the present application provides a method for automatically generating test cases for use in a software testing system.

[0026] This embodiment uses a software testing system as an application example to specifically illustrate the above method. In actual implementation, the above method can also be used in other systems, which is not limited in this embodiment.

[0027] Specific reference Figure 1 , a test case automatic generation method, used in the field of software testing technology, comprising:

[0028] S10: searching for the starting point of the test scenario through the graph database; wherein the data in the graph database is stored in a standardized format, and the data includes test output parameters, input parameters, and verification rules;

[0029] S20: By associating the scene starting point with its operation steps, a corresponding path use case is generated; in this embodiment, the path includes mandatory steps and optional steps; among which, the use cases of the mandatory step path are generated first, and the use cases of the optional step path are generated later.

[0030] S30: Search for corresponding rules according to each operation entity association, input data or obtain verification values ​​according to the rules, and generate scenario use cases.

[0031] The solution utilizes the characteristics of relational query in graph databases to generate graphical automation test cases covering business scenarios more accurately and efficiently, solving the problems of high cost, impracticality and instability of traditional graphical automation. At the same time, when setting up the graph database, a standardized format is used for data storage and update, avoiding error-prone execution and making the testing process more efficient and stable.

[0032] Based on this embodiment, the process of generating a graph database includes:

[0033] The data entered according to the standardized format is formed into a tree structure;

[0034] Associate execution steps according to product design, and design rules and data that need to be verified after operating each element;

[0035] Based on the preset scenario steps, rules, and verification data, all involved paths are queried through the graph database to generate graphical automation use cases through fixed-pattern code.

[0036] In this embodiment, the data of the graph database includes: products, pages, elements, element attributes, element operations, checks, business rules and custom rules. Of course, the data of the graph database may also include other data, which are not limited to the description in this embodiment.

[0037] Specifically, the entered data includes: entering relevant entities and relationships according to a standardized format (such as entry performed in an initial development phase), and making changes to entities and relationships according to a standardized format (such as changes performed in a later maintenance phase).

[0038] Based on this embodiment, the construction of the graph database includes:

[0039] Enter the business processes between entities through mind mapping as needed;

[0040] Set the output and input parameters according to the characteristics of the entity;

[0041] Set validation rules based on business characteristics and entity characteristics in requirements.

[0042] This embodiment scheme utilizes the relationship query characteristics of the graph database to more accurately and efficiently generate graphic automation test cases containing business scenarios, solving the problems of high cost, impracticality and instability of traditional graphic automation.

[0043] In addition, the implementation of this technical solution can also analyze the usage of components to find out which components or data are used most and which scenarios are prone to errors, and continuously optimize the software system. Furthermore, through test quality analysis and usage scenario analysis, problems can be quickly located and solved, thus improving the quality of software products.

[0044] In another embodiment, referring to the attached Figure 2 , Attachment Figure 3 , Attachment Figure 4 As shown, the steps for forming the graph database are as follows:

[0045] (1) Formulate unified standards

[0046] Formulate product design specifications. Relevant information includes: product and page entity information, product-product, product-page, page-page, and page-page relationships;

[0047] Formulate database design specifications. Relevant information includes: entity information of people, models, and fields, as well as the relationship between people and models, between models and models, and between models and fields;

[0048] Formulate interface design specifications. Related information includes: interface entity information, as well as the relationship between people and interfaces, between interfaces, between interfaces and entities, and between interfaces and fields;

[0049] Develop front-end component design specifications. Relevant information includes: front-end component entity information, as well as the relationship between people and components, between components and components, and between components and interfaces.

[0050] Formulate specifications for graph database entry, update, and query.

[0051] (2) Information entry

[0052] During the development phase, relevant entities and relationships are entered according to standards;

[0053] The change phase involves making changes to entities and relationships according to the specifications.

[0054] (3) Test design

[0055] Enter the business processes between entities through mind mapping as needed;

[0056] Design the input parameters according to the entity characteristics;

[0057] Design validation rules based on business characteristics and entity characteristics in requirements.

[0058] (4) Schematic diagram of graphical automation use case generation

[0059] Formed by entering information Figure 2 The tree structure shown contains basic information such as products, pages, elements, element attributes, element operations, verification, custom rules, business rules, etc. Standardized information entry can ensure the stability of graphic automation. However, no specific business scenario operation steps have been formed at this time. Only basic element verification can be generated, such as whether the elements are displayed correctly, whether the text is correct, and whether the interface is accessible. It is impossible to generate scenario test cases.

[0060] like Figure 3 As shown, the test can associate execution steps (mandatory, optional) according to the product design, and design the rules and data that need to be verified after operating each element. If there is a change record, the corresponding change information can also be queried through the graph database, so as to adjust the test scenario, verification rules and verification data in time.

[0061] like Figure 4 As shown in the figure, the test can query all the paths involved through the graph database according to the designed scenario steps, rules, and verification data. The fixed-pattern code can generate graphical automation use cases more easily and comprehensively.

[0062] Specifically, for example, by repeatedly performing the WEB product A scenario use case generation, an example is given below:

[0063] Step 1: Open [Page A];

[0064] Step 2: Get the location information of [Element A], and enter [Fixed Value A] of [Business Rule A] in [Element A];

[0065] Step 3: Get the location information of [Element B], and enter [Fixed value B] of [Custom rule B] in [Element B];

[0066] Step 4: Get the location information of [element C] and upload [picture C] on [element C];

[0067] Step 5: [Element C] has two associated lower-level operation steps, one of which is necessary (solid line) and one is not necessary (dashed line);

[0068] (1) Generate a solid line relationship first, click [Element E], and verify the operation result according to [Verification Value A] of [Business Verification Rule B];

[0069] (2) The dotted line will add an additional step at [Element D], then click [Element E];

[0070] Step 6: Click [Element E] and call [Interface A] to verify the interface return according to [Verification Value D] of [Business Verification Rule C];

[0071] In this way, according to the location information of the [page|element|interface] instance, the element can be accurately located, and then according to the order of the operation steps, the automated operation steps can be generated, and the [input value] can be obtained according to the rules corresponding to each element, and the [verification value] can be obtained according to the [verification rule] corresponding to the [page|element|interface]. Using a programming language to query according to the above steps, it is easy to realize the automatic generation of graphical automated test cases covering business scenarios.

[0072] The present application also provides a testing method for performing software testing using test cases, wherein the test cases are generated by the above test case automatic generation method.

[0073] The present application also provides an electronic device, such as Figure 5 As shown, Figure 5 The electronic device 700 shown includes: a processor 701 and a memory 703. The processor 701 and the memory 703 are connected, such as through a bus 702. Optionally, the electronic device 700 may also include a transceiver 704. It should be noted that in actual applications, the transceiver 704 is not limited to one, and the structure of the electronic device 700 does not constitute a limitation on the embodiments of the present application.

[0074] Processor 701 may be a CPU (Central Processing Unit), a general purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 701 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0075] The bus 702 may include a path to transmit information between the above components. The bus 702 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 702 may be divided into an address bus, a data bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0076] The memory 703 can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these.

[0077] The memory 703 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 701. The processor 701 is used to execute the application code stored in the memory 703 to implement the contents shown in the above method embodiment.

[0078] The electronic devices include, but are not limited to, mobile terminals such as mobile phones, notebook computers, PDAs (personal digital assistants), PADs (tablet computers), etc., and fixed terminals such as digital TVs, desktop computers, etc. It can also be a server, etc. Figure 5 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0079] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute the test case automatic generation method provided in the above embodiment.

[0080] It should be understood that although the steps in the flowchart of the accompanying drawings are shown in sequence according to the instructions of the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise clearly stated in this document, the execution of these steps is not strictly limited in order and can be performed in other orders.

[0081] The above are only some implementation methods of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for automatically generating test cases, characterized in that: Used in the field of software testing technology, the method comprises: Find the starting point of the test scenario through a graph database; wherein the data of the graph database is stored in a standardized format, and the data includes test output parameters, input parameters, and verification rules; Through the scenario starting point, associate its operation steps and generate the corresponding path use case; Find the corresponding rules according to each operation entity association, input data or obtain verification values ​​according to the rules, and generate scenario use cases.

2. The method for automatically generating test cases according to claim 1, characterized in that: The generation process of the graph database includes: The data entered according to the standardized format is formed into a tree structure; Associate execution steps according to product design, and design rules and data that need to be verified after operating each element; Based on the preset scenario steps, rules, and verification data, all involved paths are queried through the graph database to generate graphical automation use cases through fixed-pattern code.

3. The test case automatic generation method according to claim 1, characterized in that: The data of the graph database includes: products, pages, elements, element attributes, element operations, verifications, business rules and custom rules.

4. The method for automatically generating test cases according to claim 2, characterized in that: The path includes mandatory steps and optional steps; among them, the use cases of the mandatory step path are generated first, and the use cases of the optional step path are generated later.

5. The method for automatically generating test cases according to claim 1, characterized in that: The data entered includes: entering relevant entities and relationships according to a standardized format, and making changes to entities and relationships according to a standardized format.

6. The method for automatically generating test cases according to claim 2, characterized in that: The construction of the graph database includes: Enter the business processes between entities through mind mapping as needed; Set the output and input parameters according to the characteristics of the entity; Set validation rules based on business characteristics and entity characteristics in requirements.

7. A testing method, characterized in that: The test cases used in the test of the test method are generated by the test case automatic generation method according to any one of claims 1 to 6.

8. An electronic device, characterized in that: The electronic device includes: at least one processor; Memory; At least one application, wherein the at least one application is stored in a memory and configured to be executed by at least one processor, and the at least one application is configured to: execute the test case automatic generation method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed in a computer, the computer is caused to execute the test case automatic generation method according to any one of claims 1 to 6.