CN114398282A - Test script generation method, device, equipment and storage medium - Google Patents

Test script generation method, device, equipment and storage medium Download PDF

Info

Publication number
CN114398282A
CN114398282A CN202210056354.2A CN202210056354A CN114398282A CN 114398282 A CN114398282 A CN 114398282A CN 202210056354 A CN202210056354 A CN 202210056354A CN 114398282 A CN114398282 A CN 114398282A
Authority
CN
China
Prior art keywords
interface
script
generating
data
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
CN202210056354.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.)
Ping An International Smart City Technology Co Ltd
Original Assignee
Ping An International Smart City Technology Co 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 Ping An International Smart City Technology Co Ltd filed Critical Ping An International Smart City Technology Co Ltd
Priority to CN202210056354.2A priority Critical patent/CN114398282A/en
Publication of CN114398282A publication Critical patent/CN114398282A/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
    • 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/3688Test management for test execution, e.g. scheduling of test suites

Abstract

The invention relates to a software testing technology, and discloses a method for generating a testing script, which comprises the following steps: acquiring a target interface, and analyzing the annotation in the target interface to generate an interface document through swagger; analyzing the interface document to generate an interface content text, and combining the interface content text with a preset script template to obtain an initial script; randomly generating simulation test data according to the interface document; and generating a test script according to the simulation test data and the initial script. In addition, the invention also relates to a block chain technology, and the interface document can be stored in the node of the block chain. The invention also provides a test script generation device, electronic equipment and a storage medium. The invention can improve the efficiency of interface test.

Description

Test script generation method, device, equipment and storage medium
Technical Field
The present invention relates to the field of software testing technologies, and in particular, to a method and an apparatus for generating a test script, an electronic device, and a computer-readable storage medium.
Background
In system design, due to the separation of the front end and the back end, the interaction between the front end and the back end is generally realized through an interface, but the problems that an interface document given by the back end is inconsistent with the actual situation, the interface document is written and maintained for a long time and the like often occur. For the test of the interface, the existing test method usually arranges and then tests separately through manpower, and arranges the test script according to the provided modified interface information content, which is time-consuming and labor-consuming and has low efficiency. Therefore, a more efficient test script generation method for an interface is needed.
Disclosure of Invention
The invention provides a method and a device for generating a test script and a computer readable storage medium, and mainly aims to improve the efficiency of interface test.
In order to achieve the above object, the method for generating a test script provided by the present invention includes:
acquiring a target interface, and analyzing the annotation in the target interface to generate an interface document through swagger;
analyzing the interface document to generate an interface content text, and combining the interface content text with a preset script template to obtain an initial script;
randomly generating simulation test data according to the interface document;
and generating a test script according to the simulation test data and the initial script.
Optionally, the obtaining the target interface, and parsing the annotation in the target interface by swagger to generate an interface document, includes:
receiving an interface document generation request of a target interface;
acquiring a target interface according to a path in the interface document generation request;
and analyzing the swagger annotation in the target interface through swagger, and generating an interface document according to the swagger annotation.
Optionally, the parsing the interface document to generate an interface content text includes:
creating a json object abstract base class, and defining a macro definition object in the json object abstract base class, wherein the macro definition object is used for creating attributes of various types and realizing an analysis function on the attributes;
calling the json object abstract base class to create an entity class containing all attribute members of the interface document, and assigning values to each attribute;
and converting the entity class into a text to be exported to obtain an interface content text.
Optionally, the merging the interface content text with a preset script template to obtain an initial script includes:
extracting script types in the interface content texts;
and acquiring a script template of a corresponding type in a preset script library according to the script type, and importing the interface content text into the script template to obtain an initial script.
Optionally, the randomly generating simulation test data according to the interface document includes:
acquiring data elements in the interface document and attribute information corresponding to the data elements;
traversing each data element in the interface document, and constructing a multi-branch tree according to a serial number in attribute information corresponding to the data element;
and traversing each node in the multi-branch tree, and generating simulation data of the current node according to the type of the current traversed node and a preset generation rule to obtain simulation test data.
Optionally, the generating, according to the type of the current traversal node and according to a preset generation rule, simulation data of the current node includes:
traversing each node in the multi-branch tree, acquiring the data type attribute of the data element corresponding to the current node, and determining the type of the current node according to the data type;
if the type of the current node is a non-leaf node, generating a null array, wherein the null array defines the returned simulation data as the simulation data of the branch node of the current node;
and if the type of the current node is a leaf node, randomly generating analog data with the same type as the data type according to the data type.
Optionally, the generating a test script according to the simulation test data and the initial script includes:
acquiring an attribute name in the initial script;
importing data of a corresponding type in the simulation test data into the position corresponding to the attribute name to obtain a test script;
and executing the test script to generate a test result.
In order to solve the above problem, the present invention further provides a test script generating apparatus, including:
the analysis module is used for acquiring a target interface and analyzing the annotation in the target interface to generate an interface document through swagger;
the template merging module is used for analyzing the interface document to generate an interface content text and merging the interface content text with a preset script template to obtain an initial script;
the data generation module is used for randomly generating simulation test data according to the interface document;
and the script generation module is used for generating a test script according to the simulation test data and the initial script.
In order to solve the above problem, the present invention also provides an electronic device, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the method of generating a test script described above.
In order to solve the above problem, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored, the at least one computer program being executed by a processor in an electronic device to implement the test script generation method described above.
According to the embodiment of the invention, the swagger analyzes the annotation in the target interface to generate the interface document, the interface document is analyzed to generate the interface content text, the attribute information of the target interface can be automatically extracted and combined with the script template, the corresponding initial script can be quickly generated, the labor and the time are saved, and the development efficiency is improved; meanwhile, simulation test data are randomly generated according to the interface document, so that a test script is generated, and automatic generation of the simulation data is realized, so that developers do not need to manually write the simulation data for automatic testing, batch testing can be realized by generating the test script according to the simulation test data and the initial script, and the test efficiency is effectively improved. Therefore, the generation method and device of the test script, the electronic device and the computer readable storage medium provided by the invention can improve the efficiency of interface test.
Drawings
Fig. 1 is a schematic flowchart of a method for generating a test script according to an embodiment of the present invention;
FIG. 2 is a functional block diagram of an apparatus for generating a test script according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device for implementing the method for generating the test script according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the application provides a test script generation method. The execution subject of the test script generation method includes, but is not limited to, at least one of electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiments of the present application. In other words, the test script generation method may be executed by software or hardware installed in the terminal device or the server device, and the software may be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like. The server may be an independent server, or may be a cloud server that provides basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a Content Delivery Network (CDN), a big data and artificial intelligence platform, and the like.
Fig. 1 is a schematic flow chart of a method for generating a test script according to an embodiment of the present invention. In this embodiment, the method for generating the test script includes:
s1, acquiring a target interface, and analyzing the annotation in the target interface through swagger to generate an interface document.
The swagger in the embodiment of the invention is an interface development tool conforming to the OpenAPI specification, and can support the development of the whole API life cycle from design and documentation to test and deployment. The OpenAPI Specification (OAS) specifies the RESTful service development process by defining a language that describes the API format or API definition.
The target interface is a section of program code written at the back end and used for interacting with the front end, receiving the request sent by the front end and responding to the request.
The interface document is a json text which explains the interface and contains various attribute information of the interface.
In detail, the obtaining of the target interface and the parsing of the annotation in the target interface by swagger to generate an interface document include:
receiving an interface document generation request of a target interface;
acquiring a target interface according to a path in the interface document generation request;
and analyzing the swagger annotation in the target interface through swagger, and generating an interface document according to the swagger annotation.
The embodiment of the invention determines the path of the target interface by generating the request through the interface document, finds the program code of the target interface according to the path, analyzes the corresponding code annotation in the program code, determines the attribute information of the interface from the code annotation and generates the corresponding document.
Wherein the swagger annotation is an annotation based on a reflection mechanism, such as: @ Api (): as used in the requesting class, the description of the class is shown.
Optionally, to further ensure the security of the interface document, the interface document may also be stored in a node of a blockchain.
Optionally, before generating the interface document of the target interface based on swagger parsing, the method further includes:
adding annotations in the program code of the target interface at corresponding positions according to the annotations;
and annotating the attribute of the entity class by using an annotation in the entity class called by the target interface.
In another embodiment of the present invention, the generating an interface document of a target interface based on swagger parsing includes:
acquiring a native swagger assembly, and generating a json file stream according to the native swagger assembly;
acquiring attribute information of a target interface from the json file stream;
and generating an interface document according to the attribute information.
S2, analyzing the interface document to generate an interface content text, and combining the interface content text with a preset script template to obtain an initial script.
The preset script template in the embodiment of the invention is a template script which is written in advance based on different service scenes and can be used for testing.
In detail, the parsing the interface document to generate an interface content text includes:
creating a json object abstract base class, and defining a macro definition object in the json object abstract base class, wherein the macro definition object is used for creating attributes of various types and realizing an analysis function on the attributes;
calling the json object abstract base class to create an entity class containing all attribute members of the interface document, and assigning values to each attribute;
and converting the entity class into a text to be exported to obtain an interface content text.
The json object abstract base class is a type based on a json analysis library, and the entity class is a class corresponding to a database object.
In detail, the merging the interface content text with a preset script template to obtain an initial script includes:
extracting script types in the interface content texts;
and acquiring a script template of a corresponding type in a preset script library according to the script type, and importing the interface content text into the script template to obtain an initial script.
The embodiment of the invention can generate the appointed script information by analyzing the obtained interface information and adding the script template, for example, providing the script template of a jmeter, analyzing the script template, writing swagger analysis result content into the jemter script template, and generating real script content.
And S3, randomly generating simulation test data according to the interface document.
In detail, the randomly generating simulation test data according to the interface document includes:
acquiring data elements in the interface document and attribute information corresponding to the data elements;
traversing each data element in the interface document, and constructing a multi-branch tree according to a serial number in attribute information corresponding to the data element;
and traversing each node in the multi-branch tree, and generating simulation data of the current node according to the type of the current traversed node and a preset generation rule to obtain simulation test data.
Wherein, the sequence number is used to indicate the relationship between data elements, such as: who is whose child elements to facilitate subsequent construction of the multi-way tree.
Further, the generating of the simulation data of the current node according to the type of the current traversal node and the preset generation rule includes:
traversing each node in the multi-branch tree, acquiring the data type attribute of the data element corresponding to the current node, and determining the type of the current node according to the data type;
if the type of the current node is a non-leaf node, generating a null array, wherein the null array defines the returned simulation data as the simulation data of the branch node of the current node;
and if the type of the current node is a leaf node, randomly generating analog data with the same type as the data type according to the data type.
According to the embodiment of the invention, the multi-branch tree is intelligently generated according to the interface document, and then the corresponding simulation data is generated, so that the simulation data is automatically generated according to the interface document, developers do not need to manually compile the simulation data, and the development efficiency can be effectively improved.
And S4, generating a test script according to the simulation test data and the initial script.
After the simulation test data are generated, the simulation test data are imported into the initial script, so that a test script is generated, and the test script is executed, so that a test result about a target interface can be obtained.
In detail, the generating a test script according to the simulation test data and the initial script includes:
acquiring an attribute name in the initial script;
importing data of a corresponding type in the simulation test data into the position corresponding to the attribute name to obtain a test script;
and executing the test script to generate a test result.
The test result in the embodiment of the invention is the test result of the target interface, and the automatic test of the target interface can be realized by analyzing the interface and generating the simulation test data, thereby effectively improving the efficiency.
According to the embodiment of the invention, the swagger analyzes the annotation in the target interface to generate the interface document, the interface document is analyzed to generate the interface content text, the attribute information of the target interface can be automatically extracted and combined with the script template, the corresponding initial script can be quickly generated, the labor and the time are saved, and the development efficiency is improved; meanwhile, simulation test data are randomly generated according to the interface document, so that a test script is generated, and automatic generation of the simulation data is realized, so that developers do not need to manually write the simulation data for automatic testing, batch testing can be realized by generating the test script according to the simulation test data and the initial script, and the test efficiency is effectively improved. Therefore, the generation method and device of the test script, the electronic device and the computer readable storage medium provided by the invention can improve the efficiency of interface test.
Fig. 2 is a functional block diagram of a test script generation apparatus according to an embodiment of the present invention.
The test script generating apparatus 100 according to the present invention may be installed in an electronic device. According to the implemented functions, the device 100 for generating a test script may include an analysis module 101, a template merging module 102, a data generation module 103, and a script generation module 104. The module of the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the parsing module 101 is configured to obtain a target interface, and parse the annotation in the target interface by swagger to generate an interface document;
the template merging module 102 is configured to parse the interface document to generate an interface content text, and merge the interface content text with a preset script template to obtain an initial script;
the data generation module 103 is configured to randomly generate simulation test data according to the interface document;
the script generating module 104 is configured to generate a test script according to the simulation test data and the initial script.
In detail, when the modules in the test script generating apparatus 100 according to the embodiment of the present invention are used, the same technical means as the test script generating method described in fig. 1 are adopted, and the same technical effects can be produced, and details are not described here.
Fig. 3 is a schematic structural diagram of an electronic device implementing a method for generating a test script according to an embodiment of the present invention.
The electronic device 1 may include a processor 10, a memory 11, a communication bus 12, and a communication interface 13, and may further include a computer program, such as a test script generation program, stored in the memory 11 and executable on the processor 10.
In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same function or different functions, and includes one or more Central Processing Units (CPUs), a microprocessor, a digital Processing chip, a graphics processor, a combination of various control chips, and the like. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device by running or executing programs or modules (e.g., executing a test script generation program, etc.) stored in the memory 11 and calling data stored in the memory 11.
The memory 11 includes at least one type of readable storage medium including flash memory, removable hard disks, multimedia cards, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disks, optical disks, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device, for example a removable hard disk of the electronic device. The memory 11 may also be an external storage device of the electronic device in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device. The memory 11 may be used not only to store application software installed in the electronic device and various types of data, such as codes of a test script generation program, but also to temporarily store data that has been output or is to be output.
The communication bus 12 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like.
The communication interface 13 is used for communication between the electronic device and other devices, and includes a network interface and a user interface. Optionally, the network interface may include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), which are typically used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a Display (Display), an input unit such as a Keyboard (Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable, among other things, for displaying information processed in the electronic device and for displaying a visualized user interface.
Fig. 3 shows only an electronic device with components, and it will be understood by those skilled in the art that the structure shown in fig. 3 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than those shown, or some components may be combined, or a different arrangement of components.
For example, although not shown, the electronic device may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management and the like are realized through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The generation program of the test script stored in the memory 11 of the electronic device 1 is a combination of a plurality of instructions, and when running in the processor 10, can realize:
acquiring a target interface, and analyzing the annotation in the target interface to generate an interface document through swagger;
analyzing the interface document to generate an interface content text, and combining the interface content text with a preset script template to obtain an initial script;
randomly generating simulation test data according to the interface document;
and generating a test script according to the simulation test data and the initial script.
Specifically, the specific implementation method of the instruction by the processor 10 may refer to the description of the relevant steps in the embodiment corresponding to the drawings, which is not described herein again.
Further, the integrated modules/units of the electronic device 1, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. The computer readable storage medium may be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
The present invention also provides a computer-readable storage medium, storing a computer program which, when executed by a processor of an electronic device, may implement:
acquiring a target interface, and analyzing the annotation in the target interface to generate an interface document through swagger;
analyzing the interface document to generate an interface content text, and combining the interface content text with a preset script template to obtain an initial script;
randomly generating simulation test data according to the interface document;
and generating a test script according to the simulation test data and the initial script.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The embodiment of the application can acquire and process related data based on an artificial intelligence technology. Among them, Artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A method for generating a test script, the method comprising:
acquiring a target interface, and analyzing the annotation in the target interface to generate an interface document through swagger;
analyzing the interface document to generate an interface content text, and combining the interface content text with a preset script template to obtain an initial script;
randomly generating simulation test data according to the interface document;
and generating a test script according to the simulation test data and the initial script.
2. The method for generating a test script according to claim 1, wherein the obtaining a target interface, and parsing the annotation in the target interface by swagger to generate an interface document, includes:
receiving an interface document generation request of a target interface;
acquiring a target interface according to a path in the interface document generation request;
and analyzing the swagger annotation in the target interface through swagger, and generating an interface document according to the swagger annotation.
3. The method for generating a test script according to claim 1, wherein parsing the interface document to generate an interface content text comprises:
creating a json object abstract base class, and defining a macro definition object in the json object abstract base class, wherein the macro definition object is used for creating attributes of various types and realizing an analysis function on the attributes;
calling the json object abstract base class to create an entity class containing all attribute members of the interface document, and assigning values to each attribute;
and converting the entity class into a text to be exported to obtain an interface content text.
4. The method for generating a test script according to claim 1, wherein the combining the interface content text with a preset script template to obtain an initial script comprises:
extracting script types in the interface content texts;
and acquiring a script template of a corresponding type in a preset script library according to the script type, and importing the interface content text into the script template to obtain an initial script.
5. The method for generating a test script according to claim 1, wherein said randomly generating simulated test data from said interface document comprises:
acquiring data elements in the interface document and attribute information corresponding to the data elements;
traversing each data element in the interface document, and constructing a multi-branch tree according to a serial number in attribute information corresponding to the data element;
and traversing each node in the multi-branch tree, and generating simulation data of the current node according to the type of the current traversed node and a preset generation rule to obtain simulation test data.
6. The method for generating a test script according to claim 5, wherein the generating the simulation data of the current node according to the type of the current traversal node and the preset generation rule comprises:
traversing each node in the multi-branch tree, acquiring the data type attribute of the data element corresponding to the current node, and determining the type of the current node according to the data type;
if the type of the current node is a non-leaf node, generating a null array, wherein the null array defines the returned simulation data as the simulation data of the branch node of the current node;
and if the type of the current node is a leaf node, randomly generating analog data with the same type as the data type according to the data type.
7. The method for generating a test script according to claim 1, wherein the generating a test script according to the simulation test data and the initial script comprises:
acquiring an attribute name in the initial script;
importing data of a corresponding type in the simulation test data into the position corresponding to the attribute name to obtain a test script;
and executing the test script to generate a test result.
8. An apparatus for generating a test script, the apparatus comprising:
the analysis module is used for acquiring a target interface and analyzing the annotation in the target interface to generate an interface document through swagger;
the template merging module is used for analyzing the interface document to generate an interface content text and merging the interface content text with a preset script template to obtain an initial script;
the data generation module is used for randomly generating simulation test data according to the interface document;
and the script generation module is used for generating a test script according to the simulation test data and the initial script.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform a method of generating a test script according to any one of claims 1 to 7.
10. A computer-readable storage medium, in which a computer program is stored, which, when being executed by a processor, implements a method of generating a test script according to any one of claims 1 to 7.
CN202210056354.2A 2022-01-18 2022-01-18 Test script generation method, device, equipment and storage medium Pending CN114398282A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210056354.2A CN114398282A (en) 2022-01-18 2022-01-18 Test script generation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210056354.2A CN114398282A (en) 2022-01-18 2022-01-18 Test script generation method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114398282A true CN114398282A (en) 2022-04-26

Family

ID=81231815

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210056354.2A Pending CN114398282A (en) 2022-01-18 2022-01-18 Test script generation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114398282A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114860617A (en) * 2022-07-06 2022-08-05 上海金仕达软件科技有限公司 Intelligent pressure testing method and system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114860617A (en) * 2022-07-06 2022-08-05 上海金仕达软件科技有限公司 Intelligent pressure testing method and system
CN114860617B (en) * 2022-07-06 2022-09-30 上海金仕达软件科技有限公司 Intelligent pressure testing method and system

Similar Documents

Publication Publication Date Title
CN113238929B (en) Code testing method and device based on Mock data, electronic equipment and storage medium
CN113961584A (en) Method and device for analyzing field blood relationship, electronic equipment and storage medium
CN114020256A (en) Front-end page generation method, device and equipment and readable storage medium
CN113377661A (en) Interface testing method and device, electronic equipment and storage medium
CN115408399A (en) Blood relationship analysis method, device, equipment and storage medium based on SQL script
CN114880238A (en) Mobile terminal interface testing method, device, equipment and storage medium
CN115202639A (en) Code generation method, device, equipment and storage medium based on custom module
CN114398282A (en) Test script generation method, device, equipment and storage medium
CN113434542A (en) Data relation identification method and device, electronic equipment and storage medium
CN105573763A (en) Embedded system modeling method supporting RTOS
CN112579475A (en) Code testing method, device, equipment and readable storage medium
CN112214256A (en) Operation control method and device for machine learning, electronic equipment and storage medium
CN115048111B (en) Code generation method, device, equipment and medium based on metadata
CN114911479A (en) Interface generation method, device, equipment and storage medium based on configuration
CN114356379A (en) Backup-based service upgrading method, device, equipment and storage medium
CN115496166A (en) Multitasking method and device, electronic equipment and storage medium
CN114721952A (en) Method, device, equipment and storage medium for synchronously deploying multiple sets of test environments
CN115033489A (en) Code resource detection method and device, electronic equipment and storage medium
CN114461531A (en) Platform adaptability test method, device, equipment and storage medium of test case
CN113051171A (en) Interface test method, device, equipment and storage medium
CN111680204A (en) Data acquisition method, data acquisition device and computer readable storage medium
CN113176993A (en) Case testing method and device, electronic equipment and storage medium
CN113010129A (en) Virtual studio full-flow multi-terminal blackboard writing extraction method and device
CN112527443A (en) Prompt box display method and device, electronic equipment and computer readable storage medium
CN112214981B (en) Presentation file generation 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