CN113900958A - Test case script generation method, system, medium and electronic device - Google Patents

Test case script generation method, system, medium and electronic device Download PDF

Info

Publication number
CN113900958A
CN113900958A CN202111280146.2A CN202111280146A CN113900958A CN 113900958 A CN113900958 A CN 113900958A CN 202111280146 A CN202111280146 A CN 202111280146A CN 113900958 A CN113900958 A CN 113900958A
Authority
CN
China
Prior art keywords
stream
test case
unified
description information
test
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111280146.2A
Other languages
Chinese (zh)
Inventor
曹孟毅
齐洁
屈振华
江洪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Telecom Corp Ltd
Original Assignee
China Telecom Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Telecom Corp Ltd filed Critical China Telecom Corp Ltd
Priority to CN202111280146.2A priority Critical patent/CN113900958A/en
Publication of CN113900958A publication Critical patent/CN113900958A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application relates to the field of software testing, and discloses a method and a system for generating a test case script, a computer readable medium and electronic equipment. The method comprises the following steps: acquiring a Rest API definition document, and analyzing the Rest API definition document to obtain element and parameter format information; outputting a graphical stream visual editing page; displaying target components according to the target components selected from the components of the graphical stream visual editing page, and acquiring parameter data corresponding to each target component; drawing a graphic stream in a graphic stream visual editing page according to the received interactive instruction; acquiring graphic stream data corresponding to the graphic stream, and taking the parameter data and the graphic stream data as graphic stream editing data; converting the graphics stream editing data into unified use case description information; and converting the unified case description information into a test case script. The method reduces the learning threshold of software testing, improves the software evaluation efficiency, and also solves the problem of script incompatibility of different testing engine environments.

Description

Test case script generation method, system, medium and electronic device
Technical Field
The present application relates to the field of software testing technologies, and in particular, to a method and a system for generating a test case script, a computer-readable medium, and an electronic device.
Background
At present, most online systems are developed according to the Rest API specification, adopt a front-end and back-end separation architecture, and exchange data through a json format. Thus, most conventional test case writing requires knowledge of the access format of a particular Rest API request and then the generation of test cases using automated test framework specific syntax or tools.
However, the scheme for generating the test cases still has the defects that certain learning threshold is required by using a test framework, the time and the cost for knowing the access format of the Rest API request are high, the logic of the complex test cases is difficult to understand, the debugging is difficult, and the like.
Disclosure of Invention
In the field of software testing technologies, to solve the above technical problems, an object of the present application is to provide a method, a system, a computer-readable medium, and an electronic device for generating a test case script.
According to an aspect of the embodiments of the present application, a method for generating a test case script is provided, where the method includes:
acquiring a Rest API definition document, and analyzing the Rest API definition document to obtain elements and parameter format information corresponding to the elements;
outputting a graphical stream visual editing page, wherein the graphical stream visual editing page comprises components corresponding to the elements;
displaying the target components according to the target components selected from the components of the graphical stream visual editing page, and acquiring parameter data corresponding to parameter format information of each target component;
drawing a graphic stream in the graphic stream visual editing page according to the received interactive instruction, wherein the graphic stream is used for representing the logical relationship between the target components;
acquiring graphics stream data corresponding to the graphics stream, and taking the parameter data and the graphics stream data as graphics stream editing data;
according to the format specification describing the test case, converting the graphics stream editing data into unified case description information;
and converting the unified case description information into a test case script.
According to an aspect of the embodiments of the present application, there is provided a test case script generating system, including:
the Rest API analysis module is used for acquiring a Rest API definition document and analyzing the Rest API definition document to obtain elements and parameter format information corresponding to the elements;
a front-end graphical stream editing module, configured to output a graphical stream visual editing page, where the graphical stream visual editing page includes a component corresponding to the element, and the front-end graphical stream editing module is further configured to:
displaying the target components according to the target components selected from the components of the graphical stream visual editing page, and acquiring parameter data corresponding to parameter format information of each target component;
drawing a graphic stream in the graphic stream visual editing page according to the received interactive instruction, wherein the graphic stream is used for representing the logical relationship between the target components; and
acquiring graphics stream data corresponding to the graphics stream, and taking the parameter data and the graphics stream data as graphics stream editing data;
the unified case description conversion module is used for converting the graphic stream editing data into unified case description information according to the format specification for describing the test case;
and the adaptation and conversion module is used for converting the unified case description information into a test case script.
According to an aspect of embodiments of the present application, there is provided a computer-readable medium, on which a computer program is stored, which, when executed by a processor, implements the method as described in the above embodiments.
According to an aspect of an embodiment of the present application, there is provided an electronic device including:
one or more processors;
storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the method as described in the embodiments above.
The technical scheme provided by the embodiment of the application can have the following beneficial effects:
the method for generating the test case script comprises the following steps: acquiring a Rest API definition document, and analyzing the Rest API definition document to obtain elements and parameter format information corresponding to the elements; outputting a graphical stream visual editing page, wherein the graphical stream visual editing page comprises components corresponding to the elements; displaying the target components according to the target components selected from the components of the graphical stream visual editing page, and acquiring parameter data corresponding to parameter format information of each target component; drawing a graphic stream in the graphic stream visual editing page according to the received interactive instruction, wherein the graphic stream is used for representing the logical relationship between the target components; acquiring graphics stream data corresponding to the graphics stream, and taking the parameter data and the graphics stream data as graphics stream editing data; according to the format specification describing the test case, converting the graphics stream editing data into unified case description information; and converting the unified case description information into a test case script.
Under the method, on one hand, a user can edit the test case in a visual mode through the graphic stream, and the test case can be automatically converted into a test case script after the editing is completed, so that the method is simple, intuitive, easy to understand and convenient to operate, greatly reduces the requirement on the script capability of a tester, and greatly reduces the learning threshold; on the other hand, only parameter data need to be provided in the editing test case, the parameter data are set according to the parameter format information, and the parameter format information is obtained by analyzing the Rest API definition document, so that the parameter data can be standardized, the error probability can be reduced, and the software evaluation efficiency can be improved; in addition, the whole scheme automatically generates the test case script through the unified case description information, and the test case script can be executed in an actual test engine, so that the decoupling of test case compiling and a specific test engine is realized, and the problem of incompatibility of scripts in different test engine environments is solved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
FIG. 1 is a system architecture diagram illustrating a method for test case script generation in accordance with an illustrative embodiment;
FIG. 2 is a flowchart illustrating a method for test case script generation in accordance with an illustrative embodiment;
FIG. 3 is a schematic diagram illustrating a graphical stream visualization editing page in accordance with an illustrative embodiment;
FIG. 4 is a schematic diagram illustrating a parameter data acquisition page in accordance with an illustrative embodiment;
FIG. 5 is a diagram illustrating the manner in which test case scripts are displayed in a test engine in accordance with an illustrative embodiment;
FIG. 6 is a block diagram illustrating a system for generating test case scripts in accordance with an illustrative embodiment;
FIG. 7 is a flowchart illustrating a test case script based generation system generating scripts in accordance with an illustrative embodiment;
FIG. 8 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
Furthermore, the drawings are merely schematic illustrations of the present application and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities.
The test case compiling is used as the main work of the software evaluating flow, and the efficiency, the quality and the accuracy of the test case compiling are not only related to the self-ability of a tester, but also have great relation to a tester. In the related technology, when the test case is written by using the existing tools such as a jmeter, a robotframe and the like, the path, the mode and the parameters of the request cannot be checked to be correct when a Rest API is called; and an intuitive way is lacked to describe the relationship among all elements in the test case; in addition, the test tool needs to be installed locally before it can be used.
Therefore, the method for generating the test case script is provided firstly, the defects can be overcome, the test case can be compiled on the page only in the networking environment, testers can conveniently know the logic structure of the whole test case, the efficiency, the quality and the correctness of compiling the test case are improved, and the efficiency of the software evaluation workflow is further improved greatly.
The implementation terminal of the present application may be any device having computing, processing, and communication functions, and the device may be connected to an external device for receiving or sending data, and specifically may be a portable mobile device, such as a smart phone, a tablet computer, a notebook computer, a pda (personal Digital assistant), or the like, or may be a fixed device, such as a computer device, a field terminal, a desktop computer, a server, a workstation, or the like, or may be a set of multiple devices, such as a physical infrastructure of cloud computing or a server cluster.
Optionally, the implementation terminal of the present application may be a server or a physical infrastructure of cloud computing.
FIG. 1 is a system architecture diagram illustrating a method for generating test case scripts in accordance with an exemplary embodiment. As shown in fig. 1, the system architecture 100 includes terminal devices, a network 104 and a server 105, where the terminal devices may specifically include a desktop computer 101, a smart phone 102 and a notebook computer 103, and each terminal device is connected to the server 110 through the network 104, so as to implement interaction between the terminal device and the server 110. The server 110 is an implementation terminal of the embodiment of the present application, and is provided with a test case script generation system, and when the test case script generation method provided by the present application is applied to the system architecture shown in fig. 1, a process may be as follows: firstly, a user of the notebook computer 103 sends a Rest API definition document to the server 110 through the network 104, and the user of the notebook computer 103 can be a developer of the Rest API; then, after obtaining the Rest API definition document, the server 110 parses it, thereby obtaining elements and corresponding parameter format information; then, the server 110 outputs a graphic stream visual editing page including components corresponding to the elements, and returns the graphic stream visual editing page to the terminal device according to a request of the terminal device; then, the user of the terminal device interacts with the test case script generating system through the graphical stream visual editing page, the user can select a target component on the graphical stream visual editing page, draw a graphical stream through a connecting line, and submit parameter data corresponding to the target component through the page, so that the server 110 obtains graphical stream editing data including the parameter data and the graphical stream data; finally, the server 110 converts the graphics stream editing data into unified case description information, and converts the unified case description information into a test case script.
In an embodiment of the present application, the server 110 is further deployed with a test engine, and the server 110 outputs the generated test case script to a specified directory that can be read by the test engine.
In an embodiment of the present application, test engines are deployed on the desktop computer 101 and the smartphone 102, the server 110 generates a link for downloading the test case script after outputting the test case script and sends the link to the desktop computer 101 and the smartphone 102, and the desktop computer 101 and the smartphone 102 can download the test case script through the obtained link and complete testing by executing the test case script.
It should be noted that fig. 1 is only one embodiment of the present application, and although in the embodiment of fig. 1, the Rest API definition document is submitted to the implementation terminal by the terminal device, in other embodiments or specific applications, the Rest API definition document may also be created and written locally at the implementation terminal; although the terminal interacting with the test case script generating system and the implementing terminal are different terminals in the embodiment of fig. 1, in other embodiments of the present application, the terminal interacting with the test case script generating system and the implementing terminal may be the same terminal. The embodiments of the present application are not limited in this respect, and the scope of protection of the present application should not be limited thereby.
FIG. 2 is a flow diagram illustrating a method for generating test case scripts in accordance with an illustrative embodiment. Physically, the method for generating the test case script provided by this embodiment may be executed by a server; logically, the method for generating a test case script provided by this embodiment may be executed by a system for generating a test case script, as shown in fig. 2, and may include the following steps:
step 210, obtaining a Rest API definition document, and analyzing the Rest API definition document to obtain an element and parameter format information corresponding to the element.
The Rest API definition document (which may be specifically an OpenAPI specification document) may be written by a developer, which defines the writing specification of the Rest API. The Rest API may also be referred to as a restul API, i.e., an API (Application Programming Interface) established based on the Rest (Representational State Transfer) technique. Restul is a design style and development approach for web applications, which is based on HTTP and may use XML format definition or JSON format definition.
Therefore, the test case script generated based on the scheme of the embodiment of the application can actually realize the interface test.
The result API definition document may be obtained from a terminal of a tester, or may be obtained from another location such as a database.
Parsing the Rest API definition document may result in elements such as HTTP requests, response assertions, branches, and the like. For one element, not only the parameter format information corresponding to the element can be analyzed, but also other specification information can be analyzed. For example, for the element of the HTTP request, information such as a request path, a request mode, header information, and an access format can be extracted by parsing the Rest API definition document.
In an embodiment of the present application, the obtaining a Rest API definition document includes: and acquiring the submitted Rest API definition document in a page or interface mode.
Specifically, when a developer accesses a test case script generation system, the developer can submit a Rest API definition document by clicking a control on an access page. The test case script generation system can also provide an interface to the outside, and a Rest API definition document can be submitted by calling the interface.
The parameter format information defines the specification of parameter data that needs to be provided to call the Rest API.
Step 220, outputting a graphical stream visual editing page, wherein the graphical stream visual editing page comprises components corresponding to the elements.
The graphical stream visualization editing page may be a Web page. The user side (such as a terminal of a tester) can receive the output graphic stream visual editing page by performing page access.
In one embodiment of the application, the components include HTTP requests, response assertions, and branches.
As mentioned above, an element may be an object such as an HTTP request, a response assertion, a branch, etc., and thus, a component corresponding to the element may be a component such as an HTTP request, a response assertion, a branch, etc. It is to be readily understood that the types of elements may be various and may not be limited to the above.
Step 230, displaying the target components according to the target components selected from the components of the graphical stream visual editing page, and acquiring parameter data corresponding to the parameter format information of each target component.
The user side can interact with the system through the visual editing page of the graphic stream, and the editing of the graphic stream is realized. The selected target component is the component used to create the graphics stream.
In an embodiment of the present application, the acquiring parameter data corresponding to parameter format information of each target component includes: and checking the corresponding parameter data according to the parameter format information.
In the embodiment of the application, the parameter data is verified based on the parameter format information, so that the provided parameter data is legal, and the accuracy of the test can be ensured.
The parameter data corresponding to the parameter format information may be obtained by selecting from a list.
In an embodiment of the present application, the acquiring parameter data corresponding to parameter format information of each target component includes: providing a list control including a plurality of standard parameter data corresponding to parameter format information so as to acquire parameter data selected from the plurality of standard parameter data through the list control.
In the embodiment of the application, the parameter data is acquired in a list control mode, and the standard parameter data in the list control is legal parameter data set according to the parameter format information, so that the acquired parameter data is legal, and the accuracy of the test can be ensured.
FIG. 3 is a schematic diagram illustrating a graphical stream visualization editing page in accordance with an exemplary embodiment. Referring to fig. 3, the graphical stream visualization editing page includes a left area and a right area, where the left area is a component area, and may include multiple components such as HTTP requests, response assertions, and branches, where if () is a branch component, and a target component may be selected in the component area; the right area is an editing area and can display a target component, in the editing area of fig. 3, HTTP represents an HTTP component, the assertion result can be a response assertion component, and two branches corresponding to assertion success and assertion failure can be branch components; and editing operation can be carried out on the displayed target assembly through the right area, so that corresponding parameter data can be obtained.
Step 240, drawing a graphic stream in the graphic stream visual editing page according to the received interactive instruction, wherein the graphic stream is used for representing the logical relationship between the target components.
The graphical stream is actually a visual logical relationship graph between target components, in which the testcase logic is recorded.
In an embodiment of the present application, the displaying the target components according to the target components selected from the components of the graphical stream visual editing page, and acquiring parameter data corresponding to parameter format information of each of the target components includes:
moving a target component selected from the components displayed in the first area to a second area according to a received dragging instruction, and displaying the target component in the second area;
outputting a parameter data acquisition page according to a received editing instruction of a target assembly, and acquiring parameter data corresponding to parameter format information of each target assembly through the parameter data acquisition page;
the drawing the graphic stream in the graphic stream visual editing page according to the received interactive instruction comprises the following steps:
and drawing a graphic stream in the second area according to the interaction instruction received through the second area.
With continued reference to fig. 3, the first area may be the left area in fig. 3, and the second area may be the right area in fig. 3. The user may perform a selection operation (e.g., a click operation) on the target component in the first area, and then drag the selected target component to the second area on the right side, where the second area may display the dragged target component. The user can also perform editing operations on the target components in the second area. Specifically, the user may enter the parameter data acquisition page by performing a specific operation such as double-click or right-click on the target component, thereby providing the corresponding parameter data. The user may form the graphics stream by drawing a line between the target components in the second region.
The parameter data acquisition page is actually a component editing page through which data required for the test can be filled. In one parameter data acquisition page, only parameter data of one target component may be acquired, and parameter data of a plurality of target components may also be acquired simultaneously.
A list including all parsed REST API requests may be displayed on a parameter data acquisition page of the REST API request component, a tester selects a REST API request to be tested in the list and fills in the reference data, edits assertion information, for example, may assert a status code, and then selects to end a flow or initiate another REST API request according to an assertion result.
FIG. 4 is a schematic diagram illustrating a parameter data acquisition page in accordance with an illustrative embodiment.
Referring to fig. 4, for a certain REST API request component, in a parameter data obtaining page corresponding to the REST API request component, the REST API request component may be used to obtain parameters that can be selected through a list, such as an API document, an API operation, and an API method, and may also be used to obtain request parameters, response assertion related parameters, output parameters, and the like through a list selection or input, and the like. In the request parameter part, a user can input an API request header, request parameters and request body information; in the request header area, the user can also select from the provided reference object types, specifically can select input parameters, global variables and values, specifically selected reference object types can be parameter format information, according to different selected reference object types, the selectable values of the reference object values can change, and if the reference object types select values, the reference object values can receive any input. In the response assertion part, the request response can be asserted, options comprise an assertion mode, assertion parameters, assertion rules, reference object types and reference values, response assertion related parameters provided by a user can be acquired through a selection or input mode, and the assertion mode can select a state code, a response body and the like. In the output parameter part, the information of the response can be saved into a global variable through the configuration of parameter data and used in the subsequent graphics stream component. When the user clicks the confirmation button in the page shown in FIG. 4, the entry of the parameter data for the REST API request component is complete.
In addition, the parameter data acquisition page may display other information obtained by parsing the Rest API definition document, for example, basic information such as a URL may be displayed.
Step 250, obtaining the graphics stream data corresponding to the graphics stream, and using the parameter data and the graphics stream data as graphics stream editing data.
The graphics stream data is background data corresponding to the graphics stream shown at the front end.
Step 260, according to the format specification describing the test case, the graphics stream editing data is converted into the unified case description information.
In other words, the unified use case description is defined by a format specification describing the test case, in which various elements, attributes and inclusion relationships of the elements are defined. For example, test cases, test steps, branch assertions, and the like may be defined.
The unified case description information mainly includes test steps (i.e. steps array field), and the test steps may include calling keywords, branching, loop control, and the like. Meanwhile, the method can also comprise built-in keywords such as request sending, assertion, assignment, request result extraction and the like.
An example of unified use case description information is as follows:
Figure BDA0003329190010000091
Figure BDA0003329190010000101
Figure BDA0003329190010000111
for example, in the above example, steps may be the test step, http is the send request key, http _ assert is the assert key, http _ extract is the extract request result key, and "if _ true" and "if _ false" are the branches in the test step.
Step 270, converting the unified case description information into a test case script.
In an embodiment of the application, the converting the unified case description information into a test case script includes: and converting the unified case description information into a test case script which can be executed by at least one specified test engine.
The unified case description information can be converted into a test case script which can be executed by each specified test engine by setting a corresponding plug-in. Specifically, the specified test engine may be a test engine such as a jmeter and robotframe. A jmeter conversion plug-in and a robotframe conversion plug-in can be set to respectively convert into corresponding test case scripts.
The script formats which can be identified and executed by different test engines may be different, the embodiment of the application can respectively convert the unified case description information into the scripts which can be executed by each test engine, so that the isolation and the decoupling of test case script writing and the test engines are realized, the scripts of different test engines can be generated more flexibly, and the applicability is stronger.
In an embodiment of the present application, the unified case description information includes a custom function, and the converting the unified case description information into a test case script that can be executed by at least one specified test engine includes: and packaging the custom function in the unified case description information into an element which can be identified by a corresponding specified test engine.
Specifically, a custom function can be created in the unified use case description information, and repeated test steps are packaged into the function. For example, in a jmeter conversion plug-in, a custom function may be encapsulated using a Test Fragment element that the jmeter can recognize.
In one embodiment of the present application, the method further comprises: obtaining element self-defining codes; the converting the graphics stream editing data into unified use case description information includes: and converting the graphic stream editing data and the element custom code into unified use case description information.
For example, a tester can implement a jmeter custom Java Request element through Java code and then reference it in the unified use case description.
In the embodiment of the application, the unified case description reserves certain expandability, and for testers with strong coding capacity, complex test logic can be realized by creating custom keywords.
In an embodiment of the application, after converting the unified case description information into a test case script, the method further includes: and performing interface test by executing the test case script.
As described above, the element and parameter format information is obtained by parsing the Rest API definition document, and therefore, the graphics stream editing data and the unified case description information also correspond to the interface, and based on this, the finally generated test case script can be used for performing the interface test.
In an embodiment of the present application, after converting the unified case description information into a test case script that can be executed by at least one specified test engine, the converting the unified case description information into the test case script further includes: and outputting the test case script to a reading directory of a corresponding specified test engine.
In the embodiment of the application, the test case script is directly output to the reading directory of the corresponding specified test engine, so that the specified test engine can directly execute the test case script for testing, and the test efficiency is improved.
FIG. 5 is a diagram illustrating a manner in which test case scripts are displayed in a test engine in accordance with an illustrative embodiment. After generating the test case script in the format of the jmeter script and importing the test case script into the jmeter test engine, each element will be displayed as a node in the tree structure on the left side in fig. 5 in the display interface of the jmeter test engine.
In summary, by the method for generating the test case script provided by the embodiment of the application, the Rest API test case script can be generated on line in a graph flow manner, and the test case can be compiled on the page only in a networking environment, so that a tester can intuitively know the logic structure of the whole test case, and the Rest API definition document is used for assisting in editing the test case, thereby improving the efficiency, quality and correctness of compiling the test case; meanwhile, the embodiment of the application also decouples the writing of the test case and the specific test engine, and solves the problem of incompatibility of scripts in different test engine environments.
According to another aspect of the present application, the present application further provides a test case script generation system, and the following are system embodiments of the present application.
FIG. 6 is a block diagram illustrating a system for generating test case scripts in accordance with an exemplary embodiment.
As shown in fig. 6, the test case script generation system 600 includes:
the reset API analyzing module 610 is configured to obtain a reset API definition document, and analyze the reset API definition document to obtain an element and parameter format information corresponding to the element.
The Rest API analysis module can analyze the correctness of the acquired Rest API definition document and store the Rest API definition document in a test case script generation system.
The reset API analysis module provides an access interface for the front-end graphics stream editing module, so that the front-end graphics stream editing module can obtain the analysis result of the reset API analysis module.
A front-end graphical stream editing module 620, configured to output a graphical stream visual editing page, where the graphical stream visual editing page includes a component corresponding to the element, and the front-end graphical stream editing module is further configured to:
displaying the target components according to the target components selected from the components of the graphical stream visual editing page, and acquiring parameter data corresponding to parameter format information of each target component;
drawing a graphic stream in the graphic stream visual editing page according to the received interactive instruction, wherein the graphic stream is used for representing the logical relationship between the target components; and
and acquiring the graphics stream data corresponding to the graphics stream, and taking the parameter data and the graphics stream data as graphics stream editing data.
The front-end graphic stream editing module provides a graphic stream visual editing page, the page provides elements such as a Rest API, an assertion and a branch, and a tester edits the elements and combines and edits the elements in the page in a connection mode, so that a test case is formed. When editing the result API element, the page may display the imported result API, and by selecting different result APIs, the page may display different parameters for the tester to fill in.
The unified use case description conversion module 630 is configured to convert the graphics stream editing data into unified use case description information according to a format specification describing a test case.
And an adaptation and conversion module 640, configured to convert the unified case description information into a test case script.
The adaptation and conversion module can be developed by using programming languages such as Java, python, golang and the like, and can traverse the unified case description information and convert the unified case description information into an executable script file in a format which can be identified by a test engine. The adaptation and conversion module can comprise conversion plug-ins corresponding to the test engines, and the unified case description information is converted into the test case scripts through the conversion plug-ins. Specifically, the adaptation and conversion module may include a jmeter conversion plug-in and a robotframe conversion plug-in, a corresponding conversion interface is defined and implemented in the conversion plug-in, and the conversion of the unified case description information into the test case script may be implemented through the conversion interface. For example, a person familiar with robotframe format scripts can implement the above conversion interface, and by calling the conversion interface, the unified use case description information can be converted into a script that can be executed by a robotframe test engine, so that a robotframe conversion plug-in can be provided.
FIG. 7 is a flowchart illustrating a test case script based generation system generating a script in accordance with an illustrative embodiment. As shown in fig. 7, the method specifically includes the following steps: firstly, importing a Rest API document into a Rest API analysis module, and analyzing the Rest API document by the Rest API analysis module; then, the Rest API analysis module sends the analysis result to the front-end graphics stream editing module; then, a user can edit through the front-end graphics stream editing module, so as to establish a graphics stream test case; next, sending the graphics stream test case to a unified case description conversion module, and converting the graphics stream test case into a unified case description by the unified case description conversion module; then, the unified case description is sent to an adaptation and conversion module, and the adaptation and conversion module converts the unified case description into a test case script; finally, the test framework executes the test case script.
According to another aspect of the present application, there is also provided an electronic device capable of implementing the above method.
As will be appreciated by one skilled in the art, aspects of the present application may be embodied as a system, method or program product. Accordingly, various aspects of the present application may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
FIG. 8 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
It should be noted that the computer system 800 of the electronic device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 8, a computer system 800 includes a Central Processing Unit (CPU)801 that can perform various appropriate actions and processes, such as performing the methods described in the above embodiments, according to a program stored in a Read-Only Memory (ROM) 802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for system operation are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other via a bus 804. An Input/Output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a Network interface card such as a LAN (Local Area Network) card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.
In particular, according to embodiments of the application, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. When the computer program is executed by the Central Processing Unit (CPU)801, various functions defined in the system of the present application are executed.
It should be noted that the computer readable medium shown in the embodiments of the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a Read-Only Memory (ROM), an Erasable Programmable Read-Only Memory (EPROM), a flash Memory, an optical fiber, a portable Compact Disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. Each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software, or may be implemented by hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
As an aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by an electronic device, cause the electronic device to implement the method described in the above embodiments.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments 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 disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present application.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (10)

1. A method for generating a test case script, the method comprising:
acquiring a Rest API definition document, and analyzing the Rest API definition document to obtain elements and parameter format information corresponding to the elements;
outputting a graphical stream visual editing page, wherein the graphical stream visual editing page comprises components corresponding to the elements;
displaying the target components according to the target components selected from the components of the graphical stream visual editing page, and acquiring parameter data corresponding to parameter format information of each target component;
drawing a graphic stream in the graphic stream visual editing page according to the received interactive instruction, wherein the graphic stream is used for representing the logical relationship between the target components;
acquiring graphics stream data corresponding to the graphics stream, and taking the parameter data and the graphics stream data as graphics stream editing data;
according to the format specification describing the test case, converting the graphics stream editing data into unified case description information;
and converting the unified case description information into a test case script.
2. The method according to claim 1, wherein said converting the unified case description information into a test case script comprises:
and converting the unified case description information into a test case script which can be executed by at least one specified test engine.
3. The method of claim 2, wherein after converting the unified case description information into a test case script that can be executed by at least one specified test engine, the converting the unified case description information into a test case script further comprises:
and outputting the test case script to a reading directory of a corresponding specified test engine.
4. The method of claim 2, wherein the unified use case description information comprises a custom function, and wherein converting the unified use case description information into a test case script that can be executed by at least one specified test engine comprises:
and packaging the custom function in the unified case description information into an element which can be identified by a corresponding specified test engine.
5. The method of claim 1, wherein the components include HTTP requests, response assertions, and branches.
6. The method of claim 1, wherein obtaining the Rest API definition document comprises:
and acquiring the submitted Rest API definition document in a page or interface mode.
7. The method according to claim 1, wherein the graphical stream visual editing page includes a first area and a second area, and the displaying the target components according to the target components selected from the components of the graphical stream visual editing page and acquiring parameter data corresponding to parameter format information of each of the target components includes:
moving a target component selected from the components displayed in the first area to a second area according to a received dragging instruction, and displaying the target component in the second area;
outputting a parameter data acquisition page according to a received editing instruction of a target assembly, and acquiring parameter data corresponding to parameter format information of each target assembly through the parameter data acquisition page;
the drawing the graphic stream in the graphic stream visual editing page according to the received interactive instruction comprises the following steps:
and drawing a graphic stream in the second area according to the interaction instruction received through the second area.
8. A system for generating test case scripts, the system comprising:
the Rest API analysis module is used for acquiring a Rest API definition document and analyzing the Rest API definition document to obtain elements and parameter format information corresponding to the elements;
a front-end graphical stream editing module, configured to output a graphical stream visual editing page, where the graphical stream visual editing page includes a component corresponding to the element, and the front-end graphical stream editing module is further configured to:
displaying the target components according to the target components selected from the components of the graphical stream visual editing page, and acquiring parameter data corresponding to parameter format information of each target component;
drawing a graphic stream in the graphic stream visual editing page according to the received interactive instruction, wherein the graphic stream is used for representing the logical relationship between the target components; and
acquiring graphics stream data corresponding to the graphics stream, and taking the parameter data and the graphics stream data as graphics stream editing data;
the unified case description conversion module is used for converting the graphic stream editing data into unified case description information according to the format specification for describing the test case;
and the adaptation and conversion module is used for converting the unified case description information into a test case script.
9. A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 7.
10. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to carry out the method of any one of claims 1 to 7.
CN202111280146.2A 2021-10-29 2021-10-29 Test case script generation method, system, medium and electronic device Pending CN113900958A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111280146.2A CN113900958A (en) 2021-10-29 2021-10-29 Test case script generation method, system, medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111280146.2A CN113900958A (en) 2021-10-29 2021-10-29 Test case script generation method, system, medium and electronic device

Publications (1)

Publication Number Publication Date
CN113900958A true CN113900958A (en) 2022-01-07

Family

ID=79027708

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111280146.2A Pending CN113900958A (en) 2021-10-29 2021-10-29 Test case script generation method, system, medium and electronic device

Country Status (1)

Country Link
CN (1) CN113900958A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114518906A (en) * 2022-01-25 2022-05-20 厦门锐谷通信设备有限公司 XML (extensive markup language) description file-based equipment configuration parameter management system and method
CN116088825A (en) * 2023-04-03 2023-05-09 广东省信息工程有限公司 Script generation method, visual editor and storage medium
CN116127926A (en) * 2023-04-17 2023-05-16 英创互联(北京)科技有限公司 Method, device, equipment and medium for generating XSLT file of data body
CN116431135A (en) * 2023-06-12 2023-07-14 江西五十铃汽车有限公司 Method, system, computer and readable storage medium for writing automobile code
CN116521572A (en) * 2023-07-03 2023-08-01 天津金城银行股份有限公司 Webpage script visual verification method, system, terminal equipment and storage medium
CN116991706A (en) * 2023-06-21 2023-11-03 广州汽车集团股份有限公司 Vehicle automatic test method, device, equipment and storage medium
CN117032536A (en) * 2023-09-04 2023-11-10 镁佳(北京)科技有限公司 Method and device for quickly constructing OTX diagnostic sequence

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114518906A (en) * 2022-01-25 2022-05-20 厦门锐谷通信设备有限公司 XML (extensive markup language) description file-based equipment configuration parameter management system and method
CN114518906B (en) * 2022-01-25 2024-05-14 厦门锐谷通信设备有限公司 Device configuration parameter management system and method based on XML description file
CN116088825A (en) * 2023-04-03 2023-05-09 广东省信息工程有限公司 Script generation method, visual editor and storage medium
CN116127926A (en) * 2023-04-17 2023-05-16 英创互联(北京)科技有限公司 Method, device, equipment and medium for generating XSLT file of data body
CN116127926B (en) * 2023-04-17 2023-08-04 英创互联(北京)科技有限公司 Method, device, equipment and medium for generating XSLT file of data body
CN116431135A (en) * 2023-06-12 2023-07-14 江西五十铃汽车有限公司 Method, system, computer and readable storage medium for writing automobile code
CN116431135B (en) * 2023-06-12 2023-09-22 江西五十铃汽车有限公司 Method, system, computer and readable storage medium for writing automobile code
CN116991706A (en) * 2023-06-21 2023-11-03 广州汽车集团股份有限公司 Vehicle automatic test method, device, equipment and storage medium
CN116991706B (en) * 2023-06-21 2024-04-19 广州汽车集团股份有限公司 Vehicle automatic test method, device, equipment and storage medium
CN116521572A (en) * 2023-07-03 2023-08-01 天津金城银行股份有限公司 Webpage script visual verification method, system, terminal equipment and storage medium
CN116521572B (en) * 2023-07-03 2023-09-19 天津金城银行股份有限公司 Webpage script visual verification method, system, terminal equipment and storage medium
CN117032536A (en) * 2023-09-04 2023-11-10 镁佳(北京)科技有限公司 Method and device for quickly constructing OTX diagnostic sequence

Similar Documents

Publication Publication Date Title
US11422778B2 (en) Development environment for real-time dataflow programming language
CN113900958A (en) Test case script generation method, system, medium and electronic device
CN108415832B (en) Interface automation test method, device, equipment and storage medium
US10108535B2 (en) Web application test script generation to test software functionality
CN112187558B (en) Data verification method and device and electronic equipment
CN110543297B (en) Method and apparatus for generating source code
CN110716853A (en) Test script recording method, application program testing method and related device
CN113032244B (en) Interface test method, device, computer system and computer readable storage medium
CN111209202A (en) Terminal application testing method and device
CN111309317A (en) Code automation method and device for realizing data visualization
CN111694561A (en) Interface management method, device, equipment and storage medium
CN114077430A (en) Interface generation method and device, electronic equipment and storage medium
CN116360735A (en) Form generation method, device, equipment and medium
CN113836014A (en) Interface testing method and device, electronic equipment and storage medium
CN113778897A (en) Automatic test method, device, equipment and storage medium of interface
CN112988578A (en) Automatic testing method and device
US20160292067A1 (en) System and method for keyword based testing of custom components
CN111666201A (en) Regression testing method, device, medium and electronic equipment
CN114238128A (en) Test case generation method and device, electronic equipment and computer readable medium
CN113051173B (en) Method, device, computer equipment and storage medium for arranging and executing test flow
CN115495362A (en) Method, device, storage medium and computer equipment for generating test code
CN115544950A (en) Constraint file importing method, device, equipment and storage medium
CN113377648A (en) Software system diagnosis method and device, electronic equipment and computer readable medium
CN114416210B (en) Method, device, medium and equipment for simulating decision flow
CN113076252A (en) Interface testing method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination