CN111026629A - Method and device for automatically generating test script - Google Patents

Method and device for automatically generating test script Download PDF

Info

Publication number
CN111026629A
CN111026629A CN201811171370.6A CN201811171370A CN111026629A CN 111026629 A CN111026629 A CN 111026629A CN 201811171370 A CN201811171370 A CN 201811171370A CN 111026629 A CN111026629 A CN 111026629A
Authority
CN
China
Prior art keywords
interface
tested
binary search
search tree
tested interface
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
CN201811171370.6A
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information 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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201811171370.6A priority Critical patent/CN111026629A/en
Publication of CN111026629A publication Critical patent/CN111026629A/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 invention discloses a method and a device for automatically generating a test script, and relates to the technical field of computers. One embodiment of the method comprises: acquiring a precursor binary search tree generated according to the parameters of the tested interface so as to traverse the precursor binary search tree; acquiring the input parameters of the tested interface according to the traversed parameters to generate a calling statement of the tested interface; and generating a test script of the tested interface according to the entry of the tested interface and the calling statement of the tested interface. The method and the device can solve the problem that the interface test script cannot be automatically generated in the prior art.

Description

Method and device for automatically generating test script
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for automatically generating a test script.
Background
With the continuous development of the automatic testing technology, the interface automatic technology has become an indispensable detection means in any information system testing life cycle. At present, in various interface test frames, all workflow testers write test scripts according to the specification of the test frames, design parameter pools, and run the test scripts for testing. In the above-mentioned work flow of the test script of the automatic interface, because of the fast update and fast iteration of the tested interface, the maintenance work of the test script becomes the elbow which affects the automatic test quality of all the interfaces.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
at present, the script of the interface test still depends on the manual generation of the tester according to the test frame, so the generation of the test script wastes time and labor and has low efficiency.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for automatically generating a test script, which can solve the problem that an interface test script cannot be automatically generated in the prior art.
In order to achieve the above object, according to an aspect of the embodiments of the present invention, a method for automatically generating a test script is provided, including obtaining a predecessor binary search tree generated according to a tested interface parameter, so as to traverse the predecessor binary search tree; acquiring the input parameters of the tested interface according to the traversed parameters to generate a calling statement of the tested interface; and generating a test script of the tested interface according to the entry of the tested interface and the calling statement of the tested interface.
Optionally, the obtaining a predecessor binary search tree generated according to the measured interface parameter includes:
defining a storage structure of a precursor binary search tree;
and reading parameters of the tested interface, and generating a precursor binary search tree according to the storage structure.
Optionally, traversing the predecessor binary search tree comprises:
and traversing and storing the precursor binary search tree according to a parameter sequence preset by the tested interface.
Optionally, obtaining an entry of the tested interface according to the traversed parameter to generate a call statement of the tested interface, including:
reading the traversed parameters based on a logic rule which initializes the basic type first and then initializes the complex type;
and acquiring the entry of the tested interface, and further generating a calling statement of the tested interface.
In addition, according to an aspect of the embodiments of the present invention, there is provided an apparatus for automatically generating a test script, including an obtaining module, configured to obtain a predecessor binary search tree generated according to a tested interface parameter, so as to traverse the predecessor binary search tree; the traversal module is used for obtaining the input parameters of the tested interface according to the traversed parameters so as to generate a calling statement of the tested interface; and the generating module is used for generating a test script of the tested interface according to the entry of the tested interface and the calling statement of the tested interface.
Optionally, the acquiring module acquires a predecessor binary search tree generated according to the measured interface parameter, including:
defining a storage structure of a precursor binary search tree;
and reading parameters of the tested interface, and generating a precursor binary search tree according to the storage structure.
Optionally, the traversing module traverses the predecessor binary search tree, including:
and traversing and storing the precursor binary search tree according to a parameter sequence preset by the tested interface.
Optionally, the generating module obtains an entry of the tested interface according to the traversed parameter to generate a call statement of the tested interface, including:
reading the traversed parameters based on a logic rule which initializes the basic type first and then initializes the complex type;
obtaining the entry of the tested interface and further generating the call statement of the tested interface
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any of the above embodiments of automatically generating a test script.
According to another aspect of the embodiments of the present invention, there is also provided a computer readable medium, on which a computer program is stored, which when executed by a processor, implements the method according to any of the above-mentioned embodiments of automatic generation based on test scripts.
One embodiment of the above invention has the following advantages or benefits: the method comprises the steps of traversing a precursor binary search tree by acquiring the precursor binary search tree generated according to a tested interface parameter; acquiring the input parameters of the tested interface according to the traversed parameters to generate a calling statement of the tested interface; and generating a test script of the tested interface according to the entry of the tested interface and the calling statement of the tested interface. Therefore, the invention provides a memory structure based on a precursor binary search tree and a corresponding traversal algorithm thereof, which solve the problem of automatic generation of the test script and realize the purposes of quickly generating the script and quickly testing.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main flow of a method of automatic generation of a test script according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a main flow of a method of automatic generation of a test script according to a referenceable embodiment of the present invention;
FIG. 3 is a schematic diagram of a main flow of generating a predecessor binary search tree, according to a referenceable embodiment of the present invention;
FIG. 4 is a schematic diagram of a main flow of generating a predecessor binary search tree sub-tree, according to a referenceable embodiment of the present invention;
FIG. 5 is a schematic diagram of the main modules of an apparatus for automatic generation of test scripts according to an embodiment of the present invention;
FIG. 6 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 7 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of a main flow of a method for automatically generating a test script according to an embodiment of the present invention, where the method for automatically generating a test script may include:
and step S101, acquiring a precursor binary search tree generated according to the tested interface parameters to traverse the precursor binary search tree.
In an embodiment, the predecessor binary search tree generated from the measured interface parameters may be obtained by the following process:
firstly, defining a storage structure of a precursor binary search tree, then reading parameters of a tested interface, and generating the precursor binary search tree according to the storage structure. The binary search tree is a tree structure with at most two subtrees in each node. And predecessor means that each node has a pointer to its parent.
In a preferred embodiment, a precursor binary search tree can be traversed in a medium order to store the parameters of the traversal in order. The middle-order traversal of the binary search tree firstly traverses the left subtree, then traverses the root node and finally traverses the right subtree. It should be noted that, no matter whether the middle-order traversal, the front-order traversal, the back-order traversal, or other traversal is adopted, the purpose is that the parameter sequence obtained after the traversal can conform to the parameter sequence specified when the tested interface is developed.
In addition, a predecessor binary search tree may be subject to a middle-order traversal to store the traversed parameters in the Map class in sequence. The Map class is a container for storing a plurality of elements, and the elements are all composed of Key Value (Value) and mapping Value (Mapped Value) pairs. It should be noted that, by storing the traversed parameters into the Map class having the key-value pair rule, the traversed parameters can be sorted more accurately and effectively, and certainly, the traversed parameters can also be stored into any other form.
And step S102, obtaining the input parameter of the tested interface according to the traversed parameters to generate a calling statement of the tested interface.
In an embodiment, the Map class may be traversed based on a logic rule that initializes a base type before a complex type. And then, acquiring the entry of the tested interface according to the parameters acquired after traversing the Map class, and further generating a calling statement of the tested interface.
Step S103, generating a test script of the tested interface according to the entry of the tested interface and the calling statement of the tested interface.
According to the various embodiments, the analysis of the calling structure of the tested interface is solved through the storage structure of the precursor binary search tree, and then the automatic generation of the interface automatic test script and the test parameter file is completed through the middle-order traversal of the binary search tree. That is to say, the invention can rapidly complete the automatic test script of the tested interface, thereby saving much time. In addition, the invention is completely modified into the script according to the call relation tree of the tested interface, thereby ensuring the correctness of the automatic test script logic.
Fig. 2 is a schematic diagram of a main flow of a method for automatically generating a test script according to a referential embodiment of the present invention, and the method for automatically generating a test script may include:
in step S201, a storage structure of a predecessor binary search tree is defined.
In an embodiment, the memory structure of the defined predecessor binary search tree may be:
Name Type Leftchild Rightchild Father
if the node is stored in the root node of the precursor binary search tree, the Name is expressed as a field to store the interface Name of the tested interface; type indicates the field store return value Type; if not, null; the Rightchlid points to a first load type node of a first tested interface, and if not, the Rightchlid is null; while the Father (parent) is null.
If the precursor binary search tree basic type parameter is stored, the Name is expressed as a storage variable Name; type is expressed as a store traversal Type; the Leftchild points to the basic type node in the same layer calling; rightchlid is null; the Father points to the last Node called by the same layer or to the Node of the Father Node of the complex type, and if the Node is the second layer Node of the binary tree, the Node points to the root Node.
Wherein, if the storage of the predecessor binary search tree complex object node may include storage of Java object type parameter, storage of Map type parameter, and storage of List type parameter, then specifically defined as:
the storage of Java object type parameters requires the creation of two new type nodes: a Java object node and a Java object node. The method comprises the following specific steps:
for a Java object node, Name is expressed as a storage object variable Name; type is expressed as storing Java objects; the Leftchild points to the corresponding object Node; the Rightchlid points to the complex object node on the same layer; the Father points to the last node of the same layer call or to the node of its parent node of the complex type, and if the node is the second layer node of the binary tree, points to the root node.
For the object Node, the Name is expressed as storage null; type is denoted as storage null; if not, null; the Rightchlid points to the first complex object node nested in the first complex object node, and if not, null is detected; the Father points to its corresponding Java object node.
The storage of Map type parameters requires two new type nodes: map type nodes and Map type node nodes. The method comprises the following specific steps:
for a Map type node, Name is expressed as a storage object variable Name; type is expressed as storing Map flag; the Leftchild points to the corresponding Map type Node; the Rightchlid points to the complex object node on the same layer; the Father points to the last node of the same layer call or to the node of its parent node of the complex type, and if the node is the second layer node of the binary tree, points to the root node.
For a Map type Node, the Name is expressed as a storage null; type is denoted as storage null; the Leftchild points to the first key node of the Leftchild, and the keys are processed according to specific types; the Rightchlid points to a first value node, and the value node is processed according to a specific type; the Father points to its corresponding Map type node.
The storage of the List type parameters requires two new type nodes: list type nodes and List type node nodes. The method comprises the following specific steps:
for the List type node, Name is expressed as a storage object variable Name; type is expressed as storing Map flag; the Leftchild points to the corresponding List type Node; the Rightchlid points to the complex object node of the same layer; the Father points to the last node of the same layer call or to the node of its parent node of the complex type, and if the node is the second layer node of the binary tree, points to the root node.
Aiming at the List type Node, the Name is expressed as a storage null; type is denoted as storage null; leftchild indicates that if the List is a basic type, then Lefchlid points to the corresponding basic type node, and righthlid is null; rightchlid indicates that if the List is a complex type, then Rightchlid points to its corresponding complex type node, and Leftchild is null; the Father points to its corresponding List type node.
In step S202, a predecessor binary search tree is generated. As shown in fig. 3, the specific implementation process includes:
step S301: and establishing a root node.
Step S302: and setting a mark i of the current node.
Step S303: and judging whether the mark i of the current node is less than the number of the parameters, if so, performing the step S304, and otherwise, exiting the process.
Step S304: and acquiring the ith parameter node.
Step S305: and judging whether the ith parameter node is of the basic type, if so, performing step S306, and otherwise, performing step S307.
Step 306: the left child of the ith parameter node points to the new node and self-increment i is reassigned to i, returning to step S303.
Step S307: and generating a subtree according to the ith parameter node.
In a further embodiment, as shown in fig. 4, the process of generating a sub-tree according to the ith parameter node comprises:
step S401: and creating a node of the complex object according to the mark i of the parameter node.
Step S402: and judging whether the mark i of the parameter node is less than the attribute number of the node, if so, performing step S403, and otherwise, exiting the process.
Step S403: and (5) creating the ith attribute node of the node.
Step S404: and judging whether the ith attribute node is of the basic type, if so, performing the step S405, and otherwise, returning to the step S401.
Step S405: the left child of the ith attribute node points to the new node and self-increment i is reassigned to i, returning to step S402.
And step S203, performing middle-order traversal on the precursor binary search tree, and sequentially storing the traversed parameters into a Map class.
In an embodiment, when performing a middle-order traversal on the predecessor binary search tree, the left sub-tree is traversed first, then the root node is traversed, and finally the right sub-tree is traversed. In the traversal process, the traversed parameters are sequentially stored in the Map class, so that the calling relationship among the parameters can be obtained.
And step S204, obtaining the entry of the tested interface by traversing the Map class, and further generating a calling statement of the tested interface.
In an embodiment, when traversing the Map class, a logic rule that initializes the basic type first and then initializes the complex type may be used. Further, according to traversal of the Map class, the entry of the good tested interface can be obtained, and therefore the calling statement of the tested interface can be obtained.
Step S205, generating a test script of the tested interface according to the entry of the tested interface and the calling statement of the tested interface.
Fig. 5 is an apparatus for automatically generating a test script according to an embodiment of the present invention, and as shown in fig. 5, the apparatus for automatically generating a test script includes an obtaining module 501, a traversing module 502, and a generating module 503. The obtaining module 501 obtains a precursor binary search tree generated according to the measured interface parameter to traverse the precursor binary search tree. The traversal module 502 obtains the entry of the tested interface according to the traversed parameters to generate the call statement of the tested interface. The generating module 503 generates a test script of the interface to be tested according to the entry of the interface to be tested and the call statement of the interface to be tested.
Preferably, when the obtaining module 501 obtains the precursor binary search tree generated according to the parameters of the interface to be tested, it may first define a storage structure of the precursor binary search tree, and then read the parameters of the interface to be tested, and generate the precursor binary search tree according to the storage structure.
As another embodiment, when traversing the predecessor binary search tree, the traversing module 502 may adopt a middle-order traversal for the predecessor binary search tree, and sequentially store parameters of the traversal into the Map class. Further, the generating module 503 obtains the entry of the tested interface according to the parameters obtained after traversing the Map class, so as to generate the call statement of the tested interface.
Further, the generating module 503 traverses the Map class by using a logic rule based on initializing the basic type first and then initializing the complex type. And then, acquiring the entry of the tested interface according to the parameters acquired after traversing the Map class, and further generating a calling statement of the tested interface.
It should be noted that, in the implementation contents of the apparatus for automatically generating a test script according to the present invention, the details of the method for automatically generating a test script are already described in detail, and therefore, the repeated contents are not described herein again.
Fig. 6 illustrates an exemplary system architecture 600 to which the method for automatic generation of test scripts or the apparatus for automatic generation of test scripts of embodiments of the present invention may be applied.
As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 serves to provide a medium for communication links between the terminal devices 601, 602, 603 and the server 605. Network 604 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 601, 602, 603 to interact with the server 605 via the network 604 to receive or send messages or the like. The terminal devices 601, 602, 603 may have installed thereon various communication client applications, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 601, 602, 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 605 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 601, 602, 603. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the method for automatically generating the test script provided by the embodiment of the present invention is generally executed by the server 605, and accordingly, the apparatus for automatically generating the test script is generally disposed in the server 605.
It should be understood that the number of terminal devices, networks, and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 7, shown is a block diagram of a computer system 700 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM703, various programs and data necessary for the operation of the system 700 are also stored. The CPU701, the ROM 702, and the RAM703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure 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 in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 701.
It should be noted that the computer readable medium shown in the present invention can 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 or 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 invention, 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 the present invention, 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, wire, fiber optic cable, RF, 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 invention. In this regard, 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 modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes an acquisition module, a traversal module, and a generation module. Wherein the names of the modules do not in some cases constitute a limitation of the module itself.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: acquiring a precursor binary search tree generated according to the parameters of the tested interface so as to traverse the precursor binary search tree; acquiring the input parameters of the tested interface according to the traversed parameters to generate a calling statement of the tested interface; and generating a test script of the tested interface according to the entry of the tested interface and the calling statement of the tested interface.
According to the technical scheme of the embodiment of the invention, the problem that the interface test script cannot be automatically generated in the prior art can be solved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method for automatically generating a test script is characterized by comprising the following steps:
acquiring a precursor binary search tree generated according to the parameters of the tested interface so as to traverse the precursor binary search tree;
acquiring the input parameters of the tested interface according to the traversed parameters to generate a calling statement of the tested interface;
and generating a test script of the tested interface according to the entry of the tested interface and the calling statement of the tested interface.
2. The method of claim 1, wherein obtaining a predecessor binary search tree generated from a measured interface parameter comprises:
defining a storage structure of a precursor binary search tree;
and reading parameters of the tested interface, and generating a precursor binary search tree according to the storage structure.
3. The method of claim 1, wherein traversing the predecessor binary search tree comprises:
and traversing and storing the precursor binary search tree according to a parameter sequence preset by the tested interface.
4. The method of claim 2, wherein obtaining the entry of the interface to be tested according to the traversed parameters to generate the call statement of the interface to be tested comprises:
reading the traversed parameters based on a logic rule which initializes the basic type first and then initializes the complex type;
and acquiring the entry of the tested interface, and further generating a calling statement of the tested interface.
5. An apparatus for automatic generation of a test script, comprising:
the acquisition module is used for acquiring a precursor binary search tree generated according to the tested interface parameters so as to traverse the precursor binary search tree;
the traversal module is used for obtaining the input parameters of the tested interface according to the traversed parameters so as to generate a calling statement of the tested interface;
and the generating module is used for generating a test script of the tested interface according to the entry of the tested interface and the calling statement of the tested interface.
6. The apparatus of claim 5, wherein the obtaining module obtains a predecessor binary search tree generated from the measured interface parameters, including:
defining a storage structure of a precursor binary search tree;
and reading parameters of the tested interface, and generating a precursor binary search tree according to the storage structure.
7. The method of claim 1, wherein the traversing module traverses the predecessor binary search tree, comprising:
and traversing and storing the precursor binary search tree according to a parameter sequence preset by the tested interface.
8. The apparatus of claim 6, wherein the generating module obtains an entry of the interface to be tested according to the traversed parameters to generate a call statement of the interface to be tested, and includes:
reading the traversed parameters based on a logic rule which initializes the basic type first and then initializes the complex type;
and acquiring the entry of the tested interface, and further generating a calling statement of the tested interface.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-4.
10. 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-4.
CN201811171370.6A 2018-10-09 2018-10-09 Method and device for automatically generating test script Pending CN111026629A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811171370.6A CN111026629A (en) 2018-10-09 2018-10-09 Method and device for automatically generating test script

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811171370.6A CN111026629A (en) 2018-10-09 2018-10-09 Method and device for automatically generating test script

Publications (1)

Publication Number Publication Date
CN111026629A true CN111026629A (en) 2020-04-17

Family

ID=70190689

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811171370.6A Pending CN111026629A (en) 2018-10-09 2018-10-09 Method and device for automatically generating test script

Country Status (1)

Country Link
CN (1) CN111026629A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111694729A (en) * 2020-04-29 2020-09-22 北京三快在线科技有限公司 Application testing method and device, electronic equipment and computer readable medium
CN112148601A (en) * 2020-09-16 2020-12-29 京东数字科技控股股份有限公司 Interface testing method and device, electronic equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111694729A (en) * 2020-04-29 2020-09-22 北京三快在线科技有限公司 Application testing method and device, electronic equipment and computer readable medium
CN112148601A (en) * 2020-09-16 2020-12-29 京东数字科技控股股份有限公司 Interface testing method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
WO2021023149A1 (en) Method and apparatus for dynamically returning message
CN109976999B (en) Method and device for measuring coverage rate of test cases
CN111190888A (en) Method and device for managing graph database cluster
CN111038906B (en) Order sorting method and device
CN110689268B (en) Method and device for extracting indexes
CN109901987B (en) Method and device for generating test data
CN109903105B (en) Method and device for perfecting target commodity attributes
CN110879776A (en) Test case generation method and device
CN114116065B (en) Method and device for acquiring topological graph data object and electronic equipment
CN113760488A (en) Method, device, equipment and computer readable medium for scheduling task
CN113127357B (en) Unit test method, apparatus, device, storage medium, and program product
CN111026629A (en) Method and device for automatically generating test script
CN110795331A (en) Software testing method and device
CN110928594A (en) Service development method and platform
CN110895591A (en) Method and device for positioning self-picking point
CN112433757A (en) Method and device for determining interface calling relationship
CN115454971A (en) Data migration method and device, electronic equipment and storage medium
CN115495518B (en) Method and device for generating chart
CN112711588A (en) Multi-table connection method and device
CN110806967A (en) Unit testing method and device
CN110688295A (en) Data testing method and device
CN110880059A (en) Batch number generation method and device
CN113362097B (en) User determination method and device
CN110727739B (en) Data storage method and device
CN118069507A (en) Regression testing quality assessment method and device based on code knowledge graph

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