Test case generation method, device, electronic device and computer readable medium

The method of generating Rest API test cases online through graphical streams solves the problem of complex writing of Rest API test cases and incompatible scripts in the existing technology, and achieves the effect of reducing learning threshold, reducing the chance of errors and improving evaluation efficiency.

CN114238128BActive Publication Date: 2025-04-15CHINA TELECOM CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111572450.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-21
Publication Date
2025-04-15
Estimated Expiration
2041-12-21

AI Technical Summary

Technical Problem

When writing Rest API test cases in the prior art, it is necessary to understand the entry and exit format of specific requests, which have problems such as high learning threshold, high time cost, difficult logic to understand and difficult to troubleshoot.

Method used

Rest API test cases are generated online through graphical streams, multiple target components are determined according to user's operation instructions, and the data to be tested is filled in the corresponding location of the component, the test case logic is generated, and it is converted into unified use case description data, and finally converted into test cases.

Benefits of technology

It reduces the scripting capability requirements for testers, reduces enterprise costs, reduces the chance of errors, improves software evaluation efficiency, and solves the script incompatibility problem of different test engine environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114238128B_ABST
    Figure CN114238128B_ABST
Patent Text Reader

Abstract

The present application relates to a test case generation method, device, electronic device and computer-readable medium. The method includes: determining multiple target components according to the user's operation instructions; filling the data to be tested into the corresponding positions of the multiple target components; generating the test case logic of the multiple target components; generating unified use case description data according to the multiple target components and their corresponding test case logic; converting the unified use case description data into a test case. The test case generation method, device, electronic device and computer-readable medium involved in the present application can reduce the script ability requirements for testers, reduce enterprise costs, reduce the probability of errors, improve software evaluation efficiency, and solve the script incompatibility problem of different test engine environments.
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, and in particular, to a test case generation method, device, electronic device and computer-readable medium. Background Art

[0002] API (Application Programming Interface) is used to describe the characteristics of a library or how to use it. REST (Representational State Transfer) is used to describe the standard method of creating HTTP API.

[0003] At present, most online systems are developed in accordance with the Rest API specification, using a front-end and back-end separation architecture, and exchanging data in json format. Therefore, most conventional test case writing requires understanding the input and output parameter formats of specific Rest API requests, and then using the specific syntax or tools of the automated testing framework to generate test cases. When writing test cases, there are the following problems: using the test framework requires a certain learning threshold; understanding the input and output parameter formats of Rest API requests is time-consuming and costly; when the test case is complex, the logic is difficult to understand and troubleshooting is difficult.

[0004] Therefore, a new test case generation method, device, electronic device and computer-readable medium are needed.

[0005] The above information disclosed in the Background section is only for enhancement of understanding of the background of the present application and therefore it may contain information that does not constitute the prior art that is already known to a person of ordinary skill in the art. Summary of the invention

[0006] In view of this, the present application provides a test case generation method, device, electronic device and computer-readable medium, which can reduce the script ability requirements for testers, reduce enterprise costs, reduce the error rate, improve software evaluation efficiency, and solve the script incompatibility problem of different test engine environments.

[0007] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.

[0008] According to one aspect of the present application, a test case generation method is proposed, which includes: determining multiple target components according to user operation instructions; filling the data to be tested into corresponding positions of the multiple target components; generating test case logic for the multiple target components; generating unified use case description data according to the multiple target components and their corresponding test case logic; and converting the unified use case description data into test cases.

[0009] In an exemplary embodiment of the present application, it also includes: obtaining a Rest API definition document of a component; extracting a Rest API definition, a request path, a request method, header information, and an input and output parameter format based on the Rest API definition document; and generating an auxiliary template for the component based on the Rest API definition, request path, request method, header information, and input and output parameter format.

[0010] In an exemplary embodiment of the present application, multiple target components are determined according to the user's operation instructions, including: determining multiple target components by the component area according to the user's operation instructions; dragging the multiple target components from the component area to the editing area; receiving the user's operation instructions on the target components in the editing area to display the auxiliary template.

[0011] In an exemplary embodiment of the present application, filling the data to be tested into corresponding positions of the multiple target components includes: filling the data to be tested into corresponding positions in the auxiliary templates of the multiple target components in sequence.

[0012] In an exemplary embodiment of the present application, generating the test case logic of the multiple target components includes: obtaining the user's connection operation between the multiple target components; and generating the test case logic based on the connection logic between the multiple target components.

[0013] In an exemplary embodiment of the present application, unified use case description data is generated according to the multiple target components and their corresponding test case logic, including: converting the test case logic into test step data; generating the unified use case description data based on the test step data and the multiple target components.

[0014] In an exemplary embodiment of the present application, converting the unified use case description data into a test case includes: converting the unified use case description data into a test script based on multiple programming languages.

[0015] According to one aspect of the present application, a test case generation device is proposed, which includes: an instruction module, used to determine multiple target components according to user operation instructions; a filling module, used to fill the data to be tested into the corresponding positions of the multiple target components; a logic module, used to generate test case logic for the multiple target components; a description module, used to generate unified use case description data according to the multiple target components and their corresponding test case logic; a conversion module, used to convert the unified use case description data into a test case.

[0016] According to one aspect of the present application, an electronic device is proposed, which includes: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the method as described above.

[0017] According to one aspect of the present application, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described above is implemented.

[0018] According to the test case generation method, device, electronic device and computer-readable medium of the present application, multiple target components are determined according to the user's operating instructions; the data to be tested is filled into the corresponding positions of the multiple target components; the test case logic of the multiple target components is generated; unified use case description data is generated according to the multiple target components and their corresponding test case logic; and the unified use case description data is converted into a test case. This method can reduce the scripting ability requirements for testers, reduce enterprise costs, reduce the error rate, improve software evaluation efficiency, and solve the script incompatibility problem of different test engine environments.

[0019] It should be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The above and other objects, features and advantages of the present application will become more apparent by describing in detail the exemplary embodiments thereof with reference to the accompanying drawings. The accompanying drawings described below are only some embodiments of the present application, and it is clear to a person skilled in the art that other accompanying drawings can be obtained from these accompanying drawings without creative effort.

[0021] Figure 1 The present invention is a flowchart of a test case generation method according to an exemplary embodiment.

[0022] Figure 2 It is a schematic diagram of a test case generation method according to an exemplary embodiment.

[0023] Figure 3 The figure is a flowchart of a test case generating method according to another exemplary embodiment.

[0024] Figure 4 It is a schematic diagram of a test case generation method according to an exemplary embodiment.

[0025] Figure 5 It is a schematic diagram of a test case generation method according to an exemplary embodiment.

[0026] Figure 6The invention is a block diagram of a test case generating device according to an exemplary embodiment.

[0027] Figure 7 It is a block diagram of an electronic device according to an exemplary embodiment.

[0028] Figure 8 It is a block diagram of a computer-readable medium according to an exemplary embodiment. DETAILED DESCRIPTION

[0029] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this application will be comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.

[0030] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.

[0031] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0032] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0033] It should be understood that although the terms first, second, third, etc. may be used herein to describe various components, these components should not be limited by these terms. These terms are used to distinguish one component from another component. Therefore, the first component discussed below can be referred to as the second component without departing from the teachings of the concepts of the present application. As used herein, the term "and / or" includes any one of the associated listed items and all combinations of one or more.

[0034] Those skilled in the art will appreciate that the drawings are merely schematic diagrams of example embodiments, and the modules or processes in the drawings are not necessarily necessary for implementing the present application, and therefore cannot be used to limit the scope of protection of the present application.

[0035] Writing test cases is the main work of the software evaluation process. The efficiency, quality and correctness of test case writing are not only related to the tester's own ability, but also have a lot to do with the test case generation tool. When writing test cases with existing tools, such as jmeter, robotframework, etc., when calling the Rest API, it is not possible to verify whether the path, method and parameters of the request are correct; and there is a lack of an intuitive way to describe the relationship between the various elements in the test case; in addition, the test tool needs to be installed locally before it can be used. In response to the above series of problems, this patent proposes a test case generation method, which generates Rest API test cases online through graphic streams. Test cases can be written on the page only in an Internet environment, which makes it convenient for testers to understand the logical structure of the entire test case and improves the efficiency, quality and correctness of test case writing.

[0036] Figure 1 The flowchart of a test case generation method according to an exemplary embodiment is shown. The test case generation method 10 at least includes steps S102 to S110.

[0037] like Figure 1 As shown, in S102, multiple target components are determined according to the user's operation instruction. The user's selection of a component is received, and multiple target components are determined according to the user's click.

[0038] In one embodiment, it also includes: obtaining a Rest API definition document of a component; extracting a Rest API definition, a request path, a request method, header information, and an input and output parameter format based on the Rest API definition document; and generating an auxiliary template for the component based on the Rest API definition, request path, request method, header information, and input and output parameter format.

[0039] In one embodiment, multiple target components can be determined from the component area according to the user's operation instructions; the multiple target components can be dragged from the component area to the editing area; and the user's operation instructions on the target components can be received in the editing area to display the auxiliary template.

[0040] In S104, the data to be tested is filled into the corresponding positions of the plurality of target components. The data to be tested is filled into the corresponding positions of the auxiliary templates of the plurality of target components in sequence.

[0041] In S106, test case logic of the plurality of target components is generated. A user's connection operation between the plurality of target components is obtained; and the test case logic is generated based on the connection logic between the plurality of target components.

[0042] In S108, unified use case description data is generated according to the multiple target components and their corresponding test case logics. The test case logic is converted into test step data; and the unified use case description data is generated based on the test step data and the multiple target components.

[0043] In one embodiment, the graphic flow data generated in the above steps is converted into a unified use case description by a unified use case description conversion module. The unified use case description mainly consists of test steps (i.e., the steps array field), and the test steps include call keywords, branches, and loop controls, etc. At the same time, keywords can also be built-in, such as sending requests, assertions, assignments, and extracting request results.

[0044] More specifically, you can create custom functions in the unified use case description to encapsulate recurring test steps into functions. For example, in the jmeter conversion plug-in, you can encapsulate custom functions using the Test Fragment element. The unified use case description retains a certain degree of scalability. For testers with strong coding skills, they can implement complex test logic by creating custom keywords. For example, testers can implement a jmeter custom JavaRequest element through java code and then reference it in the unified use case description.

[0045] In S110, the unified use case description data is converted into a test case. The unified use case description data is converted into a test script based on multiple programming languages.

[0046] The engine adaptation and conversion modules can be developed using languages ​​such as Java, python, golang, etc., so that the unified use case description can be converted into a test engine format file (executable script) after being traversed by the underlying engine adaptation module and the plug-in. For example, the unified use case description data can be converted into the jmeter script format, or other script formats, but this application is not limited to this.

[0047] The test case generation method of this application has the following advantages:

[0048] Write test cases in a graphical flow to intuitively display the test case logic;

[0049] Reduce human errors by importing Rest API definitions to assist in editing test cases;

[0050] Use a unified test case description to isolate test case writing from the underlying test engine, and then use plug-ins to flexibly convert test cases into the formats of different test engines.

[0051] Figure 2 is a schematic diagram of a test case generation method according to an exemplary embodiment. In a specific application scenario, the test case generation method in this application can be divided into multiple functional modules. Figure 2 As shown, the main functional modules include: Rest API analysis module, front-end graphic stream editing module, unified use case description conversion module, and underlying engine adaptation and conversion module.

[0052] The Rest API analysis module provides an interface for importing Rest API definition documents, analyzes the correctness of the imported Rest API definition documents and saves them to the system. It also needs to provide an access interface to the front-end graphic stream editing module so that the graphic stream editing page can display the corresponding parameters when editing Rest API elements.

[0053] The front-end graphic flow editing module provides a front-end graphic flow editing page. The page provides elements such as Rest API, assertion and branch. Testers edit each element and combine the elements in the editing page by connecting them to form a test case. When editing the original Rest API element, the page will display the imported Rest API. By selecting different Rest APIs, the page will display different parameters for testers to fill in.

[0054] The unified use case description conversion module provides the ability to convert the front-end graphic stream editing data into a unified use case description. The unified use case description is defined by a format specification for describing test cases, which defines various elements, their attributes and inclusion relationships, such as test cases, test steps, branch assertions, etc.

[0055] The underlying engine adaptation and conversion module provides the ability to access and traverse the unified use case description, and defines a conversion interface, which is used to convert the unified use case description to a specific test engine format file. For example, people who are familiar with the robotframework format script can implement the above conversion interface and provide a robotframework conversion plug-in.

[0056] According to the test case generation method of the present application, multiple target components are determined according to the user's operating instructions; the data to be tested is filled into the corresponding positions of the multiple target components; the test case logic of the multiple target components is generated; unified use case description data is generated according to the multiple target components and their corresponding test case logic; and the unified use case description data is converted into a test case. This method can reduce the scripting ability requirements for testers, reduce enterprise costs, reduce the probability of errors, improve software evaluation efficiency, and solve the script incompatibility problem of different test engine environments.

[0057] It should be clearly understood that the present application describes how to form and use specific examples, but the principles of the present application are not limited to any details of these examples. On the contrary, based on the teaching of the content disclosed in the present application, these principles can be applied to many other embodiments.

[0058] Figure 3 The figure is a flowchart of a test case generating method according to another exemplary embodiment. Figure 3 The process 30 shown is for Figure 2 A detailed description of S106 “generating test case logic for the multiple target components” in the process shown.

[0059] like Figure 3 As shown, in S302, multiple target components are determined by the component area according to the user's operation instruction. The component area and the editing area can be displayed in the user interface, wherein the component area provides components such as HTTP request, response assertion, branch, etc.

[0060] In S304, the multiple target components are dragged from the component area to the editing area. The tester drags the selected components from the component area to the editing area by dragging.

[0061] In S306, an operation instruction of a user on a target component is received in the editing area to display the auxiliary template.

[0062] In S308, the data to be tested is sequentially filled into corresponding positions in the auxiliary templates of the multiple target components. The tester can double-click the component to enter the component editing page to complete the test data filling.

[0063] Figure 4 FIG. 1 is a schematic diagram of a test case generation method according to another exemplary embodiment. Figure 4 As shown, on the component editing page, the Rest API list of imported module A will be displayed. The tester selects the Rest API request to be tested and fills in the input parameter data, edits the assertion information to assert the status code, and then chooses to end or initiate another Rest API request based on the assertion result. Figure 4The text content is only used as an exemplary description and is not used as the basis of the technology of the present invention.

[0064] In S310, the test case logic is generated based on the wiring logic between the multiple target components. Figure 5 As shown in the figure, the test case logic can be drawn through the connection lines. Parameters such as logical judgment criteria can also be added to the connection lines.

[0065] According to the test case generation method of the present application, the test cases are edited graphically, which is simple, intuitive, and easy to operate, greatly reducing the scripting ability requirements of testers and reducing enterprise costs; the Rest API is used to define standardized input and output parameters to reduce the error rate and improve software evaluation efficiency; through the unified use case description, the test case writing is decoupled from the specific test engine, solving the problem of script incompatibility in different test engine environments.

[0066] Those skilled in the art will appreciate that all or part of the steps for implementing the above embodiments are implemented as a computer program executed by a CPU. When the computer program is executed by the CPU, the above functions defined by the above method provided in the present application are executed. The program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.

[0067] In addition, it should be noted that the above figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present application, and are not intended to be limiting. It is easy to understand that the processes shown in the above figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.

[0068] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0069] Figure 6 FIG. 1 is a block diagram of a test case generating device according to another exemplary embodiment. Figure 6 As shown, the test case generating device 60 includes: an instruction module 602 , a filling module 604 , a logic module 606 , a description module 608 , and a conversion module 610 .

[0070] The instruction module 602 is used to determine multiple target components according to the user's operation instructions; the instruction module 602 is also used to determine multiple target components from the component area according to the user's operation instructions; drag the multiple target components from the component area to the editing area; receive the user's operation instructions on the target components in the editing area to display the auxiliary template.

[0071] The filling module 604 is used to fill the data to be tested into the corresponding positions of the multiple target components; the filling module 604 is also used to fill the data to be tested into the corresponding positions in the auxiliary templates of the multiple target components in sequence.

[0072] The logic module 606 is used to generate the test case logic of the multiple target components; the logic module 606 is also used to obtain the user's connection operation between the multiple target components; and generate the test case logic based on the connection logic between the multiple target components.

[0073] The description module 608 is used to generate unified use case description data according to the multiple target components and their corresponding test case logic; the description module 608 is also used to convert the test case logic into test step data; and generate the unified use case description data based on the test step data and the multiple target components.

[0074] The conversion module 610 is used to convert the unified use case description data into a test case. The conversion module 610 is also used to convert the unified use case description data into a test script based on multiple programming languages.

[0075] According to the test case generation device of the present application, multiple target components are determined according to the user's operating instructions; the data to be tested is filled into the corresponding positions of the multiple target components; the test case logic of the multiple target components is generated; unified use case description data is generated according to the multiple target components and their corresponding test case logic; and the unified use case description data is converted into a test case. This method can reduce the scripting ability requirements for testers, reduce enterprise costs, reduce the probability of errors, improve software evaluation efficiency, and solve the script incompatibility problem of different test engine environments.

[0076] Figure 7 It is a block diagram of an electronic device according to an exemplary embodiment.

[0077] Refer to the following Figure 7 hereinafter describes an electronic device 700 according to this embodiment of the present application. Figure 7 The electronic device 700 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.

[0078] like Figure 7 As shown, the electronic device 700 is in the form of a general computing device. The components of the electronic device 700 may include, but are not limited to: at least one processing unit 710, at least one storage unit 720, a bus 730 connecting different system components (including the storage unit 720 and the processing unit 710), a display unit 740, etc.

[0079] The storage unit stores a program code, which can be executed by the processing unit 710, so that the processing unit 710 performs the steps described in this specification according to various exemplary embodiments of the present application. For example, the processing unit 710 can perform the following steps: Figure 2 , Figure 3 Follow the steps shown in .

[0080] The storage unit 720 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 7201 and / or a cache memory unit 7202 , and may further include a read-only memory unit (ROM) 7203 .

[0081] The storage unit 720 may also include a program / utility 7204 having a set (at least one) of program modules 7205, such program modules 7205 including but not limited to: an operating system, one or more application programs, other program modules and program data, each of which or some combination may include the implementation of a network environment.

[0082] Bus 730 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0083] The electronic device 700 may also communicate with one or more external devices 700' (e.g., keyboards, pointing devices, Bluetooth devices, etc.) to enable a user to communicate with the electronic device 700, and / or any device (e.g., routers, modems, etc.) that the electronic device 700 can communicate with one or more other computing devices. Such communication may be performed via an input / output (I / O) interface 750. In addition, the electronic device 700 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 760. The network adapter 760 may communicate with other modules of the electronic device 700 via a bus 730. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0084] Through the above description of the implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by combining software with necessary hardware. Figure 8As shown, the technical solution according to the implementation mode of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes a number of instructions to enable a computing device (which can be a personal computer, a server, or a network device, etc.) to execute the above method according to the implementation mode of the present application.

[0085] The software product may be any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, a system, device or component of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0086] The computer readable storage medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by an instruction execution system, an apparatus, or a device or used in combination with it. The program code contained on the readable storage medium may be transmitted with any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.

[0087] Program code for performing the operations of the present application may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).

[0088] The computer-readable medium carries one or more programs. When the one or more programs are executed by a device, the computer-readable medium implements the following functions: determining multiple target components according to the user's operation instructions; filling the data to be tested into the corresponding positions of the multiple target components; generating the test case logic of the multiple target components; generating unified use case description data according to the multiple target components and their corresponding test case logic; converting the unified use case description data into a test case. The computer-readable medium can also implement the following functions: obtaining the Rest API definition document of the component; extracting the Rest API definition, request path, request method, header information, and input and output parameter formats based on the Rest API definition document; generating the auxiliary template of the component based on the Rest API definition, request path, request method, header information, and input and output parameter formats.

[0089] Those skilled in the art will appreciate that the above modules can be distributed in the device according to the description of the embodiment, or can be changed accordingly and only used in one or more devices different from the embodiment. The modules of the above embodiments can be combined into one module, or further divided into multiple sub-modules.

[0090] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiment of the present application.

[0091] The exemplary embodiments of the present application are specifically shown and described above. It should be understood that the present application is not limited to the detailed structures, configurations or implementations described herein; on the contrary, the present application is intended to cover various modifications and equivalent configurations included in the spirit and scope of the appended claims.

Claims

1. A test case generation method, characterized in that: include: Determine multiple target components according to the user's operation instructions; Filling the to-be-tested data into corresponding positions of the plurality of target components; Generate test case logic for the multiple target components; Generate unified use case description data according to the multiple target components and their corresponding test case logic; wherein the unified use case description is defined by a format specification for describing test cases, and the specification defines various elements, attributes and inclusion relationships of the elements, such as test cases, test steps and branch assertions; Converting the unified use case description data into test cases; Obtain a Rest API definition document of a component; extract a Rest API definition, a request path, a request method, header information, and an input / output parameter format based on the Rest API definition document; generate an auxiliary template of a component based on the Rest API definition, the request path, the request method, header information, and the input / output parameter format; Determine multiple target components according to the user's operation instructions, including: determine multiple target components from the component area according to the user's operation instructions; drag the multiple target components from the component area to the editing area; receive the user's operation instructions on the target components in the editing area to display the auxiliary template.

2. The method according to claim 1, characterized in that Filling the to-be-tested data into corresponding positions of the plurality of target components includes: Fill the data to be tested into the corresponding positions of the auxiliary templates of the multiple target components.

3. The method according to claim 1, characterized in that Generate test case logic for the multiple target components, including: Obtaining a user's connection operation between the multiple target components; The test case logic is generated based on the wiring logic between the multiple target components.

4. The method according to claim 1, characterized in that Generate unified use case description data according to the multiple target components and their corresponding test case logics, including: Convert the test case logic into test step data; The unified use case description data is generated based on the test step data and the multiple target components.

5. The method according to claim 1, characterized in that Converting the unified use case description data into test cases includes: The unified use case description data is converted into a test script based on multiple programming languages.

6. A test case generating device, characterized in that: include: An instruction module, used for determining multiple target components according to the user's operation instructions; A filling module, used to fill the to-be-tested data into corresponding positions of the plurality of target components; A logic module, used to generate test case logic for the multiple target components; A description module, used to generate unified use case description data according to the multiple target components and their corresponding test case logic; wherein the unified use case description is defined by a format specification for describing test cases, and the specification defines various elements, attributes and inclusion relationships of the elements, such as test cases, test steps and branch assertions; A conversion module, used to convert the unified use case description data into a test case; Determining multiple target components according to the user's operation instruction includes: determining multiple target components from the component area according to the user's operation instruction; dragging the multiple target components from the component area to the editing area; receiving the user's operation instruction on the target component in the editing area to display the auxiliary template; The auxiliary template is obtained in the following manner: obtaining a Rest API definition document of a component; extracting a Rest API definition, a request path, a request method, header information, and an input and output parameter format based on the Rest API definition document; and generating an auxiliary template of the component based on the Rest API definition, request path, request method, header information, and an input and output parameter format.

7. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.

8. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Automatic unit testing method and device based on unified description language

    CN111382055A

  • Test case generation method and device

    CN113742238A