CN110958155B - Test configuration method and related device - Google Patents

Test configuration method and related device Download PDF

Info

Publication number
CN110958155B
CN110958155B CN201911088043.9A CN201911088043A CN110958155B CN 110958155 B CN110958155 B CN 110958155B CN 201911088043 A CN201911088043 A CN 201911088043A CN 110958155 B CN110958155 B CN 110958155B
Authority
CN
China
Prior art keywords
message
information
test
application program
configuration information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911088043.9A
Other languages
Chinese (zh)
Other versions
CN110958155A (en
Inventor
刘均
周辉濂
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Launch Technology Co Ltd
Original Assignee
Shenzhen Launch Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Launch Technology Co Ltd filed Critical Shenzhen Launch Technology Co Ltd
Priority to CN201911088043.9A priority Critical patent/CN110958155B/en
Publication of CN110958155A publication Critical patent/CN110958155A/en
Application granted granted Critical
Publication of CN110958155B publication Critical patent/CN110958155B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application discloses a test configuration method and a related device, wherein the method comprises the following steps: the method comprises the steps that a test terminal obtains a target configuration file, wherein the target configuration file comprises first configuration information; the test terminal loads the target configuration file through a first application program and reads first configuration information included in the target configuration file; the test terminal stores the first configuration information in a program variable corresponding to the first application program to obtain a second application program; the test terminal runs the second application program and sends a first message to the test object; and the test terminal receives a second message returned by the test object aiming at the first message, and determines the test result of the test object according to the first configuration information and the second message. By adopting the embodiment of the application, the configuration information can be configured in a configuration file mode, so that the test terminal is easy to maintain, and labor is saved.

Description

Test configuration method and related device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a test configuration method and a related apparatus.
Background
In daily production development, particularly hardware development, communication messages are often required to be debugged, and a common test tool cannot meet specific requirements, for example, the test tool is not suitable for being used by production personnel with high requirements on interface. Therefore, corresponding test tools need to be developed according to different requirements for development or production personnel to use.
As products are different and projects are increased, more and more test tools need to be developed and maintained. Some testing tools are serial communication testing tools, and some testing tools are network testing tools; the serial communication tool derives a plurality of test tools according to different requirements of sending messages and the like of projects. Currently, if one test tool is developed for each product or project, a plurality of similar test tools will need to be developed, which will certainly waste much manpower and increase the difficulty of developing and maintaining the test tools.
Disclosure of Invention
The embodiment of the application provides a test configuration method and a related device, which not only provide a test method of a general test tool, but also can configure configuration information in a configuration file mode, so that the maintenance of a test terminal is easy, the labor is saved, and similar test tools do not need to be developed for many times.
In a first aspect, an embodiment of the present application provides a test configuration method, including:
the method comprises the steps that a test terminal obtains a target configuration file, wherein the target configuration file comprises first configuration information;
the test terminal loads the target configuration file through a first application program and reads first configuration information included in the target configuration file;
the test terminal stores the first configuration information in a program variable corresponding to the first application program to obtain a second application program;
the test terminal runs the second application program and sends a first message to the test object;
and the test terminal receives a second message returned by the test object aiming at the first message, and determines the test result of the test object according to the first configuration information and the second message.
With reference to the first aspect, in a possible implementation manner, the obtaining, by a test terminal, a target configuration file includes: the test terminal displays a first application interface corresponding to the first application interface information, wherein the first application interface comprises a test control, an information display control and an information input control; the test terminal acquires first configuration information input by a user on the first application interface and generates a target configuration file according to the first configuration information.
With reference to the first aspect, in a possible implementation manner, the first configuration information includes communication information and message information, where the message information includes a message format, a message sending content, and a message sending timing sequence, the message sending content includes at least two pieces of message sending data, and the message sending timing sequence is a sending sequence of the at least two pieces of message sending data in the message sending content. The test terminal runs the second application program to send a first message to the test object, and the first message comprises the following steps: the test terminal runs the second application program to generate a first message, the message format of the first message is the same as the message format included in the message information, and the message content of the first message is the same as the first message sending data in at least two pieces of message sending data included in the message sending content; the test terminal determines a communication mode corresponding to the communication information through the second application program, calls a sending function corresponding to the communication mode in the second application program, and sends the first message to the test object according to the message sending time sequence.
With reference to the first aspect, in a possible implementation manner, the message information further includes message receiving content. Determining a test result of the test object according to the first configuration information and the second message, including: the test terminal detects whether the message format in the message information is matched with the message format of the second message, whether the message receiving content is matched with the message content of the second message, and whether the message sending time sequence in the message information is matched with the message sending time sequence of the second message; if the message format in the message information is matched with the message format of the second message, the message receiving content is matched with the message content of the second message, and the message sending time sequence in the message information is matched with the message sending time sequence of the second message, the test terminal determines that the test result of the test object is successful.
With reference to the first aspect, in a possible implementation manner, the method further includes: if any one of the message format in the message information and the message format of the second message, the message receiving content and the message content of the second message, and the message sending time sequence in the message information and the message sending time sequence of the second message is detected to be not matched, the test terminal determines that the test result of the test object is a test failure, and tests the test object again.
With reference to the first aspect, in a possible implementation manner, the first configuration information further includes interface information. The test terminal stores the first configuration information in a program variable corresponding to the first application program to obtain a second application program, and the method comprises the following steps: the test terminal stores the interface information and the communication information in a group of program variables corresponding to the first application program, and stores at least two pieces of message sending data included in message sending contents in the message information in another group of program variables corresponding to the first application program according to the message sending time sequence so as to obtain the second application program.
With reference to the first aspect, in a possible implementation manner, the first configuration information further includes interface information. The method further comprises the following steps: and the test terminal runs the second application program, and adjusts the first application interface based on the interface information in the first configuration information to obtain a second application interface.
In a second aspect, an embodiment of the present application provides a testing apparatus, including:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a target configuration file which comprises first configuration information;
the reading unit is used for loading the target configuration file through a first application program and reading first configuration information included in the target configuration file;
the storage unit is used for storing the first configuration information in a program variable corresponding to the first application program to obtain a second application program;
the receiving and sending unit is used for running the second application program and sending a first message to the test object;
the receiving and sending unit is also used for receiving a second message returned by the test object aiming at the first message;
and the determining unit is used for determining the test result of the test object according to the first configuration information and the second message.
With reference to the second aspect, in a possible implementation manner, the obtaining unit is specifically configured to: displaying a first application interface corresponding to first application interface information, wherein the first application interface comprises a test control, an information display control and an information input control; the method comprises the steps of obtaining first configuration information input by a user on the first application interface, and generating a target configuration file according to the first configuration information.
With reference to the second aspect, in a possible implementation manner, the first configuration information includes communication information and message information, where the message information includes a message format, a message sending content, and a message sending timing sequence, the message sending content includes at least two pieces of message sending data, and the message sending timing sequence is an order of sending at least two pieces of message sending data in the message sending content. The transceiver unit is specifically configured to: running the second application program to generate a first message, wherein the message format of the first message is the same as the message format included in the message information, and the message content of the first message is the same as the first message sending data in at least two pieces of message sending data included in the message sending content; and determining a communication mode corresponding to the communication information through the second application program, calling a sending function corresponding to the communication mode in the second application program, and sending the first message to the test object according to the message sending time sequence.
With reference to the second aspect, in a possible implementation manner, the message information further includes message receiving content. The determining unit is specifically configured to: detecting whether the message format in the message information is matched with the message format of the second message, whether the message receiving content is matched with the message content of the second message, and whether the message sending time sequence in the message information is matched with the message sending time sequence of the second message; and if the message format in the message information is matched with the message format of the second message, the message receiving content is matched with the message content of the second message, and the message sending time sequence in the message information is matched with the message sending time sequence of the second message, determining that the test result of the test object is successful.
With reference to the second aspect, in a possible implementation manner, the determining unit is further configured to: if any one of the message format in the message information and the message format of the second message, the message receiving content and the message content of the second message, and the message sending time sequence in the message information and the message sending time sequence of the second message is detected to be not matched, determining that the test result of the test object is a test failure, and testing the test object again.
With reference to the second aspect, in one possible implementation, the first configuration information further includes interface information. The storage unit is specifically configured to: storing the interface information and the communication information in a group of program variables corresponding to the first application program, and storing at least two pieces of message sending data included in message sending contents in the message information in another group of program variables corresponding to the first application program according to the message sending time sequence to obtain the second application program.
With reference to the second aspect, in a possible implementation manner, the first configuration information further includes interface information. The transceiver unit is further configured to: and running the second application program, and adjusting the first application interface based on the interface information in the first configuration information to obtain a second application interface.
In a third aspect, a test terminal is provided, which includes a processor, a memory, and an input/output interface, where the processor, the memory, and the input/output interface are connected to each other, where the input/output interface is used to input or output data, the memory is used to store program codes, and the processor is used to call the program codes to execute the test configuration method of the first aspect.
In a fourth aspect, there is provided a computer-readable storage medium, wherein the computer storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to perform the test configuration method of the first aspect.
According to the embodiment of the application, a target configuration file is obtained, the target configuration file comprises first configuration information, the target configuration file is loaded through a first application program, the first configuration information in the target configuration file is read, the first configuration information is stored in a program variable corresponding to the first application program, a second application program is obtained, the second application program is operated to send a first message to a test object, a second message returned by the test object aiming at the first message is received, and a test result of the test object is determined according to the first configuration information and the second message. By adopting the embodiment of the application, the test method of the universal test tool is provided, the configuration information can be configured in a configuration file mode, the test terminal is easy to maintain, the labor is saved, and similar test tools do not need to be developed for multiple times.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a schematic flowchart of a test configuration method according to an embodiment of the present application;
FIG. 2 is a schematic flowchart of another test configuration method provided in an embodiment of the present application;
FIG. 3 is a schematic diagram of a first application interface provided by an embodiment of the present application;
FIG. 4 is a schematic diagram of a target configuration file provided by an embodiment of the present application;
FIG. 5 is a schematic structural diagram of a testing apparatus according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a test terminal according to an embodiment of the present application.
Detailed Description
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 some embodiments of the present application, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort belong to the protection scope of the present application.
Referring to fig. 1, fig. 1 is a schematic flowchart of a test configuration method according to an embodiment of the present application. As shown in fig. 1, the test configuration method of the embodiment of the present application may include, but is not limited to, the following steps:
s101, the test terminal obtains a target configuration file, wherein the target configuration file comprises first configuration information.
In a possible implementation manner, the test terminal obtains a target configuration file, where the target configuration file includes the first configuration information. Optionally, the test terminal may be a terminal device corresponding to the test tool. For example, the test terminal may be a PC computer. Optionally, the target configuration file is an independent file, and is a variable storage file with a standardized data format. Alternatively, the data format of the target configuration file may be an extensible Markup Language (XML) format, another Markup Language (YAML) format, a JavaScript Object Notation (JSON) format, a Text document (Text, TXT) format, and the like. Optionally, the first configuration information may include interface information, communication information, and message information. Optionally, the first configuration information may be various pieces of test requirement information input by the user. Optionally, the first configuration information in the target configuration file has an instructive effect on the execution of the application program.
S102, the test terminal loads the target configuration file through a first application program and reads first configuration information included in the target configuration file.
In a possible implementation manner, the test terminal may load the target configuration file through the first application program in the background, and read the first configuration information included in the target configuration file. Optionally, the first application is a computer program that is developed to run on the test terminal in order to accomplish a specific task or tasks. Optionally, loading refers to a process of calling the target configuration file into the first application program.
S103, the test terminal stores the first configuration information in a program variable corresponding to the first application program to obtain a second application program.
In a possible implementation manner, the program variable corresponding to the first application program may include multiple sets of program variables. The test terminal may store various information included in the first configuration information in a plurality of sets of program variables corresponding to the first application program to obtain the second application program, where one information may be stored in one set of program variables. Optionally, the test terminal may store interface information in the first configuration information in a first group of program variables corresponding to the first application program, store communication information in the first configuration information in a second group of program variables corresponding to the first application program, and store message information in the first configuration information in a third group of program variables corresponding to the first application program, so as to obtain the second application program. Optionally, the first application and the second application are different applications. For example, the second application program is obtained by writing parameters (information) into each set of program variables corresponding to the first application program.
And S104, the test terminal runs the second application program to send a first message to the test object.
In a possible implementation manner, the test terminal may generate a first message based on the message information in the first configuration information, and may run the second application program to send the first message to the test object. After receiving the first message, the test object may reply to the first message, and may return a second message to the test terminal. Alternatively, the test object may be a test device or a test product. Optionally, the message format of the first message may be a fixed-length message format, a delimiter message format, or an XML message format. Optionally, the message content of the first message may be any message sending data included in the message information in the first configuration information. For example, the message data may be a 16-ary number of 18 bytes. For another example, the message information may include 3 pieces of message transmission data, which are the first message transmission data 0011 22 33 44 f 65 21 1F 00 0001 02ff 00 AF, the second message transmission data 0011 22 33 44 f 68 21 1F 00 0001 07 ff 00 AF 2, and the third message transmission data 0011 33 44 f 69 21 1F 00 08ff 00 AF 3. The first packet may be any one of the 3 pieces of messaging data, for example, the first packet is the first messaging data.
S105, the test terminal receives a second message returned by the test object aiming at the first message, and determines the test result of the test object according to the first configuration information and the second message.
In a possible implementation manner, the test terminal may receive a second message returned by the test object for the first message, and may determine a test result of the test object according to the first configuration information and the received second message. Optionally, the message format of the second message may be a fixed-length message format, a User Datagram Protocol (UDP) message format, an ethernet packet format, and an Address Resolution Protocol (ARP) message format. Optionally, the message format of the second message may be the same as or different from the message format of the first message.
Alternatively, the test result of the test object may be a test success or a test failure. Optionally, the test terminal may match the second message according to the message information in the first configuration information, and if the message information in the first configuration information and the second message are successfully matched, it is determined that the test result of the test object is successful; and if the matching between the message information in the first configuration information and the second message fails, determining that the test result of the test object is a test failure.
Optionally, the first configuration information may be modified according to different requirements of the user. For example, different users may modify any one or more of the interface information, the communication information, and the message information in the first configuration information according to their own needs, so as to obtain the second configuration information. The test terminal may obtain second configuration information obtained by modifying the first configuration information by the user, and may generate a configuration file based on the second configuration information. The test terminal can load the configuration file through the first application program, read second configuration information included in the configuration file, and store the second configuration information in a program variable corresponding to the first application program to obtain a third application program. The test terminal may run the third application program to send a third message to the test object. After receiving the third message, the test object may send a fourth message to the test terminal for the third message. The test terminal may receive a fourth packet returned by the test object for the third packet, and may determine a test result of the test object according to the second configuration information and the fourth packet. The second configuration information may be the same as the information type included in the first configuration information, for example, the second configuration information may also include interface information, communication information, and message information. According to the embodiment of the application, the test of the test object can be automatically realized by modifying the configuration information, a plurality of test terminals do not need to be maintained or developed, the test terminals are easy to maintain, and labor is saved.
In this embodiment of the present application, a test terminal obtains a target configuration file, where the target configuration file includes first configuration information, the target configuration file may be loaded by a first application program and the first configuration information in the target configuration file is read, the first configuration information is stored in a program variable corresponding to the first application program to obtain a second application program, the second application program is run to send a first packet to a test object, a second packet returned by the test object for the first packet is received, and a test result of the test object is determined according to the first configuration information and the second packet. By adopting the embodiment of the application, the test method of the universal test tool is provided, the configuration information can be configured in a configuration file mode, the test terminal is easy to maintain, the labor is saved, and similar test tools do not need to be developed for multiple times.
Referring to fig. 2, fig. 2 is a schematic flowchart of another test configuration method provided in the embodiment of the present application. As shown in fig. 2, another test configuration method according to the embodiment of the present application may include, but is not limited to, the following steps:
s201, the test terminal displays a first application interface corresponding to the first application interface information, and the first application interface comprises a test control, an information display control and an information input control.
In one possible implementation manner, the test terminal displays a first application interface corresponding to the first application interface information, and the first application interface includes a test control, an information display control, and an information input control. Optionally, the first application interface information is application interface information preset by a user. Optionally, the test terminal may be a terminal device corresponding to the test tool. For example, the test terminal may be a PC computer.
For example, please refer to fig. 3, fig. 3 is a schematic diagram of a first application interface according to an embodiment of the present disclosure. As shown in fig. 3a of fig. 3, the first application interface includes a test control, an information display control, and an information input control, and the test control in the first application interface may include a one-touch test and a step test. Optionally, the user may use a one-key test in the test control to test the product, so as to directly obtain a test result; the product can also be tested by using the step-by-step test in the test control, so that a plurality of step-by-step test results corresponding to a plurality of sub-functions of the product are obtained. As shown in fig. 3b, the first application interface includes a test control, an information display control, and an information input control, where the information display control in the first application interface may include a status display and a data display. Optionally, the state display in the information display control may be divided into three states: a connection state, a sub-function test state, and a one-key test state. Optionally, the data display in the information display control may be used to display configuration file data, send and/or receive related message data, and a test result. As shown in fig. 3c, the first application interface includes a test control, an information display control, and an information input control, and the information input control in the first application interface may be used to edit or modify the configuration information.
S202, the test terminal obtains first configuration information input by a user on the first application interface, and generates a target configuration file according to the first configuration information.
In a possible implementation manner, the first configuration information includes interface information, communication information, and message information, where the message information includes a message format, a message sending content, a message receiving content, and a message sending timing sequence, the message sending content includes at least two pieces of message sending data, and the message sending timing sequence is a sequence of sending at least two pieces of message sending data in the message sending content.
Further, the test terminal obtains first configuration information input by a user on the first application interface, and generates a target configuration file according to the first configuration information, wherein the first configuration information includes interface information, communication information and message information, the message information includes a message format, message sending content, message receiving content and a message sending time sequence, the message sending content includes at least two pieces of message sending data, and the message sending time sequence is the sending sequence of the at least two pieces of message sending data in the message sending content. Optionally, the user may input the first configuration information by using an information input control in the first application interface. Optionally, the message format may include an Internet Protocol (IP) message format, a Transmission Control Protocol (TCP) message format, and a Multi-Protocol Label Switching (MPLS) message format. Optionally, the data format of the target configuration file may be an XML format, a YAML format, a JSON format, a TXT format, or the like. Optionally, a specific symbol may be used to record configuration information such as interface information, communication information, and message information in the target configuration file.
For example, please refer to fig. 4, wherein fig. 4 is a schematic diagram of a target configuration file according to an embodiment of the present application. As shown in fig. 4, the first configuration information in the target configuration file includes communication information and message information, and the communication mode corresponding to the communication information is a serial port mode, that is, howSend = serial port. The message information includes a message sending time sequence, message sending contents and message receiving contents. The message sending sequence refers to the sequence of sending a plurality of pieces of message sending data to the test object by the PC computer, namely SendQrder = message sending data 1, message sending data 2, message sending data 3, message sending data 4, message sending data 5, message sending data 6, and message sending data 7. The above-mentioned message transmission contents are 7 pieces of message transmission data, and respectively, the message transmission data 1 is SendMessage =00 = 11 22 33 44 0f 64 21 f 00 0001 01 ff 00 AE, the message transmission data 2 is SendMessage =00 11 33 0f 65 21 1F 00 0001 02ff 00 AF, the message transmission data 3 is SendMessage =00 11 22 33 0f 66 21 1F 0003 ff 00 AC, the message transmission data 4 is SendMessage =00 11 33 0f 67 21 1F 00 06 ff 00 AD, the message transmission data 5 is SendMessage =00 11 33 44 33 0f 68 21 1F 00 07 07 f 07 07 ff 00 aff 2, the message transmission data 6 is SendMessage =00 = 11 33 10 f 33 0f 69 f 21 AB 0800 AF 08, 3, and the message transmission data 7 is SendMessage transmission data 33 =00 = 11 20 10 f 33 033 10 f 00 ff 63 f 01 ff 3 AF 01 AF 00 AF 3. The message receiving content refers to content for processing the message receiving data sent by the PC computer for receiving the test object aiming at any one of the message sending data, and may include three conditions: if the PC computer receives that the message receiving data sent by the test object aiming at any one of the message sending data is 0011 33 44 00, the test result is test OK, and the test OK represents that the test is successful; if the PC computer receives that the message receiving data sent by the test object aiming at any message sending data is 0011 33 44 01, the test result is test failure; if the PC computer receives that the message receiving data sent by the test object aiming at any message sending data is 0011 33 44 61, the test result is a test ERROR, and the test ERROR represents a test ERROR.
S203, the test terminal loads the target configuration file through the first application program and reads first configuration information included in the target configuration file.
In a possible implementation manner, step S203 in the embodiment of the present application may refer to step S102 in the embodiment shown in fig. 1, and is not described herein again.
And S204, the test terminal stores the interface information and the communication information in a group of program variables corresponding to the first application program, and stores at least two pieces of message sending data included in message sending contents in the message information in another group of program variables corresponding to the first application program according to the message sending time sequence so as to obtain the second application program.
In a possible implementation manner, the test terminal stores the interface information and the communication information in a set of program variables corresponding to the first application program, and may store at least two pieces of message sending data included in the message sending content in the message information in another set of program variables corresponding to the first application program according to the message sending timing sequence, so as to obtain the second application program. Optionally, the interface information may include display, hiding, and position information of each control, such as a test control, an information display control, and an information input control, on the first application interface, and the communication information includes a communication mode and a sending function corresponding to the communication mode, and may store the interface information and the communication information in a set of program variables corresponding to the first application program.
Optionally, the message sending content includes at least two pieces of message sending data, the message sending timing sequence is a sending sequence of the at least two pieces of message sending data in the message sending content, and the at least two pieces of message sending data included in the message sending content in the message information may be stored in another set of program variables corresponding to the first application program according to the message sending timing sequence. Optionally, the test terminal may store the message format, the message receiving content, and the message sending timing sequence in the message information in another set of program variables corresponding to the first application program.
S205, the test terminal runs the second application to generate a first message, where a message format of the first message is the same as a message format included in the message information, and a message content of the first message is the same as a first message sending data in at least two message sending data included in the message sending content.
In a possible implementation manner, the test terminal runs the second application program to generate a first message, where a message format of the first message is the same as a message format included in the message information, and a message content of the first message is the same as first message sending data in at least two pieces of message sending data included in the message sending content. Optionally, the message format of the first message may include a fixed-length message format, a delimiter message format, and an IP message format. For example, the message content of the first message may be the same as the message transmission data 1 in the target profile as shown in fig. 4.
S206, the test terminal determines the communication mode corresponding to the communication information through the second application program, calls a sending function corresponding to the communication mode in the second application program, and sends the first message to the test object according to the message sending time sequence.
In a possible implementation manner, the test terminal may determine a communication manner corresponding to the communication information through the second application program, call a sending function corresponding to the communication manner in the second application program, send the first message to the test object according to the message sending timing sequence, receive the first message by the test object, reply the first message, and return a second message to the test terminal. Alternatively, the test object may be a test device or a test product. Optionally, the communication mode may include serial port communication, TCP communication, and HyperText Transfer Protocol (HTTP) communication. Optionally, if the communication information in the first configuration information is serial communication, the test terminal may determine that the communication mode is serial communication by running the second application program. For example, if the communication information is "00", it indicates that the communication mode is "serial communication"; if the communication information is "01", it indicates that the communication mode is "TCP communication".
S207, the test terminal receives a second message returned by the test object aiming at the first message.
In a possible implementation manner, the test terminal receives a second message returned by the test object for the first message. Optionally, the message format of the second message may include, but is not limited to, a fixed-length message format, a delimiter message format, and an ethernet packet format.
S208, the test terminal detects whether the message format in the message information is matched with the message format of the second message, whether the message receiving content is matched with the message content of the second message, and whether the message sending time sequence in the message information is matched with the message sending time sequence of the second message.
In a possible implementation manner, the test terminal detects whether a message format in the message information matches a message format of the second message, whether the message receiving content matches a message content of the second message, and whether a message sending timing sequence in the message information matches a message sending timing sequence of the second message. Optionally, the message content of the second message is the message content of the test object for the first message, that is, the message content of the second message is returned by the test object for the first message sending data of the at least two pieces of message sending data included in the message sending content. Optionally, the message receiving content may include at least two pieces of message receiving data respectively corresponding to at least two pieces of message sending data in the message sending content. Optionally, the message content of the first message may be a 16-ary number with 18 bytes, and the message receiving data corresponding to the message content of the first message in the message receiving content may be a 16-ary number with 7 bytes. For example, if the message content of the first message is 0011 33 44 0f 64 21 1F 00 0001 01 ff 00 AE, the first message received data corresponding to the message content of the first message in the message received content is 0011 33 44 04 12.
S209, if it is detected that the message format in the message information matches the message format of the second message, the message receiving content matches the message content of the second message, and the message sending timing sequence in the message information matches the message sending timing sequence of the second message, the test terminal determines that the test result of the test object is a successful test.
In a possible embodiment, if the message format in the message information is the same as the message format of the second message, it is described that the message format in the message information matches the message format of the second message; if the message receiving content is the same as the message content of the second message, the message receiving content is matched with the message content of the second message; if the message sending time sequence in the message information is the same as the message sending time sequence of the second message, which indicates that the message sending time sequence in the message information is matched with the message sending time sequence of the second message, the test terminal determines that the test result of the test object is successful. For example, the message sending timing sequence in the message information may be SendQrder = first message receiving data, and second message receiving data, where the first message receiving data corresponding to the message content of the first message in the message receiving content is 0011 33 44 04 12, and if the second message is 0011 22 33 44 04 12, the message content, the message format, and the message sending timing sequence of the first message receiving data and the second message are completely the same, and the test result of the test object is determined to be successful by the test terminal; if the test terminal sends a third message to the test object again, where the third message is the same as the second message sending data in at least two pieces of message sending data in the message sending content, the message content of the third message is 0011 22 33 44 f 65 21 f 00 0001 02ff 00 AF, the second message receiving data corresponding to the message content of the third message in the message receiving content is 0011 22 33 44 05, and if the fourth message returned by the test object for the third message received by the test terminal is 0011 22 33 44 05, the message content, the message format, and the message sending time sequence of the second message receiving data and the fourth message are completely the same, the test terminal determines that the test result of the test object is successful.
Optionally, if the matching degree between the message format in the message information and the message format of the second message is greater than the first threshold, it is indicated that the message format in the message information matches the message format of the second message; if the matching degree between the message receiving content and the message content of the second message is greater than a second threshold value, the message receiving content is matched with the message content of the second message; if the matching degree between the message sending time sequence in the message information and the message sending time sequence of the second message is larger than a third threshold value, which indicates that the message sending time sequence in the message information is matched with the message sending time sequence of the second message, the test terminal determines that the test result of the test object is successful. Optionally, the first threshold, the second threshold, and the third threshold may be the same or different. For example, the first threshold may be 98%, the second threshold may be 100%, and the third threshold may be 98%.
Optionally, if it is detected that any one of the message format in the message information and the message format of the second message, the message receiving content and the message content of the second message, and the message sending timing sequence in the message information and the message sending timing sequence of the second message is not matched, the test terminal determines that the test result of the test object is a test failure, and can resend the first message to the test object, the test object receives the first message and replies to the first message, and returns the second message to the test terminal, the test terminal receives the second message returned by the test object for the first message, and resends the test result that the test object matches the message format in the message information and the message format of the second message, matches the message receiving content and the message content of the second message, matches the message sending timing sequence in the message information and the message sending timing sequence of the second message, and if it is detected that the message format in the message information and the message format of the second message, the message receiving content and the message content of the second message, and the message sending timing sequence of the message information and the message sending timing sequence of the second message are matched, and the test result of the test object is determined that the test result of the test object is a test failure.
Optionally, the test terminal runs a second application program, and adjusts the first application interface based on the interface information in the first configuration information to obtain a second application interface. Optionally, the first message, the second message, and the test result of the test object may be displayed on the second application interface.
Optionally, the first configuration information may be modified according to different requirements of the user. For example, different users may modify any one or more of the interface information, the communication information, and the message information in the first configuration information according to their own needs, so as to obtain the second configuration information. The test terminal may obtain second configuration information obtained by modifying the first configuration information by the user, and may generate a configuration file based on the second configuration information. The test terminal can load the configuration file through the first application program, read the second configuration information included in the configuration file, and store the second configuration information in the program variable corresponding to the first application program to obtain a third application program. The test terminal may run the third application program to send a third message to the test object. After receiving the third message, the test object may send a fourth message to the test terminal for the third message. The test terminal may receive a fourth packet returned by the test object for the third packet, and may determine a test result of the test object according to the second configuration information and the fourth packet. The second configuration information may be the same as the information type included in the first configuration information, for example, the second configuration information may also include interface information, communication information, and message information. According to the embodiment of the application, the test of the test object can be automatically realized by modifying the configuration information, a plurality of test terminals do not need to be maintained or developed, the test terminals are easy to maintain, and labor is saved.
In this embodiment of the present application, a test terminal obtains a target configuration file, where the target configuration file includes first configuration information, the target configuration file may be loaded by a first application program and the first configuration information in the target configuration file is read, the first configuration information is stored in a program variable corresponding to the first application program to obtain a second application program, the second application program is run to send a first packet to a test object, a second packet returned by the test object for the first packet is received, and a test result of the test object is determined according to the first configuration information and the second packet. By adopting the embodiment of the application, the test method of the universal test tool is provided, the configuration information can be configured in a configuration file mode, the test terminal is easy to maintain, the labor is saved, and similar test tools do not need to be developed for multiple times.
Referring to fig. 5, fig. 5 is a schematic structural diagram of a testing apparatus provided in an embodiment of the present application. As shown in fig. 5, the test apparatus 50 includes:
an obtaining unit 501 is configured to obtain a target configuration file, where the target configuration file includes first configuration information.
In a possible implementation manner, the obtaining unit 501 is configured to obtain a target configuration file, where the target configuration file includes the first configuration information. Optionally, the target configuration file is an independent file, and is a variable storage file with a standardized data format. Alternatively, the data format of the target configuration file may be an XML format, a YAML format, a JSON format, a TXT format, and the like. Optionally, the first configuration information may include interface information, communication information, and message information. Optionally, the first configuration information may be information of each item of test requirements input by a user. Optionally, the first configuration information in the target configuration file has an instructive effect on the execution of the application program.
A reading unit 502, configured to load the target configuration file through a first application program and read first configuration information included in the target configuration file.
In a possible embodiment, the reading unit 502 may be configured to load the target configuration file through the first application in the background, and read the first configuration information included in the target configuration file. Optionally, the first application is a computer program that is developed to run on the test terminal in order to accomplish a specific task or tasks. Optionally, loading refers to a process of calling the target configuration file into the first application program.
The storage unit 503 is configured to store the first configuration information in a program variable corresponding to the first application program, so as to obtain a second application program.
In a possible implementation manner, the program variable corresponding to the first application may include multiple sets of program variables, and various information included in the first configuration information may be stored in the multiple sets of program variables corresponding to the first application to obtain the second application, where one information may be stored in one set of program variables. Further, the storage unit 503 may be configured to store interface information in the first configuration information in a first set of program variables corresponding to a first application, store communication information in the first configuration information in a second set of program variables corresponding to the first application, and store message information in the first configuration information in a third set of program variables corresponding to the first application, so as to obtain a second application. Optionally, the first application and the second application are different applications. For example, the second application program is obtained by writing parameters (information) into each set of program variables corresponding to the first application program.
A transceiving unit 504, configured to run the second application program to send a first message to the test object; the transceiving unit 504 is further configured to receive a second packet returned by the test object for the first packet.
In a possible implementation manner, a first message is generated based on the message information in the first configuration information, and the transceiver 504 may be configured to run the second application to send the first message to the test object. After receiving the first message, the test object may reply to the first message, and may return a second message to the transceiver 504. Alternatively, the test object may be a test device or a test product. Optionally, the message format of the first message may be a fixed-length message format, a delimiter message format, or an XML message format. Optionally, the message content of the first message may be any message sending data included in the message information in the first configuration information. For example, the message data may be a 16-ary number of 18 bytes. For another example, the message information may include 3 pieces of message transmission data, which are the first message transmission data 0011 22 33 44 f 65 21 1F 00 0001 02ff 00 AF, the second message transmission data 0011 33 44 f 68 21 1F 00 0001 ff 00 AF 2, and the third message transmission data 0011 33 44 f 69 21 10 f 00 0001 ff 08ff 00 AF 3, respectively. The first message may be any one of the 3 pieces of messaging data, for example, the first message is the first messaging data.
Further, the transceiver 504 may be further configured to receive a second message returned by the test object for the first message. Optionally, the message format of the second message may be a fixed-length message format, a UDP message format, an ethernet packet format, or an ARP message format. Optionally, the message format of the second message may be the same as or different from the message format of the first message.
A determining unit 505, configured to determine a test result of the test object according to the first configuration information and the second packet.
In a possible implementation manner, the determining unit 505 may be configured to determine a test result of the test object according to the first configuration information and the received second message. Alternatively, the test result of the test object may be a test success or a test failure. Optionally, the test terminal may match the second message according to the message information in the first configuration information, and if the message information in the first configuration information and the second message are successfully matched, it is determined that the test result of the test object is a successful test; and if the matching between the message information in the first configuration information and the second message fails, determining that the test result of the test object is test failure.
Optionally, the first configuration information may be modified according to different requirements of the user. For example, different users may modify any one or more of the interface information, the communication information, and the message information in the first configuration information according to their own needs, so as to obtain the second configuration information. The test terminal may obtain second configuration information obtained by modifying the first configuration information by the user, and may generate a configuration file based on the second configuration information. The test terminal can load the configuration file through the first application program, read the second configuration information included in the configuration file, and store the second configuration information in the program variable corresponding to the first application program to obtain a third application program. The test terminal may run the third application program to send a third message to the test object. After receiving the third message, the test object may send a fourth message to the test terminal for the third message. The test terminal may receive a fourth packet returned by the test object for the third packet, and may determine a test result of the test object according to the second configuration information and the fourth packet. The second configuration information may be the same as the information type included in the first configuration information, for example, the second configuration information may also include interface information, communication information, and message information. According to the embodiment of the application, the test of the test object can be automatically realized by modifying the configuration information, a plurality of test terminals do not need to be maintained or developed, the test terminals are easy to maintain, and labor is saved.
It should be noted that, for the content that is not mentioned in the embodiment corresponding to fig. 5, reference may be made to the description of the method embodiment in fig. 1 and/or fig. 2, and details are not repeated here.
In the embodiment of the application, a test terminal obtains a target configuration file, where the target configuration file includes first configuration information, and the target configuration file may be loaded by a first application program and the first configuration information in the target configuration file is read, the first configuration information is stored in a program variable corresponding to the first application program to obtain a second application program, and the second application program is run to send a first message to a test object, receive a second message returned by the test object for the first message, and determine a test result of the test object according to the first configuration information and the second message. By adopting the embodiment of the application, the test method of the universal test tool is provided, the configuration information can be configured in a configuration file mode, the test terminal is easy to maintain, the labor is saved, and similar test tools do not need to be developed for many times.
Referring to fig. 6, fig. 6 is a schematic structural diagram of a test terminal according to an embodiment of the present disclosure. As shown in fig. 6, the test terminal 60 includes a processor 601, a memory 602, an input/output interface 603, and a communication bus 604. The processor 601 is connected to the memory 602 and the input output interface 603, for example, the processor 601 may be connected to the memory 602 and the input output interface 603 through a communication bus 604.
The processor 601 is configured to support the test terminal to perform corresponding functions in the test configuration method of fig. 1-2. The Processor 601 may be a Central Processing Unit (CPU), a Network Processor (NP), a hardware chip, or any combination thereof. The hardware chip may be an Application-Specific Integrated Circuit (ASIC), a Programmable Logic Device (PLD), or a combination thereof. The PLD may be a Complex Programmable Logic Device (CPLD), a Field-Programmable Gate Array (FPGA), general Array Logic (GAL), or any combination thereof.
The memory 602 is used for storing program codes and the like. The Memory 602 may include Volatile Memory (VM), such as Random Access Memory (RAM); the Memory 602 may also include a Non-Volatile Memory (NVM), such as a Read-Only Memory (ROM), a flash Memory (flash Memory), a Hard Disk Drive (HDD) or a Solid-State Drive (SSD); the memory 602 may also comprise a combination of memories of the kind described above.
The input/output interface 603 is used for inputting or outputting data, and the input/output interface 603 may be used for sending a first message to a test object and receiving a second message returned by the test object for the first message.
The processor 601 may call the above program code to perform the following operations:
the method comprises the steps that a test terminal obtains a target configuration file, wherein the target configuration file comprises first configuration information;
the test terminal loads the target configuration file through a first application program and reads first configuration information included in the target configuration file;
the test terminal stores the first configuration information in a program variable corresponding to the first application program to obtain a second application program;
the test terminal runs the second application program and sends a first message to the test object;
and the test terminal receives a second message returned by the test object aiming at the first message, and determines the test result of the test object according to the first configuration information and the second message.
It should be noted that, the implementation of each operation may also correspond to the corresponding description of the method embodiment shown in fig. 1-2; the processor 601 may also cooperate with the input output interface 603 to perform other operations in the above-described method embodiments.
Embodiments of the present application also provide a computer-readable storage medium storing a computer program comprising program instructions which, when executed by a computer, cause the computer to perform the method according to the aforementioned embodiments, the computer may be part of the aforementioned test terminal. Such as the processor 601 described above.
It will be understood by those skilled in the art that all or part of the processes of the embodiments of the methods described above may be implemented by hardware instructions of a computer program, which may be stored in a computer-readable storage medium, and when executed, may include processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present application and is not to be construed as limiting the scope of the present application, so that the present application is not limited thereto, and all equivalent variations and modifications can be made to the present application.

Claims (9)

1. A method of test configuration, comprising:
a test terminal acquires a target configuration file, wherein the target configuration file comprises first configuration information, the first configuration information comprises communication information, message information and interface information, the message information comprises a message format, message sending content and a message sending time sequence, the message sending content comprises at least two pieces of message sending data, and the message sending time sequence is the sending sequence of the at least two pieces of message sending data in the message sending content;
the test terminal loads the target configuration file through a first application program and reads first configuration information included in the target configuration file;
the test terminal stores the first configuration information in a program variable corresponding to the first application program to obtain a second application program; the method comprises the following steps: the test terminal stores the interface information and the communication information in a group of program variables corresponding to the first application program, and stores at least two pieces of message sending data included in message sending contents in the message information in another group of program variables corresponding to the first application program according to the message sending time sequence to obtain a second application program;
the test terminal runs the second application program and sends a first message to a test object;
and the test terminal receives a second message returned by the test object aiming at the first message, and determines the test result of the test object according to the first configuration information and the second message.
2. The method of claim 1, wherein the obtaining of the target configuration file by the test terminal comprises:
the test terminal displays a first application interface corresponding to first application interface information, and the first application interface comprises a test control, an information display control and an information input control;
the test terminal acquires first configuration information input by a user on the first application interface and generates a target configuration file according to the first configuration information.
3. The method of claim 1, wherein the second application program executed by the test terminal sends the first message to the test object, and the method comprises:
the test terminal runs the second application program to generate a first message, the message format of the first message is the same as the message format included in the message information, and the message content of the first message is the same as the first message sending data in at least two pieces of message sending data included in the message sending content;
and the test terminal determines a communication mode corresponding to the communication information through the second application program, calls a sending function corresponding to the communication mode in the second application program, and sends the first message to the test object according to the message sending time sequence.
4. The method of claim 1, wherein the message information further comprises message receipt content;
the determining a test result of the test object according to the first configuration information and the second packet includes:
the test terminal detects whether the message format in the message information is matched with the message format of the second message, whether the message receiving content is matched with the message content of the second message, and whether the message sending time sequence in the message information is matched with the message sending time sequence of the second message;
and if the message format in the message information is matched with the message format of the second message, the message receiving content is matched with the message content of the second message, and the message sending time sequence in the message information is matched with the message sending time sequence of the second message, the test terminal determines that the test result of the test object is successful.
5. The method of claim 4, further comprising:
if any one of the message format in the message information and the message format of the second message, the message receiving content and the message content of the second message, and the message sending time sequence in the message information and the message sending time sequence of the second message is detected to be not matched, the test terminal determines that the test result of the test object is a test failure, and tests the test object again.
6. The method of claim 2, wherein the first configuration information further comprises interface information;
the method further comprises the following steps:
and the test terminal runs the second application program, and adjusts the first application interface based on the interface information in the first configuration information to obtain a second application interface.
7. A test apparatus, comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a target configuration file, the target configuration file comprises first configuration information, the first configuration information comprises communication information, message information and interface information, the message information comprises a message format, message sending content and a message sending time sequence, the message sending content comprises at least two pieces of message sending data, and the message sending time sequence is the sending sequence of the at least two pieces of message sending data in the message sending content;
the reading unit is used for loading the target configuration file through a first application program and reading first configuration information included in the target configuration file;
the storage unit is used for storing the first configuration information in a program variable corresponding to the first application program to obtain a second application program; the method comprises the following steps: the test terminal stores the interface information and the communication information in a group of program variables corresponding to the first application program, and stores at least two pieces of message sending data included in message sending contents in the message information in another group of program variables corresponding to the first application program according to the message sending time sequence so as to obtain a second application program;
the receiving and sending unit is used for running the second application program and sending a first message to the test object;
the receiving and sending unit is further configured to receive a second packet returned by the test object for the first packet;
and the determining unit is used for determining the test result of the test object according to the first configuration information and the second message.
8. A test terminal comprising a processor, a memory and an input/output interface, the processor, the memory and the input/output interface being connected to each other, wherein the input/output interface is used for inputting or outputting data, the memory is used for storing program code, and the processor is used for calling the program code and executing the method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to carry out the method according to any one of claims 1-6.
CN201911088043.9A 2019-11-08 2019-11-08 Test configuration method and related device Active CN110958155B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911088043.9A CN110958155B (en) 2019-11-08 2019-11-08 Test configuration method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911088043.9A CN110958155B (en) 2019-11-08 2019-11-08 Test configuration method and related device

Publications (2)

Publication Number Publication Date
CN110958155A CN110958155A (en) 2020-04-03
CN110958155B true CN110958155B (en) 2023-02-28

Family

ID=69977189

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911088043.9A Active CN110958155B (en) 2019-11-08 2019-11-08 Test configuration method and related device

Country Status (1)

Country Link
CN (1) CN110958155B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106933745A (en) * 2017-03-30 2017-07-07 携程计算机技术(上海)有限公司 WEB automatic interface testing methods and system
CN108628743A (en) * 2018-04-26 2018-10-09 武汉斗鱼网络科技有限公司 Applied program testing method, device, equipment and storage medium
CN108804318A (en) * 2018-05-24 2018-11-13 北京金山安全软件有限公司 Page element testing method and device, electronic equipment and storage medium
CN109656831A (en) * 2018-12-26 2019-04-19 北京物芯科技有限责任公司 Test packet centralization generation method, device, equipment and storage medium
CN109815105A (en) * 2017-11-20 2019-05-28 北京京东尚科信息技术有限公司 Applied program testing method and device based on Btrace

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106933745A (en) * 2017-03-30 2017-07-07 携程计算机技术(上海)有限公司 WEB automatic interface testing methods and system
CN109815105A (en) * 2017-11-20 2019-05-28 北京京东尚科信息技术有限公司 Applied program testing method and device based on Btrace
CN108628743A (en) * 2018-04-26 2018-10-09 武汉斗鱼网络科技有限公司 Applied program testing method, device, equipment and storage medium
CN108804318A (en) * 2018-05-24 2018-11-13 北京金山安全软件有限公司 Page element testing method and device, electronic equipment and storage medium
CN109656831A (en) * 2018-12-26 2019-04-19 北京物芯科技有限责任公司 Test packet centralization generation method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN110958155A (en) 2020-04-03

Similar Documents

Publication Publication Date Title
CN106209830B (en) message construction method based on XML network protocol expression
EP3703315B1 (en) Communication system, control device, setting device, setting method and program
CN106484611B (en) Fuzzy test method and device based on automatic protocol adaptation
AU2017377898B2 (en) System and method for address-mapped control of field programmable gate array (FPGA) via Ethernet
CN111064638B (en) Method, device, equipment and storage medium for testing e-mail protocol service
CN111246406A (en) Short message sending method, system, storage medium and terminal equipment
WO2020259551A1 (en) Method and apparatus for handling network connection fault
CN110888816A (en) Program testing method, program testing device, and storage medium
CN110445658B (en) Message processing method and system
CN110958155B (en) Test configuration method and related device
CN109951549B (en) Network page access method and device and computer readable storage medium
CN111786898A (en) Monitoring equipment information acquisition method, device, equipment and medium
US10459816B2 (en) Communication setting notification apparatus
CN113765722B (en) Configurable multi-protocol message processing method and device and electronic equipment
CN114168463A (en) Method and device for switching project environment, storage medium and electronic equipment
CN110971716B (en) Address configuration method, device, system and computer readable storage medium
JP6280089B2 (en) Whitelist creation device, whitelist creation method, and whitelist creation program
CN110519149B (en) Message pushing method and application system thereof
CN114615170B (en) Message processing method, device and computer storage medium
EP4300908A1 (en) Base station management system and method
CN111756748B (en) Data interaction method and device, electronic equipment and storage medium
CN116886463B (en) Cascade communication method, device, equipment and medium
CN112019649B (en) Method, device and system for correcting IP address, storage medium and electronic equipment
CN114048081A (en) VPN device testing method and device, electronic device and storage medium
CN111835812B (en) Global data acquisition method and device, electronic equipment and computer storage medium

Legal Events

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