CN112579427A - Method and device for generating virtualization test code - Google Patents

Method and device for generating virtualization test code Download PDF

Info

Publication number
CN112579427A
CN112579427A CN201910935681.3A CN201910935681A CN112579427A CN 112579427 A CN112579427 A CN 112579427A CN 201910935681 A CN201910935681 A CN 201910935681A CN 112579427 A CN112579427 A CN 112579427A
Authority
CN
China
Prior art keywords
test
data
virtualization
code
parameter
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
CN201910935681.3A
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 CN201910935681.3A priority Critical patent/CN112579427A/en
Publication of CN112579427A publication Critical patent/CN112579427A/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
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • H04L63/101Access control lists [ACL]

Abstract

The invention discloses a method and a device for generating a virtualization test code, and relates to the technical field of computers. One embodiment of the method comprises: generating test data according to the acquired parameter input data and parameter output data of the method to be tested; assembling the test data by using a preset virtualization test template to generate a virtualization test pseudo code; and integrating the virtualization test pseudo codes to generate virtualization test codes. The implementation mode avoids the technical defects that certain tedious and repetitive work exists in test data preparation in test case virtualization work, and testers need to write virtualization test codes in the later period to input a large amount of work, so that the software delivery cycle is long and unnecessary cost expenditure is generated, and further achieves the technical effects of obtaining test data from the existing test environment data, improving the accuracy of the test data, enabling the test cases to run at any time and not relying on an external interface environment.

Description

Method and device for generating virtualization test code
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for generating a virtualization test code.
Background
When the method to be tested is upgraded or optimized, in order to verify the logic correctness of the modified method to be tested, the corresponding test case needs to be executed again. The test case relies on the external environment, and the data of the external environment is not necessarily reasonably valid for prior test cases. Therefore, in the prior art, virtualization testing is adopted to package and solidify data returned by an external method.
In the process of implementing the invention, the inventor finds that at least the technical defects of certain tedious and repetitive work, long software delivery cycle and unnecessary cost expenditure in the test data preparation in the test case virtualization work in the prior art exist.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for generating a virtualized test code, which can avoid technical defects that test data preparation in test case virtualization work is tedious and repetitive, and a tester needs to write a large amount of virtualized test codes to invest in later stage, resulting in a long software delivery period and unnecessary cost expenditure, so as to achieve technical effects of obtaining test data from existing test environment data, improving accuracy of the test data, enabling a test case to run at any time, and being independent of an external interface environment.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a method of generating virtualization test code, including:
generating test data according to the acquired parameter input data and parameter output data of the method to be tested;
assembling the test data by using a preset virtualization test template to generate a virtualization test pseudo code;
and integrating the virtualization test pseudo codes to generate virtualization test codes.
Optionally, generating test data according to the obtained parameter input data and parameter output data of the method to be tested, including:
configuring path information of a method to be tested;
monitoring the path information by using a surrounding notification technology, and determining the parameter entering data and parameter exiting data of the method to be tested;
according to a calling information acquisition data structure, formatting the input parameter data and the output parameter data to generate test data;
wherein the path information includes: a path blacklist and/or a path whitelist.
Optionally, before assembling the test data by using a preset virtualization test template and generating a virtualization test pseudo code, the method includes:
and determining the virtualization test template according to the object information, the parameter entering information, the parameter exiting information and the template type.
Optionally, integrating according to the virtualization test pseudo code to generate a virtualization test code, including:
performing line feed operation on the virtualization test pseudo code according to the replacement line feed character;
JSON formatting is carried out on the virtualized test pseudo code which finishes the line changing;
and determining the JSON formatted result as a virtualization test code.
According to still another aspect of the embodiments of the present invention, there is provided an apparatus for generating a virtualized test code, including:
the test data generation module is used for generating test data according to the acquired parameter input data and parameter output data of the method to be tested;
the virtualization test pseudo code generation module is used for assembling the test data by using a preset virtualization test template to generate a virtualization test pseudo code;
and the virtualization test code generation module is used for integrating the virtualization test pseudo codes to generate virtualization test codes.
Optionally, generating test data according to the obtained parameter input data and parameter output data of the method to be tested, including:
configuring path information of a method to be tested;
monitoring the path information by using a surrounding notification technology, and determining the parameter entering data and parameter exiting data of the method to be tested;
according to a calling information acquisition data structure, formatting the input parameter data and the output parameter data to generate test data;
wherein the path information includes: a path blacklist and/or a path whitelist.
Optionally, before assembling the test data by using a preset virtualization test template and generating a virtualization test pseudo code, the method includes:
and determining the virtualization test template according to the object information, the parameter entering information, the parameter exiting information and the template type.
Optionally, integrating according to the virtualization test pseudo code to generate a virtualization test code, including:
performing line feed operation on the virtualization test pseudo code according to the replacement line feed character;
JSON formatting is carried out on the virtualized test pseudo code which finishes the line changing;
and determining the JSON formatted result as a virtualization test code.
According to another aspect of the embodiments of the present invention, there is provided an electronic device for generating a virtualized test code, including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the method for generating virtualized test code provided by the invention.
According to a further aspect of the embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, which when executed by a processor implements the method for generating virtualized test code provided by the present invention.
One embodiment of the above invention has the following advantages or benefits:
by adopting the technical means of assembling and integrating the test data obtained by automatic monitoring and the virtualization test template to generate the virtual test code, the technical defects that certain tedious and repetitive work exists in the test data preparation in the test case virtualization work, and a tester needs to write the virtualization test code to input a large amount of work in the later period, so that the software delivery cycle is long and unnecessary cost expenditure is generated are overcome, and the technical effects of obtaining the test data from the existing test environment data, improving the accuracy of the test data, running the test case at any time and not depending on the external interface environment are achieved.
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 a main flow of a method of generating virtualized test code according to an embodiment of the invention;
FIG. 2 is a corresponding relationship between data acquisition and a virtualized test template data structure;
FIG. 3 is a process of processing and outputting a virtualization test pseudo code to a corresponding terminal;
FIG. 4 is a diagram illustrating a detailed flow of a method for generating virtualized test code according to an embodiment of the invention;
FIG. 5 is a schematic diagram of the main modules of an apparatus for generating virtualized test code according to an embodiment of the 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 generating virtualized test code according to an embodiment of the present invention, as shown in fig. 1, including:
step S101, generating test data according to the acquired parameter input data and parameter output data of the method to be tested;
step S102, assembling the test data by using a preset virtualization test template to generate a virtualization test pseudo code;
step S103, integrating the virtualization test pseudo codes to generate virtualization test codes.
According to the technical scheme, the technical means of generating the test data according to the monitored parameter input data and parameter output data of the method to be tested is adopted, the technical defects that the test data needs to be matched with a test scene possibly existing in a multi-layer calling process in the test data generating process, the preparation time is long and the preparation process is tedious when the test data is manually prepared are overcome, and the beneficial effects that the test data is obtained from the existing test environment data, and the accuracy of the test data is improved are achieved.
And assembling the generated test data by using a preset virtualization test template to generate a virtualization test pseudo code. By the technical means of sleeving the test data into the virtualization test template, the technical defects that virtualization test codes need to be written manually, virtualization test coding time is long, development difficulty is high, and the quality of generated virtualization test pseudo codes is uneven in the prior art are overcome, and the technical effect that the automatically acquired parameter input data and parameter output data are assembled into virtualization test codes and standardized virtualization test codes is achieved.
By means of the technical means of integrating and generating the virtualization test codes according to the virtualization test pseudo codes, the technical defects that in the prior art, an external test environment is required to be relied on when testing, and if an external environment cannot normally use a test case, testing cannot be executed are overcome, so that the technical effects that the test case runs at any time and does not rely on an external interface environment are achieved.
Optionally, generating test data according to the obtained parameter input data and parameter output data of the method to be tested, including:
configuring path information of a method to be tested; the path information only needs to be configured once in the process of generating the virtualization test code, wherein the path information can support white list and black list configuration of a path and can also support sub-path configuration;
the path information may be monitored by using a Spring framework technology (which may also be referred to as a surround notification, AOP around method) in the java technology, and corresponding parameter information is acquired before and during the target access method.
Monitoring the path information by utilizing an around informing technology (AOP around method), and determining the access data and the egress data of the method to be tested;
according to a calling information acquisition data structure, formatting the input parameter data and the output parameter data to generate test data;
wherein the path information includes: a path blacklist and/or a path whitelist.
Invoking an information gathering data structure comprising at least: object full path information, called method name, input parameter object, output parameter type.
Specifically, in the process of generating test data, the called method to be tested, repltasksosaserviceimpl. adjust bestprlloc, calls code fragments of 3 interfaces of the external service correspondingly as follows:
Figure BDA0002221518330000061
Figure BDA0002221518330000071
when the external 3 methods are called, the following codes are used to record the code class or method information required by the template, and collect the corresponding input and output parameters (implemented by an Around interceptor based on a Spring open source framework, where the scanning path configured in execution can be implemented by other technical methods), and the specific codes are as follows:
Figure BDA0002221518330000072
Figure BDA0002221518330000081
in the Java environment, various test frameworks can be selectively used for testing, including JUnit or Spock3 frameworks. Different virtualization test templates can be used for different environments according to actual needs. In the scheme, a virtual test template under a space frame is adopted.
Optionally, assembling the test data by using a preset virtualization test template to generate a virtualization test pseudo code, including:
determining the virtualization test template according to object information, parameter entering information, parameter exiting information and template types;
and assembling the test data according to the virtualization test template to generate a virtualization test pseudo code.
Wherein, the content and the example information of the virtualization test template are shown in the following table 1:
table 1 virtualizes the contents of a test template and an example information table.
Figure BDA0002221518330000082
Figure BDA0002221518330000091
The above-mentioned { } in table 1 represents a placeholder, that is, a symbol which occupies a fixed position and adds contents according to actually acquired test data. Virtualization test codes may be pre-generated from the test data.
Fig. 2 is a corresponding relationship between data acquisition and a data structure of a virtualization test template, as shown in fig. 2:
and assembling the successively acquired test data into the template to form the virtual test pseudo code. At this time, most of the pseudo code can be executed, but there may be some configuration information in the process to be converted. Such as the instruction separator # number used in the translation. The virtualization test pseudo code is finally optimized and output at the integration output module.
Specifically, the integrating according to the virtualization test pseudo code to generate a virtualization test code includes:
performing line feed operation on the virtualization test pseudo code according to the replacement line feed character;
JSON formatting is carried out on the virtualized test pseudo code which finishes the line changing;
and determining the JSON formatted result as a virtualization test code.
FIG. 3 is a process of processing and outputting a virtualization test pseudo code to a corresponding terminal;
as shown in fig. 3, the processing content may include the wrapping output of the virtualized test code and the formatting of the JSON data source, thereby facilitating the developer to adjust the data more intuitively and conveniently when using the final virtualized test code.
FIG. 4 is a diagram illustrating a detailed flow of a method for generating virtualized test code according to an embodiment of the invention; as shown in figure 4 of the drawings,
the method for generating the virtualized test code can be divided into three parts, and specifically comprises the following steps:
1) and a data acquisition part, corresponding to A, B, C steps in fig. 4, for acquiring method information, parameter input data and parameter output data of the sub-method to be tested through the data acquisition.
Wherein, step A represents: acquiring path information of a method to be tested;
step B represents: the path information can be monitored by using a Spring framework technology (also called a surrounding notification AOP around method technology) in a java technology, and corresponding parameter information is acquired before and during the target access method.
Step C represents: and formatting the input parameter data and the output parameter data according to a calling information acquisition data structure to generate test data.
2) The assembling part of the data corresponds to step D in fig. 4, and specifically, the assembling part of the data combines the data acquired by the acquiring part of the data with the virtualization test template to generate the virtualization test pseudo code.
3) The data integration and output part corresponds to step E in fig. 4, specifically, the assembly part of the data generates the virtualization test pseudo code to be integrated, and the generated virtualization test code is output to the terminal of the console.
Fig. 5 is a schematic diagram of main modules of an apparatus for generating virtualized test code according to an embodiment of the present invention, and as shown in fig. 5, there is provided an apparatus 500 for generating virtualized test code, including:
the test data generating module 501 is configured to generate test data according to the obtained parameter input data and parameter output data of the method to be tested;
a virtualization test pseudo code generation module 502, configured to assemble the test data by using a preset virtualization test template to generate a virtualization test pseudo code;
the virtualization test code generating module 503 is configured to integrate the virtualization test pseudo codes to generate virtualization test codes.
Optionally, generating test data according to the obtained parameter input data and parameter output data of the method to be tested, including:
configuring path information of a method to be tested;
monitoring the path information by using a surrounding notification technology, and determining the parameter entering data and parameter exiting data of the method to be tested;
according to a calling information acquisition data structure, formatting the input parameter data and the output parameter data to generate test data;
wherein the path information includes: a path blacklist and/or a path whitelist.
Optionally, before assembling the test data by using a preset virtualization test template and generating a virtualization test pseudo code, the method includes:
and determining the virtualization test template according to the object information, the parameter entering information, the parameter exiting information and the template type.
Optionally, integrating according to the virtualization test pseudo code to generate a virtualization test code, including:
performing line feed operation on the virtualization test pseudo code according to the replacement line feed character;
JSON formatting is carried out on the virtualized test pseudo code which finishes the line changing;
and determining the JSON formatted result as a virtualization test code.
FIG. 6 illustrates an exemplary system architecture 600 for a method or apparatus for generating virtualized test code to which embodiments of the 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 generating virtualized test code according to the embodiment of the present invention is generally executed by the server 605, and accordingly, the apparatus for generating virtualized test code 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 module (CPU)701, which can perform various appropriate actions and processes according to 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 RAM 703, various programs and data necessary for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 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 module (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 a sending module, an obtaining module, a determining module, and a first processing module. The names of these modules do not form a limitation on the modules themselves in some cases, and for example, the sending module may also be described as a "module sending a picture acquisition request to a connected server".
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:
generating test data according to the acquired parameter input data and parameter output data of the method to be tested;
assembling the test data by using a preset virtualization test template to generate a virtualization test pseudo code;
and integrating the virtualization test pseudo codes to generate virtualization test codes.
According to the technical scheme of the embodiment of the invention, the following beneficial effects can be achieved:
by adopting the technical means of assembling and integrating the test data obtained by automatic monitoring and the virtualization test template to generate the virtual test code, the technical defects that certain tedious and repetitive work exists in the test data preparation in the test case virtualization work, and a tester needs to write the virtualization test code to input a large amount of work in the later period, so that the software delivery cycle is long and unnecessary cost expenditure is generated are overcome, and the technical effects of obtaining the test data from the existing test environment data, improving the accuracy of the test data, running the test case at any time and not depending on the external interface environment are achieved.
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 of generating virtualized test code, comprising:
generating test data according to the acquired parameter input data and parameter output data of the method to be tested;
assembling the test data by using a preset virtualization test template to generate a virtualization test pseudo code;
and integrating the virtualization test pseudo codes to generate virtualization test codes.
2. The method of claim 1, wherein generating test data according to the obtained parameter input data and parameter output data of the method to be tested comprises:
configuring path information of a method to be tested;
monitoring the path information by using a surrounding notification technology, and determining the parameter entering data and parameter exiting data of the method to be tested;
according to a calling information acquisition data structure, formatting the input parameter data and the output parameter data to generate test data;
wherein the path information includes: a path blacklist and/or a path whitelist.
3. The method of claim 1, wherein before assembling the test data using a predetermined virtualization test template to generate a virtualization test pseudo-code, the method comprises:
and determining the virtualization test template according to the object information, the parameter entering information, the parameter exiting information and the template type.
4. The method of claim 1, wherein integrating according to the virtualization test pseudo-code to generate virtualization test code comprises:
performing line feed operation on the virtualization test pseudo code according to the replacement line feed character;
JSON formatting is carried out on the virtualized test pseudo code which finishes the line changing;
and determining the JSON formatted result as a virtualization test code.
5. An apparatus for generating virtualized test code, comprising:
the test data generation module is used for generating test data according to the acquired parameter input data and parameter output data of the method to be tested;
the virtualization test pseudo code generation module is used for assembling the test data by using a preset virtualization test template to generate a virtualization test pseudo code;
and the virtualization test code generation module is used for integrating the virtualization test pseudo codes to generate virtualization test codes.
6. The apparatus of claim 5, wherein generating test data according to the obtained parameter input data and parameter output data of the method to be tested comprises:
configuring path information of a method to be tested;
monitoring the path information by using a surrounding notification technology, and determining the parameter entering data and parameter exiting data of the method to be tested;
according to a calling information acquisition data structure, formatting the input parameter data and the output parameter data to generate test data;
wherein the path information includes: a path blacklist and/or a path whitelist.
7. The apparatus of claim 5, wherein before assembling the test data using a predetermined virtualization test template to generate a virtualization test pseudo-code, the method comprises:
and determining the virtualization test template according to the object information, the parameter entering information, the parameter exiting information and the template type.
8. The apparatus of claim 5, wherein generating virtualization test code from the virtualization test pseudo-code for integration comprises:
performing line feed operation on the virtualization test pseudo code according to the replacement line feed character;
JSON formatting is carried out on the virtualized test pseudo code which finishes the line changing;
and determining the JSON formatted result as a virtualization test code.
9. An electronic device that generates virtualized test code, 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.
CN201910935681.3A 2019-09-29 2019-09-29 Method and device for generating virtualization test code Pending CN112579427A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910935681.3A CN112579427A (en) 2019-09-29 2019-09-29 Method and device for generating virtualization test code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910935681.3A CN112579427A (en) 2019-09-29 2019-09-29 Method and device for generating virtualization test code

Publications (1)

Publication Number Publication Date
CN112579427A true CN112579427A (en) 2021-03-30

Family

ID=75111322

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910935681.3A Pending CN112579427A (en) 2019-09-29 2019-09-29 Method and device for generating virtualization test code

Country Status (1)

Country Link
CN (1) CN112579427A (en)

Similar Documents

Publication Publication Date Title
CN111338623B (en) Method, device, medium and electronic equipment for developing user interface
CN109684188B (en) Test method and device
CN112631590B (en) Component library generation method, device, electronic equipment and computer readable medium
CN110858172A (en) Automatic test code generation method and device
CN109582317B (en) Method and apparatus for debugging hosted applications
CN111309304B (en) Method, device, medium and electronic equipment for generating IDL file
WO2019029451A1 (en) Method for publishing mobile applications and electronic apparatus
CN113505302A (en) Method, device and system for supporting dynamic acquisition of buried point data and electronic equipment
CN113360377B (en) Test method and device
CN112395098A (en) Application program interface calling method and device, storage medium and electronic equipment
CN112015383A (en) Login method and device
CN109002389B (en) Method and device for automatically testing page
CN112559024A (en) Method and device for generating transaction code change list
CN111414154A (en) Method and device for front-end development, electronic equipment and storage medium
CN110489326B (en) IDS-based HTTPAPI debugging method device, medium and equipment
CN112783903B (en) Method and device for generating update log
CN115080109A (en) Multi-cloud-end environment joint debugging method, device, system and equipment based on hybrid development
CN114840379A (en) Log generation method, device, server and storage medium
CN112579427A (en) Method and device for generating virtualization test code
CN112131095B (en) Pressure testing method and device
CN112579428A (en) Interface testing method and device, electronic equipment and storage medium
CN112860447A (en) Interaction method and system between different applications
CN113468041A (en) Interface comparison test method and device
CN112306324B (en) Information processing method, apparatus, device and medium
CN117827630A (en) Method and device for generating test script

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