CN107688538B - Script execution method and device and computing equipment - Google Patents

Script execution method and device and computing equipment Download PDF

Info

Publication number
CN107688538B
CN107688538B CN201710769075.XA CN201710769075A CN107688538B CN 107688538 B CN107688538 B CN 107688538B CN 201710769075 A CN201710769075 A CN 201710769075A CN 107688538 B CN107688538 B CN 107688538B
Authority
CN
China
Prior art keywords
script
protocol
unit
identifier
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710769075.XA
Other languages
Chinese (zh)
Other versions
CN107688538A (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.)
Beijing Ruixiang Technology Co ltd
Original Assignee
Sichuan Ruixiang Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Ruixiang Technology Co ltd filed Critical Sichuan Ruixiang Technology Co ltd
Priority to CN201710769075.XA priority Critical patent/CN107688538B/en
Publication of CN107688538A publication Critical patent/CN107688538A/en
Application granted granted Critical
Publication of CN107688538B publication Critical patent/CN107688538B/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 script execution method, a device and a computing device, wherein the computing device is respectively in communication connection with a scheduling server and a file server, a plurality of script files are stored in the file server, each script file is associated with a unique script identifier and comprises a plurality of script units, and the method comprises the following steps: receiving a script execution instruction issued by a scheduling server, wherein the script execution instruction comprises a script identifier of a script to be executed; acquiring a script file corresponding to the script identifier from a file server; performing serialization processing on the script file; analyzing the serialized script file to obtain a script example, wherein the script example comprises a plurality of script unit examples corresponding to the script units; sequencing each script unit to obtain the execution sequence of the script unit; and for each script unit, executing the corresponding script unit instance by using the corresponding protocol according to the execution sequence of each script unit and the protocol identifier and the port identifier of the script unit.

Description

Script execution method and device and computing equipment
Technical Field
The invention relates to the field of software testing, in particular to a script execution method and device and computing equipment.
Background
At present, various software on the internet market are in endless, and different service logics and business purposes cause that when one software transmits data and messages, different types of network protocols are used, including a relatively common HTTP/HTTPs protocol, a WebSocket protocol, an MQTT protocol and the like. Therefore, when the software is subjected to the stress test, mixed sending of various protocols is involved in consideration of requirements of clients on different types of protocols, and when the multi-protocol mixed sending phenomenon occurs, corresponding stress tests are required to be respectively performed on different protocols.
However, existing stress test schemes typically use the HTTP protocol for request transmission when executing test scripts, and ignore other network protocols. With the development and innovation of the technology, more new protocols are used as a pressure test tool to send client requests, and in order to adapt to a test scenario of multi-protocol mixed transmission and improve rapid function iteration under the newly-added protocols, a new script execution scheme is needed to improve the processing procedure.
Disclosure of Invention
To this end, the present invention provides a solution for script execution in an attempt to solve or at least alleviate the above-existing problems.
According to an aspect of the present invention, there is provided a script execution method, adapted to be executed in a computing device, the computing device being respectively in communication connection with a scheduling server and a file server, the file server storing therein a plurality of script files, each script file being associated with a unique script identifier and including a plurality of script units, each script unit having corresponding attribute information, the attribute information including a protocol identifier and a port identifier, the method including the steps of: firstly, receiving a script execution instruction issued by a scheduling server, wherein the script execution instruction comprises a script identifier of a script to be executed; acquiring a script file corresponding to the script identifier from a file server; performing serialization processing on the script file; analyzing the serialized script file to obtain a script example, wherein the script example comprises a plurality of script unit examples corresponding to the script units; sequencing each script unit to obtain the execution sequence of the script unit; and for each script unit, executing the corresponding script unit instance by using the corresponding protocol according to the execution sequence of each script unit and the protocol identifier and the port identifier of the script unit.
Optionally, in the script execution method according to the present invention, the step of parsing the serialized script file to obtain the script instance includes: analyzing each script unit included in the serialized script file respectively; instantiating the script unit to generate a corresponding script unit instance according to the protocol identifier and the port identifier of each script unit; the generated script unit instances are combined to form a script instance corresponding to the script file.
Optionally, in the script execution method according to the present invention, the attribute information further includes an index identifier and a reference identifier, and the step of performing a sorting process on each script unit to obtain an execution order of the script unit includes: sequencing each script unit once according to the sequence of the index identification from small to large; and performing secondary sequencing on the script units with the same index identification according to the sequence of the reference identifications from small to large so as to obtain the execution sequence of the script units.
Optionally, in the script execution method according to the present invention, the step of executing the corresponding script unit instance by using the corresponding protocol according to the protocol identifier and the port identifier of the script unit, where the computing device is further communicatively connected to a timeout control server, includes: generating a corresponding request by using a corresponding protocol according to the protocol identifier and the port identifier of the script unit; sending the request to an overtime control server to indicate the overtime control server to return to an overtime state after a preset first time interval; sending the request to a corresponding script unit instance, sending the request through the script unit instance to acquire data responding to the request, and sending a timeout control instruction for canceling the request to a timeout control service; and if the overtime state is received, after a preset second time interval, the request is sent to the overtime control server and the corresponding script unit instance again.
Optionally, in the script execution method according to the present invention, the protocol includes one or more of an HTTP protocol, an HTTPs protocol, a WebSocket protocol, a Socket protocol, an MQTT protocol, a TCP protocol, and a UDP protocol.
According to another aspect of the present invention, a script executing apparatus is provided, which is adapted to reside in a computing device, the computing device is respectively in communication connection with a scheduling server and a file server, the file server stores a plurality of script files, each script file is associated with a unique script identifier and includes a plurality of script units, each script unit has corresponding attribute information, and the attribute information includes a protocol identifier and a port identifier. The receiving module is suitable for receiving a script execution instruction issued by the scheduling server, and the script execution instruction comprises a script identifier of a script to be executed; the acquisition module is suitable for acquiring a script file corresponding to the script identifier from the file server; the serialization module is suitable for executing serialization processing on the script file; the analysis module is suitable for analyzing the serialized script file to obtain a script example, and the script example comprises a plurality of script unit examples corresponding to the script units; the sequencing module is suitable for sequencing all script units to acquire the execution sequence of the script units; the execution module is suitable for executing the corresponding script unit instance by using the corresponding protocol according to the protocol identifier and the port identifier of the script unit according to the execution sequence of the script units for each script unit.
According to still another aspect of the present invention, there is provided a computing device including the script execution apparatus according to the present invention.
According to yet another aspect of the invention, there is provided a computing device comprising one or more processors, memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for performing a script execution method according to the invention.
According to yet another aspect of the present invention, there is also provided a computer readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a computing device, cause the computing device to perform a script execution method according to the present invention.
According to the technical scheme of script execution, the obtained script file is firstly subjected to serialization processing and then is analyzed to obtain a script example, the script example comprises a plurality of script unit examples corresponding to the script units, all the script units are subjected to sequencing processing to obtain the execution sequence of the script units, and for each script unit, the corresponding script unit example is executed by using a corresponding protocol according to the execution sequence of all the script units and the protocol identification and the port identification of the script unit. In the above scheme, when the serialized script file is analyzed, each script unit included in the script file is analyzed respectively, and then instantiated according to the protocol identifier and the port identifier of each script unit to generate a corresponding script unit instance, so that the corresponding script unit instance is executed by using the protocol corresponding to the protocol and the port identifier of the script unit in the following, so that the pressure test is performed on the client related to multi-protocol mixing, more test scenarios can be adapted, dynamic expansion can be performed when a new protocol appears, function iteration is realized quickly, the proposal speed of a newly-added protocol solution is greatly improved, further, when the script unit instance is executed, the execution time is controlled by a timeout control unit, and the situation that the script execution falls into a non-response state or keeps the execution state all the time due to long-time non-response request is avoided, wasting system resources. In addition, the execution sequence of each script unit is generated by sequencing the index identifier and the reference identifier of the script unit twice, so that the relevance and the hierarchical relation among the script units are ensured.
Drawings
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which are indicative of various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to be within the scope of the claimed subject matter. The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description read in conjunction with the accompanying drawings. Throughout this disclosure, like reference numerals generally refer to like parts or elements.
FIG. 1 shows a schematic diagram of a script execution system 100 according to one embodiment of the invention;
FIG. 2 illustrates a block diagram of a computing device 200, according to an embodiment of the invention;
FIG. 3 illustrates a flow diagram of a script execution method 300 according to one embodiment of the invention;
FIG. 4 shows a schematic diagram of a script execution system 400 according to yet another embodiment of the invention; and
fig. 5 shows a schematic diagram of a script execution apparatus 500 according to one embodiment of the invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
FIG. 1 shows a schematic diagram of a script execution system 100, according to one embodiment of the invention. It should be noted that the script execution system 100 in FIG. 1 is merely exemplary, and in a specific practical situation, there may be different numbers of computing devices, scheduling servers, and file servers in the script execution system 100, and the present invention does not limit the number of computing devices, scheduling servers, and file servers included in the script execution system 100. As shown in FIG. 1, the script execution system 100 includes a computing device 200, a scheduling server 600, and a file server 700. Wherein, the computing device 200 is respectively connected with the scheduling server 600 and the file server 700 in a communication way, and the computing device 200 may be a PC, but is not limited thereto. The file server 700 stores a plurality of script files, each script file is associated with a unique script identifier and includes a plurality of script units, each script unit has corresponding attribute information, and the attribute information includes a protocol identifier and a port identifier. Specifically, the scheduling server 600 issues a script execution instruction to the computing device 200, where the script execution instruction includes a script identifier of a script to be executed, and after receiving the script execution instruction issued by the scheduling server 600, the computing device 200 obtains a script file corresponding to the script identifier from the file server 700, performs serialization processing on the script file, parses the serialized script file to obtain a script instance, where the script instance includes multiple script unit instances corresponding to script units, performs serialization processing on each script unit to obtain an execution order of the script unit, and for each script unit, executes, according to the execution order of each script unit, a corresponding script unit instance according to a protocol identifier and a port identifier of the script unit by using a corresponding protocol.
FIG. 2 is a block diagram of a computing device 200, according to one embodiment of the invention. In a basic configuration 202, computing device 200 typically includes system memory 206 and one or more processors 204. A memory bus 208 may be used for communication between the processor 204 and the system memory 206.
Depending on the desired configuration, the processor 204 may be any type of processing, including but not limited to: a microprocessor (μ P), a microcontroller (μ C), a Digital Signal Processor (DSP), or any combination thereof. The processor 204 may include one or more levels of cache, such as a level one cache 210 and a level two cache 212, a processor core 214, and registers 216. Example processor cores 214 may include Arithmetic Logic Units (ALUs), Floating Point Units (FPUs), digital signal processing cores (DSP cores), or any combination thereof. The example memory controller 218 may be used with the processor 204, or in some implementations the memory controller 218 may be an internal part of the processor 204.
Depending on the desired configuration, system memory 206 may be any type of memory, including but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. System memory 206 may include an operating system 220, one or more programs 222, and program data 224. In some implementations, the program 222 can be arranged to execute instructions on the operating system with the program data 224 by the one or more processors 204.
Computing device 200 may also include an interface bus 240 that facilitates communication from various interface devices (e.g., output devices 242, peripheral interfaces 244, and communication devices 246) to the basic configuration 202 via the bus/interface controller 230. The example output device 242 includes a graphics processing unit 248 and an audio processing unit 250. They may be configured to facilitate communication with various external devices, such as a display or speakers, via one or more a/V ports 252. Example peripheral interfaces 244 can include a serial interface controller 254 and a parallel interface controller 256, which can be configured to facilitate communications with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I/O ports 258. An example communication device 246 may include a network controller 260, which may be arranged to facilitate communications with one or more other computing devices 262 over a network communication link via one or more communication ports 264.
A network communication link may be one example of a communication medium. Communication media may typically be embodied by computer readable instructions, data structures, program modules, and may include any information delivery media, such as carrier waves or other transport mechanisms, in a modulated data signal. A "modulated data signal" may be a signal that has one or more of its data set or its changes made in such a manner as to encode information in the signal. By way of non-limiting example, communication media may include wired media such as a wired network or private-wired network, and various wireless media such as acoustic, Radio Frequency (RF), microwave, Infrared (IR), or other wireless media. The term computer readable media as used herein may include both storage media and communication media.
Computing device 200 may be implemented as a server, such as a file server, a database server, an application server, a WEB server, etc., or as part of a small-form factor portable (or mobile) electronic device, such as a cellular telephone, a Personal Digital Assistant (PDA), a personal media player device, a wireless WEB-browsing device, a personal headset device, an application-specific device, or a hybrid device that include any of the above functions. Computing device 200 may also be implemented as a personal computer including both desktop and notebook computer configurations. In some embodiments, the computing device 200 is configured to perform a script execution method 300 in accordance with the present invention. The program 222 includes a script execution apparatus 500 according to the present invention.
FIG. 3 shows a flow diagram of a script execution method 300 according to one embodiment of the invention. The script execution method 300 is suitable for execution in a computing device, such as the computing device 200 shown in FIG. 2. As shown in fig. 3, the method 300 begins at step S310. In step S310, a script execution instruction issued by the scheduling server 600 is received, where the script execution instruction includes a script identifier of a script to be executed. According to an embodiment of the present invention, the script identifier of the script to be executed included in the script execution instruction issued by the scheduling server 600 is S1.
Subsequently, step S320 is executed to obtain the script file corresponding to the script identifier from the file server 700. According to an embodiment of the present invention, 100 script files, A1, a2, A3, … …, a99 and a100, are stored in the file server 700, each script file is associated with a unique script identifier, which is S1, S2, S3, … …, S99 and S100 in sequence, and each script file includes a plurality of script units, and each script unit has corresponding attribute information, and the attribute information includes a protocol identifier and a port identifier. In this embodiment, the script file corresponding to the script identifier S1 is obtained as a1, and an example of the script file a1 is as follows:
< http ranging config name ═ transaction _1 ═ id ═ 200 ═ pid ═ 2 ═ index ═ 1 ═ gon ═ false >
<clazz>HttpTransactionConfig</clazz>
<configs>
< http pageconfig name ═ page _1 ═ id ═ 201 ═ pid ═ 200 ═ index ═ 1 ═ goon ═ false ═ mainRequestId ═ 202 >
<clazz>HttpPageConfig</clazz>
<configs/>
<exeArea>2</exeArea>
<domain>10.128.106.20</domain>
<port>8081</port>
<protocol>http</protocol>
<path>/</path>
<method>GET</method>
<fileArgConfigs/>
……
</HttpTransactionConfig>
<SocketConnectConfig name="socket connect_1"id="18"pid="46"index="0"goon="false">
<clazz>SocketConnectConfig</clazz>
<configs/>
<exeArea>2</exeArea>
<protocol>tcp</protocol>
<domain>10.128.106.20</domain>
<port>8088</port>
……
</SocketConnectConfig>
For script file a1, there are 3 script units, and as can be seen from script parameters "name" and "id", the names of the 3 script units are "transaction _1", "page _1", and "socket connect _1", unit identifiers are 200, 201, and 18 in sequence, and the 3 script units are respectively denoted as B11, B12, and B13. For script units B11 and B12, as can be seen from the related "< protocol > HTTP </protocol" and "< port >8081 </port" statements, the protocol identifiers of script units B11 and B12 are HTTP, the port identifier is 8081, which indicates that the protocol corresponding to script units B11 and B12 is HTTP, and for script unit B13, the protocol identifier of script unit B13 is TCP, the port identifier is 8088, which indicates that the protocol corresponding to script unit B13 is TCP. It should be noted that the structure of the script file is fixed, except for the case that the protocol identifier is http, when the protocol corresponding to the other protocol identifier is extended, a script unit is added under "configurations" under the script parameter "http and script configuration", and by adopting a tagged script format, a new type of script content is conveniently extended.
Next, step S330 is executed to perform a serialization process on the script file. According to one embodiment of the invention, script file A1 is serialized to generate a hash structure for subsequent execution of the script to find the corresponding executable instance. The present invention is not limited to the above specific algorithms for serialization processing, and those algorithms for implementing corresponding lookup and associated storage are easily conceivable for those skilled in the art who understand the scheme of the present invention and are also within the protection scope of the present invention, and are not described herein again.
In step S340, the serialized script file is parsed to obtain a script instance, where the script instance includes multiple script unit instances corresponding to the script units. According to an embodiment of the present invention, the serialized script file may be parsed to obtain the script instance in the following manner. Firstly, each script unit included in the serialized script file is analyzed respectively, then the script unit is instantiated according to the protocol identifier and the port identifier of each script unit to generate a corresponding script unit example, and finally the generated script unit examples are combined to form a script example corresponding to the script file. In this embodiment, script units B11, B12, and B13 included in serialized script file a1 are parsed, HTTP and port identification 8081 are identified according to protocols of script units B11 and B12, these 2 script units are instantiated according to corresponding protocols, that is, HTTP protocols, to generate corresponding script unit instances, resulting in that script unit instances corresponding to script units B11 and B12 are C11 and C12, respectively, and according to protocol identification TCP and port identification 8088 of script unit B13, script unit B13 is instantiated according to corresponding protocols, that is, TCP protocol, to generate corresponding script unit instance C13, and finally, the generated script unit instances C11, C12, and C13 are combined to form a script instance corresponding to script file a1, and this script instance is denoted as D1.
After the parsing process of the script file is completed, the process proceeds to step S350, and the script units are sorted to obtain the execution order of the script units. According to an embodiment of the present invention, the attribute information further includes an index identifier and a reference identifier, and the script units may be sorted according to the following method to obtain the execution order of the script units. Firstly, sequencing all script units once according to the sequence of the index identifications from small to large, and then sequencing all script units with the same index identifications twice according to the sequence of the reference identifications from small to large to obtain the execution sequence of the script units. In this embodiment, the script parameters "index" and "pid" respectively represent index identifiers and reference identifiers, and it is known from the content of the script file a1 that the index identifiers of the script units B11, B12 and B13 are respectively 1, 1 and 0, the script units B11, B12 and B13 are first sorted in the order of the index identifiers from small to large, at this time, the execution order of the 3 script units is first of the script unit B1, the execution order of the script units B12 and B13 is the same, and then the script units B11 and B12 having the same index identifier are sorted in the second order of the reference identifiers, the reference identifiers of the script units B11 and B12 are respectively 2 and 200, it is known that the execution order of the 2 script units is sequentially B11 and B12, and the execution order of the finally available script units B11, B12 and B13 is sequentially B5, B11 and B5857324.
After the execution sequence of each script unit of the script file is determined, step S360 is executed, and for each script unit, according to the execution sequence of each script unit, a corresponding protocol is used to execute a corresponding script unit instance according to the protocol identifier and the port identifier of the script unit. The protocol comprises one or more of an HTTP protocol, an HTTPS protocol, a WebSocket protocol, a Socket protocol, an MQTT protocol, a TCP protocol and a UDP protocol. FIG. 4 shows a schematic diagram of a script execution system 400 according to yet another embodiment of the invention. As shown in fig. 4, the script execution system 400 includes a computing device 200, a scheduling server 600, a file server 700, and a timeout control server 800. Wherein, the computing device 200 is communicatively connected to the schedule server 600 and the file server 700, and also to the timeout control server 800, for each script unit to be executed, the corresponding script unit instance can be executed by the following method. Firstly, according to the protocol identification and the port identification of the script unit, a corresponding request is generated by using a corresponding protocol, and then the request is sent to the timeout. The control server 800 is configured to instruct the timeout control server 800 to return to the timeout state after a preset first time interval, send the request to the corresponding script unit instance, send the request through the script unit instance to obtain data responding to the request, send a timeout control instruction for canceling the request to the timeout control service, and if the timeout state is received, send the request to the timeout control server 800 and the corresponding script unit instance again after a preset second time interval. For convenience of description, the script unit instance C11 corresponding to the execution script unit B11 is taken as an example for illustration. In this embodiment, if the protocol id and the port id of the script unit B11 are HTTP and 8081, respectively, it is known that the protocol corresponding to the script unit is HTTP protocol, and thus an HTTP request corresponding to the script unit B11 is generated by using HTTP protocol, and the type of the HTTP request is GET type, as is known from the "< method > GET </method >" statement of the script file a 1. Next, the HTTP request is sent to the timeout control server 800, and no data processing is performed in the timeout control server 800, but a timeout state is returned after the first time interval to prompt the script to execute timeout, and the timeout state is returned to the preset callback function. At the same time as sending the HTTP request to the timeout control server 800, the HTTP request is also sent to the corresponding script unit instance C11, where the script unit instance C11 is understood to be a client for sending HTTP requests. And further sending the HTTP request through the client to acquire data responding to the HTTP request.
In practice, the computing device 200 is further communicatively connected to a test server (not shown in fig. 4) configured to receive a request corresponding to a protocol, such as the HTTP request, respond to the request to generate a test result, and return the test result to the computing device 200 as data of the response request, more specifically, to a client sending the request, and then the test result is fed back to the callback function by the client, so that the callback function sends a timeout control instruction to cancel the request to the timeout control server 800. Therefore, after the script unit instance C11 serving as the client receives the data of the HTTP request sent by the test server in response to the test server, the cancel command is sent to the timeout control server 800 based on the callback function, the timeout control corresponding to the HTTP request is cancelled, the pressure of the timeout control server 800 is reduced, and the waste of resources is avoided. It should be noted that, if the timeout state is received, after the second time interval, the request is sent to the timeout control server 800 and the corresponding script unit instance again, on one hand, the timeout control server 800 is used to monitor the timeout state again, and on the other hand, the corresponding script unit instance is instructed to continue to initiate the request to obtain the response data, so as to re-execute the script. Of course, if the number of times of receiving the timeout state is too large, the request is not sent to the timeout control server 800 and the corresponding script unit instance again, but the script error is recorded for later debugging to solve the problem, so that unnecessary system resource and time cost consumption caused by sending a large number of useless requests and executing wrong scripts is prevented.
Fig. 5 shows a schematic diagram of a script execution apparatus 500 according to one embodiment of the invention. As shown in fig. 4, the script execution apparatus 500 includes a receiving module 510, an obtaining module 520, a serialization module 530, a parsing module 540, a sorting module 550, and an executing module 560.
The receiving module 510 is adapted to receive a script execution instruction issued by the scheduling server 600, where the script execution instruction includes a script identifier of a script to be executed. For details of the receiving module 510 to perform the above operations, reference may be made to step S310 in the method 300, which is not described herein again.
The obtaining module 520 is connected to the receiving module 510 and is adapted to obtain a script file corresponding to a script identifier from the file server 700, where the script file is associated with a unique script identifier and includes a plurality of script units, each script unit has corresponding attribute information, and the attribute information includes a protocol identifier and a port identifier. For details of the obtaining module 520 to perform the above operations, reference may be made to step S320 in the method 300, which is not described herein again.
The serialization module 530 is coupled to the acquisition module 520 and is adapted to perform serialization processing on the script file. For details of the operation performed by the serialization module 530, reference may be made to step S330 in the method 300, which is not described herein again.
The parsing module 540 and the serialization module 530 are adapted to parse the serialized script file to obtain a script instance, where the script instance includes multiple script unit instances corresponding to the script units. The parsing module 540 is further adapted to parse each script unit included in the serialized script file respectively; instantiating the script unit to generate a corresponding script unit instance according to the protocol identifier and the port identifier of each script unit; the generated script unit instances are combined to form a script instance corresponding to the script file. For details of the analysis module 540 to perform the above operations, reference may be made to step S340 in the method 300, which is not described herein again.
The sequencing module 550 is connected to the serialization module 530 and is adapted to sequence the script units to obtain the execution order of the script units. The attribute information further includes an index identifier and a reference identifier, and the sorting module 550 is further adapted to sort the script units once according to the order of the index identifiers from small to large; and performing secondary sequencing on the script units with the same index identification according to the sequence of the reference identifications from small to large so as to obtain the execution sequence of the script units. For details of the sorting module 550 to perform the above operations, reference may be made to step S350 in the method 300, which is not described herein again.
The execution module 560, connected to the parsing module 540 and the sorting module 550, is adapted to execute, for each script unit, a corresponding script unit instance according to the protocol identifier and the port identifier of the script unit according to the execution order of the script unit. The protocol comprises one or more of an HTTP protocol, an HTTPS protocol, a WebSocket protocol, a Socket protocol, an MQTT protocol, a TCP protocol and a UDP protocol. The computing device 200 is further communicatively connected to the timeout control server 800, and the execution module 560 is further adapted to generate a corresponding request using a corresponding protocol according to the protocol identifier and the port identifier of the script unit; sending the request to the timeout control server 800 to instruct the timeout control server 800 to return to the timeout state after a preset first time interval; sending the request to a corresponding script unit instance, sending the request through the script unit instance to acquire data responding to the request, and then sending a timeout control instruction for canceling the request to a timeout control service; when the timeout condition is received, the request is re-sent to the timeout control server 800 and the corresponding script unit instance after a preset second time interval. For details of the execution module 560 to execute the above operations, reference may be made to step S360 in the method 300, which is not described herein again.
In the existing scheme for carrying out pressure test on software related to mixed transmission of multiple protocols, when a script is executed, a request is generally sent by using an HTTP (hyper text transport protocol), other network protocols are omitted, and the script format is inconvenient for expanding script units related to the newly added protocols. According to the technical scheme of script execution, the obtained script file is firstly subjected to serialization processing and then is analyzed to obtain the script example, the script example comprises a plurality of script unit examples corresponding to the script units, all the script units are subjected to sequencing processing to obtain the execution sequence of the script units, and for each script unit, the corresponding script unit example is executed by using the corresponding protocol according to the execution sequence of all the script units and the protocol identification and the port identification of the script unit. In the above scheme, when the serialized script file is analyzed, each script unit included in the script file is analyzed respectively, and then instantiated according to the protocol identifier and the port identifier of each script unit to generate a corresponding script unit instance, so that the corresponding script unit instance is executed by using the protocol corresponding to the protocol and the port identifier of the script unit in the following, so that the pressure test is performed on the client related to multi-protocol mixing, more test scenarios can be adapted, dynamic expansion can be performed when a new protocol appears, function iteration is realized quickly, the proposal speed of a newly-added protocol solution is greatly improved, further, when the script unit instance is executed, the execution time is controlled by a timeout control unit, and the situation that the script execution falls into a non-response state or keeps the execution state all the time due to long-time non-response request is avoided, wasting system resources. In addition, the execution sequence of each script unit is generated by sequencing the index identifier and the reference identifier of the script unit twice, so that the relevance and the hierarchical relation among the script units are ensured.
B8. The apparatus of B6 or 7, the attribute information further comprising an index identification and a reference identification, the ranking module further adapted to:
sequencing each script unit once according to the sequence of the index identification from small to large;
and performing secondary sequencing on the script units with the same index identification according to the sequence of the reference identifications from small to large so as to obtain the execution sequence of the script units.
B9. The apparatus of any of B6-8, the computing device further communicatively connected to a timeout control server, the execution module further adapted to:
generating a corresponding request by using a corresponding protocol according to the protocol identifier and the port identifier of the script unit;
sending the request to the overtime control server to indicate the overtime control server to return to an overtime state after a preset first time interval;
sending the request to a corresponding script unit instance, sending the request through the script unit instance to acquire data responding to the request, and then sending a timeout control instruction for canceling the request to the timeout control service;
and when the overtime state is received, after a preset second time interval, the request is sent to the overtime control server and the corresponding script unit instance again.
B10. The apparatus of any of B6-9, the protocol comprising one or more of an HTTP protocol, an HTTPS protocol, a WebSocket protocol, a Socket protocol, an MQTT protocol, a TCP protocol, and a UDP protocol.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules or units or groups of devices in the examples disclosed herein may be arranged in a device as described in this embodiment, or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into multiple sub-modules.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. Modules or units or groups in embodiments may be combined into one module or unit or group and may furthermore be divided into sub-modules or sub-units or sub-groups. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
Furthermore, some of the described embodiments are described herein as a method or combination of method elements that can be performed by a processor of a computer system or by other means of performing the described functions. A processor having the necessary instructions for carrying out the method or method elements thus forms a means for carrying out the method or method elements. Further, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is used to implement the functions performed by the elements for the purpose of carrying out the invention.
The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as floppy diskettes, CD-ROMs, hard drives, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.
In the case of program code execution on programmable computers, the computing device will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to execute the script execution method of the present invention according to instructions in the program code stored in the memory.
By way of example, and not limitation, computer readable media may comprise computer storage media and communication media. Computer-readable media includes both computer storage media and communication media. Computer storage media store information such as computer readable instructions, data structures, program modules or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of computer readable media.
As used herein, unless otherwise specified the use of the ordinal adjectives "first", "second", "third", etc., to describe a common object, merely indicate that different instances of like objects are being referred to, and are not intended to imply that the objects so described must be in a given sequence, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of this description, will appreciate that other embodiments can be devised which do not depart from the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. The present invention has been disclosed in an illustrative rather than a restrictive sense, and the scope of the present invention is defined by the appended claims.

Claims (8)

1. A script execution method, adapted to be executed in a computing device, the computing device being respectively in communication connection with a scheduling server and a file server, the file server storing therein a plurality of script files, each script file being associated with a unique script identifier and including a plurality of script units, each script unit having corresponding attribute information, the attribute information including a protocol identifier, a port identifier, an index identifier, and a reference identifier, the method comprising:
receiving a script execution instruction issued by the scheduling server, wherein the script execution instruction comprises a script identifier of a script to be executed;
acquiring a script file corresponding to the script identifier from the file server;
performing serialization processing on the script file;
analyzing the serialized script file to obtain a script instance, wherein the script instance comprises a plurality of script unit instances corresponding to script units;
the method for sequencing the script units to acquire the execution order of the script units comprises the following steps:
sequencing each script unit once according to the sequence of the index identification from small to large;
performing secondary sequencing on all script units with the same index identification according to the sequence of the reference identification from small to large so as to obtain the execution sequence of the script units;
for each script unit, according to the execution sequence of each script unit, executing a corresponding script unit instance by using a corresponding protocol according to the protocol identifier and the port identifier of the script unit; the step of parsing the serialized script file to obtain a script instance includes:
analyzing each script unit included in the serialized script file respectively;
instantiating the script unit to generate a corresponding script unit instance according to the protocol identifier and the port identifier of each script unit;
and combining the generated script unit instances to form a script instance corresponding to the script file.
2. The method of claim 1, the computing device further communicatively coupled to a timeout control server, the executing the respective script unit instance with the respective protocol based on the protocol identification and the port identification of the script unit comprising:
generating a corresponding request by using a corresponding protocol according to the protocol identifier and the port identifier of the script unit;
sending the request to the overtime control server to indicate the overtime control server to return to an overtime state after a preset first time interval;
sending the request to a corresponding script unit instance, sending the request through the script unit instance to acquire data responding to the request, and sending a timeout control instruction for canceling the request to the timeout control service;
and if the overtime state is received, after a preset second time interval, the request is sent to the overtime control server and the corresponding script unit instance again.
3. The method of claim 1 or 2, the protocol comprising one or more of an HTTP protocol, an HTTPs protocol, a WebSocket protocol, a Socket protocol, an MQTT protocol, a TCP protocol, and a UDP protocol.
4. A script execution apparatus adapted to reside in a computing device, the computing device being respectively in communication connection with a scheduling server and a file server, the file server storing therein a plurality of script files, each script file being associated with a unique script identifier and including a plurality of script units, each script unit having corresponding attribute information, the attribute information including a protocol identifier, a port identifier, an index identifier, and a reference identifier, the apparatus comprising:
the receiving module is suitable for receiving a script execution instruction issued by the scheduling server, and the script execution instruction comprises a script identifier of a script to be executed;
the acquisition module is suitable for acquiring the script file corresponding to the script identifier from the file server;
the serialization module is suitable for executing serialization processing on the script file;
the analysis module is suitable for analyzing the serialized script file to obtain a script example, the script example comprises a plurality of script unit examples corresponding to the script units, and the analysis module comprises:
analyzing each script unit included in the serialized script file respectively;
instantiating the script unit to generate a corresponding script unit instance according to the protocol identifier and the port identifier of each script unit;
combining the generated script unit instances to form a script instance corresponding to the script file;
the sequencing module is suitable for sequencing each script unit to acquire the execution sequence of the script unit, and comprises:
sequencing each script unit once according to the sequence of the index identification from small to large;
performing secondary sequencing on all script units with the same index identification according to the sequence of the reference identification from small to large so as to obtain the execution sequence of the script units;
and the execution module is suitable for executing the corresponding script unit instance by using the corresponding protocol according to the execution sequence of each script unit and the protocol identifier and the port identifier of the script unit.
5. The apparatus of claim 4, the computing device further communicatively coupled to a timeout control server, the execution module further adapted to:
generating a corresponding request by using a corresponding protocol according to the protocol identifier and the port identifier of the script unit;
sending the request to the overtime control server to indicate the overtime control server to return to an overtime state after a preset first time interval;
sending the request to a corresponding script unit instance, sending the request through the script unit instance to acquire data responding to the request, and then sending a timeout control instruction for canceling the request to the timeout control service;
and when the overtime state is received, after a preset second time interval, the request is sent to the overtime control server and the corresponding script unit instance again.
6. The apparatus of claim 4 or 5, the protocol comprising one or more of an HTTP protocol, an HTTPS protocol, a WebSocket protocol, a Socket protocol, an MQTT protocol, a TCP protocol, and a UDP protocol.
7. A computing device, comprising:
one or more processors;
a memory; and
one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs comprising instructions for performing any of the methods of claims 1-3.
8. A computer readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a computing device, cause the computing device to perform any of the methods of claims 1-3.
CN201710769075.XA 2017-08-31 2017-08-31 Script execution method and device and computing equipment Active CN107688538B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710769075.XA CN107688538B (en) 2017-08-31 2017-08-31 Script execution method and device and computing equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710769075.XA CN107688538B (en) 2017-08-31 2017-08-31 Script execution method and device and computing equipment

Publications (2)

Publication Number Publication Date
CN107688538A CN107688538A (en) 2018-02-13
CN107688538B true CN107688538B (en) 2020-11-06

Family

ID=61155828

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710769075.XA Active CN107688538B (en) 2017-08-31 2017-08-31 Script execution method and device and computing equipment

Country Status (1)

Country Link
CN (1) CN107688538B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108683521B (en) * 2018-04-20 2021-01-15 厦门爱陆通通信科技有限公司 Equipment configuration management method based on serial link
CN109117246B (en) * 2018-07-06 2022-05-10 网宿科技股份有限公司 Server and command execution method and control method thereof
CN109697116A (en) * 2018-08-20 2019-04-30 平安普惠企业管理有限公司 Calamity is for drilling method, device, equipment and readable storage medium storing program for executing
CN111294250B (en) * 2018-12-07 2023-05-26 三六零科技集团有限公司 Pressure testing method, device and system
CN111931200B (en) * 2020-07-13 2024-02-23 车智互联(北京)科技有限公司 Data serialization method, mobile terminal and readable storage medium
CN112416448A (en) * 2020-12-08 2021-02-26 北京中亦安图科技股份有限公司 Operating system information acquisition method and device
CN112565443A (en) * 2020-12-08 2021-03-26 中煤航测遥感集团有限公司 Internet of things data analysis method, device, equipment and storage medium
CN113901365A (en) * 2021-05-29 2022-01-07 长沙市到家悠享家政服务有限公司 Performance pressure measurement platform and method, electronic equipment and readable medium
CN114691238A (en) * 2022-03-30 2022-07-01 阿波罗智联(北京)科技有限公司 Script file execution method, device, equipment, storage medium and program product

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101944033A (en) * 2009-07-09 2011-01-12 中兴通讯股份有限公司 Device and method for dynamically supporting multiple protocols in embedded system
CN105279090A (en) * 2015-11-17 2016-01-27 中国建设银行股份有限公司 Test script generating method and test script generating device applied in financial field

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7747782B2 (en) * 2000-04-26 2010-06-29 Novarra, Inc. System and method for providing and displaying information content

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101944033A (en) * 2009-07-09 2011-01-12 中兴通讯股份有限公司 Device and method for dynamically supporting multiple protocols in embedded system
CN105279090A (en) * 2015-11-17 2016-01-27 中国建设银行股份有限公司 Test script generating method and test script generating device applied in financial field

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
tsung--开源多协议分布式压力测试工具;sdyy321;《CSDN: https://blog.csdn.net/sdyy321/article/details/8863892》;20130428;第1-4页 *

Also Published As

Publication number Publication date
CN107688538A (en) 2018-02-13

Similar Documents

Publication Publication Date Title
CN107688538B (en) Script execution method and device and computing equipment
JP6912469B2 (en) Access request conversion method and device
CN105335293B (en) A kind of automatization test system and method based on interface concurrent
CN107133180B (en) Dynamic page testing method, testing device and storage medium
US7721262B2 (en) System, methods and apparatus for markup language debugging
US20100332968A1 (en) Generic Declaration of Bindings Between Events and Event Handlers Regardless of Runtime Structure
CN109831466B (en) Micro-service business processing method and nginx server
US20150082286A1 (en) Real-time code instrumentation
US11726800B2 (en) Remote component loader
US20190278590A1 (en) Automated generation of service definitions for message queue application clients
CN106844040B (en) Job submitting method, system and server
CN111177664B (en) Watermark information adding method, server and system
CN112565443A (en) Internet of things data analysis method, device, equipment and storage medium
CN111026634A (en) Interface automation test system, method, device and storage medium
CN108900627B (en) Network request method, terminal device and storage medium
CN112699321A (en) Page loading method, computing equipment and storage medium
US20180275957A1 (en) Assistive technology for code generation using voice and virtual reality
CN106034113A (en) Data processing method and data processing device
JP7409197B2 (en) Elaboration of repair patterns for static analysis violations in software programs
CN112732468B (en) Data processing method, data interaction system and computing equipment
US10123190B2 (en) System and method for testing a CoAP server
CN108173716B (en) Method for identifying network equipment manufacturer and computing equipment
CN110874278A (en) Embedding method of external system, workflow system, device and storage medium
CN115576711A (en) Method and system for simulating returned data and computing equipment
CN111338928A (en) Chrome-based browser testing method and device

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
TA01 Transfer of patent application right

Effective date of registration: 20191211

Address after: 610000 No.11, 29th floor, building 3, No.88, Jitai 5th Road, hi tech Zone, Chengdu City, Sichuan Province

Applicant after: Sichuan Ruixiang Technology Co.,Ltd.

Address before: 100189, Beijing, Haidian District, 66 west side road, No. three or four, Zhongguancun Dongsheng science and Technology Park, building A-5

Applicant before: BEIJING ONEAPM Co.,Ltd.

GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20230309

Address after: 100193 room 101-216, 2nd floor, building 4, East District, yard 10, northwest Wangdong Road, Haidian District, Beijing

Patentee after: Beijing Ruixiang Technology Co.,Ltd.

Address before: No. 11, 29/F, Building 3, No. 88, Jitai Fifth Road, High-tech Zone, Chengdu, Sichuan, 610000

Patentee before: Sichuan Ruixiang Technology Co.,Ltd.