CN110213119B - Test pile generation method, test system, test method and test equipment - Google Patents
Test pile generation method, test system, test method and test equipment Download PDFInfo
- Publication number
- CN110213119B CN110213119B CN201810186432.4A CN201810186432A CN110213119B CN 110213119 B CN110213119 B CN 110213119B CN 201810186432 A CN201810186432 A CN 201810186432A CN 110213119 B CN110213119 B CN 110213119B
- Authority
- CN
- China
- Prior art keywords
- test
- module
- pile
- communication protocol
- data
- 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
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/50—Testing arrangements
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/18—Multiprotocol handlers, e.g. single devices capable of handling multiple protocols
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Computer And Data Communications (AREA)
Abstract
The embodiment of the invention provides a test pile generation method, a test system, a test method and test equipment, and belongs to the technical field of computers. The test pile generation method comprises the following steps: receiving a test pile generation instruction, wherein the test pile generation instruction comprises a communication protocol identifier and pile number, the communication protocol identifier is used for indicating the type of the test pile, and the pile number is used for indicating the number of the test pile; and generating corresponding test piles according to the test pile generation instruction, wherein the test piles are used for responding to data requests of the tested system, and the test piles of different types have the same general functions. According to the embodiment of the invention, the test piles are generated according to the pile number included in the test pile generation instruction and the communication protocol identification used for indicating the type of the test pile, and because the test piles of different types have the same general functions and are not mutually independent systems, the test piles of different types and different numbers can be dynamically generated, the flexibility of generating the test piles is improved, and the processing cost of testing can be saved.
Description
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a test pile generation method, a test system, a test method and test equipment.
Background
In the field of communications technology, communications between devices require support from the communication system in which the devices operate, in addition to hardware support. The communication system, when operating, requests its own required data from other systems. Therefore, when testing the communication system, the developer needs to simulate other systems requested by the tested communication system through the testing stub to respond to the data request of the tested communication system.
In the related art, different communication systems may communicate with other systems based on different communication protocols. Therefore, when testing a plurality of communication systems based on different communication protocols, it is necessary to perform the test through a plurality of test stubs. Wherein the plurality of test stakes are mutually independent systems and respectively correspond to different communication systems.
In the related art, since different test stubs are mutually independent systems, when testing a plurality of communication systems based on different communication protocols, a plurality of mutually independent test stubs need to be operated simultaneously, that is, a plurality of mutually independent systems need to be operated simultaneously to test the plurality of communication systems, which results in an excessive processing overhead of the test.
Disclosure of Invention
The embodiment of the invention provides a test pile generation method, a test system, a test method and test equipment, which can be used for solving the problem that when a plurality of communication systems based on different communication protocols are tested, a plurality of mutually independent test piles need to be operated simultaneously, so that the processing cost of the test is overlarge. The technical scheme is as follows:
in one aspect, a test pile generation method is provided, and the method includes:
receiving a test pile generation instruction, wherein the test pile generation instruction comprises a communication protocol identifier and pile number, the communication protocol identifier is used for indicating the type of a test pile, and the pile number is used for indicating the number of the test piles;
and generating corresponding test piles according to the test pile generation instruction, wherein the test piles are used for responding to data requests of a tested system, and the test piles of different types have the same general functions.
In another aspect, there is provided a test pile generating apparatus, the apparatus including:
the test pile module is used for receiving a test pile generation instruction, wherein the test pile generation instruction comprises a communication protocol identifier and pile number, the communication protocol identifier is used for indicating the type of the test pile, and the pile number is used for indicating the number of the test pile;
the test pile module is also used for generating corresponding test piles according to the test pile generation instruction, the test piles are used for responding to data requests of a tested system, and the test piles of different types have the same general functions.
In yet another aspect, a test system is provided, the system comprising: the test pile comprises a test pile management module and a test pile module, wherein the test pile module comprises a general submodule and different protocol submodules;
the test pile management module is used for calling the test pile module;
the universal submodule is used for receiving a data request sent by a tested system;
the protocol submodule is used for acquiring response data according to the data request, and the data request and the protocol submodule correspond to the same communication protocol;
the universal submodule is also used for sending the response data to the tested system.
In another aspect, a testing method is provided, where the method is applied to a testing system, and the testing system includes: the test pile comprises a test pile management module and a test pile module, wherein the test pile module comprises a general submodule and different protocol submodules;
the method comprises the following steps:
the test pile management module calls the test pile module;
the universal submodule receives a data request sent by a tested system;
the protocol sub-module acquires response data according to the data request, and the data request and the protocol sub-module correspond to the same communication protocol;
and the universal submodule sends the response data to the tested system.
In a further aspect, there is provided a computer device comprising a processor and a memory having stored therein at least one instruction, at least one program, set of codes, or set of instructions which, when executed by the processor, implements a test stake generation method or a test method as described in the above aspects.
In a further aspect, there is provided a computer readable storage medium having stored therein at least one instruction, at least one program, a set of codes, or a set of instructions which, when executed, implement a test stake generation method or a test method as described in the above aspects.
In a further aspect, a computer program product is provided for performing the test stake generation method or the test method of the above aspects when the computer program product is executed.
The technical scheme provided by the embodiment of the invention can bring the following beneficial effects:
in the embodiment of the invention, the test piles are generated according to the pile number included in the test pile generation instruction and the communication protocol identification used for indicating the type of the test pile, and because the test piles of different types have the same general functions and are not mutually independent systems, the test piles of different types and different numbers can be dynamically generated, and the flexibility of generating the test piles is improved; in addition, the testing pile management module calls the testing pile module to realize the testing pile function to test, so that the processing expense of the test can be saved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic diagram of an application scenario of a test system provided by an embodiment of the invention;
FIG. 2 is an architecture diagram of a test system provided by one embodiment of the present invention;
FIG. 3 is an architecture diagram of a test system provided by another embodiment of the present invention;
FIG. 4 is an architecture diagram of a test system provided by another embodiment of the present invention;
FIG. 5 is a flow chart of a testing method provided by one embodiment of the present invention;
FIG. 6 is a flow chart of a test pile generation method provided by an embodiment of the invention;
fig. 7 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
Referring to fig. 1, a schematic diagram of an application scenario of a test system according to an embodiment of the present invention is shown. The application scene comprises the following steps: a test system 110, a system under test 120, and a control system 130.
The test system 110 is used to simulate other systems requested by the system under test 120 in response to data requests from the system under test 120.
The system under test 120 refers to a communication system that needs to be tested. The system under test 120 sends a data request to the test system 110. The test system 110 returns response data to the system under test 120 in response to the data request, so that the test on the system under test 120 can be completed.
The control system 130 is used to control the test system 110. The control system 130 may interact directly with the user to control the test system 110 according to instructions input by the user. It should be noted that the control system 130 may control one test system 110, or may control a plurality of test systems 110 at the same time.
It should be noted that only one tested system 120 is shown in the figure, but in practical applications, the testing system 110 may respond to data requests of multiple tested systems 120 at the same time, and test multiple tested systems 120 at the same time. The multiple systems under test 120 may correspond to different communication protocols or may correspond to the same communication protocol.
Referring to fig. 2, an architecture diagram of a test system 110 according to an embodiment of the invention is shown. The test system 110 includes: a test stub management module 111 and a test stub module 112. The test pile module 112 includes: a general submodule 112a and a different protocol submodule 112 b. The different protocol sub-modules 112b correspond to different communication protocols, respectively.
The test stub management module 111 is used to manage the test stub module 112, for example, to invoke the test stub module 112.
The test stub module 112 is used to respond to data requests of the system under test 120. The general sub-module 112a is used to implement functions that do not relate to communication protocols, such as receiving, transmitting, delaying, etc. The protocol sub-module 112b is used for implementing functions related to a communication protocol, such as determining data requested by a hypertext Transfer protocol (HTTP) -based web page request.
Optionally, as shown in fig. 3, the test system 110 further comprises a test agent module 113. The test agent module 113 is used to communicate with the control system 130, for example, to receive commands and data sent by the control system 130.
Next, a process of testing the system under test 120 using the test system 110 will be described.
And the test stub management module 111 is used for calling the test stub module 112.
The test stub management module 111 may invoke the test stub module 112 to generate a test stub, which responds to data requests of the system under test 120 based on the generated test stub. The test pile module 112 includes a general sub-module 112a and different protocol sub-modules 112b, and the different protocol sub-modules 112b correspond to different communication protocols, respectively. The test stub management module 111 generates a test stub by calling the general submodule 112a and the protocol submodule 112b to call the test stub module 112. A test stub refers to a process created by invoking the test stub module 112. Test system 110 generates a test stub for each test of system under test 120. The test stub implements a function of responding to a data request of the system under test 120 through the test stub generated by the general submodule 112a and the protocol submodule 112 b.
Illustratively, the testing pile module comprises a general sub-module D, and further comprises a protocol sub-module a corresponding to the communication protocol a, and a protocol sub-module B corresponding to the communication protocol B.
When a plurality of test piles corresponding to different communication protocols need to be generated, the test pile management module 111 calls the test pile module 112, for example, sends a test pile generation instruction to the test pile module 112, where the test pile generation instruction includes a communication protocol identifier and a pile number. The test stub management module 111 calls the general submodule 112a based on the test stub generation instruction and calls the protocol submodule 112b corresponding to the different communication protocol, thereby generating a plurality of test stubs corresponding to the different communication protocols. Illustratively, one test stub corresponding to communication protocol a and one test stub corresponding to communication protocol B need to be generated. The test pile management module 111 generates a test pile a by calling the general submodule D and the protocol submodule a corresponding to the communication protocol a, and generates a test pile B by calling the protocol submodule B corresponding to the communication protocol B.
If the testing system 110 tests multiple systems under test 120 simultaneously and the multiple systems under test 120 correspond to the same communication protocol, the testing system 110 needs to generate multiple testing stubs corresponding to the same communication protocol. The test stub management module 111 calls the test stub module 112 multiple times to generate a plurality of test stubs corresponding to the same communication protocol. The test stub management module 111 calls the general sub-module 112a, and calls the same protocol sub-module 112b corresponding to the same communication protocol multiple times according to the number of test stubs to be generated, thereby generating a plurality of test stubs corresponding to the same communication protocol. Exemplarily, the system under test a1 and the system under test a2 correspond to the same communication protocol a, and two test stubs corresponding to the communication protocol a need to be generated. Test stub management module 111 invokes general submodule D and invokes protocol submodule a corresponding to communication protocol a twice, generating test stub a1 and test stub a 2. Test peg a1 and test peg a2 both correspond to communication protocol a. Test stub A1 is used to test system under test A1 in response to data requests by system under test A1. Test stub A2 is used to test system under test A2 in response to data requests by system under test A2.
The test stub management module 111 may also invoke the test stub module 112 to directly respond to the data request of the system under test 120 without generating a test stub in advance. The test stub management module 111 directly calls the general submodule 112a and calls the corresponding protocol submodule 112b according to the communication protocol of the system under test 120, so as to respond to the data request of the system under test 120.
Optionally, the test stub management module 111 is configured to obtain a communication protocol identifier, and call the test stub module 112 according to the communication protocol identifier. The communication protocol identification is used to uniquely indicate a test stub type. Different types of test stakes correspond to different communication protocols, i.e., to different protocol sub-modules 112 b. The common functions of the different types of test stakes are the same, which refers to functions that do not involve a communication protocol. The test stub management module 111 stores a configuration file, which includes correspondence between communication protocol identifiers, communication protocols, and the protocol sub-module 112 b. The test stub management module 111 calls the protocol sub-module 112b indicated by the communication protocol identifier according to the configuration file to call the test stub module 112. Illustratively, the correspondence of the communication protocol identification, the communication protocol and the protocol sub-module 112b is shown in the following table-1:
communication protocol identification | Communication protocol | Protocol submodule |
A | HTTP | Protocol submodule A |
B | TELNET | Protocol submodule B |
C | SMTP | Protocol submodule C |
TABLE-1
As shown in table-1 above, the communication protocol identification A, HTTP corresponds to the protocol sub-module a. The test stub management module 111 invokes the protocol sub-module a according to the communication protocol identifier a to generate a test stub for testing the system under test based on the HTTP communication protocol, or directly responds to a data request of the system under test.
It should be noted that the configuration file is preset by a designer according to the protocol sub-module 112b, the communication protocol corresponding to the protocol sub-module 112b, and the communication protocol identifier corresponding to the protocol sub-module 112 b. The communication protocol identifier corresponding to the protocol sub-module 112b may be preset by a designer. For example, the test system 110 includes a protocol sub-module a corresponding to the HTTP communication protocol, and a communication protocol identifier corresponding to the protocol sub-module a is a, and a correspondence relationship between the communication protocol identifier A, HTTP and the protocol sub-module a is set in the configuration file in advance. Optionally, the correspondence in the configuration file may be extended. When the protocol sub-module 112b is added in the test system 110, the correspondence relationship of the added protocol sub-module 112b may be set in a configuration file.
When the test pile management module 111 calls the test pile module 112 to generate a test pile, a test pile generation instruction is first sent to the test pile module 112. The test pile generation instruction comprises a communication protocol identifier and pile number, and the pile number is used for indicating the number of the test piles. After receiving the test pile generation instruction, the test pile module 112 generates a corresponding test pile by combining the number of test piles indicated by the pile number through the protocol sub-module 112b and the universal sub-module 112a indicated by the communication protocol identifier.
In one possible embodiment, the test stub management module 111 is configured to invoke the test stub module 112 to generate a test stub when the test system 110 is started. When the test system 110 is started, the communication protocol identifier corresponding to the protocol submodule 112b in the test pile module 112 to be called by the test pile management module 111 and the number of test piles to be generated may be preset by a designer according to actual experience, or may be preset by a user in a user-defined manner. The test pile management module 111 calls the test pile module 112 to generate test piles according to the preset communication protocol identifier and the number of the test piles to be generated.
In another possible embodiment, the test agent module 113 is configured to obtain the operation instruction. The operation instruction comprises at least one communication protocol identification, the number of piles corresponding to each communication protocol identification, and an operation identification corresponding to each communication protocol identification. The operation identifier is used to indicate the operation type, which includes but is not limited to: call operation or stop operation. Invoking the operation refers to invoking the test stub module 112 to generate the test stub. The stop operation means to stop calling the test pile module 112 and destroy the test pile. The test agent module 113 is further configured to send a call instruction to the test stub management module 111 when the operation type indicated by the operation identifier is a call operation, where the call instruction includes a communication protocol identifier and a stub number corresponding to the communication protocol identifier. At this time, the number of stubs in the call instruction indicates the number of test stubs required to be generated. And the test pile management module 111 is used for calling the test pile module 112 according to the calling instruction to generate the test pile. Illustratively, the operation instruction includes a communication protocol identifier a, and the number of stakes corresponding to the communication protocol identifier a: 2. the operation identifier corresponding to the communication protocol identifier a: calling operation, a communication protocol identifier B and the quantity of piles corresponding to the communication protocol identifier B: 1. and an operation identifier corresponding to the communication protocol identifier B. The operation types indicated by the two operation identifiers are calling operations. The test agent module 113 sends a call instruction to the test stub management module 111 according to the operation instruction. The test stub management module 111 calls the test stub module 112 according to the call instruction, and generates two test stubs corresponding to the communication protocol identifier a and one test stub corresponding to the communication protocol identifier B.
Alternatively, the test stub management module 111 calls the test stub module 112 to directly respond to the data request of the system under test 120. And the test agent module 113 is used for acquiring the operation instruction. The operation instruction comprises at least one communication protocol identification and an operation identification corresponding to each communication protocol identification. When the operation type indicated by the operation identifier is a call operation, the test agent module 113 sends a call instruction to the test stub management module 111, where the call instruction includes a communication protocol identifier. And the test stub management module 111 is configured to call the test stub module 112 according to the call instruction, and respond to a data request of the system under test 120.
Optionally, a control system 130, configured to send an operation instruction to the test agent module 113. The control system 130 sends an operation instruction to the test agent module 113 according to the communication protocol identification, the number of stubs, and the operation type input by the user.
The general sub-module 112a is configured to receive a data request sent by the system under test 120.
When the testing pile management module 111 calls the testing pile module 112 to generate a testing pile, data interaction is performed between the testing pile and the system 120 to be tested. Because the test stub is a process created by invoking the test stub module 112, the data interaction between the test stub and the system under test 120 is an interaction between the test stub module 112 and the system under test 120. In the test, after the system under test 120 sends a data request, the general-purpose sub-module 112a in the testing stub module 112 receives the data request sent by the system under test 120. When the test stub module 111 calls the test stub module 112 to directly respond to the data request of the system under test 120, the generic sub-module 112a in the test stub module 112 receives the data request sent by the system under test 120.
Optionally, the test stub management module 111 is further configured to send the generated stub information of the test stub to the test agent module 113 before data interaction is performed between the test stub module 112 and the system under test 120. The test agent module 113 is further configured to send the stub information to the control system 130. The control system 130 displays the stub information to the user. The stub information includes, but is not limited to, first address information and a communication protocol identification. The user determines the communication protocol corresponding to the generated test stub according to the communication protocol identifier, thereby determining the system 120 under test that the test stub can test, and then inputs the first address information into the system 120 under test. The tested system 120 obtains the first address information input by the user, and sends a data request to the test pile according to the first address information. Optionally, the first address information is a Socket address.
And the protocol sub-module 112b is used for acquiring response data according to the data request.
The tested system 120 and the testing stub module 112 perform data interaction based on the same communication protocol, and therefore, the data request of the tested system 120 is sent based on the communication protocol. The protocol sub-module 112b corresponding to the communication protocol parses the data request based on the communication protocol, and acquires response data according to the parsing result. For example, the data type requested by the data request is parsed based on the communication protocol, and response data of the data type is acquired.
The general sub-module 112a is further configured to send response data to the system under test 120.
The general submodule 112a sends the response data obtained by the protocol submodule 112b to the system under test 120, and completes the response of the data request.
In one possible implementation, the data request sent by the system under test 120 includes the second address information. The general-purpose submodule 112a transmits response data to the system under test 120 according to the second address information.
In another possible implementation, the data request sent by the system under test 120 includes the second address information and the system identifier. The system identification is used to uniquely identify a system under test 120. When a plurality of systems under test 120 share the same second address information, the general-purpose submodule 112a transmits response data to the systems under test 120 according to the second address information and the system identification.
Optionally, the test agent module 113 is further configured to obtain an operation instruction after the test is finished. The operation instruction comprises at least one communication protocol identification, the number of piles corresponding to each communication protocol identification, and an operation identification corresponding to each communication protocol identification. The test agent module 113 is further configured to send a stop instruction to the test stub management module 111 when the operation type indicated by the operation identifier is a stop operation, where the stop instruction includes a communication protocol identifier and a stub number corresponding to the communication protocol identifier. At this time, the number of piles in the stop instruction indicates the number of test piles required to be destroyed. The test pile management module 111 is further configured to stop calling the test pile module 112 according to the stop instruction, and destroy the test pile generated by calling the target test pile module 1121. Illustratively, the operation instruction includes a communication protocol identifier a, and the number of stakes corresponding to the communication protocol identifier a: 2. the operation identification corresponding to the communication protocol identification A, the communication protocol identification B and the pile number corresponding to the communication protocol identification B are as follows: 1. and an operation identifier corresponding to the communication protocol identifier B. The operation types indicated by the two operation identifiers are stop operations. The test agent module 113 sends a stop instruction to the test stub management module 111 according to the operation instruction. The test pile management module 111 stops calling the test pile module 112 according to the stop instruction, and destroys the two test piles corresponding to the communication protocol identifier a and the one test pile corresponding to the communication protocol identifier B.
Alternatively, the test stub management module 111 calls the test stub module 112 to directly respond to the data request of the system under test 120. The test agent module 113 is further configured to send a stop instruction to the test stub management module 111 when the operation type indicated by the operation identifier is a stop operation, where the stop instruction includes a communication protocol identifier. And the test pile management module 111 is used for calling the test pile module 112 according to the stop instruction.
Optionally, as shown in fig. 4, the test system 110 further includes a stub data storage module 114. The stub data storage module 114 is used to store data required for testing the system under test 120.
Optionally, the test agent module 113 is further configured to obtain preset data before invoking the test stub module 112. The preset data is preset by the designer according to the system under test 120 and actual experience. Different systems under test 120 correspond to different predetermined data. Wherein, the preset data comprises the response data. The control system 130 is configured to obtain preset data input by a user, and send the preset data to the test agent module 113. The test agent module 113 is further configured to send the preset data to the stub data storage module 114. And the stub data storage module 114 is used for storing preset data. And the protocol sub-module 112b is configured to obtain response data from the stub data storage module 114 according to the data request.
Optionally, since different tested systems 120 correspond to different preset data, when acquiring the preset data input by the user, the control system 130 further acquires a system identifier corresponding to the preset data. The test agent module 113 obtains the preset data and the system identifier corresponding to the preset data sent by the control system 130, and sends the preset data and the system identifier corresponding to the preset data to the stub data storage module 114. The stub data storage module 114 stores preset data and a system identifier corresponding to the preset data. The protocol sub-module 112b determines preset data corresponding to the system under test 120 according to the system identifier in the data request, and then obtains response data from the preset data.
Optionally, the test agent module 113 is further configured to obtain a data deletion instruction sent by the control system 130, and delete the preset data stored in the stub data storage module 114 according to the data deletion instruction. The control system 130 sends a data deletion instruction to the test agent module 113, so that the test agent module 113 can delete the preset data stored in the stub data storage module 114 after the test is finished, and the storage space of the test system 110 is saved.
Optionally, the data deletion instruction comprises a system identification. The test agent module 113 deletes the preset data corresponding to the system identifier stored in the stub data storage module 114 according to the system identifier. When the test of the system under test 120 is completed, only the preset data corresponding to the tested system 120 after the test is completed can be deleted by deleting the preset data corresponding to the system identifier, so that the space is saved, the deletion of the preset data corresponding to other systems under test 120 is avoided, and the test of other systems under test 120 is not affected.
In the embodiment of the invention, the test pile module is called through the test pile management module to generate the test pile for testing the tested system. Because the test piles are tested on the basis of the same universal submodule, different test piles share the same universal submodule and are not mutually independent systems, and the processing expense of the test is saved.
Referring to fig. 5, a flowchart of a test pile generation method according to an embodiment of the present invention is shown. The method can be applied to the test system shown in fig. 1. The method may include the steps of:
When the tested system is tested, the test pile management module needs to call the test pile module to generate a test pile, and the test pile is used for responding to a data request of the tested system. When the test pile management module calls the test pile module to generate a test pile, a test pile generation instruction is firstly sent to the test pile module. The test pile generation instruction includes a communication protocol identifier and a pile number, where the communication protocol identifier is used to indicate a type of a test pile to be generated, and the pile number may be determined according to an actual situation.
And 502, generating corresponding test piles according to the test pile generation instruction, wherein the test piles of different types have the same general functions.
And after the test pile module receives a test pile generation instruction, generating a corresponding test pile by combining the test pile number indicated by the pile number through the protocol sub-module and the universal sub-module indicated by the communication protocol identification. The test piles are used for responding to data requests of the tested system, and the test piles of different types have the same general functions, namely share the same general sub-module.
Optionally, after the test pile is generated, the test pile module receives a data request sent by the system under test based on the test pile, obtains response data according to the data request, and finally sends the response data to the system under test.
In the embodiment of the invention, the test piles are generated according to the pile number included in the test pile generation instruction and the communication protocol identification used for indicating the type of the test pile, and the test piles of different types are the same in general function and are not mutually independent systems, so that the test piles of different types and different numbers can be dynamically generated, the flexibility of generating the test piles is improved, and the processing cost of testing can be saved.
Referring to fig. 6, a flowchart of a testing method according to an embodiment of the invention is shown. The method can be applied to the test system shown in fig. 1. The method may include the steps of:
The test pile management module can call the test pile module to generate a test pile, and the generated test pile responds to a data request of the tested system. The test pile module comprises a general submodule and a protocol submodule. The test pile management module calls the test pile module by calling the universal sub-module and the protocol sub-module to generate the test pile. A test stub refers to a process created by invoking a test stub module. The test pile realizes the subsequent steps through the universal sub-module and the protocol sub-module so as to respond to the data request.
The testing pile module comprises a general submodule and different protocol submodules, and the different protocol submodules correspond to different communication protocols respectively.
When a plurality of test piles corresponding to different communication protocols need to be generated, the test pile management module calls the test pile module. The testing pile management module calls the universal sub-module and calls a plurality of protocol sub-modules corresponding to different communication protocols, so that a plurality of testing piles corresponding to different communication protocols are generated.
The test system is capable of testing multiple systems under test simultaneously. If multiple systems under test correspond to the same communication protocol, the test system needs to generate multiple test stubs corresponding to the same communication protocol. The test pile management module calls the test pile module for multiple times to generate a plurality of test piles corresponding to the same communication protocol. The test pile management module calls the universal sub-modules, and calls the same protocol sub-modules corresponding to the same communication protocol for multiple times according to the number of the test piles required to be generated, so that a plurality of test piles corresponding to the same communication protocol are generated.
The test pile management module can also call the test pile module to directly respond to the data request of the tested system without generating the test pile in advance. The test pile management module directly calls the universal sub-modules and calls the corresponding protocol sub-modules according to the communication protocol of the tested system so as to respond to the data request of the tested system.
Optionally, the testing stub management module obtains a communication protocol identifier, and calls the testing stub module according to the communication protocol identifier. The communication protocol identification is used to uniquely indicate a test stub type. Different types of test stakes correspond to different communication protocols, i.e., to different protocol sub-modules. The test pile management module stores a configuration file, and the configuration file is used for indicating the corresponding relation among the communication protocol identification, the communication protocol and the protocol sub-module. And the test pile management module calls the protocol sub-module indicated by the communication protocol identification to call the test pile module according to the configuration file. For an exemplary description of the configuration file, reference may be made to the description of table-1 above, which is not described in detail in this embodiment.
When the test pile management module calls the test pile module to generate a test pile, a test pile generation instruction is firstly sent to the test pile module. The test pile generation instruction comprises a communication protocol identifier and pile number, and the pile number is used for indicating the number of the test piles. After the test pile module receives a test pile generation instruction, the corresponding test pile is generated by combining the test pile number indicated by the pile number through the protocol sub-module and the universal sub-module indicated by the communication protocol identification.
In one possible embodiment, the test pile management module calls the test pile module to generate the test pile when the test system is started. When the test system is started, the communication protocol identifier corresponding to the protocol submodule in the test pile module to be called by the test pile management module and the number of the test piles to be generated can be preset by a designer according to actual experience or can be preset by a user in a self-defined manner. And the test pile management module calls the test pile module to generate the test piles according to the preset communication protocol identification and the number of the test piles to be generated.
In another possible implementation, the test agent module obtains an operation instruction, where the operation instruction includes at least one communication protocol identifier, the number of stubs corresponding to each communication protocol identifier, and an operation identifier corresponding to each communication protocol identifier. The operation identifier is used to indicate the operation type, which includes but is not limited to: call operation or stop operation. The calling operation refers to calling the test pile module to generate the test pile. The stopping operation means stopping calling the test pile module and destroying the test pile. And when the operation type indicated by the operation identifier is calling operation, the test agent module sends a calling instruction to the test stub management module, wherein the calling instruction comprises a communication protocol identifier and the number of stubs corresponding to the communication protocol identifier. At this time, the number of stubs in the call instruction indicates the number of test stubs required to be generated. And the test pile management module calls the test pile module according to the calling instruction to generate the test pile.
Alternatively, the test stub management module calls the test stub module to directly respond to the data request of the system under test 120. The test agent module obtains an operation instruction. The operation instruction comprises at least one communication protocol identification and an operation identification corresponding to each communication protocol identification. And when the operation type indicated by the operation identifier is calling operation, the test agent module sends a calling instruction to the test stub management module, wherein the calling instruction comprises a communication protocol identifier. The test stub management module calls the test stub module according to the call instruction, and responds to the data request of the system under test 120.
Optionally, the operation instruction is sent to the test agent module by the control system. And the control system sends an operation instruction to the test agent module according to the communication protocol identification, the pile number and the operation type input by the user.
And when the test pile management module calls the test pile module to generate a test pile, performing data interaction between the test pile and the tested system. Because the test stub is a process created by calling the test stub module, the data interaction between the test stub and the tested system is the interaction between the test stub module and the tested system. In the test, after the tested system sends a data request, the universal sub-module in the test pile module receives the data request sent by the tested system. When the testing pile module calls the testing pile module to directly respond to the data request of the tested system, the universal sub-module in the testing pile module receives the data request sent by the tested system.
Optionally, before data interaction is performed between the testing pile module and the system under test, the testing pile management module sends the generated pile information of the testing pile to the testing agent module. The test agent module sends the pile information to the control system, and the control system displays the pile information to a user. The stub information includes, but is not limited to, first address information and a communication protocol identification. And the user determines the communication protocol corresponding to the generated test pile according to the communication protocol identification so as to determine the tested system which can be tested by the test pile, and then the first address information is input into the tested system. The tested system obtains first address information input by a user and sends a data request to the test pile according to the first address information. Optionally, the first address information is a Socket address.
The system under test and the test module perform data interaction based on the same communication protocol, and therefore, the data request of the system under test is sent based on the communication protocol. And the protocol sub-module corresponding to the communication protocol analyzes the data request based on the communication protocol and acquires response data according to an analysis result. For example, the data type requested by the data request is parsed based on the communication protocol, and response data of the data type is acquired.
Optionally, the test system further comprises: and a stake data storage module. And before the testing pile module is called, the testing agent module acquires preset data. The preset data is preset by a designer according to a system to be tested and actual experience. Different tested systems correspond to different preset data. Wherein, the preset data comprises the response data. The control system acquires preset data input by a user and sends the preset data to the test agent module. And the test agent module sends the preset data to the pile data storage module. And the pile data storage module stores the preset data. And when testing is carried out, the protocol sub-module acquires response data from the pile data storage module according to the data request.
Optionally, different tested systems correspond to different preset data, so that when the preset data input by the user is obtained, the control system further obtains a system identifier corresponding to the preset data. The system identifier is used to uniquely identify a system under test. The test agent module obtains preset data sent by the control system and a system identification corresponding to the preset data, and sends the preset data and the system identification corresponding to the preset data to the pile data storage module. The pile data storage module stores preset data and system identification corresponding to the preset data. And the protocol submodule confirms preset data corresponding to the tested system according to the system identification in the data request and then acquires response data from the preset data.
And step 604, the universal submodule sends response data to the tested system.
And the universal submodule sends the response data acquired by the protocol submodule to the tested system to complete the response of the data request.
In one possible implementation, the data request sent by the system under test includes the second address information. And the universal submodule sends response data to the tested system according to the second address information.
In another possible implementation, the data request sent by the system under test includes the second address information and the system identifier. And when a plurality of tested systems share the same second address information, the universal submodule sends response data to the tested systems according to the second address information and the system identification.
Optionally, after the test is finished, the test agent module obtains the operation instruction. The operation instruction comprises at least one communication protocol identification, the number of piles corresponding to each communication protocol identification, and an operation identification corresponding to each communication protocol identification. And when the operation type indicated by the operation identifier is stop operation, the test agent module sends a stop instruction to the test stub management module, wherein the stop instruction comprises a communication protocol identifier and the number of stubs corresponding to the communication protocol identifier. At this time, the number of piles in the stop instruction indicates the number of test piles required to be destroyed. And the test pile management module stops calling the test pile module according to the stop instruction, and destroys and calls the test pile generated by the target test pile module.
Optionally, the test stub management module calls the test stub module to directly respond to a data request of the system under test. And when the operation type indicated by the operation identifier is stop operation, the test agent module sends a stop instruction to the test stub management module, wherein the stop instruction comprises a communication protocol identifier. And the test pile management module calls the test pile module according to the stop instruction.
Optionally, after the test is finished, the test agent module obtains a data deletion instruction sent by the control system. And the test agent module deletes the preset data stored in the pile data storage module according to the data deletion instruction. The control system sends a data deleting instruction to the test agent module, so that the test agent module can delete preset data stored in the pile data storage module after the test is finished, and the storage space of the test system is saved.
Optionally, the data deletion instruction comprises a system identification. And the test agent module deletes preset data corresponding to the system identifier, which is stored in the pile data storage module, according to the system identifier. When the test of the tested system is finished, only the preset data corresponding to the tested system after the test is finished can be deleted by deleting the preset data corresponding to the system identification, so that the space is saved, the preset data corresponding to other tested systems are prevented from being deleted, and the test of other tested systems is not influenced.
In the embodiment of the invention, the test pile module is called by the test pile management module to carry out the test, and the test pile module realizes the test pile function based on the same general submodule and different protocol submodules, so that the test pile module can share the same general submodule when realizing different test pile functions, thereby saving the processing overhead of the test.
Referring to fig. 7, a schematic structural diagram of a computer device according to an embodiment of the present invention is shown. The computer device runs the test system provided by the above embodiment. Specifically, the method comprises the following steps:
the computer device 700 includes a Central Processing Unit (CPU)701, a system memory 704 including a Random Access Memory (RAM)702 and a Read Only Memory (ROM)703, and a system bus 705 connecting the system memory 704 and the central processing unit 701. The computer device 700 also includes a basic input/output system (I/O system) 706, which facilitates transfer of information between devices within the computer, and a mass storage device 707 for storing an operating system 713, application programs 714, and other program modules 715.
The basic input/output system 706 comprises a display 708 for displaying information and an input device 709, such as a mouse, keyboard, etc., for a user to input information. Wherein the display 708 and input device 709 are connected to the central processing unit 701 through an input output controller 710 coupled to the system bus 705. The basic input/output system 706 may also include an input/output controller 710 for receiving and processing input from a number of other devices, such as a keyboard, mouse, or electronic stylus. Similarly, input-output controller 710 may also provide output to a display screen, a printer, or other type of output device.
The mass storage device 707 is connected to the central processing unit 701 through a mass storage controller (not shown) connected to the system bus 705. The mass storage device 707 and its associated computer-readable media provide non-volatile storage for the computer device 700. That is, the mass storage device 707 may include a computer-readable medium (not shown), such as a hard disk or CD-ROM drive.
Without loss of generality, the computer-readable media may comprise computer storage media and communication media. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes RAM, ROM, EPROM, EEPROM, flash memory or other solid state memory technology, CD-ROM, DVD, or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage media is not limited to the foregoing. The system memory 704 and mass storage device 707 described above may be collectively referred to as memory.
The computer device 700 may also operate as a remote computer connected to a network via a network, such as the internet, in accordance with various embodiments of the invention. That is, the computer device 700 may be connected to the network 712 through the network interface unit 711 connected to the system bus 705, or may be connected to other types of networks or remote computer systems using the network interface unit 711.
The memory has stored therein at least one instruction, at least one program, set of codes, or set of instructions configured to be executed by one or more processors to implement the test stub generation method or the test method described above, implementing the functionality of the test system.
In an exemplary embodiment, a computer readable storage medium is further provided, in which at least one instruction, at least one program, a set of codes, or a set of instructions is stored, which when executed by a processor of a computer device, implements the test pile generation method or the test method as described above, implementing the functionality of a test system.
Alternatively, the computer-readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
It should be understood that reference to "a plurality" herein means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
The above description is only exemplary of the present invention and should not be taken as limiting the invention, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (10)
1. A test system, the system comprising: the test pile management module, the test pile module and the test agent module, wherein the test pile module comprises a general submodule and a different protocol submodule;
the testing agent module is configured to obtain an operation instruction, where the operation instruction includes at least one communication protocol identifier and an operation identifier corresponding to the communication protocol identifier, where the communication protocol identifier is used to uniquely indicate a testing pile type, and the operation identifier is used to indicate an operation type, where the operation type includes: invoking an operation or stopping the operation;
the test agent module is further configured to send a call instruction to the test pile management module when the operation type indicated by the operation identifier is a call operation, where the call instruction includes the communication protocol identifier;
the test pile management module is used for calling the test pile module according to the calling instruction;
the universal submodule is used for receiving a data request sent by a tested system;
the protocol submodule is used for acquiring response data according to the data request, and the data request and the protocol submodule correspond to the same communication protocol;
the universal submodule is also used for sending the response data to the tested system.
2. The system of claim 1, wherein the test stub management module is configured to obtain a communication protocol identifier; and calling the test pile module according to the communication protocol identification, wherein the communication protocol identification is used for indicating the type of the test pile, and different types of test piles correspond to different protocol sub-modules.
3. The system of claim 1,
the test agent module is further configured to send a stop instruction to the test pile management module when the operation type indicated by the operation identifier is a stop operation, where the stop instruction includes the communication protocol identifier;
and the test pile management module is also used for stopping calling the test pile module according to the stop instruction.
4. The system of claim 1, further comprising: a pile data storage module;
the test agent module is further configured to obtain preset data before the test pile management module calls the test pile module, where the preset data includes the response data; sending the preset data to the pile data storage module;
the pile data storage module is used for storing the preset data;
and the protocol sub-module is used for acquiring the response data from the pile data storage module according to the data request.
5. The system of claim 4,
the test agent module is further used for acquiring a data deleting instruction, and the data deleting instruction is used for indicating to delete the preset data; and deleting the preset data stored in the pile data storage module according to the data deletion instruction.
6. A testing method is applied to a testing system, and the testing system comprises: the test pile management module, the test pile module and the test agent module, wherein the test pile module comprises a general submodule and a different protocol submodule;
the method comprises the following steps:
the testing agent module obtains an operation instruction, wherein the operation instruction comprises at least one communication protocol identifier and an operation identifier corresponding to the communication protocol identifier, the communication protocol identifier is used for indicating a testing pile type, the operation identifier is used for indicating an operation type, and the operation type comprises: invoking an operation or stopping the operation;
when the operation type indicated by the operation identifier is a calling operation, the test agent module sends a calling instruction to the test pile management module, wherein the calling instruction comprises the communication protocol identifier;
the test pile management module calls the test pile module according to the calling instruction;
the universal submodule receives a data request sent by a tested system;
the protocol sub-module acquires response data according to the data request, and the data request and the protocol sub-module correspond to the same communication protocol;
and the universal submodule sends the response data to the tested system.
7. The method of claim 6, wherein the test stub management module calls a test stub module according to the call instruction, comprising:
the testing pile management module acquires a communication protocol identifier, the communication protocol identifier is used for indicating the type of a testing pile, and testing piles of different types correspond to different protocol sub-modules;
and the testing pile management module calls the testing pile module according to the communication protocol identification.
8. The method of claim 6, wherein the test system further comprises: a pile data storage module;
before the testing pile management module calls the testing pile module according to the calling instruction, the method further comprises the following steps:
the test agent module acquires preset data, wherein the preset data comprises the response data;
the test agent module sends the preset data to the pile data storage module;
the pile data storage module stores the preset data;
the protocol sub-module acquires response data according to the data request, and the protocol sub-module comprises:
and the protocol sub-module acquires the response data from the pile data storage module according to the data request.
9. A computer device comprising a processor and a memory, the memory having stored therein at least one instruction, at least one program, a set of codes, or a set of instructions, which when executed by the processor, implement a testing method according to any one of claims 6 to 8.
10. A computer readable storage medium, having stored therein at least one instruction, at least one program, a set of codes, or a set of instructions which, when executed by a processor, implement a testing method according to any one of claims 6 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810186432.4A CN110213119B (en) | 2018-03-07 | 2018-03-07 | Test pile generation method, test system, test method and test equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810186432.4A CN110213119B (en) | 2018-03-07 | 2018-03-07 | Test pile generation method, test system, test method and test equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110213119A CN110213119A (en) | 2019-09-06 |
CN110213119B true CN110213119B (en) | 2022-02-22 |
Family
ID=67779044
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810186432.4A Active CN110213119B (en) | 2018-03-07 | 2018-03-07 | Test pile generation method, test system, test method and test equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110213119B (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2003009532A1 (en) * | 2001-07-19 | 2003-01-30 | Intrusion, Inc. | System and method for detecting network events |
CN1735252A (en) * | 2004-08-12 | 2006-02-15 | 华为技术有限公司 | Universal automatization testing device and method |
CN1983990A (en) * | 2006-05-11 | 2007-06-20 | 华为技术有限公司 | Parallel testing method and system |
CN101140541A (en) * | 2007-09-29 | 2008-03-12 | 中兴通讯股份有限公司 | Integration test system of distributed software system and method thereof |
CN101316196A (en) * | 2007-05-28 | 2008-12-03 | 华为技术有限公司 | Method and apparatus for implementing simulation test of service on distributed platform |
CN102214140A (en) * | 2011-06-21 | 2011-10-12 | 中兴通讯股份有限公司 | Method and system for automatic software testing |
CN104618182A (en) * | 2015-01-21 | 2015-05-13 | 中国移动通信集团广东有限公司 | Simulation testing system supporting a plurality of mobile service protocols |
-
2018
- 2018-03-07 CN CN201810186432.4A patent/CN110213119B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2003009532A1 (en) * | 2001-07-19 | 2003-01-30 | Intrusion, Inc. | System and method for detecting network events |
CN1735252A (en) * | 2004-08-12 | 2006-02-15 | 华为技术有限公司 | Universal automatization testing device and method |
CN1983990A (en) * | 2006-05-11 | 2007-06-20 | 华为技术有限公司 | Parallel testing method and system |
CN101316196A (en) * | 2007-05-28 | 2008-12-03 | 华为技术有限公司 | Method and apparatus for implementing simulation test of service on distributed platform |
CN101140541A (en) * | 2007-09-29 | 2008-03-12 | 中兴通讯股份有限公司 | Integration test system of distributed software system and method thereof |
CN102214140A (en) * | 2011-06-21 | 2011-10-12 | 中兴通讯股份有限公司 | Method and system for automatic software testing |
CN104618182A (en) * | 2015-01-21 | 2015-05-13 | 中国移动通信集团广东有限公司 | Simulation testing system supporting a plurality of mobile service protocols |
Also Published As
Publication number | Publication date |
---|---|
CN110213119A (en) | 2019-09-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108494771B (en) | Electronic device, firewall opening verification method and storage medium | |
CN110661658B (en) | Node management method and device of block chain network and computer storage medium | |
CN108256118B (en) | Data processing method, device, system, computing equipment and storage medium | |
CN104834602B (en) | A kind of program dissemination method, device and program delivery system | |
CN107241315B (en) | Access method and device of bank gateway interface and computer readable storage medium | |
CN112579622B (en) | Method, device and equipment for processing service data | |
CN112651705B (en) | Mail processing method, device, equipment and medium | |
CN114338610B (en) | Address allocation method, equipment management and irrigation system and slave equipment | |
CN113141405B (en) | Service access method, middleware system, electronic device, and storage medium | |
CN112035344A (en) | Multi-scenario test method, device, equipment and computer readable storage medium | |
CN115639954A (en) | Data transmission method, device, equipment and medium | |
CN113872951B (en) | Hybrid cloud security policy issuing method and device, electronic equipment and storage medium | |
CN106708717B (en) | A kind of exploitation adjustment method and device | |
CN110213119B (en) | Test pile generation method, test system, test method and test equipment | |
CN108345508B (en) | Interface call testing method and device | |
CN112153146A (en) | Operation notification method and apparatus, storage medium, and electronic apparatus | |
CN106254440A (en) | The upgrade method of a kind of AP and device | |
US9189370B2 (en) | Smart terminal fuzzing apparatus and method using multi-node structure | |
CN111858020A (en) | User resource limiting method, device and computer storage medium | |
KR20200046316A (en) | Web application server, method for handling user request and method for handling intergrated request | |
CN106559439B (en) | A kind of method for processing business and equipment | |
CN109871277B (en) | Inter-process multi-request management method and device, terminal equipment and readable storage medium | |
CN104407846B (en) | Information processing method and device | |
CN111143224A (en) | Pile service implementation method, device, equipment and computer storage medium | |
CN115174461B (en) | System testing method and device based on network request |
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 |