CN112799954B - Method, apparatus and computer readable medium for quickly constructing test environment - Google Patents

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

Info

Publication number
CN112799954B
CN112799954B CN202110177066.8A CN202110177066A CN112799954B CN 112799954 B CN112799954 B CN 112799954B CN 202110177066 A CN202110177066 A CN 202110177066A CN 112799954 B CN112799954 B CN 112799954B
Authority
CN
China
Prior art keywords
resources
resource
java class
java
association
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.)
Active
Application number
CN202110177066.8A
Other languages
Chinese (zh)
Other versions
CN112799954A (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 Yunzhou Information Technology Co ltd
Original Assignee
Shanghai Yunzhou 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 Yunzhou Information Technology Co ltd filed Critical Shanghai Yunzhou 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

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Computing Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The scheme firstly obtains resources required by the test environment, attribute information of the resources and association relations among the resources, then defines each resource as a Java class, defines the attribute information of the resources as member variables corresponding to the Java classes, declares association relations among other Java classes in the corresponding Java classes according to the association relations among the resources, and invokes Java classes corresponding to the resources to construct the test environment according to the environment construction codes of the specific language in the use field after obtaining the environment construction codes of the specific language in the use field. Because the relation between the resources is obtained in advance and declared in Java class, when DSL grammar is used for constructing the test environment, the code quantity is small, the whole structure of the test environment can be quickly and intuitively known, errors are not easy to occur even if the types and the quantity of the resources are large, and the DSL grammar is used for using the automatic complement function of IDE tool, so that the construction process is more convenient and faster.

Description

Method, apparatus and computer readable medium for quickly constructing test environment
Technical Field
The present disclosure relates to the field of information technologies, and in particular, to a method, an apparatus, and a computer readable medium for quickly constructing a test environment.
Background
In software testing, if an API (Application Programming Interface ) is to be tested, it is necessary to build an API-dependent test environment in advance. To create a virtual machine API example, a virtual machine image, a cluster, a clustered physical machine, a clustered network, a clustered storage, a test account, etc. needs to be prepared in advance, and adding a virtual machine image depends on an image repository.
Currently, there are two main common schemes for constructing the above test environment, namely a hard-coded implementation scheme and a JSON (JavaScript Object Notation, JS object profile) configuration file implementation scheme through XML (Extensible Markup Language ).
For the first scheme, hard-coded implementations. Writing codes to step by step create a test environment to build a virtual machine API interface test environment example:
the first step: calling an API interface of an added mirror warehouse and adding a mirror warehouse
And a second step of: calling and adding a virtual machine mirror image API interface to create a virtual machine mirror image
And a third step of: calling a create cluster API interface to create a cluster
Fourth step: calling an add physical machine API interface to add physical machines to the cluster
Fifth step: calling and creating cluster network API interface, setting cluster network configuration
Sixth step: calling an add cluster storage API interface to set cluster storage configuration
Seventh step: a common account number is created.
Building a test environment using a hard-coded scheme has the following drawbacks:
1. the number of the code lines is large, the workload is large, and the time consumption is long.
2. The complex test environment is easy to make errors, for example, a plurality of clusters need to be created, and each cluster is added with different physical machines, different cluster networks and different cluster storages.
3. The whole structure information of the environment is not visual enough, and is not beneficial to the later maintenance and modification.
For the second scheme, the implementation is realized through an XML/JSON configuration file. The test engineer lists the environment information in the configuration file, the test system analyzes the content of the configuration file, and related APIs are called to complete the environment construction. When the XML/JSON configuration file scheme is used for constructing the test environment, although the code quantity is smaller than that of the first scheme, the whole structure information of the environment is relatively visual, and the following problems are brought about:
1. the environment configuration file and the test code are separated and are not in one source code file, so that maintenance is not facilitated.
2. Configuration files are prone to spelling errors and configuration errors. Development tools such as IDE (Integrated Development Environment ) and the like cannot make code automatic complement for XML/JSON, and cannot support parameter basic type inspection and grammar inspection.
3. Not intelligent and convenient enough, the test engineer can not use the automatic complement function of IDE when writing configuration files.
Disclosure of Invention
It is an object of the present application to provide a method, apparatus and computer readable medium for quickly building a test environment to solve the problems in the prior art.
To achieve the above object, the present application provides a method for quickly constructing a test environment, the method including:
acquiring resources required by a test environment, attribute information of the resources and association relations among the resources;
defining each resource as a Java class, and defining attribute information of the resource as a member variable of the corresponding Java class;
according to the association relation between the resources, declaring the association relation between the Java class and other Java classes in the corresponding Java classes;
acquiring an environment construction code of a specific language of a use field;
and calling Java class construction test environments corresponding to the resources according to the environment construction codes.
Further, the association relationship includes a containing relationship and a usage relationship.
Further, the association relationship is a containing relationship;
according to the association relation between the resources, declaring the association relation between the Java class and other Java classes in the corresponding Java classes, wherein the method comprises the following steps:
and defining a reference of the Java class of the lower resource in the Java class of the upper resource, and adding an adding function of the Java class of the lower resource into the Java class of the upper resource, wherein the upper resource comprises the lower resource.
Further, the association relationship is a use relationship;
according to the association relation between the resources, declaring the association relation between the Java class and other Java classes in the corresponding Java classes, wherein the method comprises the following steps:
a reference of a Java class of the user resource is defined in a Java class of the user resource, and a resource association function for declaring a use relationship with the Java class of the user resource is added to the Java class of the user resource.
Further, a Groovy closure grammar is used to implement a domain-specific language for building a test environment.
Further, the association relationship is a tree structure relationship.
Further, acquiring environment construction code using a domain-specific language, including:
and acquiring environment construction codes of the specific language of the use field through the automatic complement function of the integrated 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 the test environment, attribute information of the resources and association relations among the resources;
the resource definition module is used for defining each resource as a Java class, defining attribute information of the resource as a member variable of the corresponding Java class, and declaring the association relation with other Java classes in the corresponding Java class according to the association relation between the resources;
the code acquisition module is used for acquiring environment construction codes of the specific language of the use field;
and the environment construction module is used for calling Java classes corresponding to the resources to construct a test environment according to the environment construction code.
The embodiment of the application also provides a computing device, which 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 device to execute the method for quickly constructing the test environment.
Furthermore, embodiments of the present application provide a computer readable medium having stored thereon computer program instructions executable by a processor to implement the method of quickly building a test environment.
Compared with the prior art, the method and the device for quickly constructing the test environment have the advantages that resources required by the test environment, attribute information of the resources and association relations among the resources are acquired, each resource is defined as a Java class, the attribute information of the resources is defined as member variables of the corresponding Java classes, association relations among other Java classes are declared in the corresponding Java classes according to the association relations among the resources, and after environment construction codes of a specific language in the use field are acquired, the Java classes corresponding to the resources are called according to the environment construction codes to construct the test environment. Because the relation between the resources is obtained in advance and is declared in Java class, when DSL (Domain Specific Language ) grammar is used for constructing the test environment, the code quantity is small, the whole structure of the test environment can be quickly and intuitively known, errors are not easy to occur even if the types and the quantity of the resources are large, and the automatic complement function of IDE tools can be used due to the DSL grammar, so that the construction process is more convenient and quick.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the detailed description of non-limiting embodiments, made with reference to the following drawings, in which:
FIG. 1 is a process flow diagram of a method for quickly building a test environment according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of an apparatus for quickly constructing a test environment according to an embodiment of the present application.
The same or similar reference numbers in the drawings refer to the same or similar parts.
Detailed Description
The present application is described in further detail below with reference to the accompanying drawings.
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of 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 apparent that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
In a typical configuration of the present application, the terminals, the devices of the services network each include one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer-readable media include both permanent and non-permanent, removable and non-removable media, and information storage may be implemented by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer 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 Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape storage or other magnetic storage devices, or any other non-transmission medium which 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, which acquires the relation between resources in advance and declares the relation in Java classes, so that when DSL grammar is used for constructing the test environment, the code quantity is small, the whole structure of the test environment can be quickly and intuitively known, errors are not easy to occur even if the types and the quantity of the resources are large, and the construction process is more convenient and quick because the DSL grammar is used for using an automatic complement function of an IDE tool.
Fig. 1 shows a process flow of a method for quickly constructing a test environment according to an embodiment of the present application, which at least includes the following processing steps:
step S101, acquiring resources required by a test environment, attribute information of the resources and association relations among the resources. The resources refer to objects required to be involved in the software testing process, and taking the foregoing test about creating the virtual machine API as an example, the resources required 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 qualification, for example, taking a physical machine as an example, the attribute may include ip, name, username, password, clusterUuid, where ip is an ip address of the physical machine, name is a name of the physical machine, username is a user name corresponding to the physical machine, password is a password corresponding to the physical machine, and clusteriid is a unique identifier of a cluster to which the physical machine belongs.
The resources also have a certain association relationship, and common association relationships can include inclusion relationships and use relationships. The inclusion relationship means that one resource contains another resource, and for two resources with the inclusion relationship, the two resources can be respectively defined as an upper layer resource and a lower layer resource, wherein the upper layer resource contains the lower layer resource. For example, the association relationship between the clusters and the physical machines is an inclusion relationship, and one physical machine may be included in one cluster, so that the cluster is an upper layer resource and the physical machine is a lower layer resource in the group of inclusion relationships.
The usage relationship refers to that one resource needs to be used to another resource in the system operation process, and the two resources with the usage relationship can be respectively defined as a user resource and a used resource, wherein the user resource uses 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 be used for the storage in the running process of the virtual machine system, so that in the set of usage relationships, the cluster is a user resource and is stored as a used resource.
In an actual scenario, for an object to be tested, all constituent resources required in the test environment, attributes of each resource, and association relationships between the resources may be determined in conjunction with an actual service.
In step S102, each resource is defined as a Java class, and attribute information of the resource is defined as a member variable of the corresponding Java class. Taking a cluster and a physical machine as examples, defined Java classes are respectively as follows:
and step S103, according to the association relation between the resources, declaring the association relation between the Java class and other Java classes in the corresponding Java classes.
Because the association relationship in the embodiment of the application comprises the inclusion relationship and the association relationship, which have certain differences, two association relationships between two resources can be declared in different modes respectively. Wherein, when the association relationship is an inclusion relationship, the following manner may be adopted: and defining the reference of the Java class of the lower resource in the Java class of the upper resource, and adding an adding function to the Java class of the lower resource in the Java class of the upper resource. For example, taking the foregoing 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, and the add function is added, where the Java class of the cluster may include the following:
when the association relationship is a use relationship, it can be declared in the following manner: a reference of a Java class of the user resource is defined in a Java class of the user resource, and a resource association function for declaring a use relationship with the Java class of the user resource is added to the Java class of the user resource. For example, taking a cluster and storage as an example, a reference to a stored Java class may be defined in a Java class of the cluster and added to a resource-related function, where the stored Java class and the Java class of the cluster may each include the following:
therefore, the declaration of various association relations can be completed in the corresponding Java class through the mode. Because the association relation stated in the mode is in a tree structure relation, all resources can be traversed intuitively from the resource Java class at the root (namely the uppermost layer in the contained relation or the initial user in the use relation), and therefore, the overall structure of the test environment can be known intuitively for users.
In step S104, an environment construction code using DSL is acquired. Code may be obtained by integrating the auto-completion function of the development environment tool when the environment build code is obtained for improved efficiency.
And step S105, calling Java class construction test environments corresponding to the resources according to the environment construction codes.
In some embodiments of the present application, the domain-specific language used to build the test environment may be implemented using the Groovy closure grammar. The Groovy is a development language based on a JVM (Java virtual machine), and the test environment can be constructed by using the 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 the code writing process, so that the whole process of constructing the test environment is more convenient and rapid, and the possibility of errors is reduced. It should be understood by those skilled in the art that the selection of the specific development language for DSL described above is merely exemplary, and that other types of development languages based on similar principles, whether existing or hereafter developed, are intended to be encompassed within the scope of the present application if applicable thereto and are incorporated herein by reference.
In an actual scenario, according to the Java class of the above-defined various resources, if the test environment declared by the tester in the test case is: 2 clusters (cluster 1 and cluster 2), cluster 1 has two physical machines (kvm 1 and kvm 2) and has store 1 (local) mounted, cluster 2 has 1 physical machine (kvm 3) but does not have any store mounted, and the environment construction code used at this time to construct the test environment using the Groovy closure grammar as DSL is as follows:
if instead of using DSL syntax, the APIs are called in a hard-coded manner to build the same test environment, the corresponding environment build code is as follows:
memory addition/addition
AddLocalPrimaryStorageAction addLocalPrimaryStorageAction=new A ddLocalPrimaryStorageAction()
addLocalPrimaryStorageAction.name="local"
addLocalPrimaryStorageAction.url="/local_ps"
PrimaryStorageInventory primaryStorage=addLocalPrimaryStorageActi on.call().value.inventory
Creation cluster 1
CreateClusterAction createCluster1Action=new CreateClusterAction()
createCluster1Action.name="cluster1"
ClusterInventory cluster1=createCluster1Action.call().value.inventory
Use of storage by the/(and/or configuration cluster 1)
AttachPrimaryStorageToClusterAction attachPrimaryStorageToClusterAc tion=new AttachPrimaryStorageToClusterAction()
attachPrimaryStorageToClusterAction.clusterUuid=cluster1.uuid
attachPrimaryStorageToClusterAction.primaryStorageUuid=primarySto rage.uuid
attachPrimaryStorageToClusterAction.call()
Addition of 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()
Addition of physical machines 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()
Creation cluster 2
CreateClusterAction createCluster2Action=new CreateClusterAction()
createCluster2Action.name="cluster2"
ClusterInventory cluster2=createCluster2Action.call().value.inventory
Addition of physical machines 3 to 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 (image 1), a cluster (client), a physical machine (kvm), a storage (nfs), a cluster network (12), and a common account number (account 1), the environment construction code used to construct the test environment using the Groovy closure grammar as DSL is as follows:
/>
/>
if the similar test environment construction is realized through the XML configuration file instead of DSL grammar, the configuration content of the XML is as follows:
/>
/>
by comparing the scheme provided by the embodiment of the application with the two schemes in the prior art, the DSL grammar code amount used in the embodiment of the application is less, clearer and simpler, the relation between the resources is more visual, and errors are not easy to occur when the types and the quantity of the resources are more. In addition, due to the DSL grammar, the functions of automatic code completion, parameter basic type inspection, grammar inspection and the like of the IDE tool can be used, so that the whole process of constructing the test environment is more convenient and quick, and the possibility of error is reduced.
Based on the same inventive concept, the embodiment of the application also provides a device for quickly constructing a test environment, which corresponds to the method for quickly constructing the test environment in the previous 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, which 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 association relations among the resources. The resource definition module is used for defining each resource as a Java class, defining attribute information of the resource as a member variable of the corresponding Java class, and declaring the association relation with other Java classes in the corresponding Java class according to the association relation between the resources. The code acquisition module is used for acquiring environment construction codes of the specific language of the application field. And the environment construction module is used for calling Java classes corresponding to the resources to construct a test environment according to the environment construction code.
In addition, the embodiment of the application also provides a computing device. 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 an apparatus suitable for implementing the method and/or technical solution in the embodiments of the present application, the apparatus 200 includes a central processing unit (CPU, central Processing Unit) 201, which may perform various appropriate 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, random Access Memory) 203. In the RAM203, various programs and data required for the system operation are also stored. The CPU 201, ROM 202, and RAM203 are connected to each other through 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 portion 207 including a display such as a Cathode Ray Tube (CRT), a liquid crystal display (LCD, liquid Crystal Display), 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, etc.; 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 of the present application may be implemented as a computer software program. 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 shown in the flowcharts. The above-described functions defined in the method of the present application are performed when the computer program is executed by a Central Processing Unit (CPU) 201.
It should be noted that, the computer readable medium described in the present application may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any 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 context of this document, 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 the present application, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. 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 of the present application may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ 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 kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected 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 devices, 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 which 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 that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted 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 various embodiments of the present application 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, using Application Specific Integrated Circuits (ASIC), a general purpose computer or any other similar hardware device. 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 of the present application (including associated data structures) may be stored on a computer readable recording medium, such as RAM memory, magnetic or optical drive or diskette and the like. In addition, some 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 characteristics 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 evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. A plurality of units or means recited in the apparatus claims can also be implemented by means of one unit or means in software or hardware. The terms first, second, etc. are used to denote a name, but not any particular order.

Claims (9)

1. A method of quickly building a test environment, the method comprising:
acquiring resources required by a test environment, attribute information of the resources and association relations among the resources;
defining each resource as a Java class, and defining attribute information of the resource as a member variable of the corresponding Java class;
according to the association relation between the resources, declaring the association relation between the Java class and other Java classes in the corresponding Java classes;
acquiring environment construction codes of specific languages in the use field through an automatic complement function of an integrated development environment tool;
and calling Java class construction test environments corresponding to the resources according to the environment construction codes.
2. The method of claim 1, wherein the association relationship comprises a containment relationship and a usage relationship.
3. The method of claim 2, wherein the association is a containment;
according to the association relation between the resources, declaring the association relation between the Java class and other Java classes in the corresponding Java classes, wherein the method comprises the following steps:
and defining a reference of the Java class of the lower resource in the Java class of the upper resource, and adding an adding function of the Java class of the lower resource into the Java class of the upper resource, wherein the upper resource comprises the lower resource.
4. The method of claim 2, wherein the association is a use relationship;
according to the association relation between the resources, declaring the association relation between the Java class and other Java classes in the corresponding Java classes, wherein the method comprises the following steps:
a reference of a Java class of the user resource is defined in a Java class of the user resource, and a resource association function for declaring a use relationship with the Java class of the user resource is added to the Java class of the user resource.
5. The method of claim 1, wherein the domain-specific language used to construct the test environment is implemented using a Groovy closure grammar.
6. The method of claim 1, wherein the association is a tree structure.
7. An apparatus for quickly building a test environment, the apparatus comprising:
the resource acquisition module is used for acquiring resources required by the test environment, attribute information of the resources and association relations among the resources;
the resource definition module is used for defining each resource as a Java class, defining attribute information of the resource as a member variable of the corresponding Java class, and declaring the association relation with other Java classes in the corresponding Java class according to the association relation between the resources;
the code acquisition module is used for acquiring environment construction codes of the specific languages in the use field through an automatic complement function of the integrated development environment tool;
and the environment construction module is used for calling Java classes corresponding to the resources to construct a test environment according to the environment construction code.
8. 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 one of claims 1 to 6.
9. A computer readable medium having stored thereon computer program instructions executable by a processor to implement the method of any of claims 1 to 6.
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 CN112799954A (en) 2021-05-14
CN112799954B true 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 (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9612947B2 (en) * 2012-12-03 2017-04-04 Ca, Inc. Code-free testing framework
US9405512B2 (en) * 2014-04-29 2016-08-02 Ca, Inc. Rejuvenation of legacy code into resources-oriented architectures

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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 (2)

* Cited by examiner, † Cited by third party
Title
"POU-Oriented Unit Testing of IEC 61131-3 Control Software";Marcin Jamro;《IEEE Transactions on Industrial Informatics》;第11卷(第5期);第1119-1129页 *
"模型驱动的快速业务构建平台的研究与设计";滕建发;《中国优秀硕士学位论文全文数据库 信息科技辑》(2017年第03期);第I138-2447页 *

Also Published As

Publication number Publication date
CN112799954A (en) 2021-05-14

Similar Documents

Publication Publication Date Title
US9372688B1 (en) Automatic discovery of a JavaScript API
US8615750B1 (en) Optimizing application compiling
US8954928B2 (en) Version labeling in a version control system
US9836440B2 (en) Semantic stack trace
CN110489323B (en) Visual RPC API debugging method, device, medium and equipment
US10572371B2 (en) Generating valid use cases from a parsed configuration file describing use case options
CN113126990B (en) Page development method, device, equipment and storage medium
JP2021193606A (en) Operator registration processing method, device and electronic apparatus based on deep learning
US11200048B2 (en) Modification of codified infrastructure for orchestration in a multi-cloud environment
CN112631590B (en) Component library generation method, device, electronic equipment and computer readable medium
CN106411970A (en) Fault handling method, device and system based on service call
US20210173641A1 (en) Generation of knowledge graphs based on repositories of code
CN113419740A (en) Program data stream analysis method and device, electronic device and readable storage medium
US8607201B2 (en) Augmenting visualization of a call stack
US9489179B2 (en) Application programming interface tracing mechanism
CN112799954B (en) Method, apparatus and computer readable medium for quickly constructing test environment
US11182272B2 (en) Application state monitoring
US20110246967A1 (en) Methods and systems for automation framework extensibility
US20220365758A1 (en) Tool for Introspection in Object-Oriented Source Code
CN114579466A (en) Method, device, equipment and medium for constructing test case and code test
CN112068814A (en) Method, device, system and medium for generating executable file
CN111581173A (en) Distributed storage method and device for log system, server and storage medium
CN113342633B (en) Performance test method and device
CN117118962B (en) Method and system for deploying user methods across multiple cloud platforms
US9471788B2 (en) Evaluation of software applications

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
GR01 Patent grant