CN113377638B - Method and device for generating performance test tool - Google Patents

Method and device for generating performance test tool Download PDF

Info

Publication number
CN113377638B
CN113377638B CN202110655398.2A CN202110655398A CN113377638B CN 113377638 B CN113377638 B CN 113377638B CN 202110655398 A CN202110655398 A CN 202110655398A CN 113377638 B CN113377638 B CN 113377638B
Authority
CN
China
Prior art keywords
test
class
performance
tool
performance test
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
CN202110655398.2A
Other languages
Chinese (zh)
Other versions
CN113377638A (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 Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202110655398.2A priority Critical patent/CN113377638B/en
Publication of CN113377638A publication Critical patent/CN113377638A/en
Application granted granted Critical
Publication of CN113377638B publication Critical patent/CN113377638B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3452Performance evaluation by statistical analysis

Abstract

The disclosure provides a method and a device for generating a performance test tool, and relates to the technical field of cloud computing and testing. The specific embodiment comprises the following steps: acquiring a performance test tool framework written by a target programming language, wherein the performance test tool framework comprises a test class supporting performance test, and the test class comprises a base class; converting the programming language of the test class into other programming languages to obtain a converted test class; obtaining a converted base class in the test class after inheritance conversion and a derivative class written by adopting other programming languages; a performance test tool is generated that includes the derived class and the translated test class. The present disclosure provides custom development performance test tools that support multiple programming languages, both single tool performance testing and distributed performance testing implementations with multiple tool linkages.

Description

Method and device for generating performance test tool
Technical Field
The disclosure relates to the technical field of computers, in particular to the technical field of cloud computing and testing, and particularly relates to a method and a device for generating a performance testing tool.
Background
The performance test is to simulate various normal, peak and abnormal load conditions by a performance test tool to test various performance indexes of the system. Both load testing and stress testing are performance testing, which may also be performed in combination.
In the related art, the pressure test may be performed in the following manner: testing of the maximum level of service that a system can provide is achieved by determining a bottleneck or unacceptable performance point of the system. Specifically, performance testing may be achieved by a performance testing tool.
Disclosure of Invention
Provided are a method and device for generating a performance test tool, an electronic device and a storage medium.
According to a first aspect, there is provided a method of generating a performance test tool, comprising: acquiring a performance test tool framework written by a target programming language, wherein the performance test tool framework comprises a test class supporting performance test, and the test class comprises a base class; converting the programming language of the test class into other programming languages to obtain a converted test class; obtaining a converted base class in the test class after inheritance conversion and a derivative class written by adopting other programming languages; a performance test tool is generated that includes the derived class and the translated test class.
According to a second aspect, there is provided a generating device of a performance test tool, comprising: an acquisition unit configured to acquire a performance test tool framework written in a target programming language, wherein the performance test tool framework includes a test class supporting performance testing, the test class including a base class; the conversion unit is configured to convert the programming language of the test class into other programming languages to obtain a converted test class; the deriving unit is configured to obtain a derived class inheriting the converted base class in the converted test class and written in other programming languages; and a generation unit configured to generate a performance test tool including the derived class and the converted test class.
According to a third aspect, there is provided an electronic device comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of the embodiments of the method of generating a performance test tool.
According to a fourth aspect, there is provided a non-transitory computer readable storage medium storing computer instructions for causing a computer to perform a method according to any one of the embodiments of the method of generating a performance test tool.
According to a fifth aspect, there is provided a computer program product comprising a computer program which, when executed by a processor, implements a method according to any one of the embodiments of the method of generating a performance test tool.
According to the scheme of the disclosure, the testing framework can be converted into the programming language, so that not only can the performance testing tools of other programming languages be obtained, but also the constraint of the programming language can be broken, the performance testing tools comprise derivative classes with strong flexibility, and the polymorphism of the performance testing tools is enhanced, thereby supporting the customization of the performance testing tools.
Drawings
Other features, objects and advantages of the present disclosure will become more apparent upon reading of the detailed description of non-limiting embodiments, made with reference to the following drawings:
FIG. 1 is an exemplary system architecture diagram in which some embodiments of the present disclosure may be applied;
FIG. 2 is a flow chart of one embodiment of a method of generating a performance test tool according to the present disclosure;
FIG. 3 is a schematic illustration of one application scenario of a method of generating a performance test tool according to the present disclosure;
FIG. 4 is a flow chart of yet another embodiment of a method of generating a performance test tool according to the present disclosure;
FIG. 5 is a schematic structural view of one embodiment of a generating device of a performance test tool according to the present disclosure;
FIG. 6 is a block diagram of an electronic device used to implement a method of generating a performance test tool of an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In the technical scheme of the disclosure, the acquisition, storage, application and the like of the related personal information of the user accord with the regulations of related laws and regulations, necessary security measures are taken, and the public order harmony is not violated.
It should be noted that, without conflict, the embodiments of the present disclosure and features of the embodiments may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
FIG. 1 illustrates an exemplary system architecture 100 to which embodiments of a method of generating a performance test tool or a device for generating a performance test tool of the present disclosure may be applied.
As shown in fig. 1, a system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium to provide communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or send messages or the like. Various communication client applications, such as video-type applications, live applications, instant messaging tools, mailbox clients, social platform software, etc., may be installed on the terminal devices 101, 102, 103.
The terminal devices 101, 102, 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices with display screens, including but not limited to smartphones, tablets, electronic book readers, laptop and desktop computers, and the like. When the terminal devices 101, 102, 103 are software, they can be installed in the above-listed electronic devices. Which may be implemented as multiple software or software modules (e.g., multiple software or software modules for providing distributed services) or as a single software or software module. The present invention is not particularly limited herein.
The server 105 may be a server providing various services, such as a background server providing support for the terminal devices 101, 102, 103. The background server may analyze and process the received data such as the performance test tool generation request, and feed back the processing result (e.g., the generated performance test tool) to the terminal device.
It should be noted that, the method for generating the performance test tool provided by the embodiment of the present disclosure may be executed by the server 105 or the terminal devices 101, 102, 103, and accordingly, the generating device of the performance test tool may be provided in the server 105 or the terminal devices 101, 102, 103.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, a flow 200 of one embodiment of a method of generating a performance test tool according to the present disclosure is shown. The method for generating the performance test tool comprises the following steps:
step 201, a performance testing tool framework written in a target programming language is obtained, wherein the performance testing tool framework comprises a testing class supporting performance testing, and the testing class comprises a base class.
In this embodiment, an execution body (e.g., a server or a terminal device shown in fig. 1) on which the generating method of the performance test tool runs may acquire a performance test tool framework written in a target programming language. The performance testing tool framework includes classes, i.e., test classes that support and implement performance testing. Thus, the performance testing tool framework may support performance testing for the electronic device under test.
The target programming language may be a variety of programming languages, such as the c++ language, or the C language.
Specifically, the base class refers to a core class for performance test in the test class, and is performance test core logic, i.e. a core program, for example, may indicate a performance test step.
Step 202, converting the programming language of the test class into other programming languages to obtain the converted test class.
In this embodiment, the execution body may convert the programming language of the test class into the other programming languages, and the converted result is a test class after conversion. The post-conversion test class herein includes the post-conversion base class. The execution body may perform the operation upon receiving test requirements corresponding to other programming languages.
In practice, the execution body may perform the conversion in various ways to enable communication between one programming language and another programming language by packaging and compiling the programming language. For example, the transformation may employ a specified development tool for the transformation, such as swig. In addition, a pre-trained model may be used for the transformation, such as a trained deep neural network.
Step 203, obtaining the converted base class in the inheritance converted test class and the derivative class written in other programming languages.
In this embodiment, the execution body may obtain a derived class of the transformed base class. Specifically, the derived class inherits the transformed base class and is written in the other programming languages. In this way, a custom class is obtained, which may be generated by a terminal (e.g., a service terminal), for example.
In step 204, a performance test tool is generated that includes the derived class and the translated test class.
In this embodiment, the execution body may generate a performance test tool, where the performance test tool includes the derivative class. The performance testing tool also comprises a test class after conversion.
The method provided by the embodiment of the disclosure can convert the programming language to the testing framework, not only can obtain the performance testing tools of other programming languages, but also can break the constraint of the programming languages, so that the performance testing tools comprise derivative classes with strong flexibility, and the polymorphism of the performance testing tools is enhanced, thereby supporting the customization of the performance testing tools.
With continued reference to fig. 3, fig. 3 is a schematic diagram of an application scenario of the method for generating the performance test tool according to the present embodiment. In the application scenario of fig. 3, an execution body 301 acquires a performance test tool framework 302 written in a target programming language, wherein the performance test tool framework 302 includes test classes supporting performance tests, and the test classes include base classes. The execution body 301 converts the programming language of the test class into another programming language, resulting in a converted test class 303. The execution body 301 obtains a derived class 304 inheriting the translated base class in the translated test class and written in another programming language. The execution body 301 generates a performance test tool 305 that includes a derived class and a translated test class.
With further reference to FIG. 4, a flow 400 of yet another embodiment of a method of generating a performance test tool is shown. The process 400 includes the steps of:
step 401, obtaining a performance testing tool framework written in a target programming language, wherein the performance testing tool framework comprises a testing class supporting performance testing.
Step 402, converting the programming language of the base class into other programming languages by adopting a first conversion mode to obtain a converted base class, wherein the converted base class is used for writing the derivative class.
In this embodiment, the test class may further include a control class. The execution body may convert the programming language of the base class into the other programming languages by using a first conversion method, so as to obtain a converted base class. Specifically, the transformed base class is used to write the derived class.
The control class refers to a class in the test class that controls performance tests, such as controlling at least one of the following parameters: parameters of performance testing (such as the probability of counting the total number of delay threads in the class), starting, stopping, collecting performance test result data, and the like.
In practice, there may be two control classes, a total control class and a precision control class, respectively. The overall control class is used to define various parameters and the precision control class may include various executions for performing tests related to the various parameters described above.
And step 403, converting the programming language of the control class into other programming languages by adopting a second conversion mode to obtain the converted control class.
In this embodiment, the conversion modes for the base class and the control class may be different. And for the conversion mode of the base class, the converted base class can be inherited, so that the derivative class written in the other programming languages is obtained. The above inherited effect cannot be achieved for the conversion mode of the control class.
For example, if a swig transformation is employed, the first transformation is a swig transformation with features that support cross-language polymorphism (director). Whereas the second mode of conversion is a swig conversion which does not have this property. The polymorphic indications herein relate to both the original class (e.g., the transformed base class) and the derived class.
Step 404, obtaining a derived class inheriting the transformed base class in the transformed test class and written in other programming languages.
Step 405, a performance test tool is generated that includes the derived class and the translated test class.
Step 401, step 404 and step 405 in this embodiment are the same as or similar to step 201, step 203 and step 204, and are not described here again.
The embodiment can enable the transformed base class to be inherited through a first transformation mode, so that the derived class is obtained.
In some optional implementations of the present embodiment, the method further includes: in response to receiving a token acquisition request generated for a test thread, determining whether the test parameters of the test thread meet preset parameter conditions, wherein the test thread is created by a control class after conversion of a performance test tool; if yes, distributing tokens to the test threads in the performance test tool framework, wherein the tokens indicate to start the test threads.
In these alternative implementations, the execution body may determine, when receiving a token (token) acquisition request generated by the performance test tool for the test thread, whether the test parameters of the test thread meet the preset parameter conditions.
Test parameters refer to parameters that can be used to define a test thread. For example, the test parameters may include the number of tests. In practice, the post-translation control class may be used to create test threads.
These implementations may control the start of the test thread by distributing tokens, increasing the controllability of the scheme.
In some optional application scenarios of these implementations, the test parameters include at least one of the following of the test thread: system throughput, test times, and test time; distributing tokens to test threads, comprising: and distributing tokens to the test threads according to the specified time units, wherein the number of the distributed tokens of each specified time unit is not more than a preset number, and the specified time units are inversely proportional to the system throughput.
In these optional application scenarios, the execution body may distribute the token to the test thread if at least one of the above-mentioned at least one item meets a preset parameter condition. In practice, the number of distributed tokens may be defined for each specified time unit, e.g. 1.
The specified time unit may be various, such as 1 second. In practice, the specified time units may be determined from the system throughput. For example, system throughput may be expressed in terms of TPS, and a given time unit may be 1/TPS seconds. If TPS is 5, then a specified time unit is 0.2 seconds.
The test parameters may be specific to the same type of test thread (such as a DemoWorker type), or may be specific to all test threads of a round of test.
These application scenarios can be defined accurately for the test parameters and the appropriate specified time units can be determined by the system throughput. Tokens may be distributed more frequently when system throughput is high.
In some alternative implementations of any of the embodiments, after obtaining the integrated post-conversion test class, the performance test tool includes: in response to receiving a tool run instruction, a derived class is invoked at a test thread of the performance test tool.
In these alternative implementations, the execution body or other electronic device may invoke the derived class in the test thread of the performance test tool upon receiving the tool run instruction, so that the derived class may be executed.
The performance testing tool in these implementations may call the derived class in the test thread to enable execution of the derived class.
In some optional application scenarios of these implementations, the test class further includes a control class; the above test thread in the performance test tool, calling the derived class, may include: responding to the received tool operation instruction, and acquiring performance test condition information by calling a converted control class in converted test classes in a test thread of a performance test tool; and if the performance test condition information indicates that the performance test condition is met currently, calling the derived class in a test thread of the performance test tool.
In these optional application scenarios, the execution body may invoke the translated control class in a test thread of the performance test tool upon receiving a tool running instruction from the device or other electronic devices. Performance test condition information may be obtained by invoking a post-conversion control class, such as a specified function in the post-conversion control class. If the performance test condition information indicates that the condition for performing the performance test is currently satisfied, the derived class may be invoked on the test thread of the performance test tool.
Before calling the derived class, the execution body may obtain performance test condition information by calling a specified function (such as a get_token () function) in the converted control class. The obtained performance test condition information may indicate that the performance test condition is currently satisfied or that the performance test condition is not currently satisfied. And under the condition that the performance test condition is not met currently, the execution subject exits the performance test.
The application scenes can determine whether the performance test condition is met or not before calling the derived class, and execute the calling of the derived class under the condition that the performance test condition is met, so that the test can be performed at proper time.
In some optional implementations of any of the embodiments, the central control device and at least two performance testing tools including the performance testing tools form a distributed testing system, in the distributed testing system, the central control device is a master device, and an electronic device where the performance testing tools are located is a slave device; the operation steps of the performance test tool comprise: receiving a test starting instruction, a configuration updating instruction and a test stopping instruction issued by central control equipment; and sending a registration request, a test result parameter and a performance test result to the central control equipment.
In these alternative implementations, the device may be a physical device or a virtual device. The electronic device in which the performance testing tool is located may be a container. The electronic equipment can receive various instructions issued by the central control equipment. There is a bi-directional communication connection between the performance testing tool and the central control device (i.e., the central control node). For example, a WebSocket connection may be employed.
In practice, the central control device may receive the instruction issued by the central control device, and may also upload various information to the central control device. The test result parameters may be uploaded at the start of the test, and may include performance test result parameters to be counted, such as counting 99% of the operating delay in the test thread and 99.9% of the operating delay in the test thread.
In particular, the central control device may be in communication with the time series database.
The implementation modes can establish a distributed system for the performance testing tools, so that the central control equipment can control all the performance testing tools simultaneously, collect data of each performance testing tool so as to perform performance distributed testing, namely support a plurality of tools to perform distributed performance testing (such as pressure testing) in a linked manner, and integrate performance testing results.
In some optional implementations of any of the embodiments, the method further includes: adding a specified callback function supporting asynchronous uploading in a performance test tool framework; and a performance testing tool operation step, comprising: sending an asynchronous data request comprising a specified callback function to a target terminal, wherein the target terminal calls back the specified callback function for the tested electronic equipment in response to receiving the asynchronous data request, so that the tested electronic equipment asynchronously uploads a performance test result; and receiving a performance test result asynchronously uploaded by the tested electronic equipment.
In these alternative implementations, the execution body or other electronic device may add a specified callback function to the performance test tool framework to implement an asynchronous upload process for the tested electronic device. Specifically, adding the specified callback function corresponds to adding the specified callback function (recovery_result function) in the callback function. The device can be enabled to perform asynchronous uploading by performing callback of the specified callback function for which device (i.e., the target terminal such as the service terminal).
The implementation modes can realize asynchronous uploading of the performance test result through a callback function.
With further reference to fig. 5, as an implementation of the method shown in the foregoing figures, the present disclosure provides an embodiment of a generating device of a performance testing tool, where the embodiment of the device corresponds to the embodiment of the method shown in fig. 2, and the embodiment of the device may further include the same or corresponding features or effects as the embodiment of the method shown in fig. 2, except for the features described below. The device can be applied to various electronic equipment.
As shown in fig. 5, the generating device 500 of the performance test tool of the present embodiment includes: an acquisition unit 501, a conversion unit 502, a derivation unit 503, and a generation unit 504. Wherein the obtaining unit 501 is configured to obtain a performance test tool framework written in a target programming language, where the performance test tool framework includes a test class supporting performance test, and the test class includes a base class; a conversion unit 502 configured to convert the programming language of the test class into another programming language, to obtain a converted test class; a deriving unit 503 configured to obtain a derived class inheriting the converted base class in the converted test class and written in another programming language; a generating unit 504 configured to generate a performance test tool comprising the derived class and the translated test class.
In this embodiment, the specific processes and the technical effects of the acquiring unit 501, the converting unit 502, the deriving unit 503, and the generating unit 504 of the generating device 500 of the performance testing tool may refer to the relevant descriptions of the steps 201, 202, 203, and 204 in the corresponding embodiment of fig. 2, and are not repeated herein.
In some alternative implementations of the present embodiment, the test class further includes a control class; the conversion unit is further configured to perform conversion of the programming language of the test class into other programming languages in the following manner, so as to obtain a converted test class: converting the programming language of the base class into other programming languages by adopting a first conversion mode to obtain a converted base class, wherein the converted base class is used for writing a derivative class; and converting the programming language of the control class into other programming languages by adopting a second conversion mode to obtain the converted control class.
In some optional implementations of this embodiment, the apparatus further includes: a determining unit configured to determine whether a test parameter of a test thread meets a preset parameter condition in response to receiving a token acquisition request generated for the test thread, wherein the test thread is a test thread created by a control class after conversion of a performance test tool; and the distribution unit is configured to distribute tokens to the test threads in the performance test tool framework if the tokens are determined to be met, wherein the tokens indicate that the test threads are started.
In some alternative implementations of the present embodiment, the test parameters include at least one of the following of the test thread: system throughput, test times, and test time; a dispatch unit further configured to perform dispatching of tokens to test threads as follows: and distributing tokens to the test threads according to the specified time units, wherein the number of the distributed tokens of each specified time unit is not more than a preset number, and the specified time units are inversely proportional to the system throughput.
In some alternative implementations of the present embodiment, the performance testing tool includes the steps of: in response to receiving a tool run instruction, a derived class is invoked at a test thread of the performance test tool.
In some alternative implementations of the present embodiment, the test class further includes a control class; calling the derived class in a test thread of the performance test tool, wherein the method comprises the following steps: responding to the received tool operation instruction, and acquiring performance test condition information by calling a converted control class in converted test classes in a test thread of a performance test tool; and if the performance test condition information indicates that the performance test condition is met currently, calling the derived class in a test thread of the performance test tool.
In some optional implementations of this embodiment, the central control device and at least two performance testing tools including the performance testing tools form a distributed testing system, in which the central control device is a master device and the electronic device in which the performance testing tools are located is a slave device; the operation steps of the performance test tool comprise: receiving a test starting instruction, a configuration updating instruction and a test stopping instruction issued by central control equipment; and sending a registration request, a test result parameter and a performance test result to the central control equipment.
In some optional implementations of this embodiment, the apparatus further includes: an adding unit configured to add a specified callback function supporting asynchronous uploading in the performance test tool framework; and a performance testing tool operation step, comprising: sending an asynchronous data request comprising a specified callback function to a target terminal, wherein the target terminal calls back the specified callback function for the tested electronic equipment in response to receiving the asynchronous data request, so that the tested electronic equipment asynchronously uploads a performance test result; and receiving a performance test result asynchronously uploaded by the tested electronic equipment.
According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
As shown in fig. 6, a block diagram of an electronic device is provided for a method of generating a performance test tool according to an embodiment of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 6, the electronic device includes: one or more processors 601, memory 602, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions executing within the electronic device, including instructions stored in or on memory to display graphical information of the GUI on an external input/output device, such as a display device coupled to the interface. In other embodiments, multiple processors and/or multiple buses may be used, if desired, along with multiple memories and multiple memories. Also, multiple electronic devices may be connected, each providing a portion of the necessary operations (e.g., as a server array, a set of blade servers, or a multiprocessor system). One processor 601 is illustrated in fig. 6.
Memory 602 is a non-transitory computer-readable storage medium provided by the present disclosure. The memory stores instructions executable by the at least one processor to cause the at least one processor to perform the method of generating the performance test tool provided by the present disclosure. The non-transitory computer readable storage medium of the present disclosure stores computer instructions for causing a computer to perform the method of generating a performance test tool provided by the present disclosure.
The memory 602 is used as a non-transitory computer readable storage medium, and may be used to store a non-transitory software program, a non-transitory computer executable program, and modules, such as program instructions/modules (e.g., the obtaining unit 501, the converting unit 502, the deriving unit 503, and the generating unit 504 shown in fig. 5) corresponding to the generating method of the performance test tool in the embodiments of the disclosure. The processor 601 executes various functional applications of the server and data processing by running non-transitory software programs, instructions, and modules stored in the memory 602, i.e., implements the method of generating a performance test tool in the method embodiments described above.
The memory 602 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, at least one application program required for a function; the storage data area may store data created from the use of the generated electronic device of the performance test tool, and the like. In addition, the memory 602 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory 602 may optionally include memory remotely located with respect to processor 601, which may be connected to the generating electronics of the performance testing tool via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device of the method for generating a performance test tool may further include: an input device 603 and an output device 604. The processor 601, memory 602, input device 603 and output device 604 may be connected by a bus or otherwise, for example in fig. 6.
The input device 603 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the generating electronic device of the performance test tool, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointer stick, one or more mouse buttons, a track ball, a joystick, and the like. The output means 604 may include a display device, auxiliary lighting means (e.g., LEDs), tactile feedback means (e.g., vibration motors), and the like. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device may be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASIC (application specific integrated circuit), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
These computing programs (also referred to as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented in a high-level procedural and/or object-oriented programming language, and/or in assembly/machine language. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the internet.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service ("Virtual Private Server" or simply "VPS") are overcome. The server may also be a server of a distributed system or a server that incorporates a blockchain.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. The described units may also be provided in a processor, for example, described as: a processor includes an acquisition unit, a conversion unit, a derivation unit, and a generation unit. Where the names of these units do not constitute a limitation on the unit itself in some cases, for example, the acquisition unit may also be described as "acquire a unit of a performance test tool framework written in the target programming language".
As another aspect, the present disclosure also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by the apparatus, cause the apparatus to: acquiring a performance test tool framework written by a target programming language, wherein the performance test tool framework comprises a test class supporting performance test, and the test class comprises a base class; converting the programming language of the test class into other programming languages to obtain a converted test class; obtaining a converted base class in the test class after inheritance conversion and a derivative class written by adopting other programming languages; a performance test tool is generated that includes the derived class and the translated test class.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by those skilled in the art that the scope of the invention referred to in this disclosure is not limited to the specific combination of features described above, but encompasses other embodiments in which features described above or their equivalents may be combined in any way without departing from the spirit of the invention. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).

Claims (14)

1. A method of generating a performance test tool, the method comprising:
acquiring a performance test tool framework written in a target programming language, wherein the performance test tool framework comprises a test class supporting performance test, and the test class comprises a base class;
converting the programming language of the test class into other programming languages to obtain a converted test class;
obtaining a derived class inheriting the transformed base class in the transformed test class and written by adopting the other programming languages;
generating a performance test tool comprising the derived class and the converted test class;
wherein the test class further comprises a control class;
converting the programming language of the test class into the other programming languages to obtain a converted test class, including:
converting the programming language of the base class into the other programming languages by adopting a first conversion mode to obtain a converted base class, wherein the converted base class is used for writing the derivative class;
converting the programming language of the control class into the other programming languages by adopting a second conversion mode to obtain a converted control class;
wherein the method further comprises:
in response to receiving a token acquisition request generated for a test thread, determining whether a test parameter of the test thread meets a preset parameter condition, wherein the test thread is created by a control class after conversion of the performance test tool;
And if yes, distributing a token to the test thread in the performance test tool framework, wherein the token indicates to start the test thread.
2. The method of claim 1, wherein the test parameters include at least one of the following of a test thread: system throughput, test times, and test time;
the distributing tokens to the test threads includes:
and distributing tokens to the test threads according to specified time units, wherein the number of the distributed tokens of each specified time unit is not more than a preset number, and the specified time units are inversely proportional to the throughput of the system.
3. The method of claim 1, wherein the step of operating the performance testing tool comprises:
and in response to receiving a tool running instruction, calling the derived class in a test thread of the performance test tool.
4. A method according to claim 3, wherein the test class further comprises a control class;
the test thread of the performance test tool calls the derived class, including:
responding to a received tool operation instruction, and acquiring performance test condition information by calling a post-conversion control class in the post-conversion test classes in a test thread of the performance test tool;
And if the performance test condition information indicates that the performance test condition is met currently, calling the derivative class in a test thread of the performance test tool.
5. The method of claim 1, wherein a central control device and at least two performance testing tools including the performance testing tools form a distributed testing system, in the distributed testing system, the central control device is a master device, and an electronic device where the performance testing tools are located is a slave device;
the operation steps of the performance test tool comprise:
receiving a test start instruction, a configuration update instruction and a test stop instruction issued by the central control equipment;
and sending a registration request, a test result parameter and a performance test result to the central control equipment.
6. The method of claim 1, wherein the method further comprises:
adding a specified callback function supporting asynchronous uploading in the performance test tool framework; and
the operation steps of the performance test tool comprise:
sending an asynchronous data request comprising the specified callback function to a target terminal, wherein the target terminal calls back the specified callback function to the tested electronic equipment in response to receiving the asynchronous data request so as to enable the tested electronic equipment to asynchronously upload a performance test result;
And receiving the performance test result asynchronously uploaded by the tested electronic equipment.
7. A device for generating a performance test tool, the device comprising:
an acquisition unit configured to acquire a performance test tool framework written in a target programming language, wherein the performance test tool framework includes a test class supporting performance testing, the test class including a base class;
the conversion unit is configured to convert the programming language of the test class into other programming languages to obtain a converted test class;
a deriving unit configured to obtain a derived class inheriting a post-conversion base class in the post-conversion test class and written in the other programming language;
a generation unit configured to generate a performance test tool including the derived class and the converted test class;
wherein the test class further comprises a control class;
the conversion unit is further configured to perform the converting the programming language of the test class into the other programming language as follows, resulting in a converted test class:
converting the programming language of the base class into the other programming languages by adopting a first conversion mode to obtain a converted base class, wherein the converted base class is used for writing the derivative class;
Converting the programming language of the control class into the other programming languages by adopting a second conversion mode to obtain a converted control class;
wherein the apparatus further comprises:
a determining unit configured to determine whether a test parameter of a test thread meets a preset parameter condition in response to receiving a token acquisition request generated for the test thread, wherein the test thread is a test thread created by a control class after conversion of the performance test tool;
and the distribution unit is configured to distribute tokens to the test threads in the performance test tool framework if the test threads are determined to be in conformity, wherein the tokens indicate the start of the test threads.
8. The apparatus of claim 7, wherein the test parameters comprise at least one of the following of a test thread: system throughput, test times, and test time;
the dispatch unit is further configured to perform the dispatching of tokens to the test thread as follows:
and distributing tokens to the test threads according to specified time units, wherein the number of the distributed tokens of each specified time unit is not more than a preset number, and the specified time units are inversely proportional to the throughput of the system.
9. The apparatus of claim 7, wherein the performance testing tool comprises:
and in response to receiving a tool running instruction, calling the derived class in a test thread of the performance test tool.
10. The apparatus of claim 9, wherein the test class further comprises a control class;
the test thread of the performance test tool calls the derived class, including:
responding to a received tool operation instruction, and acquiring performance test condition information by calling a post-conversion control class in the post-conversion test classes in a test thread of the performance test tool;
and if the performance test condition information indicates that the performance test condition is met currently, calling the derivative class in a test thread of the performance test tool.
11. The apparatus of claim 7, wherein a central control device and at least two performance testing tools including the performance testing tool form a distributed testing system, in the distributed testing system, the central control device is a master device, and an electronic device where the performance testing tool is located is a slave device;
the operation steps of the performance test tool comprise:
Receiving a test start instruction, a configuration update instruction and a test stop instruction issued by the central control equipment;
and sending a registration request, a test result parameter and a performance test result to the central control equipment.
12. The apparatus of claim 7, wherein the apparatus further comprises:
an adding unit configured to add a specified callback function supporting asynchronous uploading in the performance test tool framework; and
the operation steps of the performance test tool comprise:
sending an asynchronous data request comprising the specified callback function to a target terminal, wherein the target terminal calls back the specified callback function to the tested electronic equipment in response to receiving the asynchronous data request so as to enable the tested electronic equipment to asynchronously upload a performance test result;
and receiving the performance test result asynchronously uploaded by the tested electronic equipment.
13. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.
14. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-6.
CN202110655398.2A 2021-06-11 2021-06-11 Method and device for generating performance test tool Active CN113377638B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110655398.2A CN113377638B (en) 2021-06-11 2021-06-11 Method and device for generating performance test tool

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110655398.2A CN113377638B (en) 2021-06-11 2021-06-11 Method and device for generating performance test tool

Publications (2)

Publication Number Publication Date
CN113377638A CN113377638A (en) 2021-09-10
CN113377638B true CN113377638B (en) 2023-10-27

Family

ID=77574076

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110655398.2A Active CN113377638B (en) 2021-06-11 2021-06-11 Method and device for generating performance test tool

Country Status (1)

Country Link
CN (1) CN113377638B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5493680A (en) * 1992-07-06 1996-02-20 National Business Machines Corporation Method for creating an object subclass with selective inheritance
CN1573688A (en) * 2003-06-10 2005-02-02 微软公司 Systems and methods for employing tagged types in a dynamic runtime environment
CN107678941A (en) * 2017-08-31 2018-02-09 深圳市小牛在线互联网信息咨询有限公司 Method and device, storage medium and the computer equipment of Application testing
CN110134378A (en) * 2018-02-08 2019-08-16 腾讯科技(深圳)有限公司 Application program creation method and device, computer equipment and storage medium
CN110275706A (en) * 2019-07-01 2019-09-24 拉扎斯网络科技(上海)有限公司 Program publication and loading method, device, computer system and readable storage medium storing program for executing
CN111240681A (en) * 2019-12-30 2020-06-05 瑞庭网络技术(上海)有限公司 Method and device for converting different programming languages
CN112181822A (en) * 2020-09-24 2021-01-05 北京达佳互联信息技术有限公司 Test method and test method for starting time consumption of application program

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2017110071A (en) * 2017-03-24 2018-09-24 Оракл Интернэйшнл Корпорейшн TRANSFORMING SOURCE PROGRAMMING LANGUAGE CODE

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5493680A (en) * 1992-07-06 1996-02-20 National Business Machines Corporation Method for creating an object subclass with selective inheritance
CN1573688A (en) * 2003-06-10 2005-02-02 微软公司 Systems and methods for employing tagged types in a dynamic runtime environment
CN107678941A (en) * 2017-08-31 2018-02-09 深圳市小牛在线互联网信息咨询有限公司 Method and device, storage medium and the computer equipment of Application testing
CN110134378A (en) * 2018-02-08 2019-08-16 腾讯科技(深圳)有限公司 Application program creation method and device, computer equipment and storage medium
CN110275706A (en) * 2019-07-01 2019-09-24 拉扎斯网络科技(上海)有限公司 Program publication and loading method, device, computer system and readable storage medium storing program for executing
CN111240681A (en) * 2019-12-30 2020-06-05 瑞庭网络技术(上海)有限公司 Method and device for converting different programming languages
CN112181822A (en) * 2020-09-24 2021-01-05 北京达佳互联信息技术有限公司 Test method and test method for starting time consumption of application program

Also Published As

Publication number Publication date
CN113377638A (en) 2021-09-10

Similar Documents

Publication Publication Date Title
CN110765024B (en) Simulation test method, simulation test device, electronic equipment and computer readable storage medium
CN111080243A (en) Service processing method, device, system, electronic equipment and storage medium
CN111737127A (en) Method and apparatus for testing map service
CN112486820B (en) Method, apparatus, device and storage medium for testing code
JP7030177B2 (en) Test method and equipment
CN111752843A (en) Method, device, electronic equipment and readable storage medium for determining influence surface
CN113238943A (en) Method and device for continuous integration test
CN111949272A (en) Compilation optimization method and device for hosted application, electronic device and readable storage medium
KR20210042276A (en) Method and apparatus for verifying operation state of application
CN111611767A (en) Verification method and device
CN112948018B (en) Dynamic library loading method, device, equipment and medium for applet
WO2023169193A1 (en) Method and device for generating smart contract
CN112379951A (en) Service interface access method, device, electronic equipment and medium
CN111767149A (en) Scheduling method, device, equipment and storage equipment
CN113377638B (en) Method and device for generating performance test tool
US11928627B2 (en) Workflow manager
CN111639116B (en) Data access connection session protection method and device
CN114693131A (en) Fault processing method and device for accessory robot
CN112532483A (en) Test method, test device, electronic equipment and storage medium
CN113778849A (en) Method, apparatus, device and storage medium for testing code
CN112052347A (en) Image storage method and device and electronic equipment
CN113656268B (en) Performance test method and device for business service, electronic equipment and storage medium
US11709691B2 (en) Software user assistance through image processing
CN111639032B (en) Method and apparatus for testing applications
US11442954B2 (en) Techniques for accessing on-premise data sources from public cloud for designing data processing pipelines

Legal Events

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