CN111258902A - Performance test method and performance test system based on SockJS server - Google Patents

Performance test method and performance test system based on SockJS server Download PDF

Info

Publication number
CN111258902A
CN111258902A CN202010051357.8A CN202010051357A CN111258902A CN 111258902 A CN111258902 A CN 111258902A CN 202010051357 A CN202010051357 A CN 202010051357A CN 111258902 A CN111258902 A CN 111258902A
Authority
CN
China
Prior art keywords
test
terminal
html
script
server
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010051357.8A
Other languages
Chinese (zh)
Other versions
CN111258902B (en
Inventor
虞秉磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Ping An Medical Health Technology Service Co Ltd
Original Assignee
Ping An Medical and Healthcare Management Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Medical and Healthcare Management Co Ltd filed Critical Ping An Medical and Healthcare Management Co Ltd
Priority to CN202010051357.8A priority Critical patent/CN111258902B/en
Publication of CN111258902A publication Critical patent/CN111258902A/en
Application granted granted Critical
Publication of CN111258902B publication Critical patent/CN111258902B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Abstract

The invention discloses a performance test method based on an SockJS server, a control terminal, a test terminal, a performance test system based on the SockJS server, a storage medium and computer equipment, and relates to the field of server test. The performance test system based on the SockJS server comprises at least one control terminal and at least one test terminal, wherein the method executed by the control terminal comprises the following steps: acquiring a target concurrency number and an HTML test script; obtaining a test terminal quantity value according to the target concurrency number; distributing idle test terminals to current test resources according to the quantity value of the test terminals; generating an HTML (hypertext markup language) distribution script according to the number value of the test terminal and the HTML test script, and pushing the HTML distribution script to the test terminal, so that the test terminal utilizes the HTML distribution script to perform testing; and receiving test data sent by the test terminal, and generating a test result according to the test data. The method meets the test requirement based on the multiple concurrency numbers of the SockJS server, and improves the performance test quality and efficiency of the SockJS server.

Description

Performance test method and performance test system based on SockJS server
Technical Field
The invention relates to the field of server testing, in particular to a performance testing method based on an SockJS server, a control terminal, a testing terminal, a performance testing system based on the SockJS server, a storage medium and computer equipment.
Background
HTML5 adds a WebSocket feature to help the server to actively push messages to the client browser. But as some browsers lack support for websockets, more and more items begin to make widespread use of sockss with compatibility. Sockss is a browser JavaScript library that provides a coherent, cross-browser JavaScript API that creates a low-latency, full-duplex, cross-domain communication channel between the browser and the web server. In the aspect of compatibility, the socket JS preferentially uses the native Websocket, and if the native Websocket is in a browser which does not support the Websocket, the native Websocket is automatically switched to a polling mode.
For a traditional WebSocket server, a JMeter tool is generally used in the industry or a WebSocketclient class is used for performance testing in self-built engineering. However, the WebSocket server based on the SockJS has no JMeter support at present and can not be connected through the WebSocketClient class. The only way is to call an HTML webpage for realizing the SockJS method, and enable the user to establish connection with the server in a webpage-using mode through the browser. Notably, a single browser has a limit on the number of WebSocket connections.
How to solve the problem that the number of WebSocket connections is limited by a browser so as to reach the target number of concurrent users, and how to efficiently schedule a plurality of webpages for simultaneous testing is a great mountain based on SockJS performance testing.
Disclosure of Invention
In view of this, the application provides a performance test method based on an sockss server, a control terminal, a test terminal, a performance test system based on the sockss server, a storage medium and a computer device, and mainly aims to solve the technical problem that the performance test based on the sockss server cannot reach the target number of concurrent users, so that the test quality and the test efficiency are affected.
According to the first aspect of the invention, a performance testing method based on a SockJS server is provided, and the method comprises the following steps:
acquiring a target concurrency number and an HTML test script;
obtaining a test terminal quantity value according to the target concurrency number and the WebSocket protocol connection number upper limit corresponding to the browser;
distributing idle test terminals to current test resources according to the quantity value of the test terminals;
generating an HTML (hypertext markup language) distribution script according to the test terminal quantity value and the HTML test script, and pushing the HTML distribution script to the test terminal;
issuing a test instruction to the test terminal so that the test terminal can perform testing by using the HTML distribution script;
and receiving test data sent by the test terminal, and generating a test result according to the test data.
According to a second aspect of the invention, a performance testing method based on a SockJS server is provided, wherein the method for issuing a test instruction to a test terminal to enable the test terminal to perform a test by using an HTML distribution script comprises the following steps:
receiving an HTML (hypertext markup language) distribution script pushed by a control terminal;
driving the HTML distribution script so as to establish a connection based on SockJS with the tested server;
receiving a test starting instruction issued by a control terminal, driving an HTML (hypertext markup language) distribution script to send a test request to a tested server, and receiving a request response from the tested server;
saving the log information generated by the test in the message middleware;
consuming and processing the log information stored in the message middleware to generate test data, and sending the test data to the control terminal;
and receiving a test finishing instruction issued by the control terminal or stopping the test waiting time, and driving the HTML distribution script to disconnect the SockJS-based connection with the tested server.
According to a third aspect of the present invention, there is provided a control terminal comprising:
the test task management module is used for acquiring the target concurrency number and the HTML test script;
the test terminal allocation module is used for obtaining a test terminal quantity value according to the target concurrency number and the WebSocket protocol connection number upper limit corresponding to the browser, and allocating an idle test terminal to the current test resource according to the test terminal quantity value;
the test script pushing module is used for generating an HTML (hypertext markup language) distribution script according to the test terminal quantity value and the HTML test script and pushing the HTML distribution script to the test terminal;
the test instruction transceiving module is used for issuing a test instruction to the test terminal so that the test terminal can perform testing by using the HTML distribution script;
and the test data storage module is used for receiving the test data sent by the test terminal and generating a test result according to the test data.
According to a fourth aspect of the present invention, there is provided a test terminal comprising:
the test script receiving module is used for receiving the HTML distribution script pushed by the control terminal;
the test script driving module is used for driving the HTML distribution script so as to establish a connection based on SockJS with the tested server, send a test request to the tested server, receive a request response from the tested server and disconnect the connection based on SockJS with the tested server;
the test instruction transceiving module is used for receiving a test starting instruction issued by the control terminal and receiving a test finishing instruction issued by the control terminal;
the log information processing module is used for storing the log information generated by the test in the message middleware and consuming and processing the log information stored in the message middleware to generate test data;
and the test result sending module is used for sending the test data to the control terminal.
According to a fifth aspect of the invention, a performance testing system based on a SockJS server is provided, and the system comprises at least one control terminal and at least one testing terminal.
According to a sixth aspect of the present invention, there is provided a storage medium having stored thereon a computer program which, when executed by a processor, implements the above-described sockss server-based performance testing method.
According to a seventh aspect of the present invention, there is provided a computer device, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the performance testing method based on the sockss server when executing the program.
The performance test system based on the SockJS server comprises at least one control terminal and at least one test terminal, wherein, the control terminal and the test terminal can respectively execute the performance test method based on the SockJS server to realize the unified scheduling of the test tasks, so that the whole process of the test tasks can realize automation, the manpower and material resources are saved, the test accuracy and efficiency are improved, in addition, the performance test method based on the SockJS server, which is executed by the control terminal, can automatically distribute the number of test terminals according to the target concurrency number, generate a corresponding number of HTML distribution scripts, and pushes the HTML distribution script to the test terminal, so that the test terminal can use the HTML distribution script to test, the method meets the test requirement based on multiple concurrencies of the SockJS server, and improves the performance test quality and test efficiency of the SockJS server.
The foregoing description is only an overview of the technical solutions of the present application, and the present application can be implemented according to the content of the description in order to make the technical means of the present application more clearly understood, and the following detailed description of the present application is given in order to make the above and other objects, features, and advantages of the present application more clearly understandable.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
fig. 1 is a schematic flow chart illustrating a performance testing method based on an sockss server according to an embodiment of the present invention;
fig. 2 is a schematic flow chart illustrating another performance testing method based on the sockss server according to the embodiment of the present invention;
fig. 3 is a schematic flow chart illustrating a further performance testing method based on the sockss server according to the embodiment of the present invention;
fig. 4 is a schematic structural diagram of a control terminal according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram illustrating a test terminal according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram illustrating a performance testing system based on a sockss server according to an embodiment of the present invention;
FIG. 7 is a schematic structural diagram illustrating an HTML test script according to an embodiment of the present invention.
Detailed Description
The invention will be described in detail hereinafter with reference to the accompanying drawings in conjunction with embodiments. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
The embodiment of the application aims at the problem that the performance test based on the SockJS server cannot reach the number of the target concurrent users, the test quality and the test efficiency are affected, the performance test system based on the SockJS server is provided, the performance test system comprises at least one control terminal and at least one test terminal, and through the system, unified scheduling of test tasks based on the SockJS server can be achieved. In this embodiment, the performance test system based on the sockss server can adopt a "1 + N" mode, that is, the system includes one control terminal and a plurality of test terminals, wherein the control terminal can manage all the test terminals in a Socket long connection manner, and each test terminal is relatively independent, that is, there is no interaction between the test terminals, and then each test terminal can communicate with the server based on the sockss through a WebSocket protocol.
In an embodiment, as shown in fig. 1, there is provided a performance testing method based on a sockss server, taking the control terminal applied in the above embodiment as an example, including the following steps:
101. and acquiring a target concurrency number and an HTML test script.
The target concurrency number refers to the number of connections established between the user and the server to be tested in the same time; HTML (HyperText Markup language), namely hypertext Markup language, is a Markup language and comprises a series of tags, and the tags can unify the document format on the network, so that scattered Internet resources are connected into a logic whole; test script (Testing script) refers to computer readable instructions that automatically perform a test procedure, which can be created or automatically generated using a test automation tool, or programmed in a programming language, or can be performed by combining the first three methods; the HTML test script refers to a test script written by an HTML language and comprises test information such as test rules, test duration, connection information and the like.
Specifically, the control terminal may be used as an interface for user interaction to obtain a specific test requirement, where the test requirement includes a target concurrency number and an HTML test script.
102. And obtaining a quantity value of the test terminal according to the target concurrency number and the WebSocket protocol connection number upper limit corresponding to the browser.
Specifically, the control terminal may directly obtain the test terminal quantity value through a user input mode, or may automatically generate the test terminal quantity value according to the target concurrency number and the WebSocket protocol connection number upper limit corresponding to the browser. The method for automatically generating the data quantity value of the test terminal comprises the following steps: and dividing the target concurrency number by the upper limit of the WebSocket protocol connection number corresponding to the browser to obtain a first number value, taking the first number value as the test terminal number value if the first number value is an integer, and taking the value of the first number value which is rounded up as the test terminal number value if the first number value is a decimal. Specifically, assuming that the obtained target concurrency number is a, and the upper limit of the WebSocket protocol connection number corresponding to the obtained browser is B, the generated test terminal quantity value is N ═ a/B, if N is an integer, N is the test terminal quantity value, if N is not an integer, N is rounded up, and the nearest N that is greater than or equal to N is used as the test terminal quantity value. For example, the target concurrency number is 100, the upper limit of the number of connections of the browser to be tested to the WebSocket is 32, the number value of the test terminal is N, 100/32, 3.125, and N is rounded up to obtain the number value of the test terminal, which is 4.
103. And distributing idle test terminals to the current test resources according to the quantity value of the test terminals.
Specifically, the control terminal may search the test terminal resource pool for the test terminals with the same number of idle use states as the number of the test terminals, and allocate the test terminals to the current test resources. In this embodiment, the control terminal may adopt a polling algorithm to sequentially check the usage state of each test terminal in the resource pool of the test terminals, when it is detected that there is a test terminal in the resource pool whose usage state is idle, a freezing instruction is sent to the test terminal, and the test terminal is included in the current test resource, and when the number of test terminals in the current test resource is equal to the number of test terminals, polling is stopped, and the test terminal is completely allocated.
104. And generating an HTML (hypertext markup language) distribution script according to the number value of the test terminal and the HTML test script, and pushing the HTML distribution script to the test terminal.
Specifically, the control terminal can divide the connection information in the HTML test script into the number of parts equal to the number of the test terminals according to the number of the test terminals, retain the test rules and the test duration in the HTML test script, generate the HTML distribution script equal to the number of the test terminals according to the test rules, the test duration and the divided connection information, and finally push the HTML distribution script to each test terminal. For example, if the HTML test script includes 100 pieces of connection information and the number value of the test terminal is 4, the control terminal divides the 100 pieces of connection information into 4 pieces, and generates 4 HTML distribution scripts by combining the test rule and the test duration in the HTML test script, it should be noted that the dividing method of the connection information may be average or uneven, and the connection information in each divided HTML distribution script is not repeated and the number of the connection information does not exceed the upper limit of the WebSocket protocol connection number corresponding to the browser, for example, in this example, each HTML distribution script in the generated 4 HTML distribution scripts may include 25 pieces of connection information that are not repeated.
105. And issuing a test instruction to the test terminal so that the test terminal performs testing by using the HTML distribution script.
Specifically, in the starting stage and the ending stage of the test, the control terminal can uniformly issue a test starting instruction or a test ending instruction to all the test terminals, so that all the test terminals can drive the HTML distribution script to start the test or forcibly end the test according to the instruction.
106. And receiving test data sent by the test terminal, and generating a test result according to the test data.
Specifically, the control terminal can receive test data sent by the test terminal in real time, and also can receive the test data sent by the test terminal in a unified manner after the test is finished, and then the control terminal can store the received test data in the database.
According to the performance testing method based on the SockJS server, firstly, the target concurrency number and the HTML testing script are obtained, then the testing terminal quantity value is automatically generated according to the target concurrency number, the idle testing terminals are automatically distributed to the current testing resources, finally, the HTML distribution scripts with the corresponding quantity are automatically generated according to the HTML testing script, and the HTML distribution scripts are pushed to the testing terminal, so that the testing terminal can be tested by utilizing the HTML distribution scripts.
Further, as a refinement and an extension of the specific implementation of the foregoing embodiment, in order to fully illustrate the implementation process of the present embodiment, a performance testing method based on a sockss server is provided, and taking as an example that the method is applied to the control terminal in the foregoing embodiment, as shown in fig. 2, the method includes the following steps:
201. and acquiring test parameters, and generating an HTML test script according to the test parameters.
The testing parameters comprise target concurrency number, connection parameters, testing duration, service data and response assertion, and specifically, the connection parameters comprise a user login name, a password corresponding to the login name, an IP address of the tested server and the like; the testing duration is the testing duration, and according to the parameters, the testing terminal can automatically stop testing before the instruction for finishing testing issued by the control terminal is not received; the service data refers to test data with a specific scene, so that the test data is closer to a real scene; response assertion refers to a prediction of the test result, from which parameters it can be analyzed whether the test result is correct.
Specifically, the control terminal may first generate connection information with the same number as the target concurrent number according to the target concurrent number and the connection parameter, then generate a test rule according to the service data and the response assertion, and finally generate an HTML test script according to the connection information, the test rule, and the test duration.
In this embodiment, as shown in fig. 7, the generated HTML test script includes 6 functional modules, which are a script parameter maintenance module, a multithreading management module, a connection management module, a test data sending module, a response result receiving module, and a log printing module. The script parameter maintenance module can be used for storing the test parameters, and after the test is started, the script parameter maintenance module can send the test parameters to other modules so that the other modules can execute corresponding actions according to the corresponding test parameters; the multithreading management module can be used for opening up threads with corresponding quantity according to the target concurrency parameter so as to simulate the communication scene of multiple users and the tested server; the connection management module can establish connection with the tested server by the user according to the login name and the user information such as the password corresponding to the login name; the response receiving result module can be used for receiving response data and performing response assertion on the response data according to the response assertion parameters; the printing log module can generate log information of the whole test process including the process of establishing connection, the process of sending test data, the process of receiving response data and the process of disconnecting connection, and store the log information in the message middleware for waiting processing.
202. And acquiring a target concurrency number, and acquiring a test terminal quantity value according to the target concurrency number and the WebSocket protocol connection number upper limit corresponding to the browser.
Specifically, the control terminal may directly obtain the test terminal quantity value through a user input mode, or may automatically generate the test terminal quantity value according to the target concurrency number and the WebSocket protocol connection number upper limit corresponding to the browser. The method for automatically generating the data quantity value of the test terminal comprises the following steps: and dividing the target concurrency number by the upper limit of the WebSocket protocol connection number corresponding to the browser to obtain a first number value, taking the first number value as the test terminal number value if the first number value is an integer, and taking the value of the first number value which is rounded up as the test terminal number value if the first number value is a decimal. Specifically, assuming that the obtained target concurrency number is a, and the upper limit of the WebSocket protocol connection number corresponding to the obtained browser is B, the generated test terminal quantity value is N ═ a/B, if N is an integer, N is the test terminal quantity value, if N is not an integer, N is rounded up, and the nearest N that is greater than or equal to N is used as the test terminal quantity value. For example, the target concurrency number is 100, the upper limit of the number of connections of the browser to be tested to the WebSocket is 32, the number value of the test terminal is N, 100/32, 3.125, and N is rounded up to obtain the number value of the test terminal, which is 4.
203. And distributing idle test terminals to the current test resources according to the quantity value of the test terminals.
Specifically, the control terminal may search the test terminal resource pool for the test terminals with the same number of idle use states as the number of the test terminals, and allocate the test terminals to the current test resources. In this embodiment, the control terminal may adopt a polling algorithm to sequentially check the usage state of each test terminal in the resource pool of the test terminals, when it is detected that there is a test terminal in the resource pool whose usage state is idle, a freezing instruction is sent to the test terminal, and the test terminal is included in the current test resource, and when the number of test terminals in the current test resource is equal to the number of test terminals, polling is stopped, and the test terminal is completely allocated.
204. And generating an HTML (hypertext markup language) distribution script according to the number value of the test terminal and the HTML test script, and pushing the HTML distribution script to the test terminal.
Specifically, the control terminal can divide the connection information in the HTML test script into the number of parts equal to the number of the test terminals according to the number of the test terminals, retain the test rules and the test duration in the HTML test script, generate the HTML distribution script equal to the number of the test terminals according to the test rules, the test duration and the divided connection information, and finally push the HTML distribution script to each test terminal. For example, if the HTML test script includes 100 pieces of connection information and the number value of the test terminal is 4, the control terminal divides the 100 pieces of connection information into 4 pieces, and generates 4 HTML distribution scripts by combining the test rule and the test duration in the HTML test script, it should be noted that the dividing method of the connection information may be average or uneven, and the connection information in each divided HTML distribution script is not repeated and the number of the connection information does not exceed the upper limit of the WebSocket protocol connection number corresponding to the browser, for example, in this example, each HTML distribution script in the generated 4 HTML distribution scripts may include 25 pieces of connection information that are not repeated.
205. And issuing a test starting instruction and a test ending instruction to the test terminal.
Specifically, in the starting stage and the ending stage of the test, the control terminal can uniformly issue a test starting instruction or a test ending instruction to all the test terminals, so that all the test terminals can drive the HTML distribution script to start the test or forcibly end the test according to the instruction.
206. And receiving test data sent by the test terminal, and storing the test data in a database.
Specifically, the control terminal may receive the test data sent by the test terminal in real time, or may receive the test data sent by the test terminal in a unified manner after the test is finished, and then the control terminal may store the received test data in the database.
207. And generating a test result according to the test data, and displaying the test result.
Specifically, the control terminal may extract the test data from the database, process the test data and display the processed test data on the interface, or process the test data received in real time and display the processed test data on the interface of the control terminal in real time.
In the embodiment, the original single-user connection, single message sending and single response data receiving modes are transformed into the modes of multi-user concurrent connection, multi-user message sending and multi-user response data receiving by automatically generating the HTML test script with the multi-concurrent test function, so that the performance test of the SockJS server is closer to the real application scene of multi-user concurrent, and the test quality and the test efficiency of the SockJS server are improved. In addition, the generated HTML test script can also store the whole test process in a log information mode, so that a user can conveniently track the test process and find problems in the test, and the test quality and the test efficiency are further improved.
In another embodiment, as shown in fig. 3, there is further provided a performance testing method based on the sockss server, where the method is also specifically shown in step 105, and taking the example of the application of the method to the test terminal in the foregoing embodiment as an example, the method includes the following steps:
301. and receiving an HTML distribution script pushed by the control terminal.
Specifically, the test terminal may receive an HTML distribution script pushed by the control terminal, and store the HTML distribution script on a disk of the test terminal.
302. And driving the HTML distribution script so as to establish a SockJS-based connection with the tested server.
Specifically, the test terminal can call a method of JavaScript in the HTML distribution script and establish a connection based on SockJS with the tested server through a Web driving technology, wherein the call sequence, the call parameters and the call time are determined by the test parameters in the HTML distribution script.
303. The method comprises the steps of receiving an instruction for starting a test issued by a control terminal, driving an HTML distribution script to send a test request to a tested server, and receiving a request response from the tested server.
Specifically, the test terminal may drive the HTML distribution script after receiving an instruction issued by the control terminal to start the test, so as to send a test request to the server under test, and then receive response data from the server under test, and the process of sending the test request and receiving the response data may continue until the test is finished.
304. And saving the log information generated by the test in the message middleware.
Specifically, after the test terminal drives the HTML distribution script to start testing, a series of log information including the log information of connection establishment, the log information of test data transmission, the log information of response data reception, and the log information of disconnection is generated in real time, and the test terminal can store all the log information in the message middleware in a unified manner.
305. And consuming and processing the log information stored in the message middleware to generate test data, and sending the test data to the control terminal.
Specifically, the test terminal may process the original test data into valid test data, such as actual concurrency, response time, response success rate, error details, and the like, by consuming and processing the log information in the message middleware, where the original test data is, for example:
{ "time": time1"," user ": user1", "action": send "," content ": aaaa" } and
{"time":"time2","user":"user2","action":"receive","content":"bbbb"},
the test data processed as valid were:
{"time":"time2","user":"user2","key":"response","value":"time2-time1"}。
as another example, the original test data is:
{"time":"time1","user":"user1","action":"receive","content":"500-Internal Error"},
the test data processed as valid were:
{"time":"time1","user":"user1","key":"Success","value":"false"}。
306. and receiving a test finishing instruction issued by the control terminal or stopping the test waiting time, and driving the HTML distribution script to disconnect the SockJS-based connection with the tested server.
Specifically, the test terminal can forcibly stop the test when receiving a test ending instruction issued by the control terminal, and also can automatically stop the test when the test duration expires, and when receiving the test ending instruction or the test duration expires, the test terminal can drive the HTML distribution script to disconnect the connection with the tested server based on the SockJS. And then, the test terminal sends the test data obtained after the log information is processed to the control terminal, and automatically deletes the HTML distribution script and the log information after all the data are sent, and enters an idle state.
Further, as a specific implementation of the method shown in fig. 1 and fig. 2, this embodiment provides a control terminal, as shown in fig. 4, where the control terminal includes: a test task management module 41, a test terminal distribution module 42, a test script pushing module 43, a test instruction transceiving module 44, and a test data storage module 45, wherein:
the test task management module 41 is used for acquiring a target concurrency number and an HTML test script;
the test terminal allocation module 42 is configured to obtain a test terminal quantity value according to the target concurrency number and the WebSocket protocol connection number upper limit corresponding to the browser, and allocate an idle test terminal to a current test resource according to the test terminal quantity value;
the test script pushing module 43 is configured to generate an HTML distribution script according to the test terminal quantity value and the HTML test script, and push the HTML distribution script to the test terminal;
the test instruction transceiving module 44 is configured to issue a test instruction to the test terminal, so that the test terminal performs a test by using the HTML distribution script;
and the test data storage module 45 is configured to receive the test data sent by the test terminal, and generate a test result according to the test data.
In a specific application scenario, the control terminal further comprises a test parameter acquisition module, wherein the test parameter acquisition module is specifically used for acquiring test parameters and generating an HTML test script according to the test parameters, and the test parameters comprise target concurrency number, connection parameters, test duration, service data and response assertion; generating an HTML test script according to the test parameters, wherein the HTML test script is generated according to the test parameters and comprises the following steps: generating connection information with the same number as the target concurrency number according to the target concurrency number and the connection parameters; generating a test rule according to the service data and the response assertion; and generating an HTML test script according to the connection information, the test rule and the test duration.
In a specific application scenario, the test script pushing module 43 may be further configured to divide the connection information in the HTML test script into the number of parts equal to the number of the test terminal according to the number of the test terminal; keeping the test rule and the test duration in the HTML test script; and generating HTML distribution scripts with the same quantity as the quantity value of the test terminals according to the test rules, the test duration and the segmented connection information.
In a specific application scenario, the test terminal allocation module 42 may also be configured to sequentially check the use status of each test terminal in the test terminal resource pool by using a polling algorithm; sending a freezing instruction to a test terminal in an idle use state, and bringing the test terminal into a current test resource; when the number of test terminals in the secondary test resource is equal to the test terminal number value, the polling is stopped.
It should be noted that other corresponding descriptions of the functional units related to the control terminal provided in this embodiment may refer to the corresponding descriptions in fig. 1 and fig. 2, and are not described herein again.
Further, as a specific implementation of the method shown in fig. 3, this embodiment provides a test terminal, as shown in fig. 5, where the test terminal includes: a test script receiving module 51, a test script driving module 52, a test instruction transceiving module 53, a log information processing module 54, and a test result transmitting module 55, wherein:
a test script receiving module 51, configured to receive an HTML distribution script pushed by the control terminal;
the test script driving module 52 is configured to drive the HTML distribution script to establish a sockss-based connection with the server to be tested, send a test request to the server to be tested, receive a request response from the server to be tested, and disconnect the sockss-based connection with the server to be tested;
the test instruction transceiver module 53 is configured to receive an instruction for starting a test issued by the control terminal and an instruction for ending the test issued by the control terminal;
a log information processing module 54, operable to store log information generated by the test in the message middleware, and consume and process the log information stored in the message middleware to generate test data;
and the test result sending module 55 may be configured to send the test data to the control terminal.
It should be noted that other corresponding descriptions of the functional units related to the test terminal provided in this embodiment may refer to the corresponding description in fig. 3, and are not described herein again.
Further, the present embodiment provides a performance testing system based on the sockss server, as shown in fig. 6, the system includes at least one control terminal in the foregoing embodiment and at least one testing terminal in the foregoing embodiment. The control terminal can manage all the test terminals in a Socket long connection mode, each test terminal is relatively independent, namely no interaction exists among the test terminals, and then each test terminal can communicate with the Socket JS-based server through a Websocket protocol.
Based on the methods shown in fig. 1, fig. 2 and fig. 3, correspondingly, the present embodiment further provides a storage medium, on which a computer program is stored, and the program, when executed by a processor, implements the performance testing method based on the sockss server shown in fig. 1, fig. 2 and fig. 3.
Based on such understanding, the technical solution of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.), and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the implementation scenarios of the present application.
Based on the above-mentioned methods shown in fig. 1, fig. 2 and fig. 3, the embodiments of the control terminal and the test terminal shown in fig. 4 and fig. 5, and the system shown in fig. 6, in order to achieve the above-mentioned object, the present embodiment further provides a computer device, which may specifically be a personal computer, a server, a smart phone, a tablet computer, a smart watch, or other network device, and the like, and the computer device includes a storage medium and a processor; a storage medium for storing a computer program; a processor for executing a computer program to implement the performance testing method based on the sockss server as shown in fig. 1, fig. 2 and fig. 3.
Optionally, the entity device may further include a user interface, a network interface, a camera, a Radio Frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, and the like. The user interface may include a Display screen (Display), an input unit such as a keypad (Keyboard), etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), etc.
It will be understood by those skilled in the art that the present embodiment provides a computer device structure that is not limited to the physical device, and may include more or less components, or some components in combination, or a different arrangement of components.
The storage medium may further include an operating system and a network communication module. The operating system is a program for managing the hardware of the above-mentioned entity device and the software resources to be identified, and supports the operation of the information processing program and other software and/or programs to be identified. The network communication module is used for realizing communication among components in the storage medium and communication with other hardware and software in the information processing entity device.
Through the above description of the embodiments, those skilled in the art will clearly understand that the present application can be implemented by software plus a necessary general hardware platform, and can also be implemented by hardware. By applying the technical scheme, the control terminal and the test terminal can respectively execute the performance test method based on the SockJS server to achieve unified scheduling of test tasks, the control terminal can automatically distribute the number of the test terminals according to the target concurrent number, generate HTML distribution scripts with corresponding number, and push the HTML distribution scripts to the test terminal, so that the test terminal can utilize the HTML distribution scripts to perform testing, and the test requirement based on the number of the SockJS server is met. Compared with the prior art, the system saves manpower and material resources, improves the accuracy and efficiency of the test, achieves the target test concurrency number, and improves the performance test quality of the SockJS server.
Those skilled in the art will appreciate that the figures are merely schematic representations of one preferred implementation scenario and that the blocks or flow diagrams in the figures are not necessarily required to practice the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario may be distributed in the devices in the implementation scenario according to the description of the implementation scenario, or may be located in one or more devices different from the present implementation scenario with corresponding changes. The modules of the implementation scenario may be combined into one module, or may be further split into a plurality of sub-modules.
The above application serial numbers are for description purposes only and do not represent the superiority or inferiority of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of the present application, but the present application is not limited thereto, and any variations that can be made by those skilled in the art are intended to fall within the scope of the present application.

Claims (10)

1. A performance testing method based on a SockJS server is characterized by comprising the following steps:
acquiring a target concurrency number and an HTML test script;
obtaining a test terminal quantity value according to the target concurrency number and the WebSocket protocol connection number upper limit corresponding to the browser;
distributing idle test terminals to current test resources according to the test terminal quantity value;
generating an HTML (hypertext markup language) distribution script according to the test terminal quantity value and the HTML test script, and pushing the HTML distribution script to the test terminal;
issuing a test instruction to the test terminal so that the test terminal can test by using the HTML distribution script;
and receiving the test data sent by the test terminal, and generating a test result according to the test data.
2. The method of claim 1, wherein prior to said obtaining the HTML test script, the method further comprises:
acquiring test parameters, and generating an HTML test script according to the test parameters, wherein the test parameters comprise target concurrency number, connection parameters, test duration, service data and response assertion;
generating an HTML test script according to the test parameters, wherein the generating of the HTML test script according to the test parameters comprises:
generating connection information with the same quantity as the target concurrency number according to the target concurrency number and the connection parameters;
generating a test rule according to the service data and the response assertion;
and generating an HTML test script according to the connection information, the test rule and the test duration.
3. The method of claim 2, wherein obtaining the test terminal quantity value according to the target concurrency number and the WebSocket protocol connection number upper limit corresponding to the browser comprises:
dividing the target concurrency number by the WebSocket protocol connection number upper limit corresponding to the browser to obtain a first number value;
if the first quantity value is an integer, taking the first quantity value as a test terminal quantity value;
if the first quantity value is a decimal, taking a value obtained by rounding up the first quantity value as a test terminal quantity value;
the generating of the HTML distribution script according to the test terminal quantity value and the HTML test script comprises the following steps:
according to the number value of the test terminal, dividing the connection information in the HTML test script into the number of parts which is the same as the number value of the test terminal;
reserving a test rule and a test duration in the HTML test script;
and generating HTML distribution scripts with the same quantity as the quantity value of the test terminals according to the test rules, the test duration and the segmented connection information.
4. The method according to any of claims 1-3, wherein said allocating idle test terminals to current test resources according to said test terminal quantity value comprises:
the use state of each test terminal in the test terminal resource pool is checked in sequence by adopting a polling algorithm;
sending a freezing instruction to a test terminal in an idle use state, and bringing the test terminal into a current test resource;
and stopping polling when the number of the test terminals in the current test resource is equal to the number of the test terminals.
5. The performance test method based on the SockJS server is characterized in that a test instruction is issued to the test terminal so that the test terminal performs a test by using the HTML distribution script, and comprises the following steps:
receiving an HTML (hypertext markup language) distribution script pushed by a control terminal;
driving the HTML distribution script so as to establish a connection based on SockJS with the tested server;
receiving a test starting instruction issued by the control terminal, driving the HTML distribution script to send a test request to the tested server, and receiving a request response from the tested server;
saving the log information generated by the test in the message middleware;
consuming and processing the log information stored in the message middleware to generate test data, and sending the test data to the control terminal;
and receiving a test finishing instruction or test waiting time length ending instruction issued by the control terminal, and driving the HTML distribution script to disconnect the SockJS-based connection with the tested server.
6. A control terminal, characterized in that the control terminal comprises:
the test task management module is used for acquiring the target concurrency number and the HTML test script;
the test terminal allocation module is used for obtaining a test terminal quantity value according to the target concurrency number and the WebSocket protocol connection number upper limit corresponding to the browser, and allocating an idle test terminal to the current test resource according to the test terminal quantity value;
the test script pushing module is used for generating an HTML (hypertext markup language) distribution script according to the test terminal quantity value and the HTML test script and pushing the HTML distribution script to the test terminal;
the test instruction transceiving module is used for issuing a test instruction to the test terminal so that the test terminal can perform a test by using the HTML distribution script;
and the test data storage module is used for receiving the test data sent by the test terminal and generating a test result according to the test data.
7. A test terminal, characterized in that the test terminal comprises:
the test script receiving module is used for receiving the HTML distribution script pushed by the control terminal;
the test script driving module is used for driving the HTML distribution script so as to establish a connection based on SockJS with the tested server, send a test request to the tested server, receive a request response from the tested server and disconnect the connection based on SockJS with the tested server;
the test instruction transceiving module is used for receiving a test starting instruction issued by the control terminal and receiving a test finishing instruction issued by the control terminal;
the log information processing module is used for storing the log information generated by the test in the message middleware and consuming and processing the log information stored in the message middleware to generate test data;
and the test result sending module is used for sending the test data to the control terminal.
8. A performance testing system based on a socksjs server, characterized in that the system comprises at least one control terminal according to claim 6 and at least one testing terminal according to claim 7.
9. A storage medium having a computer program stored thereon, the computer program, when being executed by a processor, realizing the steps of the method of any one of claims 1 to 5.
10. A computer arrangement comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the computer program realizes the steps of the method of any one of claims 1 to 5 when executed by the processor.
CN202010051357.8A 2020-01-17 2020-01-17 Performance test method and performance test system based on SockJS server Active CN111258902B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010051357.8A CN111258902B (en) 2020-01-17 2020-01-17 Performance test method and performance test system based on SockJS server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010051357.8A CN111258902B (en) 2020-01-17 2020-01-17 Performance test method and performance test system based on SockJS server

Publications (2)

Publication Number Publication Date
CN111258902A true CN111258902A (en) 2020-06-09
CN111258902B CN111258902B (en) 2022-07-19

Family

ID=70954241

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010051357.8A Active CN111258902B (en) 2020-01-17 2020-01-17 Performance test method and performance test system based on SockJS server

Country Status (1)

Country Link
CN (1) CN111258902B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111813687A (en) * 2020-07-20 2020-10-23 网易(杭州)网络有限公司 Test method, test device, control terminal, test equipment and storage medium
CN113590475A (en) * 2021-07-13 2021-11-02 北京快乐茄信息技术有限公司 Joint debugging test method and joint debugging test device for online development platform

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103457784A (en) * 2012-06-01 2013-12-18 腾讯科技(深圳)有限公司 Performance testing method and device
CN104461856A (en) * 2013-09-22 2015-03-25 阿里巴巴集团控股有限公司 Performance test method, device and system based on cloud computing platform
CN105279083A (en) * 2014-07-24 2016-01-27 山东厚德测控技术有限公司 Concurrency test device and test method for performance of Web server
EP3032423A1 (en) * 2014-12-09 2016-06-15 Bull S.A.S. Method and system for validating performance test scenarios
CN107341098A (en) * 2017-07-13 2017-11-10 携程旅游信息技术(上海)有限公司 Software performance testing method, platform, equipment and storage medium
CN107797917A (en) * 2016-12-28 2018-03-13 平安科技(深圳)有限公司 Performance test script generation method and device
CN107943706A (en) * 2017-12-11 2018-04-20 深圳市路畅科技股份有限公司 A kind of test system, method, apparatus and computer-readable storage medium
CN108415847A (en) * 2018-05-08 2018-08-17 平安普惠企业管理有限公司 Performance test methods, device, computer equipment and storage medium
CN108536571A (en) * 2018-04-13 2018-09-14 平安普惠企业管理有限公司 Performance test methods, device, equipment and computer readable storage medium
CN109582579A (en) * 2018-11-30 2019-04-05 腾讯音乐娱乐科技(深圳)有限公司 Applied program testing method, device, electronic equipment and storage medium
CN110175130A (en) * 2019-06-11 2019-08-27 深圳前海微众银行股份有限公司 Test method, device, equipment and the readable storage medium storing program for executing of group system performance
CN110300050A (en) * 2019-05-23 2019-10-01 中国平安人寿保险股份有限公司 Information push method, device, computer equipment and storage medium
US20190384698A1 (en) * 2018-06-14 2019-12-19 Acer Incorporated Test system

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103457784A (en) * 2012-06-01 2013-12-18 腾讯科技(深圳)有限公司 Performance testing method and device
CN104461856A (en) * 2013-09-22 2015-03-25 阿里巴巴集团控股有限公司 Performance test method, device and system based on cloud computing platform
CN105279083A (en) * 2014-07-24 2016-01-27 山东厚德测控技术有限公司 Concurrency test device and test method for performance of Web server
EP3032423A1 (en) * 2014-12-09 2016-06-15 Bull S.A.S. Method and system for validating performance test scenarios
CN107797917A (en) * 2016-12-28 2018-03-13 平安科技(深圳)有限公司 Performance test script generation method and device
CN107341098A (en) * 2017-07-13 2017-11-10 携程旅游信息技术(上海)有限公司 Software performance testing method, platform, equipment and storage medium
CN107943706A (en) * 2017-12-11 2018-04-20 深圳市路畅科技股份有限公司 A kind of test system, method, apparatus and computer-readable storage medium
CN108536571A (en) * 2018-04-13 2018-09-14 平安普惠企业管理有限公司 Performance test methods, device, equipment and computer readable storage medium
CN108415847A (en) * 2018-05-08 2018-08-17 平安普惠企业管理有限公司 Performance test methods, device, computer equipment and storage medium
US20190384698A1 (en) * 2018-06-14 2019-12-19 Acer Incorporated Test system
CN109582579A (en) * 2018-11-30 2019-04-05 腾讯音乐娱乐科技(深圳)有限公司 Applied program testing method, device, electronic equipment and storage medium
CN110300050A (en) * 2019-05-23 2019-10-01 中国平安人寿保险股份有限公司 Information push method, device, computer equipment and storage medium
CN110175130A (en) * 2019-06-11 2019-08-27 深圳前海微众银行股份有限公司 Test method, device, equipment and the readable storage medium storing program for executing of group system performance

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111813687A (en) * 2020-07-20 2020-10-23 网易(杭州)网络有限公司 Test method, test device, control terminal, test equipment and storage medium
CN113590475A (en) * 2021-07-13 2021-11-02 北京快乐茄信息技术有限公司 Joint debugging test method and joint debugging test device for online development platform

Also Published As

Publication number Publication date
CN111258902B (en) 2022-07-19

Similar Documents

Publication Publication Date Title
CN110765744A (en) Multi-person collaborative document editing method and system
CN107766509B (en) Method and device for static backup of webpage
KR20150063514A (en) Development, compiling and debugging method and device for application
CN111258902B (en) Performance test method and performance test system based on SockJS server
CN110990228A (en) Data interface monitoring method and device
CN112437047A (en) Remote server management method, system and related device
EP4113985A1 (en) Multimedia conference data processing method and apparatus, and electronic device
CN109495553A (en) A kind of webpage display control method, system and Reverse Proxy
CN109218041B (en) Request processing method and device for server system
CN108733527B (en) System, method and apparatus for testing server functionality
CN112104679B (en) Method, apparatus, device and medium for processing hypertext transfer protocol request
CN103716230A (en) Message sending method, device and server
CN111800511B (en) Synchronous login state processing method, system, equipment and readable storage medium
CN111143017B (en) Cloud operation system interaction processing method, client and cloud operation system
CN111767558A (en) Data access monitoring method, device and system
CN112689012A (en) Cross-network proxy communication method and device
CN112423024A (en) Video transcoding method and device, computer equipment and storage medium
CN110012003B (en) Cloud application screen capturing method and device
CN111190731A (en) Cluster task scheduling system based on weight
CN113127335A (en) System testing method and device
CN111477229B (en) Voice recognition request processing method and device
CN113434384B (en) Pressure testing method and device
CN113094165A (en) Method for increasing speed of loading application program at cloud end
CN110427260B (en) Host job scheduling method, device and system
CN113230661A (en) Data synchronization method and device, computer readable medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20220525

Address after: 518000 China Aviation Center 2901, No. 1018, Huafu Road, Huahang community, Huaqiang North Street, Futian District, Shenzhen, Guangdong Province

Applicant after: Shenzhen Ping An medical and Health Technology Service Co.,Ltd.

Address before: Room 12G, Area H, 666 Beijing East Road, Huangpu District, Shanghai 200001

Applicant before: PING AN MEDICAL AND HEALTHCARE MANAGEMENT Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant