CN112799954A - Method, equipment and computer readable medium for quickly constructing test environment - Google Patents

Method, equipment and computer readable medium for quickly constructing test environment Download PDF

Info

Publication number
CN112799954A
CN112799954A CN202110177066.8A CN202110177066A CN112799954A CN 112799954 A CN112799954 A CN 112799954A CN 202110177066 A CN202110177066 A CN 202110177066A CN 112799954 A CN112799954 A CN 112799954A
Authority
CN
China
Prior art keywords
resource
java class
resources
test environment
environment
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.)
Granted
Application number
CN202110177066.8A
Other languages
Chinese (zh)
Other versions
CN112799954B (en
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.)
Shanghai Zstack Information Technology Co ltd
Original Assignee
Shanghai Zstack 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 Shanghai Zstack Information Technology Co ltd filed Critical Shanghai Zstack Information Technology Co ltd
Priority to CN202110177066.8A priority Critical patent/CN112799954B/en
Publication of CN112799954A publication Critical patent/CN112799954A/en
Application granted granted Critical
Publication of CN112799954B publication Critical patent/CN112799954B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/3664Environments for testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/33Intelligent editors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution

Abstract

The method comprises the steps of firstly obtaining resources required by a test environment, attribute information of the resources and incidence relations among the resources, then defining each resource as a Java class, defining the attribute information of the resources as member variables of the corresponding Java class, declaring incidence relations among other Java classes in the corresponding Java class according to the incidence relations among the resources, and calling the Java class corresponding to the resources to construct the test environment according to environment construction codes after environment construction codes of specific languages in the use field are obtained. Because the relation between the resources is obtained in advance and the statement is made in the Java class, when the DSL grammar is used for constructing the test environment, the code amount is small, the whole structure of the test environment can be rapidly and visually obtained, errors are not easy to occur even if the resource types and the resource amount are large, and the construction process is more convenient and quicker because the DSL grammar can use the automatic completion function of an IDE tool.

Description

Method, equipment and computer readable medium for quickly constructing test environment
Technical Field
The present application relates to the field of information technology, and in particular, to a method, device, and computer readable medium for quickly constructing a test environment.
Background
In software testing, if an API (Application Programming Interface) is to be tested, a test environment on which the API depends needs to be constructed in advance. To create a virtual machine API example, a virtual machine image, a cluster physical machine, a cluster network, a cluster storage, a test account, and the like need to be prepared in advance, and adding a virtual machine image depends on an image repository.
At present, there are two common schemes for constructing the test environment, which are a hard-coded implementation scheme and a scheme implemented by an XML (Extensible Markup Language)/JSON (JavaScript Object Notation) configuration file.
For the first scheme, a hard-coded implementation. Writing codes to create a test environment step by step so as to build a test environment example for creating a virtual machine API (application programming interface):
the first step is as follows: calling API (application program interface) interface of adding mirror image warehouse and adding a mirror image warehouse
The second step is that: calling API (application program interface) interface for adding virtual machine image and creating a virtual machine image
The third step: calling API interface of creating cluster to create a cluster
The fourth step: calling API (application program interface) of adding physical machine and adding physical machine to cluster
The fifth step: calling API interface for creating cluster network and setting configuration of cluster network
And a sixth step: calling an API (application program interface) for adding cluster storage and setting cluster storage configuration
The seventh step: a common account number is created.
The use of a hard-coded scheme to build a test environment has the following disadvantages:
1. the code line number is many, and the work load is big, and it is long to consume time.
2. When a complex test environment is constructed, errors are prone to occur, for example, multiple clusters need to be created, different physical machines are added to each cluster, different cluster networks are added to each cluster, and different cluster storages are added to each cluster.
3. The overall structure information of the environment is not visual enough, and the later maintenance and modification are not facilitated.
For the second scheme, the implementation is realized through an XML/JSON configuration file. And the test engineer lists the environment information in the configuration file, the test system analyzes the content of the configuration file and calls a related API (application program interface) to complete the environment construction. When the XML/JSON configuration file scheme is used to construct a test environment, although the number of codes is less than that of the first scheme, and the overall structure information of the environment is relatively intuitive, the following problems are brought:
1. the environment configuration file is separated from the test code, is not in a source code file, and is not beneficial to maintenance.
2. The configuration file is easy to have spelling errors and configuration errors. Development tools such as IDE (Integrated Development Environment) cannot automatically complement codes for XML/JSON, and do not support parameter basic type inspection and syntax inspection.
3. It is not intelligent enough convenient, can not use the automatic completion function to IDE when test engineer writes the configuration file.
Disclosure of Invention
An object of the present application is to provide a method, an apparatus and a computer readable medium for rapidly constructing a test environment, which solve the problems of the prior art.
In order to achieve the above object, the present application provides a method for quickly constructing a test environment, the method comprising:
acquiring resources required by a test environment, and association relation among attribute information of the resources and the resources;
defining each resource as a Java class, and defining the attribute information of the resource as member variables of the corresponding Java class;
according to the incidence relation among the resources, the incidence relation between the corresponding Java class and other Java classes is declared;
acquiring an environment construction code using a domain-specific language;
and calling the Java class corresponding to the resource according to the environment construction code to construct a test environment.
Further, the association relationship includes a containing relationship and a using relationship.
Further, the association relationship is an inclusion relationship;
according to the association relationship among the resources, the association relationship between the corresponding Java class declaration and other Java classes includes:
defining the reference of the Java class of the lower layer resource in the Java class of the upper layer resource, and adding an adding function of the Java class of the lower layer resource in the Java class of the upper layer resource, wherein the upper layer resource comprises the lower layer resource.
Further, the association relationship is a usage relationship;
according to the association relationship among the resources, the association relationship between the corresponding Java class declaration and other Java classes includes:
the reference of the Java class of the used resource is defined in the Java class of the used resource, and a resource association function for declaring the use relationship with the Java class of the used resource is added to the Java class of the used resource.
Further, a domain-specific language for building the test environment is implemented using the Groovy closure syntax.
Further, the association relationship is a tree structure relationship.
Further, obtaining environment build code using a domain-specific language, comprising:
and acquiring the environment construction code of the specific language of the use field by integrating the automatic completion function of the development environment tool.
Based on another aspect of the present application, there is also provided an apparatus for quickly constructing a test environment, the apparatus including:
the resource acquisition module is used for acquiring resources required by a test environment, attribute information of the resources and an incidence relation among the resources;
the resource definition module is used for defining each resource as a Java class, defining the attribute information of the resource as the member variable of the corresponding Java class, and declaring the association relationship between the corresponding Java class and other Java classes according to the association relationship between the resources;
the code acquisition module is used for acquiring an environment construction code using a domain specific language;
and the environment construction module is used for calling the Java classes corresponding to the resources according to the environment construction codes to construct a test environment.
Embodiments of the present application also provide a computing device comprising a memory for storing computer program instructions and a processor for executing the computer program instructions, wherein the computer program instructions, when executed by the processor, trigger the device to perform the method for rapidly building a test environment.
Furthermore, the embodiment of the application also provides a computer readable medium, on which computer program instructions are stored, and the computer program instructions can be executed by a processor to realize the method for rapidly constructing the test environment.
Compared with the prior art, the scheme has the advantages that the resources needed by the test environment, the attribute information of the resources and the incidence relation among the resources are firstly obtained, then each resource is defined as a Java class, the attribute information of the resources is defined as the member variable of the corresponding Java class, the incidence relation between the corresponding Java class and other Java classes is declared in the corresponding Java class according to the incidence relation among the resources, and after the environment construction code of the specific language in the use field is obtained, the Java class corresponding to the resources is called according to the environment construction code to construct the test environment. Because the relation between the resources is obtained in advance and is declared in the Java class, when the DSL (Domain Specific Language) grammar is used for constructing the test environment, the code amount is small, the whole structure of the test environment can be rapidly and visually obtained, errors are not easy to occur even if the resource types and the quantity are large, and the construction process is more convenient and quicker because the DSL grammar can use the automatic completion function of an IDE tool.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is a flowchart illustrating a method for quickly constructing a test environment according to an embodiment of the present disclosure;
fig. 2 is a schematic structural diagram of an apparatus for quickly constructing a test environment according to an embodiment of the present disclosure.
The same or similar reference numbers in the drawings identify the same or similar elements.
Detailed Description
The present application is described in further detail below with reference to the attached figures.
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In a typical configuration of the present application, the terminal, the devices serving the network each include one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, which include both non-transitory and non-transitory, removable and non-removable media, may implement the information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
The embodiment of the application provides a method for quickly constructing a test environment, the method acquires the relation between resources in advance and declares the relation in Java classes, so when the DSL grammar is used for constructing the test environment, the code amount is small, the overall structure of the test environment can be quickly and visually obtained, errors are not easy to occur even if the resource types and the number are large, and the construction process is more convenient and quicker due to the fact that the DSL grammar can use the automatic completion function of an IDE tool.
Fig. 1 shows a processing flow of a method for quickly building a test environment according to an embodiment of the present application, which includes at least the following processing steps:
step S101, acquiring resources required by a test environment, attribute information of the resources and an incidence relation between the resources. The resources refer to objects that need to be involved in the software testing process, and taking the aforementioned test on creating the virtual machine API as an example, the resources needed by the involved testing environment may include a mirror warehouse, a virtual machine mirror, a cluster, a physical machine, a storage, and the like.
Each resource has an attribute corresponding to the qualification, for example, taking a physical machine as an example, the attribute may include ip, name, username, password, etc., where ip is an ip address of the physical machine, name is a name of the physical machine, username is a username corresponding to the physical machine, password is a password corresponding to the physical machine, and clusterUuid is a unique identifier of a cluster to which the physical machine belongs.
Each resource may also have a certain association relationship, and a common association relationship may include an inclusion relationship and a usage relationship. The inclusion relation means that one resource includes another resource, and for two resources having the inclusion relation, the two resources can be respectively defined as an upper layer resource and a lower layer resource, wherein the upper layer resource includes the lower layer resource. For example, the association relationship between the clusters and the physical machines is an inclusion relationship, and a cluster may include a physical machine, so that in the set of inclusion relationships, the cluster is an upper-layer resource, and the physical machine is a lower-layer resource.
The usage relationship refers to that one resource needs to be used to another resource in the system operation process, and for two resources having the usage relationship, the two resources can be respectively defined as a user resource and a used resource, wherein the user resource can use the used resource in the system operation process. For example, the association relationship between the cluster and the storage is a usage relationship, and the cluster needs to use the storage during the operation of the virtual machine system, so that in the set of usage relationship, the cluster is a user resource and the storage is a used resource.
In an actual scenario, for an object needing to be tested, all the constituent resources, the attributes of each resource, and the association relationship between the resources required in the test environment may be determined in combination with the actual service.
Step S102, each resource is defined as a Java class, and the attribute information of the resource is defined as the member variable of the corresponding Java class. Taking a cluster and a physical machine as examples, the defined Java classes are respectively as follows:
Figure BDA0002941010200000061
Figure BDA0002941010200000071
and step S103, declaring the association relationship between the corresponding Java class and other Java classes according to the association relationship between the resources.
Since the association relationship in the embodiment of the present application includes the inclusion relationship and the association relationship, and there is a certain difference between the two, two association relationships between two resources can be declared by adopting different manners. When the association relationship is an inclusion relationship, the following method can be adopted to declare: and defining the reference of the Java class of the lower layer resource in the Java class of the upper layer resource, and adding an adding function of the Java class of the lower layer resource in the Java class of the upper layer resource. For example, taking the aforementioned cluster and physical machine as an example, the reference of the Java class of the physical machine may be defined in the Java class of the cluster as follows, and add an add function, where the Java class of the cluster may include the following contents:
Figure BDA0002941010200000072
Figure BDA0002941010200000081
when the association relationship is a usage relationship, it can be stated in the following manner: the reference of the Java class of the used resource is defined in the Java class of the used resource, and a resource association function for declaring the use relationship with the Java class of the used resource is added to the Java class of the used resource. For example, taking cluster and storage as an example, the reference of the stored Java class may be defined in the Java class of the cluster in the following manner, and the resource association function may be added, and the stored Java class and the clustered Java class may respectively include the following contents:
Figure BDA0002941010200000082
Figure BDA0002941010200000091
therefore, the declaration of various association relations can be completed in the corresponding Java classes through the mode. Because the association relationship declared in this way is in a tree structure relationship, all resources can be intuitively traversed from the resource Java class located at the root (i.e. the uppermost layer in the inclusion relationship or the initial user in the usage relationship), and thus, for a user, the overall structure of the test environment can be intuitively known.
In step S104, an environment building code using DSL is acquired. In order to improve efficiency, when the environment construction code is obtained, the code can be obtained by integrating the automatic completion function of the development environment tool.
And step S105, calling the Java classes corresponding to the resources according to the environment construction codes to construct a test environment.
In some embodiments of the present application, a domain-specific language for building a test environment may be implemented using the Groovy closure syntax. The Groovy is a development language based on a JVM (Java virtual machine), a test environment can be constructed by using a Groovy closure grammar, and functions of automatic code completion, parameter basic type inspection, grammar inspection and the like of development tools such as IDE and the like can be used in a code compiling process, so that the whole process of constructing the test environment is more convenient and faster, and the possibility of errors is reduced. It will be understood by those skilled in the art that the particular development language used for DSL is provided by way of example only and that other types of development languages, whether now known or later developed based on similar principles, are also included within the scope of the present application and are hereby incorporated by reference.
In an actual scenario, according to the Java class of each type of resource defined above, if the test environment declared by the tester in the test case is: 2 clusters (router 1 and router 2), cluster 1 has two physical machines (kvm1 and kvm2) and mounts storage 1(local), cluster 2 has 1 physical machine (kvm3) but does not mount any storage, at this time, the Groovy closure syntax is used as the environment build code used by the DSL to build the test environment as follows:
Figure BDA0002941010200000101
Figure BDA0002941010200000111
Figure BDA0002941010200000121
if the same test environment is constructed by calling API in a hard-coded manner instead of using DSL syntax, the corresponding environment construction code is as follows:
// adding storage
AddLocalPrimaryStorageAction addLocalPrimaryStorageAction=new A ddLocalPrimaryStorageAction()
addLocalPrimaryStorageAction.name="local"
addLocalPrimaryStorageAction.url="/local_ps"
PrimaryStorageInventory primaryStorage=addLocalPrimaryStorageActi on.call().value.inventory
// creating a cluster 1
CreateClusterAction createCluster1Action=new CreateClusterAction()
createCluster1Action.name="cluster1"
ClusterInventory cluster1=createCluster1Action.call().value.inventory
// configuring cluster 1 to use storage
AttachPrimaryStorageToClusterAction attachPrimaryStorageToClusterAc tion=new AttachPrimaryStorageToClusterAction()
attachPrimaryStorageToClusterAction.clusterUuid=cluster1.uuid
attachPrimaryStorageToClusterAction.primaryStorageUuid=primarySto rage.uuid
attachPrimaryStorageToClusterAction.call()
// adding physical machine 1 to Cluster 1
AddKVMHostAction addKVMHost1Action=new AddKVMHostAction()
addKVMHost1Action.clusterUuid=cluster1.uuid
addKVMHost1Action.name="kvm1"
addKVMHost1Action.username="root"
addKVMHost1Action.password="password"
addKVMHost1Action.managementIp="127.0.0.1"
addKVMHost1Action.call()
// adding physical machine 2 to Cluster 1
AddKVMHostAction addKVMHost2Action=new AddKVMHostAction()
addKVMHost2Action.clusterUuid=cluster1.uuid
addKVMHost2Action.name="kvm2"
addKVMHost2Action.username="root"
addKVMHost2Action.password="password"
addKVMHost2Action.managementIp="127.0.0.2"
addKVMHost2Action.call()
// creating a cluster 2
CreateClusterAction createCluster2Action=new CreateClusterAction()
createCluster2Action.name="cluster2"
ClusterInventory cluster2=createCluster2Action.call().value.inventory
// adding physical machines 3 to the cluster 2
AddKVMHostAction addKVMHost3Action=new AddKVMHostAction()
addKVMHost3Action.clusterUuid=cluster2.uuid
addKVMHost3Action.name="kvm3"
addKVMHost3Action.username="root"
addKVMHost3Action.password="password"
addKVMHost3Action.managementIp="127.0.0.3"
addKVMHost3Action.call()
In another embodiment, if the test environment that the tester needs to declare in the test case includes a mirror repository (stp), a virtual machine mirror (image1), a cluster (router), a physical machine (kvm), a storage (nfs), a cluster network (12), and a common account (account1), the environment construction code used for constructing the test environment using the Groovy closure syntax as DSL is as follows:
Figure BDA0002941010200000131
Figure BDA0002941010200000141
Figure BDA0002941010200000151
if the similar test environment construction is realized by using an XML configuration file instead of using the DSL syntax, the configuration content of the XML is as follows:
Figure BDA0002941010200000161
Figure BDA0002941010200000171
Figure BDA0002941010200000181
compared with the two schemes in the prior art, the scheme provided by the embodiment of the application has the advantages that the number of used DSL grammar codes is less, the method is clearer and simpler, the relation between resources is more visual, and errors are not easy to occur when the types and the quantity of the resources are more. Moreover, due to the fact that the DSL grammar is used, functions of automatic code completion, parameter basic type inspection, grammar inspection and the like of the IDE tool can be used, the whole process of building a test environment is more convenient and faster, and the possibility of errors is reduced.
Based on the same inventive concept, the embodiment of the present application further provides a device for quickly constructing a test environment, the corresponding method of the device is the method for quickly constructing a test environment in the foregoing embodiment, and the principle of solving the problem is similar to that of the method.
The embodiment of the application also provides equipment for quickly constructing the test environment, and the equipment comprises a resource acquisition module, a resource definition module, a code acquisition module and an environment construction module. The resource acquisition module is used for acquiring resources required by a test environment, attribute information of the resources and an incidence relation among the resources. The resource definition module is used for defining each resource as a Java class, defining the attribute information of the resource as the member variable of the corresponding Java class, and declaring the association relationship between the corresponding Java class and other Java classes according to the association relationship between the resources. The code acquisition module is used for acquiring environment construction codes using a domain-specific language. And the environment construction module is used for calling the Java classes corresponding to the resources according to the environment construction codes to construct a test environment.
In addition, the embodiment of the application also provides the computing equipment. The apparatus comprises a memory for storing computer program instructions and a processor for executing the computer program instructions, wherein the computer program instructions, when executed by the processor, trigger the apparatus to perform the aforementioned method of implementing the aforementioned fast build test environment.
Fig. 2 shows a structure of a device suitable for implementing the method and/or technical solution in the embodiment of the present application, and the device 200 includes a Central Processing Unit (CPU)201, which can execute various suitable actions and processes according to a program stored in a Read Only Memory (ROM) 202 or a program loaded from a storage portion 208 into a Random Access Memory (RAM) 203. In the RAM203, various programs and data necessary for system operation are also stored. The CPU 201, ROM 202, and RAM203 are connected to each other via a bus 204. An Input/Output (I/O) interface 205 is also connected to bus 204.
The following components are connected to the I/O interface 205: an input section 206 including a keyboard, a mouse, a touch screen, a microphone, an infrared sensor, and the like; an output section 207 including a Display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), an LED Display, an OLED Display, and the like, and a speaker; a storage portion 208 comprising one or more computer-readable media such as a hard disk, optical disk, magnetic disk, semiconductor memory, or the like; and a communication section 209 including a Network interface card such as a LAN (Local Area Network) card, a modem, or the like. The communication section 209 performs communication processing via a network such as the internet.
In particular, the methods and/or embodiments in the embodiments of the present application 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. The above-described functions defined in the method of the present application are performed when the computer program is executed by the Central Processing Unit (CPU) 201.
It should be noted that the computer readable medium described herein can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable 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 application, a computer readable medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart or block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. 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 and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
As another aspect, the present application also provides a computer-readable medium, which 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 computer-readable instructions executable by a processor to implement the methods and/or aspects of the embodiments of the present application as described above.
It should be noted that the present application may be implemented in software and/or a combination of software and hardware, for example, implemented using Application Specific Integrated Circuits (ASICs), general purpose computers or any other similar hardware devices. In some embodiments, the software programs of the present application may be executed by a processor to implement the above steps or functions. Likewise, the software programs (including associated data structures) of the present application may be stored in a computer readable recording medium, such as RAM memory, magnetic or optical drive or diskette and the like. Additionally, some of the steps or functions of the present application may be implemented in hardware, for example, as circuitry that cooperates with the processor to perform various steps or functions.
It will be evident to those skilled in the art that the present application is not limited to the details of the foregoing illustrative embodiments, and that the present application may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the application being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned. Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the apparatus claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.

Claims (10)

1. A method for rapidly building a test environment, the method comprising:
acquiring resources required by a test environment, and association relation among attribute information of the resources and the resources;
defining each resource as a Java class, and defining the attribute information of the resource as member variables of the corresponding Java class;
according to the incidence relation among the resources, the incidence relation between the corresponding Java class and other Java classes is declared;
acquiring an environment construction code using a domain-specific language;
and calling the Java class corresponding to the resource according to the environment construction code to construct a test environment.
2. The method of claim 1, wherein the associative relationship comprises a containment relationship and a usage relationship.
3. The method of claim 2, wherein the association relationship is a containment relationship;
according to the association relationship among the resources, the association relationship between the corresponding Java class declaration and other Java classes includes:
defining the reference of the Java class of the lower layer resource in the Java class of the upper layer resource, and adding an adding function of the Java class of the lower layer resource in the Java class of the upper layer resource, wherein the upper layer resource comprises the lower layer resource.
4. The method of claim 2, wherein the association relationship is a usage relationship;
according to the association relationship among the resources, the association relationship between the corresponding Java class declaration and other Java classes includes:
the reference of the Java class of the used resource is defined in the Java class of the used resource, and a resource association function for declaring the use relationship with the Java class of the used resource is added to the Java class of the used resource.
5. The method of claim 1, wherein a domain-specific language for building a test environment is implemented using a Groovy closure syntax.
6. The method of claim 1, wherein the association relationship is a tree structure relationship.
7. The method of claim 1, wherein obtaining environment build code using a domain-specific language comprises:
and acquiring the environment construction code of the specific language of the use field by integrating the automatic completion function of the development environment tool.
8. An apparatus for rapidly building a test environment, the apparatus comprising:
the resource acquisition module is used for acquiring resources required by a test environment, attribute information of the resources and an incidence relation among the resources;
the resource definition module is used for defining each resource as a Java class, defining the attribute information of the resource as the member variable of the corresponding Java class, and declaring the association relationship between the corresponding Java class and other Java classes according to the association relationship between the resources;
the code acquisition module is used for acquiring an environment construction code using a domain specific language;
and the environment construction module is used for calling the Java classes corresponding to the resources according to the environment construction codes to construct a test environment.
9. A computing device comprising a memory for storing computer program instructions and a processor for executing the computer program instructions, wherein the computer program instructions, when executed by the processor, trigger the device to perform the method of any of claims 1 to 8.
10. A computer readable medium having stored thereon computer program instructions executable by a processor to implement the method of any one of claims 1 to 8.
CN202110177066.8A 2021-02-09 2021-02-09 Method, apparatus and computer readable medium for quickly constructing test environment Active CN112799954B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110177066.8A CN112799954B (en) 2021-02-09 2021-02-09 Method, apparatus and computer readable medium for quickly constructing test environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110177066.8A CN112799954B (en) 2021-02-09 2021-02-09 Method, apparatus and computer readable medium for quickly constructing test environment

Publications (2)

Publication Number Publication Date
CN112799954A true CN112799954A (en) 2021-05-14
CN112799954B CN112799954B (en) 2024-04-16

Family

ID=75814960

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110177066.8A Active CN112799954B (en) 2021-02-09 2021-02-09 Method, apparatus and computer readable medium for quickly constructing test environment

Country Status (1)

Country Link
CN (1) CN112799954B (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140157241A1 (en) * 2012-12-03 2014-06-05 Ca, Inc. Code-free testing framework
US20150309866A1 (en) * 2014-04-29 2015-10-29 Ca, Inc. Rejuvenation of legacy code into resources-oriented architectures
CN108073511A (en) * 2016-11-14 2018-05-25 平安科技(深圳)有限公司 test code generating method and device
CN108108297A (en) * 2016-11-25 2018-06-01 腾讯科技(深圳)有限公司 The method and apparatus of automatic test
CN109284222A (en) * 2017-07-20 2019-01-29 阿里巴巴集团控股有限公司 Project testing method, device and equipment in software unit, data processing system
CN110673827A (en) * 2019-08-27 2020-01-10 广州视源电子科技股份有限公司 Resource calling method and device based on android system and electronic equipment
CN110764748A (en) * 2019-10-23 2020-02-07 北京字节跳动网络技术有限公司 Code calling method, device, terminal and storage medium
CN111258564A (en) * 2020-01-17 2020-06-09 通号万全信号设备有限公司 Method and device for automatically generating codes based on QT
CN111309752A (en) * 2019-11-26 2020-06-19 上海金融期货信息技术有限公司 Service flow data processing oriented domain specific language assembly and operation method thereof
CN111694553A (en) * 2020-06-11 2020-09-22 广州力挚网络科技有限公司 Code processing system and method
CN111858330A (en) * 2020-07-16 2020-10-30 苏州浪潮智能科技有限公司 Test script deployment method, device, equipment and readable medium
CN111949543A (en) * 2020-08-13 2020-11-17 中国工商银行股份有限公司 Testing method and device based on distributed platform, electronic equipment and storage medium

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140157241A1 (en) * 2012-12-03 2014-06-05 Ca, Inc. Code-free testing framework
US20150309866A1 (en) * 2014-04-29 2015-10-29 Ca, Inc. Rejuvenation of legacy code into resources-oriented architectures
CN108073511A (en) * 2016-11-14 2018-05-25 平安科技(深圳)有限公司 test code generating method and device
CN108108297A (en) * 2016-11-25 2018-06-01 腾讯科技(深圳)有限公司 The method and apparatus of automatic test
CN109284222A (en) * 2017-07-20 2019-01-29 阿里巴巴集团控股有限公司 Project testing method, device and equipment in software unit, data processing system
CN110673827A (en) * 2019-08-27 2020-01-10 广州视源电子科技股份有限公司 Resource calling method and device based on android system and electronic equipment
CN110764748A (en) * 2019-10-23 2020-02-07 北京字节跳动网络技术有限公司 Code calling method, device, terminal and storage medium
CN111309752A (en) * 2019-11-26 2020-06-19 上海金融期货信息技术有限公司 Service flow data processing oriented domain specific language assembly and operation method thereof
CN111258564A (en) * 2020-01-17 2020-06-09 通号万全信号设备有限公司 Method and device for automatically generating codes based on QT
CN111694553A (en) * 2020-06-11 2020-09-22 广州力挚网络科技有限公司 Code processing system and method
CN111858330A (en) * 2020-07-16 2020-10-30 苏州浪潮智能科技有限公司 Test script deployment method, device, equipment and readable medium
CN111949543A (en) * 2020-08-13 2020-11-17 中国工商银行股份有限公司 Testing method and device based on distributed platform, electronic equipment and storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
ANEL: ""如何用kotlin写DSL"", pages 1 - 6, Retrieved from the Internet <URL:《https://www.jianshu.com/p/2205b4e26879》> *
MARCIN JAMRO: ""POU-Oriented Unit Testing of IEC 61131-3 Control Software"", 《IEEE TRANSACTIONS ON INDUSTRIAL INFORMATICS》, vol. 11, no. 5, pages 1119 - 1129, XP011670967, DOI: 10.1109/TII.2015.2469257 *
滕建发: ""模型驱动的快速业务构建平台的研究与设计"", 《中国优秀硕士学位论文全文数据库 信息科技辑》, no. 2017, pages 138 - 2447 *

Also Published As

Publication number Publication date
CN112799954B (en) 2024-04-16

Similar Documents

Publication Publication Date Title
US9928038B2 (en) Dynamically building locale objects or subsections of locale objects based on historical data
US9021440B1 (en) System and method for automated test script generation
US9836440B2 (en) Semantic stack trace
CN109634587B (en) Method and equipment for generating warehousing script and warehousing data
US8972936B2 (en) Version labeling in a version control system
US10656934B2 (en) Efficient software testing
US11200048B2 (en) Modification of codified infrastructure for orchestration in a multi-cloud environment
US20140075415A1 (en) Automatic use case generation from a parsed configuration file
US9652358B1 (en) Type widening for source code analysis
CN114077430A (en) Interface generation method and device, electronic equipment and storage medium
CN112199261A (en) Application program performance analysis method and device and electronic equipment
US9280361B2 (en) Methods and systems for a real time transformation of declarative model and layout into interactive, digital, multi device forms
US11182272B2 (en) Application state monitoring
US8607201B2 (en) Augmenting visualization of a call stack
CN112799954B (en) Method, apparatus and computer readable medium for quickly constructing test environment
US20220365758A1 (en) Tool for Introspection in Object-Oriented Source Code
CN113918864A (en) Website page testing method, testing system, testing device, electronic equipment and medium
CN114579466A (en) Method, device, equipment and medium for constructing test case and code test
US11048672B2 (en) Binary large object platform for interactively analyzing and editing structural metadata
CN112068814A (en) Method, device, system and medium for generating executable file
CN116881129A (en) Method, device and computer readable medium for fast checking resource unreleased code
CN117667112A (en) Self-adaptive generation method of front-end development document based on babel
CN115904483A (en) Interface document generation method and device, medium and computer equipment
CN114237624A (en) Go language-based error processing method, device, equipment, medium and product
CN113010207A (en) Resource allocation method and device, electronic equipment and storage medium

Legal Events

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