Test environment matching method and apparatus, computing device, and storage medium

By configuring environment configuration files in test cases and automatically parsing the environment structure Topo file, the test environment can be quickly matched and released in server product integration testing, solving the problems of high labor costs and low equipment utilization, and improving testing efficiency.

CN115794523BActive Publication Date: 2026-05-15XFUSION DIGITAL TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211515653.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-30
Publication Date
2026-05-15
Estimated Expiration
2042-11-30

AI Technical Summary

Technical Problem

In server product integration testing, it is necessary to frequently replace and unplug different models of equipment, resulting in high labor costs, low equipment utilization, and low testing efficiency.

Method used

By configuring environment configuration files in test cases, the environment structure Topo file is automatically parsed and matched with the environments in the environment pool, enabling real-time matching and rapid release of test cases and test environments.

Benefits of technology

It reduced labor costs, improved testing efficiency and equipment utilization, and reduced the time required to set up the testing environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115794523B_ABST
    Figure CN115794523B_ABST
Patent Text Reader

Abstract

The embodiment of the application relates to the computer technical field, and specifically discloses a test environment matching method and device, a computing device and a storage medium, wherein the test environment matching method comprises the following steps: obtaining an environment configuration file according to a test case, wherein the environment configuration file is used for recording environment requirements required when the test case is executed; analyzing the environment configuration file to obtain an environment structure Topo file; and matching in an environment pool according to the environment structure Topo file to determine a test environment of the test case. By using the method, real-time matching, fast matching and release between the test case and the test environment can be realized, thereby saving the time for building the test environment or manually searching for the equipment, reducing the labor cost, improving the test efficiency and the utilization rate of the equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and more specifically to a test environment matching method, apparatus, computing device, and storage medium. Background Technology

[0002] In server product integration testing, it's necessary to traverse every model and board type in the data center. This necessitates manually building test environments for each model and board type, including different component models. As product specifications and testing requirements change, the various device models in the test environment frequently need to be changed, plugged in, and replaced. For integration testing verification, hundreds of different specifications and models of test equipment need to be examined. Each test requires finding equipment that meets the specified testing requirements to form the test environment. Finding specific equipment among hundreds of devices is difficult, labor-intensive, and results in high manpower costs. Furthermore, after finding the equipment and building the required test environment, the equipment is unusable until the test environment is dismantled, leading to low equipment utilization. Summary of the Invention

[0003] This application provides a test environment matching method, apparatus, computing device, and storage medium, which can reduce labor costs, improve testing efficiency, and increase equipment utilization.

[0004] The embodiments of the present invention adopt the following technical solutions:

[0005] In a first aspect, embodiments of this application provide a test environment matching method, including:

[0006] Obtain the environment configuration file based on the test cases. The environment configuration file is used to record the environment requirements required for the execution of the test cases.

[0007] The environment configuration file is parsed to obtain the environment structure Topo file;

[0008] The test environment for test cases is determined by matching the environment structure Topo file within the environment pool.

[0009] As can be seen, in this embodiment, by pre-configuring an environment configuration file that records the environmental requirements required for the execution of the test case, and then automatically parsing the environment configuration file during test case execution to obtain the environment structure Topo file of the environment required for the execution of the test case, and matching the environment structure Topo file with the environment in the environment pool, real-time matching, fast matching and release between test cases and test environments are achieved, thereby saving the time of test environment setup or manual equipment search. While reducing labor costs, it can improve testing efficiency and equipment utilization.

[0010] In one possible implementation, the environment configuration file is parsed to obtain the environment structure Topo file, which includes:

[0011] The environment structure file in the environment configuration file is parsed to obtain the structure Topo object and the first constraint condition. The structure Topo object is used to identify the environment structure required when the test case is executed, and the first constraint condition is used to identify the environmental restrictions on the environment structure.

[0012] The device configuration file in the environment configuration file is parsed to obtain the second constraint condition, which is used to identify the device restriction conditions on the environment structure;

[0013] By merging the first and second constraints, we obtain the final constraint.

[0014] Use the structure Topo object and constraints as the environment structure Topo file.

[0015] In one possible implementation, the environment structure file in the environment configuration file is parsed to obtain the structure Topo object and the first constraint condition, including:

[0016] Obtain the device name, device hierarchy information, and first constraint of all devices in the environment structure file;

[0017] Based on the device hierarchy information, the device names of all devices are hierarchically constructed to obtain a structure Topo object. The hierarchical structure in the structure Topo object is associated through the parent class field.

[0018] In one possible implementation, the test environment for the test cases is determined by matching the environment structure Topo file within the environment pool, including:

[0019] Based on the structure Topo object, a matching is performed in the environment pool to obtain at least one candidate environment, wherein the environment structure of each candidate environment in the at least one candidate environment includes the environment structure identified by the structure Topo object;

[0020] Based on the constraints, determine the test environment for the test cases from at least one candidate environment.

[0021] In one possible implementation, based on the structure Topo object, a matching process is performed in the environment pool to obtain at least one candidate environment, including:

[0022] Parse the parameters of the first environment configuration file for each environment in the environment pool to obtain the first structure Topo object for each environment;

[0023] The first structural Topo object of each environment is compared with the structural Topo object to obtain at least one candidate environment, wherein the first structural Topo object of each candidate environment includes the structural Topo object.

[0024] In one possible implementation, the test environment for the test cases is determined from at least one candidate environment based on constraints, including:

[0025] The constraints are parsed to obtain the equipment constraint parameters, which are used to identify the requirements of the equipment in the test environment of the test case.

[0026] The first environment configuration file of each environment is parsed to obtain the first device parameters of each environment;

[0027] The test environment of each test case is obtained by comparing the first device parameters of each environment with the device constraint parameters. The first device parameters of the test environment of the test case include the device constraint parameters.

[0028] In one possible implementation, the constraints are parsed to obtain device constraint parameters, including:

[0029] The constraints are parsed using regular expressions to obtain the device constraint parameters.

[0030] Secondly, embodiments of this application provide a test environment matching device, comprising:

[0031] The mapping module is used to obtain the environment configuration file based on the test cases. The environment configuration file records the environment requirements required for the execution of the test cases.

[0032] The parsing module is used to parse the environment configuration file to obtain the environment structure Topo file;

[0033] The matching module is used to match the environment pool based on the environment structure Topo file to determine the test environment for test cases.

[0034] Thirdly, embodiments of this application provide a computing device, including: a processor and a memory, the processor being coupled to the memory, the memory being used to store computer program instructions, and when the computer program instructions are executed by the processor, causing the computing device to perform the method as described in the first aspect.

[0035] As can be seen, the second and third aspects are the apparatus and equipment corresponding to the method of the first aspect. The explanations of each step in the second and third aspects, the definitions of terms, the various implementation methods and the descriptions of the beneficial effects are also applicable to the aforementioned discussions. Please refer to the relevant content in the first aspect, which will not be repeated here.

[0036] Fourthly, embodiments of this application provide a computer-readable storage medium storing program code for execution by a device, which causes a computer to perform the method as described in the first aspect. Regarding the descriptions of the steps involved in the fourth aspect, the explanations of terms, various implementation methods, and descriptions of beneficial effects, the foregoing discussions also apply, and can be found in the relevant foregoing content; they will not be repeated here.

[0037] Fifthly, embodiments of this application provide a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, operable by a computer to perform any possible implementation of the method as described in the first aspect. Regarding the descriptions of the steps involved in the fifth aspect, the explanations of terms, the various implementations, and the descriptions of beneficial effects, the foregoing discussions also apply, and can be found in the relevant foregoing content, which will not be repeated here. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention.

[0039] Figure 1 A schematic diagram of the hardware structure of a test environment matching device provided for an embodiment of the present invention;

[0040] Figure 2 A flowchart illustrating a test environment matching method provided for an embodiment of the present invention;

[0041] Figure 3 A schematic diagram of an environmental logical structure provided for an embodiment of the present invention;

[0042] Figure 4 A schematic diagram of a test environment matching device provided for an embodiment of the present invention;

[0043] Figure 5 This is a schematic diagram of the structure of a computing device provided for an embodiment of the present invention. Detailed Implementation

[0044] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, not all of them. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0045] The terms "first," "second," "third," and "fourth," etc., used in the specification, claims, and drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.

[0046] In this document, the term "implementation" means that a specific feature, result, or characteristic described in connection with an implementation may be included in at least one implementation of this application. The appearance of this phrase in various places in the specification does not necessarily refer to the same implementation, nor is it a separate or alternative implementation mutually exclusive with other implementations. It will be explicitly and implicitly understood by those skilled in the art that the implementations described herein can be combined with other implementations.

[0047] First, refer to Figure 1 , Figure 1 This is a schematic diagram of the hardware structure of a test environment matching device provided in an embodiment of this application. The test environment matching device 100 includes at least one processor 101, a communication line 102, a memory 103, and at least one communication interface 104.

[0048] In this embodiment, the processor 101 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of the program of the present application.

[0049] Communication line 102 may include a path for transmitting information between the aforementioned components.

[0050] The communication interface 104 can be any transceiver-like device (such as an antenna) used to communicate with other devices or communication networks, such as Ethernet, RAN, wireless local area networks (WLAN), etc.

[0051] The memory 103 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto.

[0052] In this embodiment, the memory 103 can exist independently and be connected to the processor 101 via the communication line 102. Alternatively, the memory 103 can be integrated with the processor 101. The memory 103 provided in this embodiment is typically non-volatile. The memory 103 stores computer execution instructions for implementing the scheme of this application, and its execution is controlled by the processor 101. The processor 101 executes the computer execution instructions stored in the memory 103 to implement the method provided in the following embodiments of this application.

[0053] In an optional implementation, the computer execution instructions may also be referred to as application code, and this application does not specifically limit this terminology.

[0054] In an optional implementation, processor 101 may include one or more CPUs, for example... Figure 1 CPU0 and CPU1 in the CPU.

[0055] In an optional implementation, the test environment matching device 100 may include multiple processors, such as... Figure 1 Processors 101 and 107 are shown in the diagram. Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor here may refer to one or more devices, circuits, and / or processing cores used to process data (e.g., computer program instructions).

[0056] In optional implementations, if the test environment matching device 100 is a server, for example, it can be a standalone server or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms, then the test environment matching device 100 may further include an output device 105 and an input device 106. The output device 105 communicates with the processor 101 and can display information in various ways. For example, the output device 105 can be a liquid crystal display (LCD), a light-emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector, etc. The input device 106 communicates with the processor 101 and can receive user input in various ways. For example, the input device 106 can be a mouse, keyboard, touch screen device, or sensing device, etc.

[0057] The aforementioned test environment matching device 100 can be a general-purpose device or a special-purpose device. The embodiments of this application do not limit the type of the test environment matching device 100.

[0058] The following will describe a test environment matching method provided in this application:

[0059] See Figure 2 , Figure 2 A flowchart illustrating a test environment matching method provided for embodiments of this application is shown. The method may include the following steps:

[0060] 201: Obtain the environment configuration file based on the test cases.

[0061] In this embodiment, the environment configuration file is used to record the environmental requirements required for the execution of test cases. Specifically, the environment configuration file also includes an environment structure file and a device configuration file. The environment structure file can logically define server device information, and the device configuration file can define specific devices, components, and their attribute information through different character tags.

[0062] For example, in this embodiment, the character definitions for device objects can be as shown in Table 1:

[0063] Table 1:

[0064]

[0065]

[0066] The character definitions for component information can be shown in Table 2:

[0067] Table 2:

[0068]

[0069] In this implementation, when test cases are executed, the environment configuration file can be passed in by calling the mapping algorithm. 202: Parse the environment configuration file to obtain the environment structure Topo file.

[0070] In this embodiment, the mapping algorithm defines the device object structure required by the test case by designing a Topo file, and then defines the specifications and component definitions of the required devices through mapping relationships. Specifically, the mapping algorithm first parses the environment structure file to obtain a structure Topo object that identifies the network structure or environment structure of the test device required by the test case during runtime, as well as a first constraint condition that restricts the network structure or environment structure. Then, it parses the device configuration file to obtain a second constraint condition that restricts the devices that make up the network structure or environment structure. Finally, it merges the first and second constraints to obtain the constraints, and uses the structure Topo object and the constraints as the environment structure Topo file.

[0071] Specifically, the device name, device hierarchy information, and first constraint of all devices in the environment structure file can be directly parsed. Then, based on the device hierarchy information, the device names of all devices are hierarchically constructed to obtain a structure Topo object. The hierarchical structure in the structure Topo object is associated through the parent class field.

[0072] For example, assume the environment structure file looks like this:

[0073]

[0074] The contents of the description file 1SER.enx are as follows:

[0075]

[0076] The device configuration file is shown below:

[0077] @ser1_bd1.check('subtype', / Net_Card / );

[0078] @ser1_bd1.check('ChipType', / X722 / )

[0079] After parsing the environment structure file, it can be seen that the environment structure is defined in 1SER.enx as: 1 environment pool, containing 1 device, and the device contains at least 1 board. Therefore, the following Topo object structure can be generated:

[0080]

[0081]

[0082] At the same time, the first constraint condition is obtained:

[0083] @ser1.subtype( / ^(?!.*2MM).*$ / )

[0084] After parsing the device configuration file, the following second constraint can be obtained:

[0085] @ser1_bd1.check('subtype', / Net_Card / );

[0086] @ser1_bd1.check('ChipType', / X722 / )

[0087] Based on this, by merging the first and second constraints, we obtain the following constraints:

[0088] Topolimit{

[0089] @ser1_bd1.check('subtype', / Net_Card / );

[0090] @ser1_bd1.check('ChipType', / X722 / );

[0091] @ser1.subtype( / ^(?!.*2MM).*$ / )

[0092] }

[0093] The resulting Topo object and constraints are then used as the Topo file for this environment.

[0094] 203: Match the test cases in the environment pool based on the environment structure Topo file.

[0095] In this embodiment, each environment in the environment pool is pre-logically formatted into data and stored. Specifically, each environment is divided into, for example: Figure 3The diagram shows a three-layer structure: environment pool, server, and sub-components. The physical information of each layer's results is stored in defined attributes. This not only establishes the association between physical devices but also facilitates efficient device lookup in subsequent mapping processes.

[0096] During matching, the hierarchical structure of each environment is determined through logical data, and corresponding environment instances are generated. The hierarchical relationship can be linked through a parent class field. Thus, the resulting environment instances are structurally consistent with the Topo object in step 202, facilitating comparison. In an optional implementation, the environment instances can also be pre-generated and directly used during matching, further improving matching efficiency.

[0097] In this implementation, firstly, based on the structure Topo object, a matching process is performed in the environment pool to obtain at least one candidate environment. Each candidate environment within the at least one candidate environment includes the environment structure identified by the structure Topo object. In short, environments that include the structure corresponding to the structure Topo object are selected as candidate environments from among the environment instances.

[0098] Specifically, the parameters of the first environment configuration file for each environment in the environment pool can be parsed to obtain the first structure Topo object for each environment. Then, the first structure Topo object for each environment is compared with the structure Topo object to obtain at least one candidate environment, wherein the first structure Topo object of each candidate environment includes the structure Topo object. For example, assume that the environment pool contains three environments: Environment 1 COMPAT_UP1, whose first environment configuration file states that this environment contains two devices, Server_Compat_111 and Server_Compat_155, both of which contain cards; Environment 2 COMPAT_UP2, whose first environment configuration file states that this environment contains one device, Server_Compat_112, which does not contain cards; and Environment 3 COMPAT_UP3, whose first environment configuration file states that this environment contains three devices, Server_Compat_113, Server_Compat_114, and Server_Compat_115, where Server_Compat_113 contains cards, while Server_Compat_114 and Server_Compat_115 do not.

[0099] Then, based on the first environment configuration file for each environment, a first structure Topo object corresponding to that environment can be generated. The method for generating the first structure Topo object is similar to the method for generating the structure Topo object in step 202, and will not be repeated here. At the same time, the first structure Topo object for each environment can also be pre-generated and stored in the environment pool, which is not limited in this application.

[0100] In this embodiment, the structure Topo object defined by the environment structure file 1SER.enx is used: one environment pool contains one device, and the device contains at least one board. Therefore, by comparing the structure Topo object with the first structure Topo object of each environment, it can be found that Server_Compat_111 and Server_Compat_155 in environment 1 and Server_Compat_113 in environment 3 all satisfy the structure Topo object. Therefore, Server_Compat_111, Server_Compat_155, and Server_Compat_113 are listed as candidate environments.

[0101] Then, in this embodiment, the test environment for the test case can be determined from at least one candidate environment based on the constraints. Specifically, the constraints can be parsed to obtain device constraint parameters, which identify the requirements for the devices in the test environment of the test case. Next, the first environment configuration file for each environment is parsed to obtain the first device parameters for each environment. Then, the first device parameters for each environment are compared with the device constraint parameters to obtain the test environment for the test case, wherein the first device parameters of the test environment for the test case include the device constraint parameters.

[0102] Specifically, using the constraint file from the example above, firstly, the constraint conditions can be parsed using methods such as regular expressions, resulting in:

[0103] @ser1_bd1.check('subtype', / Net_Card / ): The subtype field of the board is Net_Card;

[0104] @ser1_bd1.check('ChipType', / X722 / ): The board's ChipType attribute is X722;

[0105] @ser1.subtype( / ^(?!.*2MM).*$ / ): The device subtype property does not include MM.

[0106] The first environment configuration files of candidate environments Server_Compat_111, Server_Compat_155, and Server_Compat_113 are further parsed to obtain the first device parameters that identify the device information in each of these environments. The device information parsed using the constraints is then compared with the first device parameters of each of the candidate environments Server_Compat_111, Server_Compat_155, and Server_Compat_113. The candidate environment whose first device parameters satisfy the parsed device information is then selected as the final test environment. For example, if only candidate environment Server_Compat_111 simultaneously satisfies all three device parameters, then candidate environment Server_Compat_111 is determined as the final test environment. If multiple candidate environments satisfy the conditions, any one of them can be selected as the final test environment.

[0107] In addition, other methods can be used to parse the constraints, and this application does not impose any restrictions on them.

[0108] As can be seen, in this embodiment, by pre-configuring an environment configuration file that records the environmental requirements required for the execution of the test case, and then automatically parsing the environment configuration file during test case execution to obtain the environment structure Topo file of the environment required for the execution of the test case, and matching the environment structure Topo file with the environment in the environment pool, real-time matching, fast matching and release between test cases and test environments are achieved, thereby saving the time of test environment setup or manual equipment search. While reducing labor costs, it can improve testing efficiency and equipment utilization.

[0109] To facilitate the better implementation of the above-described solutions of this application, corresponding devices for implementing the above-described solutions are also provided below.

[0110] Figure 4 A schematic diagram of a test environment matching device provided in this application embodiment is shown. The test environment matching device 400 includes:

[0111] The mapping module 401 is used to obtain the environment configuration file according to the test cases. The environment configuration file is used to record the environment requirements required for the execution of the test cases.

[0112] Parsing module 402 is used to parse the environment configuration file to obtain the environment structure Topo file;

[0113] Matching module 403 is used to match the environment pool based on the environment structure Topo file to determine the test environment for the test cases.

[0114] In one possible implementation, in parsing the environment configuration file to obtain the environment structure Topo file, the parsing module 402 is specifically used for:

[0115] The environment structure file in the environment configuration file is parsed to obtain the structure Topo object and the first constraint condition. The structure Topo object is used to identify the environment structure required when the test case is executed, and the first constraint condition is used to identify the environmental restrictions on the environment structure.

[0116] The device configuration file in the environment configuration file is parsed to obtain the second constraint condition, which is used to identify the device restriction conditions on the environment structure;

[0117] By merging the first and second constraints, we obtain the final constraint.

[0118] Use the structure Topo object and constraints as the environment structure Topo file.

[0119] In one possible implementation, the parsing module 402, in parsing the environment structure file in the environment configuration file to obtain the structure Topo object and the first constraint, is specifically used for:

[0120] Obtain the device name, device hierarchy information, and first constraint of all devices in the environment structure file;

[0121] Based on the device hierarchy information, the device names of all devices are hierarchically constructed to obtain a structure Topo object. The hierarchical structure in the structure Topo object is associated through the parent class field.

[0122] In one possible implementation, in determining the test environment for test cases by matching within the environment pool based on the environment structure Topo file, the matching module 403 is specifically used for:

[0123] Based on the structure Topo object, a matching is performed in the environment pool to obtain at least one candidate environment, wherein the environment structure of each candidate environment in the at least one candidate environment includes the environment structure identified by the structure Topo object;

[0124] Based on the constraints, determine the test environment for the test cases from at least one candidate environment.

[0125] In one possible implementation, in terms of matching in the environment pool based on the structure Topo object to obtain at least one candidate environment, the matching module 403 is specifically used for:

[0126] Parse the parameters of the first environment configuration file for each environment in the environment pool to obtain the first structure Topo object for each environment;

[0127] The first structural Topo object of each environment is compared with the structural Topo object to obtain at least one candidate environment, wherein the first structural Topo object of each candidate environment includes the structural Topo object.

[0128] In one possible implementation, in determining the test environment for test cases in at least one candidate environment based on constraints, the matching module 403 is specifically configured to:

[0129] The constraints are parsed to obtain the equipment constraint parameters, which are used to identify the requirements of the equipment in the test environment of the test case.

[0130] The first environment configuration file of each environment is parsed to obtain the first device parameters of each environment;

[0131] The test environment of each test case is obtained by comparing the first device parameters of each environment with the device constraint parameters. The first device parameters of the test environment of the test case include the device constraint parameters.

[0132] In one possible implementation, the matching module 403, in parsing the constraints to obtain the device constraint parameters, is specifically used for:

[0133] The constraints are parsed using regular expressions to obtain the device constraint parameters.

[0134] Figure 5 This is a schematic diagram of a computing device 500 provided for an embodiment of this application. The computing device 500 includes a processor 501 and a memory 502, which are connected by a bus 503. The memory 502 stores computer programs and data. In this embodiment, the processor 501 can be equivalent to the fault injection system in the above embodiments.

[0135] Processor 501 is used to read the computer program in memory 502 and perform the following operations:

[0136] Obtain the environment configuration file based on the test cases. The environment configuration file is used to record the environment requirements required for the execution of the test cases.

[0137] The environment configuration file is parsed to obtain the environment structure Topo file;

[0138] The test environment for test cases is determined by matching the environment structure Topo file within the environment pool.

[0139] In one possible implementation, in parsing the environment configuration file to obtain the environment structure Topo file, processor 501 is specifically configured to perform the following operations:

[0140] The environment structure file in the environment configuration file is parsed to obtain the structure Topo object and the first constraint condition. The structure Topo object is used to identify the environment structure required when the test case is executed, and the first constraint condition is used to identify the environmental restrictions on the environment structure.

[0141] The device configuration file in the environment configuration file is parsed to obtain the second constraint condition, which is used to identify the device restriction conditions on the environment structure;

[0142] By merging the first and second constraints, we obtain the final constraint.

[0143] Use the structure Topo object and constraints as the environment structure Topo file.

[0144] In one possible implementation, in parsing the environment structure file in the environment configuration file to obtain the structure Topo object and the first constraint, processor 501 is specifically configured to perform the following operations:

[0145] Obtain the device name, device hierarchy information, and first constraint of all devices in the environment structure file;

[0146] Based on the device hierarchy information, the device names of all devices are hierarchically constructed to obtain a structure Topo object. The hierarchical structure in the structure Topo object is associated through the parent class field.

[0147] In one possible implementation, in determining the test environment for test cases by matching within an environment pool based on the environment structure Topo file, processor 501 is specifically configured to perform the following operations:

[0148] Based on the structure Topo object, a matching is performed in the environment pool to obtain at least one candidate environment, wherein the environment structure of each candidate environment in the at least one candidate environment includes the environment structure identified by the structure Topo object;

[0149] Based on the constraints, determine the test environment for the test cases from at least one candidate environment.

[0150] In one possible implementation, in order to obtain at least one candidate environment by matching in an environment pool based on the structure Topo object, processor 501 is specifically configured to perform the following operations:

[0151] Parse the parameters of the first environment configuration file for each environment in the environment pool to obtain the first structure Topo object for each environment;

[0152] The first structural Topo object of each environment is compared with the structural Topo object to obtain at least one candidate environment, wherein the first structural Topo object of each candidate environment includes the structural Topo object.

[0153] In one possible implementation, in determining the test environment for test cases in at least one candidate environment based on constraints, processor 501 is specifically configured to perform the following operations:

[0154] The constraints are parsed to obtain the equipment constraint parameters, which are used to identify the requirements of the equipment in the test environment of the test case.

[0155] The first environment configuration file of each environment is parsed to obtain the first device parameters of each environment;

[0156] The test environment of each test case is obtained by comparing the first device parameters of each environment with the device constraint parameters. The first device parameters of the test environment of the test case include the device constraint parameters.

[0157] In one possible implementation, in parsing constraints to obtain device constraint parameters, processor 501 is specifically configured to perform the following operations:

[0158] The constraints are parsed using regular expressions to obtain the device constraint parameters.

[0159] This application also provides a computer-readable storage medium storing a computer program that is executed by a processor to implement some or all of the steps of any of the test environment matching methods described in the above method embodiments.

[0160] This application also provides a computer program product that, when run on a computer or processor, causes the computer or processor to perform one or more steps in any of the above-described test environment matching methods. If the constituent modules of the aforementioned devices are implemented as software functional units and sold or used as independent products, they can be stored in the computer-readable storage medium.

[0161] It should be understood that the processor mentioned in the embodiments of this application can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.

[0162] It should also be understood that the memory mentioned in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), Synchlink Dynamic Random Access Memory (SLDRAM), and Direct Rambus RAM (DRRAM).

[0163] It should be noted that when the processor is a general-purpose processor, DSP, ASIC, FPGA, or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, the memory (storage module) is integrated into the processor.

[0164] It should be noted that, for the sake of simplicity, the aforementioned methods are described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps can be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.

[0165] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0166] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical or other forms.

[0167] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0168] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of a software program module.

[0169] If the integrated unit is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application.

[0170] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware, and the program can be stored in a computer-readable storage medium. The storage medium may include: flash drive, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc.

[0171] The embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The above description of the embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A test environment matching method, characterized in that, The method includes: Obtain the environment configuration file based on the test cases, whereby the environment configuration file records the environmental requirements required for the execution of the test cases; The environment structure file in the environment configuration file is parsed to obtain a structure Topo object and a first constraint condition. The structure Topo object is used to identify the environment structure required when the test case is executed, and the first constraint condition is used to identify the environmental restrictions on the environment structure. The device configuration file in the environment configuration file is parsed to obtain the second constraint condition, wherein the second constraint condition is used to identify the device restriction conditions on the environment structure; Combine the first constraint and the second constraint to obtain the constraint conditions; The structure Topo object and the constraints are used as the environment structure Topo file; The test environment of the test case is determined by matching the environment structure Topo file in the environment pool. The environment pool includes multiple environment instances, and each environment instance is determined by the hierarchical structure determined by the logical data of the corresponding environment. The step of parsing the environment structure file in the environment configuration file to obtain the structure Topo object and the first constraint condition includes: Obtain the device name, device hierarchy information, and the first constraint condition of all devices in the environment structure file; Based on the device hierarchy information, the device names of all devices are hierarchically constructed to obtain the structure Topo object, wherein the hierarchical structure in the structure Topo object is associated through the parent class field.

2. The method according to claim 1, characterized in that, The step of matching the test environment of the test case in the environment pool based on the environment structure Topo file includes: Based on the structure Topo object, a matching process is performed in the environment pool to obtain at least one candidate environment, wherein the environment structure of each candidate environment in the at least one candidate environment includes the environment structure identified by the structure Topo object; Based on the constraints, the test environment for the test case is determined in at least one candidate environment.

3. The method according to claim 2, characterized in that, The step of matching the environment pool based on the structured Topo object to obtain at least one candidate environment includes: The parameters of the first environment configuration file of each environment in the environment pool are parsed to obtain the first structure Topo object of each environment. The first structural Topo object of each environment is compared with the structural Topo object to obtain at least one candidate environment, wherein the first structural Topo object of each candidate environment includes the structural Topo object.

4. The method according to claim 2, characterized in that, The step of determining the test environment for the test case in the at least one candidate environment based on the constraints includes: The constraints are parsed to obtain device constraint parameters, wherein the device constraint parameters are used to identify the requirements of the device in the test environment of the test case; The first environment configuration file of each environment is parsed to obtain the first device parameters of each environment; The first device parameter of each environment is compared with the device constraint parameter to obtain the test environment of the test case, wherein the first device parameter of the test environment of the test case includes the device constraint parameter.

5. The method according to claim 4, characterized in that, The step of parsing the constraints to obtain the device constraint parameters includes: The device constraint parameters are obtained by parsing the constraint conditions using regular expressions.

6. A test environment matching device, characterized in that, The device includes: The mapping module is used to obtain the environment configuration file according to the test case, wherein the environment configuration file is used to record the environment requirements required for the execution of the test case; The parsing module is used to parse the environment structure file in the environment configuration file to obtain a structure Topo object and a first constraint condition. The structure Topo object identifies the environment structure required for the execution of the test case, and the first constraint condition identifies the environmental restrictions on the environment structure. The module also parses the device configuration file in the environment configuration file to obtain a second constraint condition, which identifies the device restrictions on the environment structure. The first constraint condition and the second constraint condition are then merged to obtain a constraint condition. Finally, the structure Topo object and the constraint condition are used as the environment structure Topo file. The matching module is used to match the environment pool according to the environment structure Topo file to determine the test environment of the test case. The environment pool includes multiple environment instances, and each environment instance is determined by the hierarchical structure determined by the logical data of the corresponding environment. Specifically, in parsing the environment structure file in the environment configuration file to obtain the structure Topo object and the first constraint condition, the parsing module is used for: Obtain the device name, device hierarchy information, and the first constraint condition of all devices in the environment structure file; Based on the device hierarchy information, the device names of all devices are hierarchically constructed to obtain the structure Topo object, wherein the hierarchical structure in the structure Topo object is associated through the parent class field.

7. A computing device, characterized in that, The device includes a processor and a memory coupled together; wherein the memory is used to store computer program instructions; when the computer program instructions are executed by the processor, the computing device performs the method as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that is executed by a processor to implement the method as described in any one of claims 1-5.