WO2019205280A1 - Server testing method, apparatus, and device, and computer readable storage medium - Google Patents

Server testing method, apparatus, and device, and computer readable storage medium Download PDF

Info

Publication number
WO2019205280A1
WO2019205280A1 PCT/CN2018/093754 CN2018093754W WO2019205280A1 WO 2019205280 A1 WO2019205280 A1 WO 2019205280A1 CN 2018093754 W CN2018093754 W CN 2018093754W WO 2019205280 A1 WO2019205280 A1 WO 2019205280A1
Authority
WO
WIPO (PCT)
Prior art keywords
server
result
request message
message
sending
Prior art date
Application number
PCT/CN2018/093754
Other languages
French (fr)
Chinese (zh)
Inventor
林小渝
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019205280A1 publication Critical patent/WO2019205280A1/en

Links

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
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0811Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/14Arrangements for monitoring or testing data switching networks using software, i.e. software packages
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0815Network architectures or network communication protocols for network security for authentication of entities providing single-sign-on or federations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content

Definitions

  • the present application relates to the field of communications technologies, and in particular, to a server testing method, apparatus, device, and computer readable storage medium.
  • the current terminal development process is to develop the back-end server first, and develop the front-end. After the front end and the back end are successfully developed, the front end and the back end are tested together. Since the development of the front-end needs to be based on the latter, when the problem occurs in the back-end test, the front-end and the back-end need to be re-developed, resulting in high development cost and low development efficiency.
  • the main purpose of the present application is to provide a test method, device, device and computer readable storage medium for a server, which aims to solve the problem that the development of the existing front end needs the back end, which leads to high development cost and low development efficiency. problem.
  • the present application provides a test method for a server, and the test method of the server includes the following steps:
  • the login operation is performed according to the login information, and after the login operation is successfully performed, the corresponding login string is obtained, and the login string is converted into the first request message;
  • the present application further provides a testing device for a server, where the testing device of the server includes:
  • An obtaining module configured to perform a login operation according to the login information after obtaining the login information by using the JMeter, and obtain a corresponding login string after successfully performing the login operation;
  • a conversion module configured to convert the login string into a first request message
  • a sending module configured to send the first request message to the server, after the server receives the first request message, verify the first request message, and obtain a verification result, and Returning the verification result;
  • the obtaining module is further configured to: after receiving the verification result, and determining to successfully establish a connection with the server according to the verification result, acquiring information to be sent by using the JMeter;
  • the conversion module is further configured to: send the information to be sent into a second request message and send the message to the server, where the server sends the second request message after receiving the second request message.
  • the text is sent to the receiving end and returns the result of the transmission;
  • a determining module configured to determine a test result of the server according to the sending result after receiving the sending result.
  • the present application further provides a test device of a server, the test device of the server comprising a memory, a microprocessor, and a test of a server stored on the memory and operable on the processor A program, the step of testing the server as described above, when the test program of the server is executed by the microprocessor.
  • the present application further provides a computer readable storage medium having a test program of a server stored thereon, and the test program of the server is implemented by the processor to implement the above The steps of the server's test method.
  • the application After obtaining the login information through the JMeter, the application performs the login operation according to the login information, and obtains the corresponding login string after successfully performing the login operation, and converts the login string into the first request message; the first request message is sent.
  • Sending to the server after receiving the first request message, the server verifies the first request message, obtains the verification result, and returns the verification result; when receiving the verification result, and determining according to the verification result
  • the information is to be sent through the JMeter; the information to be sent is converted into the second request message and sent to the server, so that the server sends the second request message to the receiving after receiving the second request message.
  • the JMeter emulates the terminal device to send messages to the backend to test the backend, avoiding waiting for the front end to be developed before testing the backend, improving development efficiency and reducing development costs. .
  • FIG. 1 is a schematic flow chart of a first embodiment of a testing method of a server of the present application
  • FIG. 2 is a schematic flow chart of a second embodiment of a testing method of the server of the present application.
  • FIG. 3 is a functional block diagram of a preferred embodiment of a test apparatus of the server of the present application.
  • FIG. 4 is a schematic structural diagram of a hardware operating environment involved in an embodiment of the present application.
  • FIG. 1 is a schematic flowchart of a first embodiment of a test method of a server according to the present application.
  • the embodiment of the present application provides an embodiment of a test method of a server. It should be noted that although the logical sequence is shown in the flowchart, in some cases, the illustrated or The steps described.
  • test method of the server can be applied to the test device of the server, and the test device of the server can be a PC (personal For the convenience of description, the following embodiments describe the present application with the test device as the execution subject.
  • JMeter is installed, and JMeter is a Java-based pressure developed by the Apache organization. test tools.
  • the server's test methods include:
  • Step S10 after obtaining the login information by the JMeter, performing a login operation according to the login information, and acquiring a corresponding login string after successfully performing the login operation, and converting the login string into the first request message.
  • the test device After the test device obtains the login information through the JMeter, the test device performs a login operation according to the login information, and obtains a login string after successfully performing the login operation. After the test device obtains the login string, the login string is converted into the first request message.
  • the login information includes the user name and login password of the login user.
  • the login string is the unique session ID after the user successfully logs in. Different users have different login information, and different login information corresponds to different login strings. The correspondence between the login information and the login string is set in advance. Users can pass the GUI in JMeter (Graphical Enter the user name and login password in the Information Send panel of the User Interface.
  • test device After the test device obtains the login information, it detects whether the click JMeter is detected.
  • the GUI page performs a click operation of the button.
  • the test device detects the click operation, it initializes the listener thread to restore the listener thread to the original state.
  • the test device restores the listening thread to its original state, the test device starts the listening thread and performs a login operation after starting the listening thread.
  • the test device invokes the corresponding login interface according to the login information, obtains the login string through the login interface, and stores the obtained login string into the global system parameter.
  • the global system parameters include but are not limited to the environment type, key, communication version number, device type, server IP address, port number, and login string.
  • the environment type includes the local environment and the test environment, the local environment is the development environment, and the test environment is the test environment set by the developer.
  • the tester can select the corresponding environment type according to the needs, or pre-set the corresponding environment type.
  • the server is directly tested according to the preset environment type.
  • the device type is the type of test device, and the device type includes Android (Android) and iOS.
  • the listening process of the listening thread is: calling an implementation class Pack Monitor of the Channel Handler interface. Handler to create a listener thread, this class has two methods, up stream and down stream. Up Stream is used to monitor sending messages when calling NIO (Non-blocking I/O) Socket When the channel class write (write) method, capture the data of the Byte buffer parameter in the write method into the context object, up The Stream method will fetch the data from the context object and output it to resopnse Data.
  • NIO Non-blocking I/O
  • Down Stream is used to monitor incoming messages, in NIO, when Selection When the Key is the Read Readable readable state, the received data is read into the Byte Buffer according to the Socket Channel read method, and the Byte is The Buffer is placed in the context object, and the down Stream method takes the data from the context object and outputs it to the resopnse Data.
  • NIO in the Java world, also known as New I/O
  • New I/O is a synchronous non-blocking I/O model that is the basis for I/O multiplexing.
  • Channel The Handler is responsible for intercepting and processing I/O (Input/Output) events or I/O operations. It can selectively intercept and process events of interest to you, as well as transparently and terminate the delivery of events.
  • I/O Input/Output
  • the Buffer class is a buffer class that is often used in Java NIO and can be used for efficient I/O operations.
  • test device when it obtains the login information, it may not detect whether the click JMeter is detected.
  • the GUI interface performs a click operation of the button to directly initialize the listening thread.
  • the validity period can be set for the login string.
  • the test device obtains the login string, it detects whether the login string is within the validity period. If the login string is within the validity period, the test device determines that the login operation is successfully executed. If the login string is not within the validity period, the test device determines that the login operation has expired.
  • the expiration date can be set according to specific needs, such as 10 minutes, 15 minutes, or 25 minutes.
  • step of converting the login string into the first request message includes:
  • step a a bit operation is performed according to the length of the login string to recombine the login string to obtain the reassembled login string.
  • the process of converting the login string into the first request packet by the test device may be: obtaining the length of the login string, performing bit operations according to the length of the login string in the for loop body, and reassembling the login string to obtain The refactored login string.
  • Step b Perform modulo operation on the re-established login string and the preset prime number to obtain a data packet corresponding to the login string.
  • the re-composed login string is modulo-operated with the preset prime number to obtain a data packet corresponding to the login string.
  • the preset prime number is 31.
  • the prime number 31 is the length specified in Java. It can be understood that the preset prime number can be modified to other prime numbers in the Java code as needed.
  • Step c Convert the data packet into a first request message by using a preset protocol.
  • the test device After the test device obtains the data packet corresponding to the login string, the data packet is converted into the first request packet by using a preset protocol.
  • a preset protocol the default agreement can be Google Protobuf protocol or Apache Thrift protocol.
  • Step S20 Send the first request message to the server, after the server receives the first request message, check the first request message, obtain a verification result, and return to the server. Said the verification result.
  • the global system parameter is loaded to obtain the IP of the server in the global system parameter (Internet) Protocol, the protocol that is interconnected between networks)
  • the address and port number through which the first request message is sent to the server can load the global system parameters through the Java reflection technology to obtain the IP address and port number of the server.
  • the server parses the request packet, obtains a parsing result, and verifies the first request packet according to the parsing result to obtain a verification result.
  • the server obtains the verification result, the verification result is sent to the test device.
  • the server can be XMPP (Extensible Messaging and Presence Protocol, scalable communication and presentation protocol) server. It should be noted that in the global system parameters, the IP address and port number of the server to be tested are set in advance.
  • the user can also enter the IP address and port number of the server in the GUI page of JMeter.
  • the server detects whether a JMeter is detected. Click on the button in the GUI page. If the click operation is detected, the test device performs the encapsulation operation and the instantiation operation through the custom lazy loading class, starts its internal auto-dealing thread, reads the class under the corresponding data packet through the thread, and loads through the Java reflection technology. And activate its internal API (Application Programming
  • the interface application programming interface
  • the test device after the test device obtains the IP address and the port number of the server, the test device automatically sends the first request message to the server by using the IP address and the port number.
  • step S20 includes:
  • step d the first request message is sent to the server through the preset communication technology framework, so that the server determines the user corresponding to the first request message after receiving the first request message. And verifying that the user corresponding to the first request packet is in a valid state and is in a login state, obtaining a verification result, and returning the verification result;
  • the server obtains a verification result that the first request packet passes the check if the user is in a valid state and is in a login state;
  • the server obtains a verification result that the first request packet fails the verification.
  • the first request message is encrypted, and the encrypted first request message is obtained, and the first request message is sent to the server through a preset communication technology framework.
  • the preset communication technology framework includes, but is not limited to, NIO, aio, netty, and mina as communication technology frameworks.
  • the process of encrypting the first request packet is: defining a packet class, the structure of the packet class is: type, length, version, and content, where type indicates a packet type, and length indicates a message message.
  • the length of the content, version indicates the version to which the message belongs, and content is a byte array that records the contents of the message.
  • the encryption method is a process of converting the first request packet into a packet class.
  • the server After receiving the first request packet, the server parses the first request packet, obtains a login string in the first request packet, and determines a user corresponding to the login string, that is, determines that the first request packet corresponds to user. After determining the user, the server verifies whether the user is in a valid state and is in a login state, obtains a verification result, and sends the verification result to the test device. Specifically, if the user is in the active state and is in the login state, the server determines that the first request packet is in the valid state, and obtains the verification result of the first request packet, and returns the first request packet to pass the verification.
  • the test result is sent to the test device; if the user is in an invalid state and/or is in a non-login state, the server determines that the first request message is in an invalid state, and obtains a check result that the first request message fails the check, and returns the first request.
  • the server searches in its database whether there is a preset user name that is the same as the user name of the user. If the preset user name matching the user name is found in the database, the server determines that the user is in a valid state; if the preset user name consistent with the user name is not found in the database, the server determines that the user is in an invalid state. If the validity period is not set for the login string, the server directly determines that the user is logged in according to the login string; if the login string is set to the validity period, the server determines whether the login string is within the validity period. If the login string is within the validity period, the server determines that the user is in the login state; if the login string is not within the validity period, the server determines that the user is in the non-login state.
  • Step S30 After receiving the verification result, and determining to successfully establish a connection with the server according to the verification result, obtain information to be sent by using the JMeter.
  • the test device After the test device receives the verification result and determines that the first request message passes the verification according to the verification result, the test device determines that the connection has been successfully established with the server. After the test device determines that it has successfully established a connection with the server, the test device obtains the message to be sent through the JMeter GUI page. It should be noted that the message to be sent is input by the user in the GUI page of JMeter according to the information specification of the server. The message to be sent is a message for testing the server, and the type and content of the message to be sent may be set according to specific needs, which is not limited in this embodiment.
  • Step S40 The information to be sent is converted into a second request message and sent to the server, so that the server sends the second request message to the receiving after receiving the second request message. End and return the result.
  • the test device After the test device obtains the to-be-sent message, the test device converts the to-be-sent message into a second request message and sends the message to the server.
  • the server After receiving the second request packet sent by the test device, the server parses the second request packet, obtains a to-be-sent message corresponding to the second request packet, sends the to-be-sent message to the receiving end, and generates a sending result, Send the results to the test equipment.
  • the process of sending the to-be-sent message to the receiving end by the server is: obtaining the message identifier of the message to be sent, and obtaining a timestamp corresponding to the parsing time of parsing the second request message, and assembling the message identifier and the timestamp into a json String, written to the Byte Buffer buffer, using the Socket Channel.write (Byte Buffer) method in NIO to json The string is written to the pipe registered by the test device to send the message to be sent to the receiving end.
  • the server If the message to be sent is successfully sent to the receiving end, the server generates a sending result of the Json string containing the message identifier and the timestamp; if the message to be sent is not successfully sent to the receiving end, the server generates the message identifier and the timestamp. And the error message consists of the result of the Json string sent. Further, the server may determine whether the message to be sent is successfully sent according to whether the response message returned by the receiving end is received within a preset duration. The preset duration can be set according to specific needs, and is not limited in this embodiment.
  • test device After the test device obtains the second request message, it is detected whether a click operation of clicking the execution button is received in the JMeter GUI page. If the click operation is received, the test device sends the second request message to the server.
  • test device After the test device obtains the second request message, the test device automatically sends the second request message to the server.
  • step S40 includes:
  • step e the information to be sent is converted into a corresponding message object, and the message object is converted into a second request message according to a preset protocol.
  • the process for the test device to send the to-be-sent message to the server is: after the test device obtains the to-be-sent message, the message to be sent is converted into a corresponding message object, and the byte array corresponding to the message object is obtained according to a preset protocol.
  • the default agreement includes but not limited to Google Protobuf protocol or Apache Thrift protocol.
  • the process of the test device converting the message to be sent into the corresponding message object is: the test device uses dom4j to convert the message to be sent into a Document object; converts the Document object into an Element object; and calls the Element object as a parameter to call Message (message)
  • the constructor gets a message object.
  • dom4j is a Java XML (Extensible Markup Language, Extensible Markup Language) API (Application Programming Interface, application programming interface), is an upgrade of jdom, used to read and write XML files.
  • Access to HTML via the document object (Hyper Text Markup Language, Hypertext Markup Language) Any HTML markup contained in a document, and can dynamically change the content of HTML markup, such as forms, images, tables, and hyperlinks.
  • Element object representation HTML element Any HTML markup contained in a document, and can dynamically change the content of HTML markup, such as forms, images, tables, and hyperlinks.
  • step f the second request packet is sent to the server, so that the server sends the to-be-sent message corresponding to the second request packet after receiving the second request packet. Give the receiver and return the result.
  • the second request message is sent to the server.
  • the server parses the second request packet, obtains a to-be-sent message corresponding to the second request packet, sends the to-be-sent message to the receiving end, generates a sending result, and returns the sending result to the test. device.
  • the process of the server parsing the second request message is: taking out the Byte from the Socket Server Channle Buffer object, then take out the Byte
  • the byte array in the Buffer object is converted into a message object according to a preset protocol, and then the message object is converted into a message to be sent.
  • the process of converting the message object into the message to be sent is an inverse process of converting the message to be sent into a message object, which is not described in this embodiment.
  • Java The Server Socket Channel in NIO is a TCP that can listen for incoming incoming packets (Transmission Control) Protocol, Transmission Control Protocol) Connected channels, just like the Server Socket in standard I/O.
  • Step S50 After receiving the sending result, determining a test result of the server according to the sending result.
  • the test device After the test device receives the transmission result, the test device determines the test result of the server according to the transmission result.
  • step S50 includes:
  • Step g After receiving the sending result, detecting a string composition manner carried in the sending result.
  • Step h if the string of the transmission result is composed of a timestamp and a message identifier of the to-be-sent message, determining that the server passes the test, wherein the timestamp is the server parsing the second The timestamp corresponding to the parsing time of the request message.
  • step i if the character string of the sending result is not composed of the time stamp and the message identifier of the to-be-sent message, it is determined that the server fails the test.
  • the test device After the test device receives the sending result sent by the server, the test device obtains the string carried in the sending result, and detects the composition of the string. If the string in the sending result is a time stamp and a message identifier of the message to be sent, the test device determines that the server passes the test; if the string in the sent result is not composed of the server time stamp and the message identifier of the message to be sent, The test device determines that the server has not passed the test. It should be noted that the timestamp is a timestamp corresponding to the parsing time of the second request message parsed by the server. When the server determines that the to-be-sent message is not successfully sent to the receiving end, the server sends a string consisting of the message identifier, the timestamp, and the error message of the corresponding message sending error to the test device.
  • the test device may set a corresponding value according to the transmission result, and display the set value to prompt the test result of the corresponding user server according to the value. For example, when the test device determines that the server passes the test according to the transmission result, the corresponding value of the measurement device setting is “11”, indicating that the server passes the test; when the test device determines that the server fails the test according to the transmission result, the corresponding value of the test device setting is "00" indicates that the server failed the test.
  • the login operation is performed according to the login information, and after the login operation is successfully performed, the corresponding login string is obtained, and the login string is converted into the first request message.
  • Transmitting the first request message to the server after the server receives the first request message, verifying the first request message, obtaining a verification result, and returning to the school
  • the information to be sent is obtained by the JMeter; and the information to be sent is converted into the second request report.
  • the JMeter emulates the terminal device to send messages to the backend to test the backend, avoiding waiting for the front end to be developed before testing the backend, improving development efficiency and reducing development costs.
  • the second embodiment of the test method of the server is different from the first embodiment of the test method of the server.
  • the test method of the server further includes:
  • Step S60 after detecting the disconnection instruction disconnected from the server, disconnecting from the server according to the disconnection instruction.
  • the test device detects whether a disconnect command to disconnect from the server is detected.
  • the test device detects the disconnection command, the test device disconnects from the server according to the disconnection command.
  • the disconnection command may be automatically triggered by the test device after the server passes the test; the disconnection command may also be manually triggered by the user on the GUI page of the test device JMeter. Specifically, the user can click on JMeter
  • the execute button in the GUI page triggers a break instruction.
  • the test device can disconnect from the server through the NIO technology and then restore its global system parameters to the initial state.
  • the connection with the server is disconnected according to the disconnection command. After obtaining the test result of the server, the connection between the server and the server is disconnected in time, the power is saved, and the server is kept connected and the service life of the server is prolonged.
  • Step k triggering a monitoring instruction, and monitoring a connection state with the server according to the monitoring instruction.
  • a monitoring instruction is triggered, and the connection state with the server is monitored according to the monitoring instruction.
  • the test device monitors the connection status between the server and the server: the test device creates a heartbeat packet, and starts the heartbeat packet after creating the heartbeat packet, and sends a timing task to the server through the heartbeat packet to monitor the connection between the server and the server. status. After the test device starts the heartbeat packet, the test device obtains the corresponding heartbeat log, and stores the heartbeat log, so that the user determines whether the test device and the server are in the connected state according to the heartbeat log. It should be noted that the test device sends a scheduled task to the server through the heartbeat packet, that is, the test device continuously sends a connection request to the server through the JMeter.
  • the connection state between the test device and the server is monitored, so that the tester can know the connection state between the test device and the server in time.
  • the application further provides a testing device for a server, where the testing device of the server includes:
  • the obtaining module 10 is configured to perform a login operation according to the login information after obtaining the login information by using the JMeter, and obtain a corresponding login string after successfully performing the login operation;
  • the conversion module 20 is configured to convert the login string into a first request message
  • the sending module 30 is configured to send the first request message to the server, where the server, after receiving the first request message, checks the first request message to obtain a verification result. And returning the verification result;
  • the obtaining module 10 is further configured to: after receiving the verification result, and determining to successfully establish a connection with the server according to the verification result, acquiring information to be sent by using the JMeter;
  • the conversion module 20 is further configured to convert the to-be-sent information into a second request message and send the message to the server, where the server sends the second request after receiving the second request message. The message is sent to the receiving end, and the result is returned.
  • the determining module 40 is configured to determine a test result of the server according to the sending result after receiving the sending result.
  • the obtaining module 10 performs a login operation according to the login information, and obtains a corresponding login string after successfully performing the login operation, and the conversion module 20 converts the login string into the first request message.
  • the sending module 30 sends the first request message to the server, so that after receiving the first request message, the server verifies the first request message, obtains the verification result, and returns the verification result; when receiving the school After the result is determined, and the connection is successfully established with the server according to the verification result, the obtaining module 10 obtains the information to be sent through the JMeter; the converting module 20 converts the information to be sent into the second request message and sends the information to the server for the server to receive.
  • the second request message is sent to the receiving end, and the sending result is returned; after receiving the sending result, the determining module 40 determines the test result of the server according to the sending result.
  • the JMeter emulates the terminal device to send messages to the backend to test the backend, avoiding waiting for the front end to be developed before testing the backend, improving development efficiency and reducing development costs. .
  • the test device of the server further includes:
  • disconnecting the module configured to disconnect the connection with the server according to the disconnection command after detecting a disconnection instruction disconnected from the server.
  • testing device of the server further includes:
  • a monitoring module configured to trigger a monitoring instruction, and monitor a connection state with the server according to the monitoring instruction.
  • the conversion module 20 includes:
  • a recombining unit configured to perform a bit operation according to the length of the login string, to recombine the login string, to obtain the recombined login string;
  • An operation unit configured to perform a modulo operation on the re-established login string and the preset prime number to obtain a data packet corresponding to the login string;
  • the first converting unit is configured to convert the data packet into a first request message by using a preset protocol.
  • the sending module 30 is further configured to send the first request message to the server by using a preset communication technology framework, so that the server determines the first request after receiving the first request message. a user corresponding to the packet, and verifying whether the user corresponding to the first request packet is in a valid state and is in a login state, obtaining a verification result, and returning the verification result;
  • the server obtains a verification result of the first request packet passing the verification; if the user is in an invalid state and/or a non-login state, The server obtains a verification result that the first request packet fails the verification.
  • the conversion module 20 further includes:
  • a second converting unit configured to convert the to-be-sent information into a corresponding message object, and convert the message object into a second request message according to a preset protocol
  • a sending unit configured to send the second request message to the server, where the server sends the second request message corresponding to the to-be-sent after receiving the second request message The message is sent to the receiver and the result is sent back.
  • the determining module 40 includes:
  • a detecting unit configured to detect a string composition manner carried in the sending result after receiving the sending result
  • a determining unit configured to: if the character string of the sending result is composed of a timestamp and a message identifier of the to-be-sent message, determining that the server passes the test, wherein the timestamp is the server parsing the The timestamp corresponding to the parsing time of the second request message; if the character string of the sending result is not composed of the timestamp and the message identifier of the to-be-sent message, it is determined that the server fails the test.
  • each embodiment of the testing device of the server is substantially the same as the embodiments of the testing method of the server, and details are not described herein again.
  • FIG. 4 is a schematic structural diagram of a hardware operating environment involved in an embodiment of the present application.
  • FIG. 4 can be a schematic structural diagram of a hardware operating environment of a test device of the server.
  • the test device of the server of the embodiment of the present application may be a terminal device such as a PC or a portable computer.
  • the test device of the server may include a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002.
  • the communication bus 1002 is used to implement connection communication between these components.
  • the memory 1005 may be a high speed RAM memory or a stable memory (non-volatile) Memory), such as disk storage.
  • the memory 1005 can also optionally be a storage device independent of the aforementioned processor 1001.
  • test device structure of the server shown in FIG. 4 does not constitute a limitation of the test device of the server, and may include more or less components than those illustrated, or combine some components, or different. Parts layout.
  • a memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a test program of the server.
  • the operating system is a program that manages and controls the test device hardware and software resources of the server, and supports the test program of the server and the operation of other software or programs.
  • the user interface 1003 is mainly used to receive the login information input by the user and the operation of clicking the execution button;
  • the network interface 1004 is mainly used to connect to the server, and the processor 1001 can be used to call the memory 1005.
  • the test program of the server stored in the server and the steps of the test method of the server as described above.
  • testing device of the server of the present application are substantially the same as the embodiments of the testing method of the foregoing server, and details are not described herein again.
  • the embodiment of the present application further provides a computer readable storage medium, where the test program of the server is stored, and the test program of the server is executed by the processor to implement the test of the server as described above. The steps of the method.
  • the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be through hardware, but in many cases, the former is better.
  • Implementation Based on such understanding, the technical solution of the present application, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk,
  • the optical disc includes a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Environmental & Geological Engineering (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The present application discloses a server testing method, apparatus, and device, and a computer readable storage medium. The method comprises steps of: performing a login operation after login information is acquired via JMeter, acquiring a corresponding login string after the login operation is successfully executed, converting the login string into a first request message, and sending the first request message to a server, such that the server receives and verifies the first request message, obtains a verification result, and returns the verification result; after the verification result is received and it is determined, according to the verification result, that a connection is successfully established with the server, acquiring, via JMeter, information to be sent; converting the information to be sent into a second request message and sending the second request message to the server, such that the server sends the second request message to a receiving end after receiving the second request message and returns a sending result; and after the sending result is received, determining a test result of the server according to the sending result. The present application improves efficiency of server development and reduces development costs.

Description

服务器的测试方法、装置、设备及计算机可读存储介质  Server test method, device, device and computer readable storage medium
本申请要求于2018年4月24日提交中国专利局、申请号为201810370939.5、发明名称为“服务器的测试方法、装置、设备及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。The present application claims priority to Chinese Patent Application No. 201810370939.5, entitled "Testing Method, Apparatus, Apparatus, and Computer-Readable Storage Medium for Servers", filed on April 24, 2018, the entire contents of which are incorporated herein by reference. It is incorporated in the application by reference.
技术领域Technical field
本申请涉及通信技术领域,尤其涉及一种服务器的测试方法、装置、设备及计算机可读存储介质。The present application relates to the field of communications technologies, and in particular, to a server testing method, apparatus, device, and computer readable storage medium.
背景技术Background technique
目前的终端开发过程是先开发后端的服务器,在开发前端。当前端和后端都成功开发后,才将前端和后端一起测试。由于前端的开发需要以后端为基础,因此当测试到后端出现问题时,需要重新开发前端和后端,从而导致开发成本高,开发效率低。The current terminal development process is to develop the back-end server first, and develop the front-end. After the front end and the back end are successfully developed, the front end and the back end are tested together. Since the development of the front-end needs to be based on the latter, when the problem occurs in the back-end test, the front-end and the back-end need to be re-developed, resulting in high development cost and low development efficiency.
发明内容Summary of the invention
本申请的主要目的在于提供一种服务器的测试方法、装置、设备及计算机可读存储介质,旨在解决现有的前端的开发需要以后端为基础,导致开发成本高,以及开发效率低的技术问题。The main purpose of the present application is to provide a test method, device, device and computer readable storage medium for a server, which aims to solve the problem that the development of the existing front end needs the back end, which leads to high development cost and low development efficiency. problem.
为实现上述目的,本申请提供一种服务器的测试方法,所述服务器的测试方法包括步骤:To achieve the above objective, the present application provides a test method for a server, and the test method of the server includes the following steps:
当通过JMeter获取到登录信息后,根据所述登录信息执行登录操作,并在成功执行所述登录操作后获取对应的登录字符串,将所述登录字符串转换成第一请求报文;After the login information is obtained by the JMeter, the login operation is performed according to the login information, and after the login operation is successfully performed, the corresponding login string is obtained, and the login string is converted into the first request message;
将所述第一请求报文发送至服务器,以供所述服务器在接收到所述第一请求报文后,校验所述第一请求报文,得到校验结果,并返回所述校验结果;Sending the first request message to the server, after the server receives the first request message, verifying the first request message, obtaining a verification result, and returning the check result;
当接收到所述校验结果,且根据所述校验结果确定与所述服务器成功建立连接后,通过所述JMeter获取待发送信息;After receiving the verification result, and determining to successfully establish a connection with the server according to the verification result, obtaining information to be sent by using the JMeter;
将所述待发送信息转换成第二请求报文发送给所述服务器,以供所述服务器在接收到所述第二请求报文后,将所述第二请求报文发送给接收端,并返回发送结果;Converting the to-be-sent information into a second request message, and sending the second request message to the server, after the server receives the second request message, sending the second request message to the receiving end, and Return the result of the transmission;
当接收到所述发送结果后,根据所述发送结果确定所述服务器的测试结果。After receiving the transmission result, determining a test result of the server according to the transmission result.
此外,为实现上述目的,本申请还提供一种服务器的测试装置,所述服务器的测试装置包括:In addition, in order to achieve the above object, the present application further provides a testing device for a server, where the testing device of the server includes:
获取模块,用于当通过JMeter获取到登录信息后,根据所述登录信息执行登录操作,并在成功执行所述登录操作后获取对应的登录字符串;An obtaining module, configured to perform a login operation according to the login information after obtaining the login information by using the JMeter, and obtain a corresponding login string after successfully performing the login operation;
转换模块,用于将所述登录字符串转换成第一请求报文;a conversion module, configured to convert the login string into a first request message;
发送模块,用于将所述第一请求报文发送至服务器,以供所述服务器在接收到所述第一请求报文后,校验所述第一请求报文,得到校验结果,并返回所述校验结果;a sending module, configured to send the first request message to the server, after the server receives the first request message, verify the first request message, and obtain a verification result, and Returning the verification result;
所述获取模块还用于当接收到所述校验结果,且根据所述校验结果确定与所述服务器成功建立连接后,通过所述JMeter获取待发送信息;The obtaining module is further configured to: after receiving the verification result, and determining to successfully establish a connection with the server according to the verification result, acquiring information to be sent by using the JMeter;
所述转换模块还用于将所述待发送信息转换成第二请求报文发送给所述服务器,以供所述服务器在接收到所述第二请求报文后,将所述第二请求报文发送给接收端,并返回发送结果;The conversion module is further configured to: send the information to be sent into a second request message and send the message to the server, where the server sends the second request message after receiving the second request message. The text is sent to the receiving end and returns the result of the transmission;
确定模块,用于当接收到所述发送结果后,根据所述发送结果确定所述服务器的测试结果。And a determining module, configured to determine a test result of the server according to the sending result after receiving the sending result.
此外,为实现上述目的,本申请还提供一种服务器的测试设备,所述服务器的测试设备包括存储器、微处理器和存储在所述存储器上并可在所述处理器上运行的服务器的测试程序,所述服务器的测试程序被所述微处理器执行时实现如上所述的服务器的测试方法的步骤。In addition, in order to achieve the above object, the present application further provides a test device of a server, the test device of the server comprising a memory, a microprocessor, and a test of a server stored on the memory and operable on the processor A program, the step of testing the server as described above, when the test program of the server is executed by the microprocessor.
此外,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有服务器的测试程序,所述服务器的测试程序被处理器执行时实现如上所述的服务器的测试方法的步骤。In addition, in order to achieve the above object, the present application further provides a computer readable storage medium having a test program of a server stored thereon, and the test program of the server is implemented by the processor to implement the above The steps of the server's test method.
本申请当通过JMeter获取到登录信息后,根据登录信息执行登录操作,并在成功执行登录操作后获取对应的登录字符串,将登录字符串转换成第一请求报文;将第一请求报文发送至服务器,以供服务器在接收到第一请求报文后,校验第一请求报文,得到校验结果,并返回校验结果;当接收到校验结果,且根据校验结果确定与服务器成功建立连接后,通过JMeter获取待发送信息;将待发送信息转换成第二请求报文发送给服务器,以供服务器在接收到第二请求报文后,将第二请求报文发送给接收端,并返回发送结果;当接收到发送结果后,根据发送结果确定服务器的测试结果。实现了在开发出后端时,通过JMeter模拟终端设备向后端发送消息,以测试后端,避免了要等到开发出前端后,才可以测试后端,提高了开发效率,以及降低了开发成本。After obtaining the login information through the JMeter, the application performs the login operation according to the login information, and obtains the corresponding login string after successfully performing the login operation, and converts the login string into the first request message; the first request message is sent. Sending to the server, after receiving the first request message, the server verifies the first request message, obtains the verification result, and returns the verification result; when receiving the verification result, and determining according to the verification result After the server successfully establishes the connection, the information is to be sent through the JMeter; the information to be sent is converted into the second request message and sent to the server, so that the server sends the second request message to the receiving after receiving the second request message. End, and return the result of the transmission; when the result of the transmission is received, the test result of the server is determined according to the result of the transmission. When the backend is developed, the JMeter emulates the terminal device to send messages to the backend to test the backend, avoiding waiting for the front end to be developed before testing the backend, improving development efficiency and reducing development costs. .
附图说明DRAWINGS
图1是本申请服务器的测试方法第一实施例的流程示意图;1 is a schematic flow chart of a first embodiment of a testing method of a server of the present application;
图2是本申请服务器的测试方法第二实施例的流程示意图;2 is a schematic flow chart of a second embodiment of a testing method of the server of the present application;
图3是本申请服务器的测试装置较佳实施例的功能示意图模块图;3 is a functional block diagram of a preferred embodiment of a test apparatus of the server of the present application;
图4是本申请实施例方案涉及的硬件运行环境的结构示意图。FIG. 4 is a schematic structural diagram of a hardware operating environment involved in an embodiment of the present application.
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The implementation, functional features and advantages of the present application will be further described with reference to the accompanying drawings.
具体实施方式detailed description
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。It is understood that the specific embodiments described herein are merely illustrative of the application and are not intended to be limiting.
本申请提供一种服务器的测试方法,参照图1,图1为本申请服务器的测试方法第一实施例的流程示意图。The present application provides a test method for a server. Referring to FIG. 1, FIG. 1 is a schematic flowchart of a first embodiment of a test method of a server according to the present application.
本申请实施例提供了服务器的测试方法的实施例,需要说明的是,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。The embodiment of the present application provides an embodiment of a test method of a server. It should be noted that although the logical sequence is shown in the flowchart, in some cases, the illustrated or The steps described.
服务器的测试方法可应用于服务器的测试设备,服务器的测试设备可为PC(personal computer,个人计算机),便携计算机等终端设备,为了便于描述,以下实施例以测试设备为执行主体描述本申请,在服务器的测试设备中,安装有JMeter,JMeter是Apache组织开发的基于Java的压力测试工具。服务器的测试方法包括:The test method of the server can be applied to the test device of the server, and the test device of the server can be a PC (personal For the convenience of description, the following embodiments describe the present application with the test device as the execution subject. In the test device of the server, JMeter is installed, and JMeter is a Java-based pressure developed by the Apache organization. test tools. The server's test methods include:
步骤S10,当通过JMeter获取到登录信息后,根据所述登录信息执行登录操作,并在成功执行所述登录操作后获取对应的登录字符串,将所述登录字符串转换成第一请求报文。Step S10, after obtaining the login information by the JMeter, performing a login operation according to the login information, and acquiring a corresponding login string after successfully performing the login operation, and converting the login string into the first request message. .
当测试设备通过JMeter获取到登录信息后,测试设备根据登录信息执行登录操作,并在成功执行登录操作后获取登录字符串。当测试设备获取到登录字符串后,将登录字符串转换成第一请求报文。其中,登录信息包括登录用户的用户名和登录密码,登录字符串是用户成功登录后的唯一会话ID,不同用户有不同的登录信息,不同登录信息对应着不同的登录字符串。登录信息与登录字符串之间的对应关系是预先设置好的。用户可通过在JMeter的GUI(Graphical User Interface,图形用户界面)的信息发送面板中输入其用户名和登录密码。After the test device obtains the login information through the JMeter, the test device performs a login operation according to the login information, and obtains a login string after successfully performing the login operation. After the test device obtains the login string, the login string is converted into the first request message. The login information includes the user name and login password of the login user. The login string is the unique session ID after the user successfully logs in. Different users have different login information, and different login information corresponds to different login strings. The correspondence between the login information and the login string is set in advance. Users can pass the GUI in JMeter (Graphical Enter the user name and login password in the Information Send panel of the User Interface.
进一步地,当测试设备获取到登录信息后,检测是否侦测到点击JMeter GUI页面执行按钮的点击操作。当测试设备侦测到该点击操作后,初始化监听线程,以将监听线程恢复至最初状态。当测试设备将监听线程恢复至最初状态后,测试设备启动监听线程,并在启动监听线程后执行登录操作。当执行登录操作后,测试设备根据登录信息调用对应的登录接口,通过该登录接口获取登录字符串,并将所获取的登录字符串存储至全局系统参数中。其中,全局系统参数包括但不限于环境类型、密钥、通信版本编号、设备类型、服务器的IP地址、端口号和登录字符串。环境类型包括本地环境和测试环境,本地环境为开发环境,测试环境是开发人员设置的测试环境。在进行服务器的测试过程中,测试人员可根据需要选择对应的环境类型,或者预先设置好对应的环境类型,在测试服务器过程中,直接根据预先设置好的环境类型测试服务器。设备类型为测试设备的类型,设备类型包括可为Android(安卓)和iOS。Further, after the test device obtains the login information, it detects whether the click JMeter is detected. The GUI page performs a click operation of the button. When the test device detects the click operation, it initializes the listener thread to restore the listener thread to the original state. When the test device restores the listening thread to its original state, the test device starts the listening thread and performs a login operation after starting the listening thread. After the login operation is performed, the test device invokes the corresponding login interface according to the login information, obtains the login string through the login interface, and stores the obtained login string into the global system parameter. The global system parameters include but are not limited to the environment type, key, communication version number, device type, server IP address, port number, and login string. The environment type includes the local environment and the test environment, the local environment is the development environment, and the test environment is the test environment set by the developer. During the testing process of the server, the tester can select the corresponding environment type according to the needs, or pre-set the corresponding environment type. In the process of testing the server, the server is directly tested according to the preset environment type. The device type is the type of test device, and the device type includes Android (Android) and iOS.
其中,监听线程的监听过程为:调用Channel Handler接口的一个实现类Pack Monitor Handler来创建监听线程,这个类有两个方法,分别为up Stream和down Stream。up Stream用于监控发送消息,当调用NIO(Non-blocking I/O)的Socket Channel类的write(写)方法的时候,捕获write方法中Byte buffer参数的数据放到上下文对象中,up Stream方法会从上下文对象取出数据输出到resopnse Data(返回值)中。Down Stream用于监控接收消息,在NIO中,当Selection Key为is Readable可读状态时,会根据Socket Channel的read方法将接收到的数据读取到Byte Buffer中,并将Byte Buffer放入上下文对象,down Stream方法从上下文对象中取出数据输出到resopnse Data中。The listening process of the listening thread is: calling an implementation class Pack Monitor of the Channel Handler interface. Handler to create a listener thread, this class has two methods, up stream and down stream. Up Stream is used to monitor sending messages when calling NIO (Non-blocking I/O) Socket When the channel class write (write) method, capture the data of the Byte buffer parameter in the write method into the context object, up The Stream method will fetch the data from the context object and output it to resopnse Data. Down Stream is used to monitor incoming messages, in NIO, when Selection When the Key is the Read Readable readable state, the received data is read into the Byte Buffer according to the Socket Channel read method, and the Byte is The Buffer is placed in the context object, and the down Stream method takes the data from the context object and outputs it to the resopnse Data.
NIO(在Java领域,也称为New I/O),是一种同步非阻塞的I/O模型,也是I/O多路复用的基础。Channel Handler负责对I/O(Input/Output,输入/输出)事件或者I/O操作进行拦截和处理,它可以选择性地拦截和处理自己感兴趣的事件,也可以透传和终止事件的传递。Byte Buffer类是在Java NIO中常常使用的一个缓冲区类,使用它可以进行高效的I/O操作。NIO (in the Java world, also known as New I/O) is a synchronous non-blocking I/O model that is the basis for I/O multiplexing. Channel The Handler is responsible for intercepting and processing I/O (Input/Output) events or I/O operations. It can selectively intercept and process events of interest to you, as well as transparently and terminate the delivery of events. Byte The Buffer class is a buffer class that is often used in Java NIO and can be used for efficient I/O operations.
进一步地,当测试设备获取到登录信息,可不检测是否侦测到点击JMeter GUI界面执行按钮的点击操作,直接初始化监听线程。Further, when the test device obtains the login information, it may not detect whether the click JMeter is detected. The GUI interface performs a click operation of the button to directly initialize the listening thread.
进一步地,为了提高测试服务器的安全性,提高测试结果的准确性,可为登录字符串设置有效期。当测试设备获取到登录字符串后,检测登录字符串是否处于有效期内。若登录字符串处于有效期内,测试设备则确定登录操作成功执行;若登录字符串未处于有效期内,测试设备则确定登录操作已失效。其中,有效期可根据具体需要而设置,如可设置为10分钟、15分钟或者25分钟等。Further, in order to improve the security of the test server and improve the accuracy of the test results, the validity period can be set for the login string. When the test device obtains the login string, it detects whether the login string is within the validity period. If the login string is within the validity period, the test device determines that the login operation is successfully executed. If the login string is not within the validity period, the test device determines that the login operation has expired. The expiration date can be set according to specific needs, such as 10 minutes, 15 minutes, or 25 minutes.
进一步地,将所述登录字符串转换成第一请求报文的步骤包括:Further, the step of converting the login string into the first request message includes:
步骤a,根据所述登录字符串的长度进行位运算,以重组所述登录字符串,得到重组后的所述登录字符串。In step a, a bit operation is performed according to the length of the login string to recombine the login string to obtain the reassembled login string.
进一步地,测试设备将登录字符串转换成第一请求报文的过程可为:获取登录字符串的长度,在for循环体中根据登录字符串的长度进行位运算,以重组登录字符串,得到重组后的登录字符串。Further, the process of converting the login string into the first request packet by the test device may be: obtaining the length of the login string, performing bit operations according to the length of the login string in the for loop body, and reassembling the login string to obtain The refactored login string.
步骤b,将重组后的所述登录字符串与所述预设质数进行取模运算,得到与所述登录字符串对应的数据报文。Step b: Perform modulo operation on the re-established login string and the preset prime number to obtain a data packet corresponding to the login string.
当测试设备得到重组后的登录字符串后,将重组后的登录字符串与预设质数进行取模运算,得到与登录字符串对应的数据报文。其中,在本实施例中,预设质数为31。质数31是Java中规定的长度。可以理解的是,可以根据需要在Java代码中将预设质数修改为其它质数。After the test device obtains the re-established login string, the re-composed login string is modulo-operated with the preset prime number to obtain a data packet corresponding to the login string. In this embodiment, the preset prime number is 31. The prime number 31 is the length specified in Java. It can be understood that the preset prime number can be modified to other prime numbers in the Java code as needed.
步骤c,通过预设协议将所述数据报文转换成第一请求报文。Step c: Convert the data packet into a first request message by using a preset protocol.
当测试设备得到与登录字符串对应的数据报文后,通过预设协议将数据报文转换成第一请求报文。其中,预设协议可为Google protobuf协议或者Apache Thrift协议。After the test device obtains the data packet corresponding to the login string, the data packet is converted into the first request packet by using a preset protocol. Among them, the default agreement can be Google Protobuf protocol or Apache Thrift protocol.
步骤S20,将所述第一请求报文发送至服务器,以供所述服务器在接收到所述第一请求报文后,校验所述第一请求报文,得到校验结果,并返回所述校验结果。Step S20: Send the first request message to the server, after the server receives the first request message, check the first request message, obtain a verification result, and return to the server. Said the verification result.
当测试设备得到第一请求报文后,加载全局系统参数,以在全局系统参数中获取服务器的IP(Internet Protocol,网络之间互连的协议)地址和端口号,通过该IP地址和端口号将第一请求报文发送至服务器。具体地,测试设备可通过Java反射技术加载全局系统参数,获取服务器的IP地址和端口号。当服务器接收到第一请求报文后,解析该请求报文,得到解析结果,根据解析结果校验第一请求报文,以得到校验结果。当服务器得到校验结果后,将校验结果发送给测试设备。在本实施例中,服务器可为XMPP(Extensible Messaging and Presence Protocol,可扩展通讯和表示协议)服务器。需要说明的是,在全局系统参数中,预先设置好要测试的服务器的IP地址和端口号。After the test device obtains the first request message, the global system parameter is loaded to obtain the IP of the server in the global system parameter (Internet) Protocol, the protocol that is interconnected between networks) The address and port number through which the first request message is sent to the server. Specifically, the test device can load the global system parameters through the Java reflection technology to obtain the IP address and port number of the server. After receiving the first request packet, the server parses the request packet, obtains a parsing result, and verifies the first request packet according to the parsing result to obtain a verification result. After the server obtains the verification result, the verification result is sent to the test device. In this embodiment, the server can be XMPP (Extensible Messaging and Presence Protocol, scalable communication and presentation protocol) server. It should be noted that in the global system parameters, the IP address and port number of the server to be tested are set in advance.
进一步地,用户也可在JMeter的GUI页面中输入服务器的IP地址和端口号。当测试设备获取到服务器的IP地址和端口号后,服务器检测是否侦测到点击JMeter GUI页面中执行按钮的点击操作。若侦测到该点击操作,测试设备则通过自定义延迟加载类进行封装操作和实例化操作,启动其内部自动义线程,通过该线程读取对应数据包下的类,通过Java反射技术进行加载并激活其内部API(Application Programming Interface,应用程序编程接口)以实现发送第一请求报文过程中的监听逻辑,通过该IP地址和端口号将第一请求报文发送至服务器。Further, the user can also enter the IP address and port number of the server in the GUI page of JMeter. After the test device obtains the IP address and port number of the server, the server detects whether a JMeter is detected. Click on the button in the GUI page. If the click operation is detected, the test device performs the encapsulation operation and the instantiation operation through the custom lazy loading class, starts its internal auto-dealing thread, reads the class under the corresponding data packet through the thread, and loads through the Java reflection technology. And activate its internal API (Application Programming The interface (application programming interface) is configured to implement the listening logic in the process of sending the first request message, and send the first request message to the server by using the IP address and the port number.
进一步地,在本实施例中,当测试设备获取到服务器的IP地址和端口号后,测试设备自动通过该IP地址和端口号将第一请求报文发送至服务器。Further, in this embodiment, after the test device obtains the IP address and the port number of the server, the test device automatically sends the first request message to the server by using the IP address and the port number.
进一步地,步骤S20包括:Further, step S20 includes:
步骤d,将所述第一请求报文通过预设通信技术框架发送至服务器,以供所述服务器在接收到所述第一请求报文后,确定所述第一请求报文对应的用户,并校验所述第一请求报文对应的用户是否处于有效状态以及是否处于登录状态,得到校验结果,并返回所述校验结果;In step d, the first request message is sent to the server through the preset communication technology framework, so that the server determines the user corresponding to the first request message after receiving the first request message. And verifying that the user corresponding to the first request packet is in a valid state and is in a login state, obtaining a verification result, and returning the verification result;
其中,若所述用户处于有效状态且处于登录状态,所述服务器则得到所述第一请求报文通过校验的校验结果;The server obtains a verification result that the first request packet passes the check if the user is in a valid state and is in a login state;
若所述用户处于无效状态和/或非登录状态,所述服务器则得到所述第一请求报文未通过校验的校验结果。If the user is in an invalid state and/or a non-login state, the server obtains a verification result that the first request packet fails the verification.
进一步地,当测试设备得到第一请求报文后,加密第一请求报文,得到加密后的第一请求报文,并通过预设的通信技术框架将第一请求报文发送给服务器。其中,预设的通信技术框架包括但不限于用NIO、aio、netty和mina作为通信技术框架。当测试设备加密第一请求报文的过程为:定义一个报文包类,该报文包类的结构为:type、length、version和content,其中,type表示报文类型,length表示报文消息内容的长度,version表示报文消息所属的版本、content是记录报文消息内容的字节数组。需要说明的是,加密方法就是将第一请求报文转为报文包类的过程。Further, after the test device obtains the first request message, the first request message is encrypted, and the encrypted first request message is obtained, and the first request message is sent to the server through a preset communication technology framework. Among them, the preset communication technology framework includes, but is not limited to, NIO, aio, netty, and mina as communication technology frameworks. The process of encrypting the first request packet is: defining a packet class, the structure of the packet class is: type, length, version, and content, where type indicates a packet type, and length indicates a message message. The length of the content, version indicates the version to which the message belongs, and content is a byte array that records the contents of the message. It should be noted that the encryption method is a process of converting the first request packet into a packet class.
当服务器接收到第一请求报文后,解析该第一请求报文,得到第一请求报文中的登录字符串,确定与该登录字符串对应的用户,即确定第一请求报文对应的用户。当确定用户后,服务器校验该用户是否处于有效状态以及是否处于登录状态,得到校验结果,并将校验结果发送给测试设备。具体地,若用户处于有效状态且处于登录状态,服务器则确定第一请求报文处于有效状态,得到第一请求报文通过校验的校验结果,返回第一请求报文通过校验的校验结果给测试设备;若用户处于无效状态和/或处于非登录状态,服务器则确定第一请求报文处于无效状态,得到第一请求报文未通过校验的校验结果,返回第一请求报文未通过校验的校验结果。After receiving the first request packet, the server parses the first request packet, obtains a login string in the first request packet, and determines a user corresponding to the login string, that is, determines that the first request packet corresponds to user. After determining the user, the server verifies whether the user is in a valid state and is in a login state, obtains a verification result, and sends the verification result to the test device. Specifically, if the user is in the active state and is in the login state, the server determines that the first request packet is in the valid state, and obtains the verification result of the first request packet, and returns the first request packet to pass the verification. The test result is sent to the test device; if the user is in an invalid state and/or is in a non-login state, the server determines that the first request message is in an invalid state, and obtains a check result that the first request message fails the check, and returns the first request. The packet failed the verification result.
进一步地,服务器判断用户是否处于有效状态的过程为:服务器在其数据库中查找是否存在与该用户的用户名相同的预设用户名。若在数据库中查找到与用户名一致的预设用户名,服务器则确定用户处于有效状态;若在数据库中未查找到与用户名一致的预设用户名,服务器则确定用户处于无效状态。若未给登录字符串设置有效期,服务器则直接根据登录字符串确定用户处于登录状态;若给登录字符串设置了有效期,服务器则判断登录字符串是否处于有效期内。若登录字符串处于有效期内,服务器则确定用户处于登录状态;若登录字符串未处于有效期内,服务器则确定用户处于非登录状态。Further, the process of determining whether the user is in a valid state by the server is: the server searches in its database whether there is a preset user name that is the same as the user name of the user. If the preset user name matching the user name is found in the database, the server determines that the user is in a valid state; if the preset user name consistent with the user name is not found in the database, the server determines that the user is in an invalid state. If the validity period is not set for the login string, the server directly determines that the user is logged in according to the login string; if the login string is set to the validity period, the server determines whether the login string is within the validity period. If the login string is within the validity period, the server determines that the user is in the login state; if the login string is not within the validity period, the server determines that the user is in the non-login state.
步骤S30,当接收到所述校验结果,且根据所述校验结果确定与所述服务器成功建立连接后,通过所述JMeter获取待发送信息。Step S30: After receiving the verification result, and determining to successfully establish a connection with the server according to the verification result, obtain information to be sent by using the JMeter.
当测试设备接收到校验结果,且根据该校验结果确定第一请求报文通过校验后,测试设备则确定已和服务器成功建立连接。当测试设备确定其已和服务器成功建立连接后,测试设备则通过JMeter的GUI页面获取待发送消息。需要说明的是,待发送消息是用户按照服务器的信息规范在JMeter的GUI页面所输入。其中,待发送消息是用于测试服务器的消息,待发送消息的类型和内容可根据具体需要而设置,在本实施例中不做限制。After the test device receives the verification result and determines that the first request message passes the verification according to the verification result, the test device determines that the connection has been successfully established with the server. After the test device determines that it has successfully established a connection with the server, the test device obtains the message to be sent through the JMeter GUI page. It should be noted that the message to be sent is input by the user in the GUI page of JMeter according to the information specification of the server. The message to be sent is a message for testing the server, and the type and content of the message to be sent may be set according to specific needs, which is not limited in this embodiment.
步骤S40,将所述待发送信息转换成第二请求报文发送给所述服务器,以供所述服务器在接收到所述第二请求报文后,将所述第二请求报文发送给接收端,并返回发送结果。Step S40: The information to be sent is converted into a second request message and sent to the server, so that the server sends the second request message to the receiving after receiving the second request message. End and return the result.
当测试设备获取到待发送消息后,测试设备将待发送消息转换成第二请求报文发送给服务器。当服务器接收到测试设备发送的第二请求报文后,解析该第二请求报文,得到第二请求报文对应的待发送消息,将待发送消息发送给接收端,并生成发送结果,将发送结果给测试设备。After the test device obtains the to-be-sent message, the test device converts the to-be-sent message into a second request message and sends the message to the server. After receiving the second request packet sent by the test device, the server parses the second request packet, obtains a to-be-sent message corresponding to the second request packet, sends the to-be-sent message to the receiving end, and generates a sending result, Send the results to the test equipment.
服务器将待发送消息发送给接收端的过程为:获取待发送消息的消息标识、以及获取解析第二请求报文的解析时间对应的时间戳,将消息标识和时间戳组装成一个json 字符串,写入到Byte Buffer缓冲区中,使用NIO中的Socket Channel.write(Byte Buffer)方法将json 字符串写入到测试设备注册的管道中,以将待发送消息发送给接收端。The process of sending the to-be-sent message to the receiving end by the server is: obtaining the message identifier of the message to be sent, and obtaining a timestamp corresponding to the parsing time of parsing the second request message, and assembling the message identifier and the timestamp into a json String, written to the Byte Buffer buffer, using the Socket Channel.write (Byte Buffer) method in NIO to json The string is written to the pipe registered by the test device to send the message to be sent to the receiving end.
若待发送消息成功发送至接收端,服务器则生成携带有消息标识和时间戳组成的Json字符串的发送结果;若待发送消息未成功发送至接收端,服务器则生成携带有消息标识、时间戳和错误信息组成的Json字符串的发送结果。进一步地,服务器可根据在预设时长内是否接收到接收端返回的响应消息来确定待发送消息是否成功发送。预设时长可根据具体需要而设置,在本实施例中不做限制。If the message to be sent is successfully sent to the receiving end, the server generates a sending result of the Json string containing the message identifier and the timestamp; if the message to be sent is not successfully sent to the receiving end, the server generates the message identifier and the timestamp. And the error message consists of the result of the Json string sent. Further, the server may determine whether the message to be sent is successfully sent according to whether the response message returned by the receiving end is received within a preset duration. The preset duration can be set according to specific needs, and is not limited in this embodiment.
进一步地,当测试设备得到第二请求报文后,检测是否在JMeter的GUI页面中接收到点击执行按钮的点击操作。若接收到该点击操作,测试设备则将第二请求报文发送给服务器。Further, after the test device obtains the second request message, it is detected whether a click operation of clicking the execution button is received in the JMeter GUI page. If the click operation is received, the test device sends the second request message to the server.
进一步地,当测试设备得到第二请求报文后,测试设备自动将第二请求报文发送给服务器。Further, after the test device obtains the second request message, the test device automatically sends the second request message to the server.
进一步地,步骤S40包括:Further, step S40 includes:
步骤e,将所述待发送信息转换成对应的消息对象,根据预设协议将所述消息对象转换成第二请求报文。In step e, the information to be sent is converted into a corresponding message object, and the message object is converted into a second request message according to a preset protocol.
进一步地,测试设备将待发送消息发送给服务器的过程为:当测试设备获取到待发送消息后,将待发送消息转换成对应的消息对象,并根据预设协议获取消息对象对应的字节数组,以将待发送消息转换成对应的消息对象。其中,预设协议包括但不限于Google protobuf协议或者Apache Thrift协议。Further, the process for the test device to send the to-be-sent message to the server is: after the test device obtains the to-be-sent message, the message to be sent is converted into a corresponding message object, and the byte array corresponding to the message object is obtained according to a preset protocol. To convert the message to be sent into a corresponding message object. Among them, the default agreement includes but not limited to Google Protobuf protocol or Apache Thrift protocol.
测试设备将待发送消息转换成对应的消息对象的过程为:测试设备使用dom4j将待发送消息转成Document(文件)对象;将Document对象转成Element对象;将Element对象作为参数调用Message(消息)的构造方法得到一个消息对象。其中,dom4j是一个Java的XML(Extensible Markup Language,可扩展标记语言) API(Application Programming Interface,应用程序编程接口),是jdom的升级品,用来读写XML文件的。通过document对象可以访问HTML(Hyper Text Markup Language,超级文本标记语言)文档中包含的任何HTML标记,并可以动态地改变HTML标记中的内容,如表单、图像、表格和超链接等。Element 对象表示 HTML 元素。The process of the test device converting the message to be sent into the corresponding message object is: the test device uses dom4j to convert the message to be sent into a Document object; converts the Document object into an Element object; and calls the Element object as a parameter to call Message (message) The constructor gets a message object. Among them, dom4j is a Java XML (Extensible Markup Language, Extensible Markup Language) API (Application Programming Interface, application programming interface), is an upgrade of jdom, used to read and write XML files. Access to HTML via the document object (Hyper Text Markup Language, Hypertext Markup Language) Any HTML markup contained in a document, and can dynamically change the content of HTML markup, such as forms, images, tables, and hyperlinks. Element object representation HTML element.
步骤f,将所述第二请求报文发送给所述服务器,以供所述服务器在接收到所述第二请求报文后,将所述第二请求报文对应的所述待发送消息发送给接收端,并返回发送结果。In step f, the second request packet is sent to the server, so that the server sends the to-be-sent message corresponding to the second request packet after receiving the second request packet. Give the receiver and return the result.
当测试设备得到第二请求报文后,将第二请求报文发送给服务器。当服务器接收到第二请求报文后,解析第二请求报文,得到第二请求报文对应的待发送消息,将待发送消息发送给接收端,并生成发送结果,将发送结果返回给测试设备。After the test device obtains the second request message, the second request message is sent to the server. After receiving the second request packet, the server parses the second request packet, obtains a to-be-sent message corresponding to the second request packet, sends the to-be-sent message to the receiving end, generates a sending result, and returns the sending result to the test. device.
服务器解析第二请求报文的过程为:从Socket Server Channle中取出Byte Buffer对象,随后取出Byte Buffer对象中的字节数组,对应按照预设协议转成消息对象,再将消息对象转换成待发送消息。其中,将消息对象转换成待发送消息的过程是将待发送消息转换成消息对象的逆过程,在本实施例中不再赘述。Java NIO中的 Server Socket Channel 是一个可以监听新进来的TCP(Transmission Control Protocol,传输控制协议)连接的通道,就像标准I/O中的Server Socket一样。The process of the server parsing the second request message is: taking out the Byte from the Socket Server Channle Buffer object, then take out the Byte The byte array in the Buffer object is converted into a message object according to a preset protocol, and then the message object is converted into a message to be sent. The process of converting the message object into the message to be sent is an inverse process of converting the message to be sent into a message object, which is not described in this embodiment. Java The Server Socket Channel in NIO is a TCP that can listen for incoming incoming packets (Transmission Control) Protocol, Transmission Control Protocol) Connected channels, just like the Server Socket in standard I/O.
步骤S50,当接收到所述发送结果后,根据所述发送结果确定所述服务器的测试结果。Step S50: After receiving the sending result, determining a test result of the server according to the sending result.
当测试设备接收到发送结果后,测试设备根据该发送结果确定服务器的测试结果。After the test device receives the transmission result, the test device determines the test result of the server according to the transmission result.
进一步地,步骤S50包括:Further, step S50 includes:
步骤g,当接收到所述发送结果后,检测所述发送结果中所携带的字符串组成方式。Step g: After receiving the sending result, detecting a string composition manner carried in the sending result.
步骤h,若所述发送结果的字符串是由时间戳和所述待发送消息的消息标识组成的,则确定所述服务器通过测试,其中,所述时间戳是所述服务器解析所述第二请求报文的解析时间对应的时间戳。Step h, if the string of the transmission result is composed of a timestamp and a message identifier of the to-be-sent message, determining that the server passes the test, wherein the timestamp is the server parsing the second The timestamp corresponding to the parsing time of the request message.
步骤i,若所述发送结果的字符串不是由所述时间戳和所述待发送消息的消息标识组成的,则确定所述服务器未通过测试。In step i, if the character string of the sending result is not composed of the time stamp and the message identifier of the to-be-sent message, it is determined that the server fails the test.
当测试设备接收到服务器发送的发送结果后,测试设备则获取发送结果中携带的字符串,并检测该字符串的组成方式。若发送结果中的字符串是时间戳和待发送消息的消息标识组成的,测试设备则确定服务器通过测试;若发送结果中的字符串不是由服务器时间戳和待发送消息的消息标识组成的,测试设备则确定服务器未通过测试。需要说明的是,时间戳是服务器解析第二请求报文的解析时间对应的时间戳。当服务器确定待发送消息未成功发送至接收端时,服务器发送由消息标识、时间戳以及对应消息发送错误的错误信息组成的字符串给测试设备。After the test device receives the sending result sent by the server, the test device obtains the string carried in the sending result, and detects the composition of the string. If the string in the sending result is a time stamp and a message identifier of the message to be sent, the test device determines that the server passes the test; if the string in the sent result is not composed of the server time stamp and the message identifier of the message to be sent, The test device determines that the server has not passed the test. It should be noted that the timestamp is a timestamp corresponding to the parsing time of the second request message parsed by the server. When the server determines that the to-be-sent message is not successfully sent to the receiving end, the server sends a string consisting of the message identifier, the timestamp, and the error message of the corresponding message sending error to the test device.
进一步地,当测试设备接收到发送结果后,测试设备可根据发送结果设置对应的值,并显示所设置的值,以根据该值提示对应的用户服务器的测试结果。如当测试设备根据发送结果确定服务器通过测试后,测设设备设置对应的值为“11”,表示服务器通过测试;当测试设备根据发送结果确定服务器未通过测试后,测试设备设置对应的值为“00”,表示服务器未通过测试。Further, after the test device receives the transmission result, the test device may set a corresponding value according to the transmission result, and display the set value to prompt the test result of the corresponding user server according to the value. For example, when the test device determines that the server passes the test according to the transmission result, the corresponding value of the measurement device setting is “11”, indicating that the server passes the test; when the test device determines that the server fails the test according to the transmission result, the corresponding value of the test device setting is "00" indicates that the server failed the test.
本实施例当通过JMeter获取到登录信息后,根据所述登录信息执行登录操作,并在成功执行所述登录操作后获取对应的登录字符串,将所述登录字符串转换成第一请求报文;将所述第一请求报文发送至服务器,以供所述服务器在接收到所述第一请求报文后,校验所述第一请求报文,得到校验结果,并返回所述校验结果;当接收到所述校验结果,且根据所述校验结果确定与所述服务器成功建立连接后,通过所述JMeter获取待发送信息;将所述待发送信息转换成第二请求报文发送给所述服务器,以供所述服务器在接收到所述第二请求报文后,将所述第二请求报文发送给接收端,并返回发送结果;当接收到所述发送结果后,根据所述发送结果确定所述服务器的测试结果。实现了在开发出后端时,通过JMeter模拟终端设备向后端发送消息,以测试后端,避免了要等到开发出前端后,才可以测试后端,提高了开发效率,以及降低了开发成本。After the login information is obtained by the JMeter, the login operation is performed according to the login information, and after the login operation is successfully performed, the corresponding login string is obtained, and the login string is converted into the first request message. Transmitting the first request message to the server, after the server receives the first request message, verifying the first request message, obtaining a verification result, and returning to the school After the verification result is received, and after determining that the connection with the server is successfully established according to the verification result, the information to be sent is obtained by the JMeter; and the information to be sent is converted into the second request report. Sending to the server, after the server receives the second request message, sending the second request message to the receiving end, and returning the sending result; after receiving the sending result, And determining a test result of the server according to the sending result. When the backend is developed, the JMeter emulates the terminal device to send messages to the backend to test the backend, avoiding waiting for the front end to be developed before testing the backend, improving development efficiency and reducing development costs. .
进一步地,提出本申请服务器的测试方法第二实施例。Further, a second embodiment of the test method of the server of the present application is proposed.
所述服务器的测试方法第二实施例与所述服务器的测试方法第一实施例的区别在于,参照图2,服务器的测试方法还包括:The second embodiment of the test method of the server is different from the first embodiment of the test method of the server. Referring to FIG. 2, the test method of the server further includes:
步骤S60,当侦测到断开与所述服务器连接的断开指令后,根据所述断开指令断开与所述服务器之间的连接。Step S60, after detecting the disconnection instruction disconnected from the server, disconnecting from the server according to the disconnection instruction.
测试设备检测是否侦测到断开与服务器之间连接的断开指令。当测试设备检测到断开指令后,测试设备根据该断开指令断开与服务器之间的连接。其中,断开指令可为测试设备确定服务器通过测试后,自动触发的;断开指令也可为用户在测试设备JMeter的GUI页面手动触发。具体地,用户可通过点击JMeter GUI页面中的执行按钮触发断开指令。在本实施例中,测试设备可通过NIO技术断开与服务器之间的连接,然后将其全局系统参数恢复到初始状态。The test device detects whether a disconnect command to disconnect from the server is detected. When the test device detects the disconnection command, the test device disconnects from the server according to the disconnection command. The disconnection command may be automatically triggered by the test device after the server passes the test; the disconnection command may also be manually triggered by the user on the GUI page of the test device JMeter. Specifically, the user can click on JMeter The execute button in the GUI page triggers a break instruction. In this embodiment, the test device can disconnect from the server through the NIO technology and then restore its global system parameters to the initial state.
本实施例通过在侦测到断开与服务器连接的断开后,根据该断开指令断开与服务器之间的连接。实现了在得到服务器的测试结果后,及时断开与服务器之间的连接,节省电量,以及避免服务器一直处于连接状态,延长服务器的使用寿命。 In this embodiment, after detecting disconnection of the disconnection from the server, the connection with the server is disconnected according to the disconnection command. After obtaining the test result of the server, the connection between the server and the server is disconnected in time, the power is saved, and the server is kept connected and the service life of the server is prolonged.
进一步地,提出本申请服务器的测试方法第三实施例。Further, a third embodiment of the test method of the server of the present application is proposed.
所述服务器的测试方法第三实施例与所述服务器的测试方法第一或第二实施例的区别在于,服务器的测试方法还包括:The difference between the third embodiment of the test method of the server and the first or second embodiment of the test method of the server is that the test method of the server further includes:
步骤k,触发监控指令,并根据所述监控指令监控与所述服务器之间的连接状态。Step k, triggering a monitoring instruction, and monitoring a connection state with the server according to the monitoring instruction.
当测试设备与服务器成功建立连接后,触发监控指令,并根据该监控指令监控与服务器之间的连接状态。After the test device successfully establishes a connection with the server, a monitoring instruction is triggered, and the connection state with the server is monitored according to the monitoring instruction.
测试设备监控与服务器之间的连接状态的过程为:测试设备创建心跳包,并在创建心跳包后启动该心跳包,通过该心跳包发送定时任务给服务器,以监控其与服务器之间的连接状态。当测试设备启动心跳包后,测试设备获取对应的心跳日志,并存储该心跳日志,以供用户根据该心跳日志确定测试设备和服务器是否处于已连接状态。需要说明的是,测试设备通过心跳包发送定时任务给服务器即为测试设备通过JMeter不断向服务器发送连接请求。The test device monitors the connection status between the server and the server: the test device creates a heartbeat packet, and starts the heartbeat packet after creating the heartbeat packet, and sends a timing task to the server through the heartbeat packet to monitor the connection between the server and the server. status. After the test device starts the heartbeat packet, the test device obtains the corresponding heartbeat log, and stores the heartbeat log, so that the user determines whether the test device and the server are in the connected state according to the heartbeat log. It should be noted that the test device sends a scheduled task to the server through the heartbeat packet, that is, the test device continuously sends a connection request to the server through the JMeter.
本实施例通过当测试设备与服务器成功建立连接后,监控其与服务器之间的连接状态,以便于测试人员能够及时了解测试设备与服务器之间的连接状态。In this embodiment, after the test device successfully establishes a connection with the server, the connection state between the test device and the server is monitored, so that the tester can know the connection state between the test device and the server in time.
此外,参照图3,本申请还提供一种服务器的测试装置,服务器的测试装置包括:In addition, referring to FIG. 3, the application further provides a testing device for a server, where the testing device of the server includes:
获取模块10,用于当通过JMeter获取到登录信息后,根据所述登录信息执行登录操作,并在成功执行所述登录操作后获取对应的登录字符串;The obtaining module 10 is configured to perform a login operation according to the login information after obtaining the login information by using the JMeter, and obtain a corresponding login string after successfully performing the login operation;
转换模块20,用于将所述登录字符串转换成第一请求报文;The conversion module 20 is configured to convert the login string into a first request message;
发送模块30,用于将所述第一请求报文发送至服务器,以供所述服务器在接收到所述第一请求报文后,校验所述第一请求报文,得到校验结果,并返回所述校验结果;The sending module 30 is configured to send the first request message to the server, where the server, after receiving the first request message, checks the first request message to obtain a verification result. And returning the verification result;
所述获取模块10还用于当接收到所述校验结果,且根据所述校验结果确定与所述服务器成功建立连接后,通过所述JMeter获取待发送信息;The obtaining module 10 is further configured to: after receiving the verification result, and determining to successfully establish a connection with the server according to the verification result, acquiring information to be sent by using the JMeter;
所述转换模块20还用于将所述待发送信息转换成第二请求报文发送给所述服务器,以供所述服务器在接收到所述第二请求报文后,将所述第二请求报文发送给接收端,并返回发送结果;The conversion module 20 is further configured to convert the to-be-sent information into a second request message and send the message to the server, where the server sends the second request after receiving the second request message. The message is sent to the receiving end, and the result is returned.
确定模块40,用于当接收到所述发送结果后,根据所述发送结果确定所述服务器的测试结果。The determining module 40 is configured to determine a test result of the server according to the sending result after receiving the sending result.
本实施例当通过JMeter获取到登录信息后,获取模块10根据登录信息执行登录操作,并在成功执行登录操作后获取对应的登录字符串,转换模块20将登录字符串转换成第一请求报文;发送模块30将第一请求报文发送至服务器,以供服务器在接收到第一请求报文后,校验第一请求报文,得到校验结果,并返回校验结果;当接收到校验结果,且根据校验结果确定与服务器成功建立连接后,获取模块10通过JMeter获取待发送信息;转换模块20将待发送信息转换成第二请求报文发送给服务器,以供服务器在接收到第二请求报文后,将第二请求报文发送给接收端,并返回发送结果;当接收到发送结果后,确定模块40根据发送结果确定服务器的测试结果。实现了在开发出后端时,通过JMeter模拟终端设备向后端发送消息,以测试后端,避免了要等到开发出前端后,才可以测试后端,提高了开发效率,以及降低了开发成本。In this embodiment, after the login information is obtained through the JMeter, the obtaining module 10 performs a login operation according to the login information, and obtains a corresponding login string after successfully performing the login operation, and the conversion module 20 converts the login string into the first request message. The sending module 30 sends the first request message to the server, so that after receiving the first request message, the server verifies the first request message, obtains the verification result, and returns the verification result; when receiving the school After the result is determined, and the connection is successfully established with the server according to the verification result, the obtaining module 10 obtains the information to be sent through the JMeter; the converting module 20 converts the information to be sent into the second request message and sends the information to the server for the server to receive. After the second request message, the second request message is sent to the receiving end, and the sending result is returned; after receiving the sending result, the determining module 40 determines the test result of the server according to the sending result. When the backend is developed, the JMeter emulates the terminal device to send messages to the backend to test the backend, avoiding waiting for the front end to be developed before testing the backend, improving development efficiency and reducing development costs. .
服务器的测试装置还包括:The test device of the server further includes:
断开模块,用于当侦测到断开与所述服务器连接的断开指令后,根据所述断开指令断开与所述服务器之间的连接。And disconnecting the module, configured to disconnect the connection with the server according to the disconnection command after detecting a disconnection instruction disconnected from the server.
进一步地,服务器的测试装置还包括:Further, the testing device of the server further includes:
监控模块,用于触发监控指令,并根据所述监控指令监控与所述服务器之间的连接状态。And a monitoring module, configured to trigger a monitoring instruction, and monitor a connection state with the server according to the monitoring instruction.
进一步地,所述转换模块20包括:Further, the conversion module 20 includes:
重组单元,用于根据所述登录字符串的长度进行位运算,以重组所述登录字符串,得到重组后的所述登录字符串;a recombining unit, configured to perform a bit operation according to the length of the login string, to recombine the login string, to obtain the recombined login string;
运算单元,用于将重组后的所述登录字符串与所述预设质数进行取模运算,得到与所述登录字符串对应的数据报文;An operation unit, configured to perform a modulo operation on the re-established login string and the preset prime number to obtain a data packet corresponding to the login string;
第一转换单元,用于通过预设协议将所述数据报文转换成第一请求报文。The first converting unit is configured to convert the data packet into a first request message by using a preset protocol.
进一步地,发送模块30还用于将所述第一请求报文通过预设通信技术框架发送至服务器,以供所述服务器在接收到所述第一请求报文后,确定所述第一请求报文对应的用户,并校验所述第一请求报文对应的用户是否处于有效状态以及是否处于登录状态,得到校验结果,并返回所述校验结果;Further, the sending module 30 is further configured to send the first request message to the server by using a preset communication technology framework, so that the server determines the first request after receiving the first request message. a user corresponding to the packet, and verifying whether the user corresponding to the first request packet is in a valid state and is in a login state, obtaining a verification result, and returning the verification result;
其中,若所述用户处于有效状态且处于登录状态,所述服务器则得到所述第一请求报文通过校验的校验结果;若所述用户处于无效状态和/或非登录状态,所述服务器则得到所述第一请求报文未通过校验的校验结果。 If the user is in an active state and is in a login state, the server obtains a verification result of the first request packet passing the verification; if the user is in an invalid state and/or a non-login state, The server obtains a verification result that the first request packet fails the verification.
进一步地,所述转换模块20还包括:Further, the conversion module 20 further includes:
第二转换单元,用于将所述待发送信息转换成对应的消息对象,根据预设协议将所述消息对象转换成第二请求报文;a second converting unit, configured to convert the to-be-sent information into a corresponding message object, and convert the message object into a second request message according to a preset protocol;
发送单元,用于将所述第二请求报文发送给所述服务器,以供所述服务器在接收到所述第二请求报文后,将所述第二请求报文对应的所述待发送消息发送给接收端,并返回发送结果。a sending unit, configured to send the second request message to the server, where the server sends the second request message corresponding to the to-be-sent after receiving the second request message The message is sent to the receiver and the result is sent back.
进一步地,所述确定模块40包括:Further, the determining module 40 includes:
检测单元,用于当接收到所述发送结果后,检测所述发送结果中所携带的字符串组成方式;a detecting unit, configured to detect a string composition manner carried in the sending result after receiving the sending result;
确定单元,用于若所述发送结果的字符串是由时间戳和所述待发送消息的消息标识组成的,则确定所述服务器通过测试,其中,所述时间戳是所述服务器解析所述第二请求报文的解析时间对应的时间戳;若所述发送结果的字符串不是由所述时间戳和所述待发送消息的消息标识组成的,则确定所述服务器未通过测试。a determining unit, configured to: if the character string of the sending result is composed of a timestamp and a message identifier of the to-be-sent message, determining that the server passes the test, wherein the timestamp is the server parsing the The timestamp corresponding to the parsing time of the second request message; if the character string of the sending result is not composed of the timestamp and the message identifier of the to-be-sent message, it is determined that the server fails the test.
需要说明的是,服务器的测试装置的各个实施例与上述服务器的测试方法的各实施例基本相同,在此不再详细赘述。It should be noted that each embodiment of the testing device of the server is substantially the same as the embodiments of the testing method of the server, and details are not described herein again.
此外,本申请还提供一种服务器的测试设备。如图4所示,图4是本申请实施例方案涉及的硬件运行环境的结构示意图。In addition, the application also provides a test device for a server. As shown in FIG. 4, FIG. 4 is a schematic structural diagram of a hardware operating environment involved in an embodiment of the present application.
需要说明的是,图4即可为服务器的测试设备的硬件运行环境的结构示意图。本申请实施例服务器的测试设备可以是PC,便携计算机等终端设备。It should be noted that FIG. 4 can be a schematic structural diagram of a hardware operating environment of a test device of the server. The test device of the server of the embodiment of the present application may be a terminal device such as a PC or a portable computer.
如图4所示,该服务器的测试设备可以包括:处理器1001,例如CPU,网络接口1004,用户接口1003,存储器1005,通信总线1002。其中,通信总线1002用于实现这些组件之间的连接通信。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。As shown in FIG. 4, the test device of the server may include a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to implement connection communication between these components. The memory 1005 may be a high speed RAM memory or a stable memory (non-volatile) Memory), such as disk storage. The memory 1005 can also optionally be a storage device independent of the aforementioned processor 1001.
本领域技术人员可以理解,图4中示出的服务器的测试设备结构并不构成对服务器的测试设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。It will be understood by those skilled in the art that the test device structure of the server shown in FIG. 4 does not constitute a limitation of the test device of the server, and may include more or less components than those illustrated, or combine some components, or different. Parts layout.
如图4所示,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及服务器的测试程序。其中,操作系统是管理和控制服务器的测试设备硬件和软件资源的程序,支持服务器的测试程序以及其它软件或程序的运行。As shown in FIG. 4, a memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a test program of the server. Among them, the operating system is a program that manages and controls the test device hardware and software resources of the server, and supports the test program of the server and the operation of other software or programs.
在图4所示的服务器的测试设备中,用户接口1003主要用于接收用户输入的登录信息和点击执行按钮的操作等;网络接口1004主要用于连接服务器,处理器1001可以用于调用存储器1005中存储的服务器的测试程序,并执行如上所述的服务器的测试方法的步骤。In the test device of the server shown in FIG. 4, the user interface 1003 is mainly used to receive the login information input by the user and the operation of clicking the execution button; the network interface 1004 is mainly used to connect to the server, and the processor 1001 can be used to call the memory 1005. The test program of the server stored in the server and the steps of the test method of the server as described above.
本申请服务器的测试设备具体实施方式与上述服务器的测试方法各实施例基本相同,在此不再赘述。The specific implementation manners of the testing device of the server of the present application are substantially the same as the embodiments of the testing method of the foregoing server, and details are not described herein again.
此外,本申请实施例还提出一种计算机可读存储介质,所述计算机可读存储介质上存储有服务器的测试程序,所述服务器的测试程序被处理器执行时实现如上所述的服务器的测试方法的步骤。In addition, the embodiment of the present application further provides a computer readable storage medium, where the test program of the server is stored, and the test program of the server is executed by the processor to implement the test of the server as described above. The steps of the method.
本申请计算机可读存储介质具体实施方式与上述服务器的测试方法各实施例基本相同,在此不再赘述。The specific embodiment of the computer readable storage medium of the present application is substantially the same as the embodiment of the test method of the server, and details are not described herein again.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It is to be understood that the term "comprises", "comprising", or any other variants thereof, is intended to encompass a non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes those elements. It also includes other elements that are not explicitly listed, or elements that are inherent to such a process, method, article, or device. An element that is defined by the phrase "comprising a ..." does not exclude the presence of additional equivalent elements in the process, method, item, or device that comprises the element.
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the embodiments of the present application are merely for the description, and do not represent the advantages and disadvantages of the embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be through hardware, but in many cases, the former is better. Implementation. Based on such understanding, the technical solution of the present application, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk, The optical disc includes a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present application.
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above is only a preferred embodiment of the present application, and is not intended to limit the scope of the patent application, and the equivalent structure or equivalent process transformations made by the specification and the drawings of the present application, or directly or indirectly applied to other related technical fields. The same is included in the scope of patent protection of this application.

Claims (20)

  1. 一种服务器的测试方法,其特征在于,所述已接入服务器的测试方法包括以下步骤: A test method for a server, characterized in that the test method of the accessed server comprises the following steps:
    当通过JMeter获取到登录信息后,根据所述登录信息执行登录操作,并在成功执行所述登录操作后获取对应的登录字符串,将所述登录字符串转换成第一请求报文;After the login information is obtained by the JMeter, the login operation is performed according to the login information, and after the login operation is successfully performed, the corresponding login string is obtained, and the login string is converted into the first request message;
    将所述第一请求报文发送至服务器,以供所述服务器在接收到所述第一请求报文后,校验所述第一请求报文,得到校验结果,并返回所述校验结果;Sending the first request message to the server, after the server receives the first request message, verifying the first request message, obtaining a verification result, and returning the check result;
    当接收到所述校验结果,且根据所述校验结果确定与所述服务器成功建立连接后,通过所述JMeter获取待发送信息;After receiving the verification result, and determining to successfully establish a connection with the server according to the verification result, obtaining information to be sent by using the JMeter;
    将所述待发送信息转换成第二请求报文发送给所述服务器,以供所述服务器在接收到所述第二请求报文后,将所述第二请求报文发送给接收端,并返回发送结果;Converting the to-be-sent information into a second request message, and sending the second request message to the server, after the server receives the second request message, sending the second request message to the receiving end, and Return the result of the transmission;
    当接收到所述发送结果后,根据所述发送结果确定所述服务器的测试结果。After receiving the transmission result, determining a test result of the server according to the transmission result.
  2. 如权利要求1所述的服务器的测试方法,其特征在于,所述当接收到所述发送结果后,根据所述发送结果确定所述服务器的测试结果的步骤之后,还包括:The method of testing the server according to claim 1, wherein after the step of determining the test result of the server according to the sending result, the method further comprises:
    当侦测到断开与所述服务器连接的断开指令后,根据所述断开指令断开与所述服务器之间的连接。After detecting the disconnection command disconnected from the server, the connection with the server is disconnected according to the disconnection command.
  3. 如权利要求1所述的服务器的测试方法,其特征在于,所述当接收到所述校验结果,且根据所述校验结果确定与所述服务器成功建立连接后,通过所述JMeter获取待发送信息的步骤之后,还包括:The testing method of the server according to claim 1, wherein the receiving, by the JMeter, the obtaining of the verification result, and determining that the connection is successfully established with the server according to the verification result After the step of sending the information, it also includes:
    触发监控指令,并根据所述监控指令监控与所述服务器之间的连接状态。A monitoring instruction is triggered, and a connection state with the server is monitored according to the monitoring instruction.
  4. 如权利要求1所述的服务器的测试方法,其特征在于,所述将所述登录字符串转换成第一请求报文的步骤包括:The method for testing a server according to claim 1, wherein the step of converting the login string into the first request message comprises:
    根据所述登录字符串的长度进行位运算,以重组所述登录字符串,得到重组后的所述登录字符串;Performing a bit operation according to the length of the login string to recombine the login string to obtain the reassembled login string;
    将重组后的所述登录字符串与所述预设质数进行取模运算,得到与所述登录字符串对应的数据报文;Performing a modulo operation on the re-established login string and the preset prime number to obtain a data packet corresponding to the login string;
    通过预设协议将所述数据报文转换成第一请求报文。Converting the data packet into a first request message by using a preset protocol.
  5. 如权利要求1所述的服务器的测试方法,其特征在于,所述将所述第一请求报文发送至服务器,以供所述服务器在接收到所述第一请求报文后,校验所述第一请求报文,得到校验结果,并返回所述校验结果的步骤包括:The method for testing a server according to claim 1, wherein the sending the first request message to a server, for the server to verify the first request message after receiving the first request message The first request message, the verification result is obtained, and the step of returning the verification result includes:
    将所述第一请求报文通过预设通信技术框架发送至服务器,以供所述服务器在接收到所述第一请求报文后,确定所述第一请求报文对应的用户,并校验所述第一请求报文对应的用户是否处于有效状态以及是否处于登录状态,得到校验结果,并返回所述校验结果;And sending, by the preset communication technology framework, the server to the server, after the server receives the first request packet, determining, by the server, the user corresponding to the first request packet, and verifying Whether the user corresponding to the first request message is in a valid state and is in a login state, and obtains a verification result, and returns the verification result;
    其中,若所述用户处于有效状态且处于登录状态,所述服务器则得到所述第一请求报文通过校验的校验结果;The server obtains a verification result that the first request packet passes the check if the user is in a valid state and is in a login state;
    若所述用户处于无效状态和/或非登录状态,所述服务器则得到所述第一请求报文未通过校验的校验结果。If the user is in an invalid state and/or a non-login state, the server obtains a verification result that the first request packet fails the verification.
  6. 如权利要求1所述的服务器的测试方法,其特征在于,所述将所述待发送信息转换成第二请求报文发送给所述服务器,以供所述服务器在接收到所述第二请求报文后,将所述第二请求报文发送给接收端,并返回发送结果的步骤包括:The method for testing a server according to claim 1, wherein the converting the information to be transmitted into a second request message is sent to the server, so that the server receives the second request. After the packet is sent, the step of sending the second request packet to the receiving end and returning the sending result includes:
    将所述待发送信息转换成对应的消息对象,根据预设协议将所述消息对象转换成第二请求报文;Converting the to-be-sent information into a corresponding message object, and converting the message object into a second request message according to a preset protocol;
    将所述第二请求报文发送给所述服务器,以供所述服务器在接收到所述第二请求报文后,将所述第二请求报文对应的所述待发送消息发送给接收端,并返回发送结果。Transmitting the second request packet to the server, so that the server sends the to-be-sent message corresponding to the second request packet to the receiving end after receiving the second request packet And return the result.
  7. 如权利要求1所述的服务器的测试方法,其特征在于,所述当接收到所述发送结果后,根据所述发送结果确定所述服务器的测试结果的步骤包括:The testing method of the server according to claim 1, wherein the step of determining the test result of the server according to the sending result after receiving the sending result comprises:
    当接收到所述发送结果后,检测所述发送结果中所携带的字符串组成方式;After receiving the sending result, detecting a string composition manner carried in the sending result;
    若所述发送结果的字符串是由时间戳和所述待发送消息的消息标识组成的,则确定所述服务器通过测试,其中,所述时间戳是所述服务器解析所述第二请求报文的解析时间对应的时间戳;If the character string of the sending result is composed of a time stamp and a message identifier of the to-be-sent message, determining that the server passes the test, where the timestamp is that the server parses the second request message Timestamp corresponding to the parsing time;
    若所述发送结果的字符串不是由所述时间戳和所述待发送消息的消息标识组成的,则确定所述服务器未通过测试。If the character string of the transmission result is not composed of the time stamp and the message identifier of the to-be-sent message, it is determined that the server fails the test.
  8. 如权利要求2所述的服务器的测试方法,其特征在于,所述当接收到所述发送结果后,根据所述发送结果确定所述服务器的测试结果的步骤包括:The testing method of the server according to claim 2, wherein the step of determining the test result of the server according to the sending result after receiving the sending result comprises:
    当接收到所述发送结果后,检测所述发送结果中所携带的字符串组成方式;After receiving the sending result, detecting a string composition manner carried in the sending result;
    若所述发送结果的字符串是由时间戳和所述待发送消息的消息标识组成的,则确定所述服务器通过测试,其中,所述时间戳是所述服务器解析所述第二请求报文的解析时间对应的时间戳;If the character string of the sending result is composed of a time stamp and a message identifier of the to-be-sent message, determining that the server passes the test, where the timestamp is that the server parses the second request message Timestamp corresponding to the parsing time;
    若所述发送结果的字符串不是由所述时间戳和所述待发送消息的消息标识组成的,则确定所述服务器未通过测试。If the character string of the transmission result is not composed of the time stamp and the message identifier of the to-be-sent message, it is determined that the server fails the test.
  9. 如权利要求3所述的服务器的测试方法,其特征在于,所述当接收到所述发送结果后,根据所述发送结果确定所述服务器的测试结果的步骤包括:The testing method of the server according to claim 3, wherein the step of determining the test result of the server according to the sending result after receiving the sending result comprises:
    当接收到所述发送结果后,检测所述发送结果中所携带的字符串组成方式;After receiving the sending result, detecting a string composition manner carried in the sending result;
    若所述发送结果的字符串是由时间戳和所述待发送消息的消息标识组成的,则确定所述服务器通过测试,其中,所述时间戳是所述服务器解析所述第二请求报文的解析时间对应的时间戳;If the character string of the sending result is composed of a time stamp and a message identifier of the to-be-sent message, determining that the server passes the test, where the timestamp is that the server parses the second request message Timestamp corresponding to the parsing time;
    若所述发送结果的字符串不是由所述时间戳和所述待发送消息的消息标识组成的,则确定所述服务器未通过测试。If the character string of the transmission result is not composed of the time stamp and the message identifier of the to-be-sent message, it is determined that the server fails the test.
  10. 如权利要求4所述的服务器的测试方法,其特征在于,所述当接收到所述发送结果后,根据所述发送结果确定所述服务器的测试结果的步骤包括:The testing method of the server according to claim 4, wherein the step of determining the test result of the server according to the sending result after receiving the sending result comprises:
    当接收到所述发送结果后,检测所述发送结果中所携带的字符串组成方式;After receiving the sending result, detecting a string composition manner carried in the sending result;
    若所述发送结果的字符串是由时间戳和所述待发送消息的消息标识组成的,则确定所述服务器通过测试,其中,所述时间戳是所述服务器解析所述第二请求报文的解析时间对应的时间戳;If the character string of the sending result is composed of a time stamp and a message identifier of the to-be-sent message, determining that the server passes the test, where the timestamp is that the server parses the second request message Timestamp corresponding to the parsing time;
    若所述发送结果的字符串不是由所述时间戳和所述待发送消息的消息标识组成的,则确定所述服务器未通过测试。If the character string of the transmission result is not composed of the time stamp and the message identifier of the to-be-sent message, it is determined that the server fails the test.
  11. 如权利要求5所述的服务器的测试方法,其特征在于,所述当接收到所述发送结果后,根据所述发送结果确定所述服务器的测试结果的步骤包括:The testing method of the server according to claim 5, wherein the step of determining the test result of the server according to the sending result after receiving the sending result comprises:
    当接收到所述发送结果后,检测所述发送结果中所携带的字符串组成方式;After receiving the sending result, detecting a string composition manner carried in the sending result;
    若所述发送结果的字符串是由时间戳和所述待发送消息的消息标识组成的,则确定所述服务器通过测试,其中,所述时间戳是所述服务器解析所述第二请求报文的解析时间对应的时间戳;If the character string of the sending result is composed of a time stamp and a message identifier of the to-be-sent message, determining that the server passes the test, where the timestamp is that the server parses the second request message Timestamp corresponding to the parsing time;
    若所述发送结果的字符串不是由所述时间戳和所述待发送消息的消息标识组成的,则确定所述服务器未通过测试。If the character string of the transmission result is not composed of the time stamp and the message identifier of the to-be-sent message, it is determined that the server fails the test.
  12. 如权利要求6所述的服务器的测试方法,其特征在于,所述当接收到所述发送结果后,根据所述发送结果确定所述服务器的测试结果的步骤包括:The testing method of the server according to claim 6, wherein the step of determining the test result of the server according to the sending result after receiving the sending result comprises:
    当接收到所述发送结果后,检测所述发送结果中所携带的字符串组成方式;After receiving the sending result, detecting a string composition manner carried in the sending result;
    若所述发送结果的字符串是由时间戳和所述待发送消息的消息标识组成的,则确定所述服务器通过测试,其中,所述时间戳是所述服务器解析所述第二请求报文的解析时间对应的时间戳;If the character string of the sending result is composed of a time stamp and a message identifier of the to-be-sent message, determining that the server passes the test, where the timestamp is that the server parses the second request message Timestamp corresponding to the parsing time;
    若所述发送结果的字符串不是由所述时间戳和所述待发送消息的消息标识组成的,则确定所述服务器未通过测试。If the character string of the transmission result is not composed of the time stamp and the message identifier of the to-be-sent message, it is determined that the server fails the test.
  13. 一种服务器的测试装置,其特征在于,所述服务器的测试装置包括:A test device for a server, characterized in that the test device of the server comprises:
    获取模块,用于当通过JMeter获取到登录信息后,根据所述登录信息执行登录操作,并在成功执行所述登录操作后获取对应的登录字符串;An obtaining module, configured to perform a login operation according to the login information after obtaining the login information by using the JMeter, and obtain a corresponding login string after successfully performing the login operation;
    转换模块,用于将所述登录字符串转换成第一请求报文;a conversion module, configured to convert the login string into a first request message;
    校验模块,用于将所述第一请求报文发送至服务器,以供所述服务器在接收到所述第一请求报文后,校验所述第一请求报文,得到校验结果,并返回所述校验结果;a verification module, configured to send the first request message to the server, where the server, after receiving the first request message, verify the first request message, and obtain a verification result, And returning the verification result;
    所述获取模块还用于当接收到所述校验结果,且根据所述校验结果确定与所述服务器成功建立连接后,通过所述JMeter获取待发送信息;The obtaining module is further configured to: after receiving the verification result, and determining to successfully establish a connection with the server according to the verification result, acquiring information to be sent by using the JMeter;
    所述转换模块还用于将所述待发送信息转换成第二请求报文发送给所述服务器,以供所述服务器在接收到所述第二请求报文后,将所述第二请求报文发送给接收端,并返回发送结果;The conversion module is further configured to: send the information to be sent into a second request message and send the message to the server, where the server sends the second request message after receiving the second request message. The text is sent to the receiving end and returns the result of the transmission;
    确定模块,用于当接收到所述发送结果后,根据所述发送结果确定所述服务器的测试结果。And a determining module, configured to determine a test result of the server according to the sending result after receiving the sending result.
  14. 如权利要求13所述的服务器的测试装置,其特征在于,所述服务器的测试装置还包括:The testing device of the server according to claim 13, wherein the testing device of the server further comprises:
    断开模块,用于当侦测到断开与所述服务器连接的断开指令后,根据所述断开指令断开与所述服务器之间的连接。And disconnecting the module, configured to disconnect the connection with the server according to the disconnection command after detecting a disconnection instruction disconnected from the server.
  15. 如权利要求13所述的服务器的测试装置,其特征在于,所述服务器的测试装置还包括:The testing device of the server according to claim 13, wherein the testing device of the server further comprises:
    监控模块,用于触发监控指令,并根据所述监控指令监控与所述服务器之间的连接状态。And a monitoring module, configured to trigger a monitoring instruction, and monitor a connection state with the server according to the monitoring instruction.
  16. 如权利要求13所述的服务器的测试装置,其特征在于,所述转换模块包括:The testing device of the server according to claim 13, wherein the conversion module comprises:
    重组单元,用于根据所述登录字符串的长度进行位运算,以重组所述登录字符串,得到重组后的所述登录字符串;a recombining unit, configured to perform a bit operation according to the length of the login string, to recombine the login string, to obtain the recombined login string;
    运算单元,用于将重组后的所述登录字符串与所述预设质数进行取模运算,得到与所述登录字符串对应的数据报文;An operation unit, configured to perform a modulo operation on the re-established login string and the preset prime number to obtain a data packet corresponding to the login string;
    第一转换单元,用于通过预设协议将所述数据报文转换成第一请求报文。The first converting unit is configured to convert the data packet into a first request message by using a preset protocol.
  17. 如权利要求13所述的服务器的测试装置,其特征在于,所述发送模块还用于将所述第一请求报文通过预设通信技术框架发送至服务器,以供所述服务器在接收到所述第一请求报文后,确定所述第一请求报文对应的用户,并校验所述第一请求报文对应的用户是否处于有效状态以及是否处于登录状态,得到校验结果,并返回所述校验结果;The testing device of the server according to claim 13, wherein the sending module is further configured to send the first request message to a server by using a preset communication technology framework, where the server receives the Determining, by the first request message, the user corresponding to the first request message, and verifying whether the user corresponding to the first request message is in a valid state and is in a login state, obtaining a verification result, and returning The verification result;
    其中,若所述用户处于有效状态且处于登录状态,所述服务器则得到所述第一请求报文通过校验的校验结果;若所述用户处于无效状态和/或非登录状态,所述服务器则得到所述第一请求报文未通过校验的校验结果。 If the user is in an active state and is in a login state, the server obtains a verification result of the first request packet passing the verification; if the user is in an invalid state and/or a non-login state, The server obtains a verification result that the first request packet fails the verification.
  18. 如权利要求13所述的服务器的测试装置,其特征在于,所述转换模块还包括:The testing device of the server according to claim 13, wherein the conversion module further comprises:
    第二转换单元,用于将所述待发送信息转换成对应的消息对象,根据预设协议将所述消息对象转换成第二请求报文;a second converting unit, configured to convert the to-be-sent information into a corresponding message object, and convert the message object into a second request message according to a preset protocol;
    发送单元,用于将所述第二请求报文发送给所述服务器,以供所述服务器在接收到所述第二请求报文后,将所述第二请求报文对应的所述待发送消息发送给接收端,并返回发送结果。a sending unit, configured to send the second request message to the server, where the server sends the second request message corresponding to the to-be-sent after receiving the second request message The message is sent to the receiver and the result is sent back.
  19. 一种服务器的测试设备,其特征在于,所述服务器的测试设备包括存储器、微处理器和存储在所述存储器上并可在所述微处理器上运行的服务器的测试程序,所述已接入服务器的测试程序被所述微处理器执行时实现如权利要求1所述的服务器的测试方法的步骤。A test device for a server, characterized in that the test device of the server comprises a memory, a microprocessor, and a test program of a server stored on the memory and operable on the microprocessor, the connected The steps of the test method of the server of claim 1 when the test program of the server is executed by the microprocessor.
  20. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有服务器的测试程序,所述已接入服务器的测试程序被处理器执行时实现如权利要求1所述的服务器的测试方法的步骤。 A computer readable storage medium, wherein the computer readable storage medium stores a test program of a server, and the test program of the accessed server is executed by the processor to implement the server according to claim 1. The steps of the test method.
PCT/CN2018/093754 2018-04-24 2018-06-29 Server testing method, apparatus, and device, and computer readable storage medium WO2019205280A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810370939.5A CN108650149B (en) 2018-04-24 2018-04-24 Server testing method, device, equipment and computer readable storage medium
CN201810370939.5 2018-04-24

Publications (1)

Publication Number Publication Date
WO2019205280A1 true WO2019205280A1 (en) 2019-10-31

Family

ID=63747075

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/093754 WO2019205280A1 (en) 2018-04-24 2018-06-29 Server testing method, apparatus, and device, and computer readable storage medium

Country Status (2)

Country Link
CN (1) CN108650149B (en)
WO (1) WO2019205280A1 (en)

Cited By (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111427566A (en) * 2020-03-18 2020-07-17 北京达佳互联信息技术有限公司 Data processing method and device suitable for analog interface platform and server
CN111767178A (en) * 2020-05-20 2020-10-13 北京奇艺世纪科技有限公司 Physical machine performance testing method and device
CN111858295A (en) * 2019-12-31 2020-10-30 北京骑胜科技有限公司 Firmware testing method and device, electronic equipment and storage medium
CN111931188A (en) * 2020-08-13 2020-11-13 中国工商银行股份有限公司 Vulnerability testing method and system under login scene
CN112134754A (en) * 2020-09-18 2020-12-25 中移(杭州)信息技术有限公司 Pressure testing method and device, network equipment and storage medium
CN112905640A (en) * 2021-01-25 2021-06-04 武汉武钢绿色城市技术发展有限公司 Netty-based distributed database data access control method
CN112965901A (en) * 2021-03-05 2021-06-15 北京百度网讯科技有限公司 API testing method, server, system and electronic equipment
CN113220594A (en) * 2021-06-04 2021-08-06 中国农业银行股份有限公司 Automatic testing method, device, equipment and storage medium
CN113225232A (en) * 2021-05-12 2021-08-06 中国第一汽车股份有限公司 Hardware testing method and device, computer equipment and storage medium
CN113704114A (en) * 2021-08-30 2021-11-26 平安普惠企业管理有限公司 Automatic testing method, device, equipment and medium for functional interface
CN113765913A (en) * 2021-09-02 2021-12-07 云宏信息科技股份有限公司 Method for configuring access to blacklist by Tomcat server, storage medium and Tomcat server
CN113760710A (en) * 2020-09-29 2021-12-07 北京沃东天骏信息技术有限公司 Task testing method and device, computer equipment and readable storage medium
CN113836003A (en) * 2021-08-30 2021-12-24 南京中兴力维软件有限公司 Position entity extraction test method and JMeter performance test equipment
US20210406155A1 (en) * 2020-06-28 2021-12-30 Baidu Online Network Technology (Beijing) Co., Ltd. Methods for configuring device debugging environment and configuration server
CN114253181A (en) * 2021-11-19 2022-03-29 苏州浪潮智能科技有限公司 System and method for realizing wattage consumption of remote monitoring server
CN114338448A (en) * 2021-12-29 2022-04-12 北京天融信网络安全技术有限公司 Performance test method and device, electronic equipment and storage medium
CN115052053A (en) * 2022-07-27 2022-09-13 中国工商银行股份有限公司 Message processing method and simulator for bank system test
CN115250291A (en) * 2022-07-28 2022-10-28 中国银行股份有限公司 Parameter data verification method, device and equipment and readable storage medium
CN115442284A (en) * 2022-08-22 2022-12-06 绿盟科技集团股份有限公司 System and method for testing equipment
CN115941991A (en) * 2023-01-10 2023-04-07 北京微吼时代科技有限公司 Method and system for verifying stability of message receiving under large concurrency
CN116599877A (en) * 2023-07-19 2023-08-15 国家计算机网络与信息安全管理中心江西分中心 IPv6 link test method based on crawler technology
CN117749451A (en) * 2023-12-12 2024-03-22 镁佳(北京)科技有限公司 Method, device and system for verifying correctness of ADAS signal
CN118353953A (en) * 2024-06-18 2024-07-16 浙江简捷物联科技有限公司 Self-registration and self-networking method of energy storage controller

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109783357A (en) * 2018-12-14 2019-05-21 深圳壹账通智能科技有限公司 The method and device of test application program, computer equipment, storage medium
CN110083523A (en) * 2019-03-13 2019-08-02 中国平安人寿保险股份有限公司 Interface test method, device, computer installation and readable storage medium storing program for executing
CN110119356B (en) * 2019-05-09 2024-02-23 网易(杭州)网络有限公司 Program testing method and device
CN110278144B (en) * 2019-05-21 2021-09-14 北京字节跳动网络技术有限公司 Card message sending method, device, medium and electronic equipment
CN110750452B (en) * 2019-09-23 2023-08-25 苏宁云计算有限公司 Automatic test method and device
CN110971509A (en) * 2019-11-27 2020-04-07 江苏艾佳家居用品有限公司 Instant messaging message transmission method under high concurrency scene
CN113190388B (en) * 2021-04-13 2022-04-22 厦门路桥信息股份有限公司 TCP interface test method, medium, equipment and device
CN114844814B (en) * 2022-03-30 2024-07-23 中国农业银行股份有限公司 Pressure testing method and device
CN116107913B (en) * 2023-04-06 2023-11-14 阿里云计算有限公司 Test control method, device and system of single-node server

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070288441A1 (en) * 2004-07-09 2007-12-13 Wolff Gregory J Synchronizing distributed work through document logs
CN104102673A (en) * 2013-04-12 2014-10-15 腾讯科技(深圳)有限公司 Webpage state monitoring method and device
CN105323287A (en) * 2014-07-31 2016-02-10 腾讯科技(深圳)有限公司 Method and system for logging in third-party application program
CN105471665A (en) * 2014-08-21 2016-04-06 北京奇虎科技有限公司 Website function testing method, website function testing system and website server

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8191048B2 (en) * 2008-11-21 2012-05-29 Oracle America, Inc. Automated testing and qualification of software-based, network service products
CN103023967B (en) * 2012-11-15 2015-05-27 武汉邮电科学研究院 Cloud computing simulation system and method based on simics system simulator
CN107666470B (en) * 2016-07-28 2020-05-19 腾讯科技(深圳)有限公司 Verification information processing method and device
CN106776343A (en) * 2017-01-13 2017-05-31 中国科学院软件研究所 A kind of web application automated test tool and method
CN107122258B (en) * 2017-04-18 2020-06-02 上海雷腾软件股份有限公司 Method and equipment for checking state code of test interface
CN107632927A (en) * 2017-07-28 2018-01-26 北京北信源软件股份有限公司 A kind of method for testing pressure and device of the encryption of the analogue data in C/S frameworks
CN107832207A (en) * 2017-10-16 2018-03-23 深圳市牛鼎丰科技有限公司 Interface performance test method, apparatus, storage medium and computer equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070288441A1 (en) * 2004-07-09 2007-12-13 Wolff Gregory J Synchronizing distributed work through document logs
CN104102673A (en) * 2013-04-12 2014-10-15 腾讯科技(深圳)有限公司 Webpage state monitoring method and device
CN105323287A (en) * 2014-07-31 2016-02-10 腾讯科技(深圳)有限公司 Method and system for logging in third-party application program
CN105471665A (en) * 2014-08-21 2016-04-06 北京奇虎科技有限公司 Website function testing method, website function testing system and website server

Cited By (37)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111858295A (en) * 2019-12-31 2020-10-30 北京骑胜科技有限公司 Firmware testing method and device, electronic equipment and storage medium
CN111858295B (en) * 2019-12-31 2024-05-14 北京骑胜科技有限公司 Firmware testing method and device, electronic equipment and storage medium
CN111427566B (en) * 2020-03-18 2024-05-07 北京达佳互联信息技术有限公司 Data processing method and device suitable for analog interface platform and server
CN111427566A (en) * 2020-03-18 2020-07-17 北京达佳互联信息技术有限公司 Data processing method and device suitable for analog interface platform and server
CN111767178A (en) * 2020-05-20 2020-10-13 北京奇艺世纪科技有限公司 Physical machine performance testing method and device
CN111767178B (en) * 2020-05-20 2023-09-01 北京奇艺世纪科技有限公司 Physical machine performance test method and device
US20210406155A1 (en) * 2020-06-28 2021-12-30 Baidu Online Network Technology (Beijing) Co., Ltd. Methods for configuring device debugging environment and configuration server
CN111931188A (en) * 2020-08-13 2020-11-13 中国工商银行股份有限公司 Vulnerability testing method and system under login scene
CN111931188B (en) * 2020-08-13 2023-09-08 中国工商银行股份有限公司 Vulnerability testing method and system in login scene
CN112134754A (en) * 2020-09-18 2020-12-25 中移(杭州)信息技术有限公司 Pressure testing method and device, network equipment and storage medium
CN113760710A (en) * 2020-09-29 2021-12-07 北京沃东天骏信息技术有限公司 Task testing method and device, computer equipment and readable storage medium
CN112905640A (en) * 2021-01-25 2021-06-04 武汉武钢绿色城市技术发展有限公司 Netty-based distributed database data access control method
CN112965901A (en) * 2021-03-05 2021-06-15 北京百度网讯科技有限公司 API testing method, server, system and electronic equipment
CN112965901B (en) * 2021-03-05 2023-08-01 北京百度网讯科技有限公司 API testing method, server, system and electronic equipment
CN113225232A (en) * 2021-05-12 2021-08-06 中国第一汽车股份有限公司 Hardware testing method and device, computer equipment and storage medium
CN113225232B (en) * 2021-05-12 2022-06-10 中国第一汽车股份有限公司 Hardware testing method and device, computer equipment and storage medium
CN113220594B (en) * 2021-06-04 2023-10-03 中国农业银行股份有限公司 Automatic test method, device, equipment and storage medium
CN113220594A (en) * 2021-06-04 2021-08-06 中国农业银行股份有限公司 Automatic testing method, device, equipment and storage medium
CN113704114A (en) * 2021-08-30 2021-11-26 平安普惠企业管理有限公司 Automatic testing method, device, equipment and medium for functional interface
CN113836003A (en) * 2021-08-30 2021-12-24 南京中兴力维软件有限公司 Position entity extraction test method and JMeter performance test equipment
CN113836003B (en) * 2021-08-30 2023-07-25 南京中兴力维软件有限公司 Position entity extraction test method and JMeter performance test equipment
CN113765913A (en) * 2021-09-02 2021-12-07 云宏信息科技股份有限公司 Method for configuring access to blacklist by Tomcat server, storage medium and Tomcat server
CN114253181B (en) * 2021-11-19 2024-01-23 苏州浪潮智能科技有限公司 System and method for realizing remote monitoring of wattage consumption of server
CN114253181A (en) * 2021-11-19 2022-03-29 苏州浪潮智能科技有限公司 System and method for realizing wattage consumption of remote monitoring server
CN114338448B (en) * 2021-12-29 2024-02-20 北京天融信网络安全技术有限公司 Performance test method and device, electronic equipment and storage medium
CN114338448A (en) * 2021-12-29 2022-04-12 北京天融信网络安全技术有限公司 Performance test method and device, electronic equipment and storage medium
CN115052053A (en) * 2022-07-27 2022-09-13 中国工商银行股份有限公司 Message processing method and simulator for bank system test
CN115250291A (en) * 2022-07-28 2022-10-28 中国银行股份有限公司 Parameter data verification method, device and equipment and readable storage medium
CN115250291B (en) * 2022-07-28 2024-03-22 中国银行股份有限公司 Parameter data verification method, device, equipment and readable storage medium
CN115442284B (en) * 2022-08-22 2023-06-09 绿盟科技集团股份有限公司 System and method for testing equipment
CN115442284A (en) * 2022-08-22 2022-12-06 绿盟科技集团股份有限公司 System and method for testing equipment
CN115941991B (en) * 2023-01-10 2023-10-27 北京微吼时代科技有限公司 Method and system for verifying stability of message collection under large concurrency
CN115941991A (en) * 2023-01-10 2023-04-07 北京微吼时代科技有限公司 Method and system for verifying stability of message receiving under large concurrency
CN116599877B (en) * 2023-07-19 2023-09-15 国家计算机网络与信息安全管理中心江西分中心 IPv6 link test method based on crawler technology
CN116599877A (en) * 2023-07-19 2023-08-15 国家计算机网络与信息安全管理中心江西分中心 IPv6 link test method based on crawler technology
CN117749451A (en) * 2023-12-12 2024-03-22 镁佳(北京)科技有限公司 Method, device and system for verifying correctness of ADAS signal
CN118353953A (en) * 2024-06-18 2024-07-16 浙江简捷物联科技有限公司 Self-registration and self-networking method of energy storage controller

Also Published As

Publication number Publication date
CN108650149B (en) 2021-10-01
CN108650149A (en) 2018-10-12

Similar Documents

Publication Publication Date Title
WO2019205280A1 (en) Server testing method, apparatus, and device, and computer readable storage medium
WO2019196213A1 (en) Interface test method, apparatus and device, and computer-readable storage medium
WO2019001110A1 (en) Authority authentication method, system, and device, and computer-readable storage medium
WO2019019374A1 (en) Method, apparatus, and system for controlling household appliance with intelligent voice device
WO2019192085A1 (en) Method, apparatus and device for direct-connected communication between bank and enterprise, and computer-readable storage medium
WO2018082482A1 (en) Network sharing method, and method and system for accessing network
WO2019100531A1 (en) Digital signature generation method and device thereof, verification method and device thereof, and storage medium
WO2017054481A1 (en) Information verification and processing method and apparatus, and information processing system
WO2015172684A1 (en) Ap connection method, terminal, and server
WO2018107610A1 (en) Service data processing method, system and device, and computer-readable storage medium
WO2019174375A1 (en) Interface test method, apparatus and device, and computer-readable storage medium
WO2015158219A1 (en) Remote debugging method and apparatus for mobile terminal
WO2018120457A1 (en) Data processing method, apparatus, device, and computer readable storage medium
WO2019037396A1 (en) Account clearing method, device and equipment and storage medium
WO2015043120A1 (en) Cloud file sharing method and system
WO2019075973A1 (en) Application program testing method and device
WO2019024336A1 (en) Data query method and device, and computer readable storage medium
WO2019104876A1 (en) Insurance product pushing method and system, terminal, client terminal, and storage medium
WO2015108283A1 (en) Application error detection method for cloud streaming service, and apparatus and system therefor
WO2019066295A1 (en) Web traffic logging system and method for detecting web hacking in real time
WO2019033904A1 (en) Login authentication method and system, and computer-readable storage medium
WO2017054592A1 (en) Interface display method and terminal
WO2018233367A1 (en) Case registration method and apparatus, terminal, and computer readable storage medium
WO2018166107A1 (en) Hybrid-based compatibility method, adapter, operating apparatus and system, and computer-readable storage medium
WO2017206377A1 (en) Method and device for synchronous playback of program

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18916245

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 02.02.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 18916245

Country of ref document: EP

Kind code of ref document: A1