CN115687065A - Test script generation method and device, storage medium and electronic device - Google Patents

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

Info

Publication number
CN115687065A
CN115687065A CN202110865772.1A CN202110865772A CN115687065A CN 115687065 A CN115687065 A CN 115687065A CN 202110865772 A CN202110865772 A CN 202110865772A CN 115687065 A CN115687065 A CN 115687065A
Authority
CN
China
Prior art keywords
interface
test script
request content
document
generating
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
CN202110865772.1A
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.)
Qingdao Haier Technology Co Ltd
Haier Smart Home Co Ltd
Original Assignee
Qingdao Haier Technology Co Ltd
Haier Smart Home 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 Qingdao Haier Technology Co Ltd, Haier Smart Home Co Ltd filed Critical Qingdao Haier Technology Co Ltd
Priority to CN202110865772.1A priority Critical patent/CN115687065A/en
Publication of CN115687065A publication Critical patent/CN115687065A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention discloses a method and a device for generating a test script, a storage medium and an electronic device, wherein the method comprises the following steps: acquiring an interface type and interface request content of an interface document through a script generator, wherein the interface request content is used for indicating parameter information of the interface document; the method comprises the steps of indicating a script generator to generate a test script according to an interface type and interface request content, wherein the test script is used for testing an interface to be tested corresponding to an interface document, namely automatically generating the test script corresponding to the interface document according to the interface type and the interface request content through the script generator.

Description

Test script generation method and device, storage medium and electronic device
Technical Field
The present invention relates to the field of communications, and in particular, to a method and an apparatus for generating a test script, a storage medium, and an electronic apparatus.
Background
At present, with the increasing development of computer technology, more and more systems providing various application functions to people are provided, and in order to ensure the stability of system operation, corresponding tests are usually performed on interfaces of the systems in the development process. The interface test is a test for testing the interface between the system components. The interface test is mainly used for detecting interaction points between external systems and between each subsystem inside. The key point of the test is to check the exchange of data, transfer and control management processes, mutual logic dependency relationship between systems and the like.
In the process of interface testing, testers usually need to write interface test scripts respectively according to interface documents corresponding to interfaces to be tested, which consumes a lot of test time. Under the condition that the number of fields involved in the interface document is too large, data omission may exist when the test script is manually written, and therefore the quality and the efficiency of the test script cannot be guaranteed.
Aiming at the problems that in the related art, under the condition that excessive fields are involved in an interface document, data omission possibly exists in manual writing of a test script, the quality and the efficiency of the test script are low, and the like, an effective solution is not provided.
Disclosure of Invention
The embodiment of the invention provides a method and a device for generating a test script, a storage medium and an electronic device, which are used for at least solving the problems that data omission possibly exists when the test script is manually written under the condition that fields involved in an interface document are too many, so that the quality and the efficiency of the test script are lower and the like in the related technology.
According to an embodiment of the present invention, a method for generating a test script is provided, including: acquiring an interface type and interface request content of an interface document through a script generator, wherein the interface request content is used for indicating parameter information of the interface document; and indicating the script generator to generate a test script according to the interface type and the interface request content, wherein the test script is used for testing the interface to be tested corresponding to the interface document.
In an exemplary embodiment, generating a test script according to the interface type and the interface request content includes: determining a test script template corresponding to the interface type in a database according to the interface type; and generating the test script according to the parameter information in the interface request content and the test script template.
In an exemplary embodiment, generating the test script according to the parameter information in the interface request content and the test script template includes: and correspondingly writing the parameter information in the interface request content into the corresponding position of the test script template to generate the test script.
In one exemplary embodiment, obtaining the interface type and the interface request content of the interface document includes: and acquiring the interface type and the interface request content of the interface document sent by a parser, wherein the parser parses the interface document after receiving the interface document imported by a target object to obtain the interface type and the interface request content.
In one exemplary embodiment, obtaining the interface type and the interface request content of the interface document includes: when a resolver acquires the interface document, instructing the resolver to resolve the interface document, wherein the resolver is used for receiving the interface document imported by a target object; after the resolver resolves the interface document, obtaining the interface type and the interface request content of the interface document resolved by the resolver.
In an exemplary embodiment, after generating the test script according to the interface type and the interface request content, the method further includes: sending the test script to the interface to be tested; and indicating the interface to be tested to run the test script so as to complete the test of the interface to be tested and generate a test report corresponding to the interface to be tested.
According to another embodiment of the present invention, there is also provided a test script generating apparatus, including: the interface processing device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring an interface type and interface request content of an interface document, and the interface request content is used for indicating parameter information of the interface document; and the generating module is used for indicating the script generator to generate a test script according to the interface type and the interface request content, wherein the test script is used for testing the interface to be tested corresponding to the interface document.
In one exemplary embodiment, further comprising: the generating module is further used for determining a test script template corresponding to the interface type in a database according to the interface type; and generating the test script according to the parameter information in the interface request content and the test script template.
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, where the computer program is configured to execute the method for generating a test script when running.
According to another aspect of the embodiments of the present invention, there is also provided an electronic apparatus, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the method for generating the test script through the computer program.
In the embodiment of the invention, the interface type and the interface request content of the interface document are obtained through a script generator, wherein the interface request content is used for indicating the parameter information of the interface document; the method comprises the steps of indicating a script generator to generate a test script according to an interface type and interface request content, wherein the test script is used for testing an interface to be tested corresponding to an interface document, namely automatically generating the test script corresponding to the interface document according to the interface type and the interface request content through the script generator.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
fig. 1 is a block diagram of a hardware configuration of a computer terminal of a test script generation method according to an embodiment of the present invention;
FIG. 2 is a flow diagram of a method of generating a test script according to an embodiment of the invention;
FIG. 3 is a timing diagram of a method of generation of a test script according to an alternate embodiment of the invention;
FIG. 4 is a schematic diagram of a method of generating a test script according to an alternative embodiment of the invention;
FIG. 5 is a block diagram (I) of a test script generating apparatus according to an embodiment of the present invention;
fig. 6 is a block diagram (ii) of the structure of a test script generation apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Moreover, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The method provided by the embodiment of the application can be executed in a mobile terminal, a computer terminal or a similar operation device. Taking the example of running on a computer terminal, fig. 1 is a hardware structure block diagram of a computer terminal of a test script generation method according to an embodiment of the present invention. As shown in fig. 1, the computer terminal may include one or more (only one shown in fig. 1) processors 102 (the processors 102 may include, but are not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, and in an exemplary embodiment, may also include a transmission device 106 for communication functions and an input-output device 108. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the computer terminal. For example, the computer terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration with equivalent functionality to that shown in FIG. 1 or with more functionality than that shown in FIG. 1.
The memory 104 may be used to store computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the test script generating method in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, so as to implement the above-mentioned method. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to a computer terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the computer terminal. In one example, the transmission device 106 includes a Network adapter (NIC), which can be connected to other Network devices through a base station so as to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.
In this embodiment, a method for generating a test script is provided, which is applied to the computer terminal, specifically, the script generator, and fig. 2 is a flowchart of a method for generating a test script according to an embodiment of the present invention, where the flowchart includes the following steps:
step S202, obtaining an interface type and interface request content of an interface document through a script generator, wherein the interface request content is used for indicating parameter information of the interface document;
and step S204, the script generator is instructed to generate a test script according to the interface type and the interface request content, wherein the test script is used for testing the interface to be tested corresponding to the interface document.
Through the steps, the interface type and the interface request content of the interface document are obtained through the script generator, wherein the interface request content is used for indicating the parameter information of the interface document; the method comprises the steps of indicating a script generator to generate a test script according to an interface type and interface request content, wherein the test script is used for testing an interface to be tested corresponding to an interface document, namely automatically generating the test script corresponding to the interface document according to the interface type and the interface request content through the script generator.
It should be noted that a test script generally refers to a series of instructions of a specific test, which can be executed by an automation side tool, and in order to improve the maintenance and reusability of the test script, the test script must be constructed before the test script is executed, and since operations that may occur will occur in several test processes, the targets of the operations should be purposefully determined, and the test script should be reused. Test scripts are computer readable instructions that automatically perform a test procedure.
In the project development, the front end and the back end of a web project are separately developed, so that a front end engineer and a back end engineer are required to jointly define an interface and compile an interface document, the interface document is required by a standard format and content, the back end receives legal data transmitted by the front end and returns standard data, and the front end processes the data returned by the back end according to the standard data and the display requirement. The interface document includes the following: interface description, request mode, call interface address, request content (including parameter type and limitation condition), return parameter description, interface type, etc.
In an exemplary embodiment, generating a test script according to the interface type and the interface request content includes: determining a test script template corresponding to the interface type in a database according to the interface type; and generating the test script according to the parameter information in the interface request content and the test script template.
That is, the test script is generated according to the following manner: the method comprises the steps of obtaining an interface type in an interface document, determining a first interface type which is the same as the interface type in a database according to the interface type, determining a test script template corresponding to the first interface type according to the first interface type, and generating a test script according to interface request content and the test script template.
It should be noted that before the interface type and the interface request content of the interface document are acquired by the script generator, a corresponding relationship between the interface type and the test script template needs to be constructed in the database, and the interface type is determined according to the corresponding relationship to determine the corresponding test script template.
In an exemplary embodiment, generating the test script according to the parameter information in the interface request content and the test script template includes: and correspondingly writing the parameter information in the interface request content into the corresponding position of the test script template to generate the test script.
Specifically, the test script is generated according to the parameter information in the interface request content and the test script template according to the following mode: and acquiring parameter information in the interface request content, and writing the parameter information into the test script template to generate a corresponding test script.
In an exemplary embodiment, obtaining the interface type and the interface request content of the interface document includes: the method comprises the steps of obtaining an interface type and interface request content of an interface document sent by a resolver, wherein the resolver resolves the interface document after receiving the interface document imported by a target object to obtain the interface type and the interface request content.
That is to say, after receiving an interface document imported by a target object, a parser automatically parses the interface document to obtain the interface type and the interface request content, and then the parser sends the interface type and the interface request content to a script generator, so that the script generator generates a test script according to the interface type and the interface request content, wherein the target object can be understood as a developer of an interface.
In an exemplary embodiment, obtaining the interface type and the interface request content of the interface document includes: when a resolver acquires the interface document, instructing the resolver to resolve the interface document, wherein the resolver is used for receiving the interface document imported by a target object; after the resolver resolves the interface document, obtaining the interface type and the interface request content of the interface document resolved by the resolver.
That is to say, when an analyzer receives an interface document imported by a target object and the analyzer receives indication information sent by a script generator, the analyzer analyzes the interface document to obtain the interface type and the interface request content, and then the analyzer sends the interface type and the interface request content to the script generator, so that the script generator generates a test script according to the interface type and the interface request content, wherein the indication information is used for indicating the analyzer to analyze the interface document.
As can be seen from the two embodiments, the present invention can obtain the type of the interface and the content of the interface request in one of the following ways: 1) After receiving the interface document imported by the target object, the analyzer analyzes the interface document to obtain the interface type and the interface request content; 2) The resolver receives the interface document imported by the target object; after the resolver resolves the interface document, the resolver resolves the interface document to obtain the interface type and the interface request content.
In an exemplary embodiment, after generating a test script according to the interface type and the interface request content, sending the test script to the interface to be tested; and indicating the interface to be tested to run the test script so as to complete the test of the interface to be tested and generate a test report corresponding to the interface to be tested.
Namely, after the test script is generated, the test script is sent to the interface to be tested, so that the interface to be tested runs the test script, and after the test script runs, a test report corresponding to the interface to be tested is generated, wherein the test report is used for indicating the function of the interface to be tested. Furthermore, the test script can be sent to a target object, so that the target object can test the interface to be tested through the test script.
Specifically, when a plurality of interfaces correspond to the interface document, the parser parses the interface types and the interface request contents corresponding to the plurality of interfaces, and the script generator generates a plurality of test scripts according to the interface types and the interface request contents in sequence.
In order to better understand the process of the test script generation method, the following describes an implementation method flow of the test script generation with reference to an optional embodiment, but the implementation method flow is not limited to the technical solution of the embodiment of the present invention.
As shown in fig. 3, fig. 3 is a schematic diagram (one) of a test script generation method according to an alternative embodiment of the present invention, which is specifically as follows:
step S301: the target object leads the interface document into a parser;
step S302: after receiving the interface document imported by the target object, the analyzer analyzes the interface document to obtain an interface type and interface request content;
step S303: the parser sends the interface type to the script generator;
step S304: the analyzer sends the interface request content to the script generator;
step S305: a script generator generates a test script according to the interface type and the interface request content, wherein the test script is used for testing the interface to be tested corresponding to the interface document;
step S306: and the script generator sends the test script to the target object so that the target object tests the corresponding interface function according to the test script.
As shown in fig. 4, fig. 4 is a schematic diagram (ii) of a test script generation method according to an alternative embodiment of the present invention, which is specifically as follows:
step S401: the target object leads the interface document into a parser;
step S402: the script generator sends indication information to a parser, wherein the indication information is used for indicating the parser to parse an interface document;
step S403: the method comprises the steps that when an analyzer receives an interface document imported by a target object and receives indication information sent by a script generator, the analyzer analyzes the interface document to obtain an interface type and interface request content;
step S404: the parser sends the interface type to the script generator;
step S405: the analyzer sends the interface request content to the script generator;
step S406: a script generator generates a test script according to the interface type and the interface request content, wherein the test script is used for testing the interface to be tested corresponding to the interface document;
step S407: and the script generator sends the test script to the target object so that the target object tests the corresponding interface function according to the test script.
Through the steps, the acquisition module acquires the interface type and the interface request content of the interface document, wherein the interface request content is used for indicating the parameter information of the interface document; the generation module indicates the script generator to generate the test script according to the interface type and the interface request content, wherein the test script is used for testing the interface to be tested corresponding to the interface document, namely the test script corresponding to the interface document is automatically generated according to the interface type and the interface request content through the script generator.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention or portions thereof contributing to the prior art may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes several instructions for enabling a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to execute the method of the embodiments of the present invention.
FIG. 5 is a block diagram (I) of a test script generating apparatus according to an embodiment of the present invention; as shown in fig. 5, includes:
an obtaining module 42, configured to obtain an interface type and interface request content of an interface document, where the interface request content is used to indicate parameter information of the interface document;
and a generating module 44, configured to instruct the script generator to generate a test script according to the interface type and the interface request content, where the test script is used to test the interface to be tested corresponding to the interface document.
By the device, the acquisition module acquires the interface type and the interface request content of the interface document, wherein the interface request content is used for indicating the parameter information of the interface document; the generation module indicates the script generator to generate the test script according to the interface type and the interface request content, wherein the test script is used for testing the interface to be tested corresponding to the interface document, namely the test script corresponding to the interface document is automatically generated according to the interface type and the interface request content through the script generator.
It should be noted that a test script generally refers to a series of instructions of a specific test, which can be executed by an automation side tool, and in order to improve the maintainability and reusability of the test script, the test script must be constructed before being executed. Test scripts are computer readable instructions that automatically perform a test procedure.
In the project development, front and back ends of a web project are separately developed, so that front and back end engineers jointly define an interface and compile an interface document, the interface document is required by a standard format and content, the back end receives legal data transmitted by the front end and returns standard data according to an interface protocol, and the front end processes the data returned by the back end according to the standard data and the requirement of display. The interface document includes the following: interface description, request mode, call interface address, request content (including parameter type and limitation condition), return parameter description, interface type, etc.
In an exemplary embodiment, the generating module 44 is further configured to generate a test script according to the interface type and the interface request content, including: determining a test script template corresponding to the interface type in a database according to the interface type; and generating the test script according to the parameter information in the interface request content and the test script template.
That is, the generation module 44 generates the test script according to the following manner: the method comprises the steps of obtaining an interface type in an interface document, determining a first interface type which is the same as the interface type in a database according to the interface type, determining a test script template corresponding to the first interface type according to the first interface type, and generating a test script according to interface request content and the test script template.
It should be noted that, before the interface type and the interface request content of the interface document are obtained through the script generator, a corresponding relationship between the interface type and the test script template needs to be established in the database, and the interface type is determined according to the corresponding relationship to determine the corresponding test script template.
In an exemplary embodiment, the generating module 44 is further configured to generate the test script according to the parameter information in the interface request content and the test script template, including: and correspondingly writing the parameter information in the interface request content into the corresponding position of the test script template to generate the test script.
Specifically, the generating module 44 is further configured to generate the test script according to the parameter information in the interface request content and the test script template in the following manner: and acquiring parameter information in the interface request content, and writing the parameter information into the test script template to generate a corresponding test script.
In an exemplary embodiment, the obtaining module 42 is further configured to obtain the interface type and the interface request content of the interface document, including: the method comprises the steps of obtaining an interface type and interface request content of an interface document sent by a resolver, wherein the resolver resolves the interface document after receiving the interface document imported by a target object to obtain the interface type and the interface request content.
That is to say, the obtaining module 42 is further configured to, after the parser receives an interface document imported by the target object, the parser automatically parses the interface document to obtain the interface type and the interface request content, and then the parser sends the interface type and the interface request content to the script generator, so that the script generator generates a test script according to the interface type and the interface request content, where the target object may be understood as a developer of the interface.
In an exemplary embodiment, the obtaining module 42 is further configured to obtain the interface type and the interface request content of the interface document, including: when a resolver acquires the interface document, instructing the resolver to resolve the interface document, wherein the resolver is used for receiving the interface document imported by a target object; after the resolver resolves the interface document, obtaining the interface type and the interface request content of the interface document resolved by the resolver.
That is to say, when the parser receives an interface document imported by a target object and the parser receives indication information sent by the script generator, the parser parses the interface document, the interface type and the interface request content, and then the parser sends the interface type and the interface request content to the obtaining module 42, so that the script generator generates a test script according to the interface type and the interface request content, where the indication information is used to indicate the parser to parse the interface document.
As can be seen from the above two embodiments, the obtaining module 42 may obtain the interface type and the interface request content by one of the following manners: 1) After receiving the interface document imported by the target object, the analyzer analyzes the interface document to obtain the interface type and the interface request content; 2) The parser receives the interface document imported by the target object; after the resolver resolves the interface document, the resolver resolves the interface document to obtain the interface type and the interface request content.
In an exemplary embodiment, fig. 6 is a block diagram (two) of the structure of a test script generating apparatus according to an embodiment of the present invention; as shown in fig. 6, the above apparatus further includes: a sending module 52, configured to send the test script to the interface to be tested; and indicating the interface to be tested to run the test script so as to complete the test of the interface to be tested and generate a test report corresponding to the interface to be tested.
Namely, after the test script is generated, the test script is sent to the interface to be tested, so that the interface to be tested runs the test script, and after the test script is run, a test report corresponding to the interface to be tested is generated, wherein the test report is used for indicating the function of the interface to be tested. Furthermore, the test script can be sent to a target object, so that the target object can test the interface to be tested through the test script.
Specifically, when a plurality of interfaces correspond to the interface document, the parser parses the interface types and the interface request contents corresponding to the plurality of interfaces, and the script generator generates a plurality of test scripts according to the interface types and the interface request contents in sequence.
An embodiment of the present invention further provides a storage medium including a stored program, wherein the program executes any one of the methods described above.
Alternatively, in the present embodiment, the storage medium may be configured to store program codes for performing the following steps:
s1, acquiring an interface type and interface request content of an interface document through a script generator, wherein the interface request content is used for indicating parameter information of the interface document;
and S2, indicating the script generator to generate a test script according to the interface type and the interface request content, wherein the test script is used for testing the interface to be tested corresponding to the interface document.
Embodiments of the present invention further provide an electronic device, comprising a memory in which a computer program is stored and a processor configured to execute the computer program to perform the steps in any of the above method embodiments.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, acquiring an interface type and interface request content of an interface document through a script generator, wherein the interface request content is used for indicating parameter information of the interface document;
and S2, indicating the script generator to generate a test script according to the interface type and the interface request content, wherein the test script is used for testing the interface to be tested corresponding to the interface document.
Optionally, in this embodiment, the storage medium may include but is not limited to: various media capable of storing program codes, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Optionally, for a specific example in this embodiment, reference may be made to the examples described in the above embodiment and optional implementation, and this embodiment is not described herein again.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the principle of the present invention shall be included in the protection scope of the present invention.

Claims (10)

1. A method for generating a test script, comprising:
acquiring an interface type and interface request content of an interface document through a script generator, wherein the interface request content is used for indicating parameter information of the interface document;
and indicating the script generator to generate a test script according to the interface type and the interface request content, wherein the test script is used for testing the interface to be tested corresponding to the interface document.
2. The method for generating a test script according to claim 1, wherein generating a test script according to the interface type and the interface request content comprises:
determining a test script template corresponding to the interface type in a database according to the interface type;
and generating the test script according to the parameter information in the interface request content and the test script template.
3. The method for generating a test script according to claim 2, wherein generating the test script according to the parameter information in the interface request content and the test script template comprises:
and correspondingly writing the parameter information in the interface request content into the corresponding position of the test script template to generate the test script.
4. The method for generating a test script according to claim 1, wherein obtaining the interface type and the interface request content of the interface document comprises:
the method comprises the steps of obtaining an interface type and interface request content of an interface document sent by a resolver, wherein the resolver resolves the interface document after receiving the interface document imported by a target object to obtain the interface type and the interface request content.
5. The method for generating a test script according to claim 1, wherein obtaining the interface type and the interface request content of the interface document comprises:
when a resolver acquires the interface document, instructing the resolver to resolve the interface document, wherein the resolver is used for receiving the interface document imported by a target object;
after the resolver resolves the interface document, obtaining the interface type and the interface request content of the interface document resolved by the resolver.
6. The method for generating a test script according to claim 1, wherein after generating a test script according to the interface type and the interface request content, the method further comprises:
sending the test script to the interface to be tested;
and indicating the interface to be tested to run the test script so as to complete the test of the interface to be tested and generate a test report corresponding to the interface to be tested.
7. An apparatus for generating a test script, comprising:
the interface processing device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring an interface type and interface request content of an interface document, and the interface request content is used for indicating parameter information of the interface document;
and the generating module is used for indicating the script generator to generate a test script according to the interface type and the interface request content, wherein the test script is used for testing the interface to be tested corresponding to the interface document.
8. The apparatus for generating a test script according to claim 7, comprising:
the generating module is further used for determining a test script template corresponding to the interface type in a database according to the interface type; and generating the test script according to the parameter information in the interface request content and the test script template.
9. A computer-readable storage medium, comprising a stored program, wherein the program is operable to perform the method of any one of claims 1 to 6.
10. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method of any of claims 1 to 6 by means of the computer program.
CN202110865772.1A 2021-07-29 2021-07-29 Test script generation method and device, storage medium and electronic device Pending CN115687065A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110865772.1A CN115687065A (en) 2021-07-29 2021-07-29 Test script generation method and device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110865772.1A CN115687065A (en) 2021-07-29 2021-07-29 Test script generation method and device, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN115687065A true CN115687065A (en) 2023-02-03

Family

ID=85059556

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110865772.1A Pending CN115687065A (en) 2021-07-29 2021-07-29 Test script generation method and device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN115687065A (en)

Similar Documents

Publication Publication Date Title
CN111459794A (en) Communication network testing method, device, computer equipment and storage medium
CN109634258B (en) Bus message checking method, device and system for hardware-in-loop test
CN109388417B (en) Communication protocol updating method, system and terminal equipment
CN109726108B (en) Front-end code testing method, device, system and medium based on analog data
CN112241360A (en) Test case generation method, device, equipment and storage medium
CN112035344A (en) Multi-scenario test method, device, equipment and computer readable storage medium
CN110569194A (en) interface testing method and device, electronic equipment and storage medium
CN109408309A (en) The test method and device of multiple terminals
CN113434405B (en) Method and device for determining test file, storage medium and electronic device
CN116028367A (en) Automatic test system and method
CN115687065A (en) Test script generation method and device, storage medium and electronic device
CN112416557B (en) Method and device for determining call relation, storage medium and electronic device
CN113535578B (en) CTS test method, CTS test device and CTS test equipment
CN112650815B (en) Method and device for synchronizing environment data, storage medium and electronic device
CN115833964A (en) Performance test method and performance test system of dual-mode communication module
CN112131127B (en) Interface testing method, device and system and electronic equipment
CN114466395A (en) Method and device for testing performance of base station, storage medium and electronic device
CN113900937A (en) Script calling method and device, electronic device and storage medium
CN112422682A (en) Data transmission method and device, storage medium, and electronic device
CN113434417B (en) Regression testing method and device for loopholes, storage medium and electronic device
CN111459795A (en) Cluster pressure testing method and device, computer equipment and storage medium
CN112737872B (en) ARINC664P7 end system cross-network testing system and method
CN113076238B (en) Pressure testing method and device, storage medium and electronic equipment
CN114035799B (en) Network file compiling method and device, storage medium and electronic device
CN113434410A (en) Data testing method and device, storage medium and electronic device

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