Disclosure of Invention
An object of the embodiments of the present application is to provide a method and an apparatus for testing compatibility, so as to improve the execution efficiency of the compatibility test.
In order to solve the above technical problem, embodiments of the present application provide a compatibility testing method and apparatus, which are implemented as follows:
a compatibility testing method, comprising: obtaining a test parameter; the test parameters include: the name of the compatibility calling service and the code version of the service in the compatibility calling service; determining a code version combination according to the test parameters; acquiring an IP address of a server to be tested, and determining a target server corresponding to the code version combination according to a preset corresponding relation between the IP address and a service code version; and carrying out compatibility test on the target server.
In a preferred embodiment, the code version combination includes: the compatibility calls one or more of all combinations of service code versions in the service.
In a preferred scheme, the code version combination selects one or more of all combinations of service code versions in the compatibility calling service according to a preset rule.
In a preferred embodiment, the determining a target server according to a preset correspondence between an IP address and a service code version specifically includes: and determining an IP address corresponding to each code version combination according to the code version combination and the corresponding relation, wherein a server corresponding to the IP address is determined as a target server.
In a preferred embodiment, the test parameters further include: a case script to be tested; the case script to be tested comprises one or more test cases.
In a preferred embodiment, the performing the compatibility test on the target server specifically includes: and determining a test path list of the target server according to the to-be-tested case, and sending the to-be-tested case script to the target server according to the test path list to perform compatibility test.
In a preferred embodiment, the test path list includes one or more server test paths.
In a preferred embodiment, determining the test path list of the target server according to the to-be-tested case includes: and determining the sequence of calling the target server according to the sequence of calling the service names corresponding to the test cases, wherein the sequence of calling the target server is a test path.
In a preferred embodiment, the compatibility testing method further includes: verifying the validity of the acquired IP address of the server to be tested; accordingly, the determining a target server comprises: and determining a target server to be detected according to the validity check result, and determining a target server in the target server to be detected according to the corresponding relation between the preset IP address and the service code version.
In an optimal scheme, the verifying the validity of the obtained IP address of the server to be tested includes: and acquiring an IP address list, and checking whether the IP address list contains the IP address of the server to be tested, wherein if the IP address list contains the IP address of the server to be tested, the IP address of the server to be tested is legal.
A compatibility testing apparatus, comprising: the system comprises a parameter acquisition unit, a code version combination determination unit, a target server determination unit and a test unit; the parameter acquiring unit is used for acquiring test parameters; the test parameters include: the name of the compatibility calling service and the code version of the service in the compatibility calling service; the test parameters also comprise a case script to be tested; the code version combination determining unit is used for determining a code version combination according to the test parameters in the parameter acquiring unit; the target server determining unit is used for acquiring the IP address of the server to be tested and determining the target server corresponding to the code version combination in the code version combination determining unit according to the corresponding relation between the preset IP address and the service code version; and the testing unit is used for carrying out compatibility test on the target server determined in the target server determining unit.
In a preferred embodiment, the target server determining unit includes: the server to be tested comprises an IP address obtaining unit and a server determining unit; the server to be tested IP acquisition unit is used for acquiring the IP address of the server to be tested; and the server determining unit is used for determining a target server in the server to be detected in the server IP acquiring unit to be detected according to the corresponding relation between the preset IP address and the service code version.
In a preferred embodiment, the target server determining unit further includes an IP address verifying unit; the IP address verification unit is used for acquiring an IP address list and verifying the validity of the IP address of the server to be tested in the IP acquisition unit of the server to be tested according to the IP address list; correspondingly, the server determining unit is configured to determine a target server in the legitimate server to be tested in the IP address verification unit according to a preset correspondence between the IP address and the service code version.
In a preferred embodiment, the compatibility testing unit includes: the test system comprises a test list construction unit and a test case sending execution unit; the test list constructing unit is used for determining a test path list of the target server according to the to-be-tested case; the test path list comprises one or more server test paths; and the test case sending execution unit is used for sending the case script to be tested to the target server for compatibility test according to the test list determined by the test list construction unit.
According to the technical scheme provided by the embodiment of the application, the compatibility testing method and the compatibility testing device disclosed by the embodiment of the application automatically deploy the code version combination according to the acquired name of the compatibility calling service and the code version of the service in the compatibility calling service. According to the corresponding relation between the preset IP address and the service code version, the target server corresponding to the code version combination can be quickly determined. And automatically constructing a test list according to the obtained test case. Therefore, the compatibility test method and the device disclosed by the embodiment of the application do not need manual deployment and code version switching combination, can improve the execution efficiency of the compatibility test, and can ensure that the condition of omitting a certain calling path in the deployment process can not occur, thereby improving the accuracy of the compatibility test.
Detailed Description
The embodiment of the application provides a compatibility testing method and device.
In order to make those skilled in the art better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Fig. 1 is a flowchart of an embodiment of a compatibility testing method of the present application. As shown in fig. 1, the compatibility testing method may include:
s100: obtaining a test parameter; the test parameters include: a name of a compatibility call service and a code version of a service in the compatibility call service.
The compatibility testing device may obtain testing parameters, which may include: a name of a compatibility call service and a code version of a service in the compatibility call service.
The name of the compatibility call service may be used to indicate the name of the service for which a compatibility test is required.
For example, a piece of software may include services A, B, C and D, and the name of the compatibility call service may include: service a, service B, and service D may indicate that the compatibility of service a, service B, and service D needs to be tested.
The code version of the service in the compatibility calling service can be used for expressing the code version included by the service needing to be tested in the compatibility calling service. For example, service A may include a new version code and an old version code, and service B may include an old version code.
The test parameters may further include: and the script of the case to be tested and the like. The case script to be tested can be used for testing the service to be tested. The case script to be tested may include one or more test cases.
S200: and determining code version combination according to the test parameters.
The compatibility testing device may determine a code version combination according to the name of the compatibility calling service and the code version of the service in the compatibility calling service.
The code version combination may include: the compatibility calls one or more of all combinations of service code versions in the service. The code version combination may select one or more of all combinations of service code versions in the compatibility calling service according to a preset rule, for example, one or more of all combinations of service code versions in the compatibility calling service may be selected according to information preset by a user.
For example, the service a includes a new version code and an old version code, the service B includes an old version code, and the service D includes a new version code and an old version code. Then, the code version combination may include: "New A, old B and New D", "New A, old B and old D", "old A, old B and New D", and "old A, old B and old D". The code version combination may also be "New A, old B, and New D". The code version combination can be selected according to preset rules.
S300: and acquiring the IP address of the server to be tested, and determining a target server corresponding to the code version combination according to the corresponding relation between the preset IP address and the service code version.
The compatibility testing device can acquire the IP address of the server to be tested. The IP address of the server to be tested may be preset or may be set by the user. The IP address of the server to be tested may represent an IP address of a server that needs to perform a compatibility test. The IP address of the server under test may include IP addresses of one or more servers.
The preset correspondence between the IP address and the service code version may be used to express the version of the service code running on the server corresponding to the IP address. For example, the IP address "xxx.xx.xxx.01" corresponds to the sending server being "server 1", and the service code running on the "server 1" is "new code of a service a".
And determining the target server according to the corresponding relation between the preset IP address and the service code version. Specifically, according to each code version combination in the code version combinations and the corresponding relationship, an IP address corresponding to each code version combination may be determined, and a server corresponding to the IP address may be determined as a target server.
The target server may be one or more servers corresponding to code combinations of the compatibility test, and each set of code combinations may correspond to one or more target servers.
In another embodiment, the compatibility testing method may further include: and checking the validity of the acquired IP address of the server to be tested. The method specifically comprises the following steps: and acquiring an IP address list, and checking whether the IP address list contains the IP address of the server to be tested, wherein if the IP address list contains the IP address of the server to be tested, the IP address of the server to be tested can be legal. The list of IP addresses may include the IP addresses of all available servers. The list of IP addresses may be obtained by a configuration center, which may be used to store the IP addresses of all servers.
Accordingly, the determining a target server may include: and eliminating the IP addresses which are different from the IP address of the server to be detected in the IP address list, wherein the server corresponding to the eliminated IP address list can be a target server to be detected, the IP address corresponding to each code version combination in the eliminated IP address list can be determined according to the preset corresponding relation between the IP address and the service code version, and the server corresponding to the IP address can be determined as the target server.
S400: and carrying out compatibility test on the target server.
The compatibility testing device may perform compatibility testing on the target server, and specifically may include: and determining a test path list of the target server according to the to-be-tested case, and sending the to-be-tested case script to the target server for compatibility test according to the test path list.
The test path list may include one or more server test paths. The server test path may be used to represent servers that are sequentially tested in a process of performing one compatibility test on one test case.
Determining the test path list of the target server according to the to-be-tested case may include: and determining the sequence of calling the target server according to the sequence of calling the service names corresponding to the test cases, wherein the sequence of calling the target server can be a test path.
For example, assume that a certain code version combination is: the A old version, the B old version and the D new version, and target servers corresponding to the code version combination are shown in Table 1.
TABLE 1
| Target server name |
Service version |
| Server 1 |
Old version A |
| Server 2 |
Old version A |
| Server 3 |
B old edition |
| Server 4 |
B old edition |
| Server 5 |
D New edition |
| Server 6 |
D New edition |
Suppose that the sequence of calling service names corresponding to a certain test case is as follows: service B → service a → service D.
Then, determining the list of server test paths corresponding to the test case may include:
test path 1: server 3 → server 1 → server 5;
test path 2: server 3 → server 1 → server 6;
test path 3: server 3 → server 2 → server 5;
test path 4: server 3 → server 2 → server 5;
test path 5: server 4 → server 1 → server 5;
test path 6: server 4 → server 1 → server 5;
test path 2: server 4 → server 2 → server 5;
test path 7: server 4 → server 2 → server 6.
The test case may be sent for compatibility testing according to the test paths 1-7.
The case script to be tested can be sent to the target server in a ssh (Secure Shell) instruction mode, and the case script to be tested is executed.
In another embodiment, the compatibility testing method may further include: and obtaining a compatibility test result.
The compatibility test results may be obtained by a third party tool. Further, the compatibility test result can be analyzed. Further, the compatibility test result and the analysis result may be displayed.
In the compatibility testing method disclosed in the above embodiment, a code version combination is automatically deployed according to the obtained name of the compatibility calling service and the code version of the service in the compatibility calling service. According to the corresponding relation between the preset IP address and the service code version, the target server corresponding to the code version combination can be quickly determined. And automatically constructing a test list according to the obtained test case. The compatibility testing method disclosed by the embodiment of the application does not need manual deployment and code version switching combination, can improve the execution efficiency of the compatibility testing, and can ensure that the condition of omitting a certain calling path in the deployment process is avoided, thereby improving the accuracy of the compatibility testing.
FIG. 2 is a block diagram of an embodiment of a compatibility testing apparatus of the present application. As shown in fig. 2, the compatibility testing apparatus may include: a parameter acquisition unit 100, a code version combination determination unit 200, a target server determination unit 300, and a test unit 400. Wherein,
the parameter obtaining unit 100 may be configured to obtain a test parameter. The test parameters may include: a name of a compatibility call service and a code version of a service in the compatibility call service. The test parameters can also comprise information such as a case script to be tested.
The code version combination determining unit 200 may be configured to determine a code version combination according to the test parameters in the parameter obtaining unit 100.
The target server determining unit 300 may be configured to obtain an IP address of a server to be tested, and determine a target server corresponding to the code version combination in the code version combination determining unit 200 according to a preset correspondence between the IP address and the service code version.
Fig. 3 is a block diagram of a target server determination unit in an embodiment of the compatibility test apparatus of the present application. As shown in fig. 3, the target server determining unit 300 may include: a server to be tested IP address acquisition unit 301 and a server determination unit 302.
The server to be tested IP obtaining unit 301 may be configured to obtain an IP address of the server to be tested.
The server determining unit 302 may be configured to determine a target server in the servers to be tested in the server to be tested IP obtaining unit 301 according to a preset correspondence between an IP address and a service code version.
In another embodiment, the target server determining unit 300 may further include: an IP address verification unit 303. The IP address verifying unit 303 may be configured to obtain an IP address list, and verify the validity of the IP address of the server to be tested in the server to be tested IP obtaining unit 301 according to the IP address list.
Accordingly, the server determining unit 302 may be configured to determine a target server in the legitimate servers to be tested in the IP address verifying unit 303 according to a preset correspondence between the IP address and the service code version.
The testing unit 400 may be configured to perform a compatibility test on the target server determined in the target server determining unit 300.
FIG. 4 is a block diagram of a test unit in an embodiment of the compatibility testing apparatus of the present application. As shown in fig. 4, the test unit 400 may include: a test list construction unit 401 and a test case transmission execution unit 402.
The test list constructing unit 401 may be configured to determine a test path list of the target server according to the to-be-tested case. The test path list may include one or more server test paths. The server test path may be used to represent servers that are sequentially tested in a process of performing one compatibility test on one test case.
The test case sending execution unit 402 may be configured to send the to-be-tested case script to the target server for performing a compatibility test according to the test list determined by the test list construction unit 401.
In another embodiment, the compatibility testing apparatus may further include: the test result unit 500. The test result unit 500 may be configured to obtain a compatibility test result. Further, the test result unit 500 may be further configured to analyze the compatibility test result. Further, the test result unit 500 may also be used to display the compatibility test result and the analysis result.
The compatibility testing device disclosed by the embodiment corresponds to the compatibility testing method embodiment, the compatibility testing device can realize the compatibility testing method embodiment, and the technical effect of the compatibility testing method embodiment is achieved.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate a dedicated integrated circuit chip 2. Furthermore, nowadays, instead of manually making an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Language Description Language), traffic, pl (core unified Programming Language), HDCal, jhddl (Java Hardware Description Language), langue, Lola, HDL, laspam, hardbyscript Description Language (vhigh Description Language), and vhigh-Language (Hardware Description Language), which is currently used by most popular. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, AtmelAT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory.
Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
From the above description of the embodiments, it is clear to those skilled in the art that the present application can be implemented by software plus necessary general hardware platform. With this understanding in mind, the present solution, or portions thereof that contribute to the prior art, may be embodied in the form of a software product, which in a typical configuration includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory. The computer software product may include instructions for causing a computing device (which may be a personal computer, a server, or a network device, etc.) to perform the methods described in the various embodiments or portions of embodiments of the present application. The computer software product may be stored in a memory, which may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium. Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include transitory computer readable media (transient media), such as modulated data signals and carrier waves.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The application is operational with numerous general purpose or special purpose computing system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
While the present application has been described with examples, those of ordinary skill in the art will appreciate that there are numerous variations and permutations of the present application without departing from the spirit of the application, and it is intended that the appended claims encompass such variations and permutations without departing from the spirit of the application.