CN113342633B - Performance test method and device - Google Patents

Performance test method and device Download PDF

Info

Publication number
CN113342633B
CN113342633B CN202010099617.9A CN202010099617A CN113342633B CN 113342633 B CN113342633 B CN 113342633B CN 202010099617 A CN202010099617 A CN 202010099617A CN 113342633 B CN113342633 B CN 113342633B
Authority
CN
China
Prior art keywords
source code
tested
module
package
performance
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
CN202010099617.9A
Other languages
Chinese (zh)
Other versions
CN113342633A (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 Jingdong Zhenshi Information Technology Co Ltd
Original Assignee
Beijing Jingdong Zhenshi Information 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 Jingdong Zhenshi Information Technology Co Ltd filed Critical Beijing Jingdong Zhenshi Information Technology Co Ltd
Priority to CN202010099617.9A priority Critical patent/CN113342633B/en
Publication of CN113342633A publication Critical patent/CN113342633A/en
Application granted granted Critical
Publication of CN113342633B publication Critical patent/CN113342633B/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/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3644Software debugging by instrumenting at runtime
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/366Software debugging using diagnostics

Abstract

The invention discloses a performance test method and device, and relates to the technical field of computers. One embodiment of the method comprises the following steps: acquiring a first source code package and source codes to be tested which belong to a part of the first source code package and are related to a module to be tested, and determining the dependency relationship of the source codes to be tested on the first source code package; acquiring a file associated with the source code to be tested from the first source code package according to the dependency relationship, and forming a second source code package based on the file and the source code to be tested; and running the second source code package to obtain the performance data of the module to be tested. The implementation mode reduces the workload generated by a developer for performance test positioning codes, further reduces the test time, reduces the interference of performance test on related modules, is beneficial to more accurately positioning the problems, and improves the test efficiency.

Description

Performance test method and device
Technical Field
The invention relates to the technical field of computers, in particular to a performance testing method.
Background
In the existing performance test method, if the performance of an interface needs to be tested, a developer needs to compile source codes and deploy the generated executable files into a performance test environment so as to complete performance test; or the developer needs to mark the interface to be tested in the source code, then the source code is deployed to the performance test environment, and the test environment compiles and runs the source code to complete the performance test.
In the process of implementing the present invention, the inventor finds that at least the following problems exist in the prior art:
in order to run performance tests, executable files provided by developers need to be processed in a performance test environment, huge manpower and time cost are often required to be consumed for deploying the performance test environment, and for the scenario that the performance test case only involves one or more interfaces in source codes, the time of performance tests is increased, resources of the performance test environment are wasted, and further the cost of projects is increased.
In another mode of running performance test, the workload of a developer is additionally increased due to the fact that the developer is required to locate a specific test interface.
Disclosure of Invention
Therefore, the embodiment of the invention provides a performance testing method, which is used for reducing the workload generated by a developer for performance testing positioning codes, further reducing the testing time, reducing the interference of performance testing on related modules, being beneficial to more accurately positioning the problems and improving the testing efficiency.
To achieve the above object, according to one aspect of an embodiment of the present invention, there is provided a method of performance testing. Characterized by comprising the following steps: acquiring a first source code package and source codes to be tested which belong to a part of the first source code package and are related to a module to be tested, and determining the dependency relationship of the source codes to be tested on the first source code package; acquiring a file associated with the source code to be tested from the first source code package according to the dependency relationship, and forming a second source code package based on the file and the source code to be tested; and running the second source code package to obtain the performance data of the module to be tested.
Optionally, the performance test method is characterized in that codes for performance analysis are added in the second source code packet to form a third source code packet; and running the third source code package to obtain the performance data of the module to be tested.
Optionally, the performance testing method is characterized in that, when the third source code packet is executed, the code of the performance analysis automatically tracks and records the running process of the source code to be tested, so as to obtain the performance data of the module to be tested.
Optionally, the performance testing method is characterized in that codes for virtual third party components are added in the third source code to form a fourth source code package; and running the fourth source code package to obtain performance data of the source code to be tested applied to the third party component.
Optionally, the performance testing method is characterized in that the code for virtualizing the third party component in the fourth source code package is generated according to the incoming parameters and the return data of the third party component.
Optionally, the performance testing method is characterized in that the code for virtualizing the third party component in the fourth source code package is further used for converting the type of the incoming parameters of the module to be tested for the third party component and/or the type of the return data of the third party component for the module to be tested.
Optionally, the performance testing method is characterized in that the performance data indicates a module of the modules to be tested, which consumes more time than a threshold time period or has more occupancy rate of a central processing unit than a threshold occupancy rate, and indicates a calling relationship related to the module.
To achieve the above object, according to a second aspect of the embodiments of the present invention, there is provided an apparatus for performance testing, including: the system comprises a source code acquisition module and a performance analysis module; the source code acquisition module is used for acquiring a first source code package and source codes to be tested, which belong to a part of the first source code package and are related to a module to be tested, and determining the dependency relationship of the source codes to be tested on the first source code package; acquiring a file associated with the code to be tested from the first source code package according to the dependency relationship, and forming a second source code package based on the file and the source code to be tested; and the performance analysis module is used for operating the second source code package to obtain the performance data of the module to be tested.
Optionally, the performance testing device is characterized in that the source code obtaining module is further configured to add a code for performance analysis to the second source code packet to form a third source code packet; the performance analysis module is further configured to run the third source code package to obtain performance data of the module to be tested.
Optionally, the performance testing device is characterized in that, when the third source code packet is executed, the code of performance analysis automatically tracks and records the running process of the source code to be tested, so as to obtain the performance data of the module to be tested.
Optionally, the performance testing device is characterized in that codes for virtual third party components are added in the third source code to form a fourth source code package; and running the fourth source code package to obtain performance data of the source code to be tested applied to the third party component.
Optionally, the performance testing apparatus is characterized in that the code for virtualizing the third party component in the fourth source code package is generated according to the incoming parameters and the return data of the third party component.
Optionally, the performance testing apparatus is characterized in that the code for virtualizing the third party component in the fourth source code package is further configured to convert a type of an incoming parameter of the module to be tested for the third party component and/or a type of the return data of the third party component for the module to be tested.
Optionally, the performance testing device is characterized in that the performance data indicates a module of the modules to be tested, which consumes more time than a threshold time period or has more occupancy rate of a central processing unit than a threshold occupancy rate, and indicates a calling relationship related to the module.
To achieve the above object, according to a third aspect of the embodiments of the present invention, there is provided an electronic device for performance testing, including: one or more processors; and a storage means for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement the method as described in any of the methods of performance testing described above.
To achieve the above object, according to a fourth aspect of embodiments of the present invention, there is provided a computer-readable medium having stored thereon a computer program, characterized in that the program, when executed by a processor, implements a method as described in any one of the above methods of performance testing.
One embodiment of the above invention has the following advantages or benefits: the method comprises the steps of picking source codes to be tested related to a module to be tested from first source codes for complete software implementation, obtaining files related to the code to be tested from a first source code package according to dependency analysis, and forming a second source code package for performance test based on the files and the source codes to be tested, so that workload of developers for positioning codes for performance test is reduced, testing time is further shortened, interference in performance test of related modules is reduced, more accurate positioning of problems is facilitated, and testing efficiency is improved.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main flow of a method of performance testing according to a first embodiment of the present invention;
FIGS. 1A and 1B are exemplary code schematics according to a first embodiment of the present invention;
FIG. 2 is a schematic diagram of the main flow of a method of performance testing according to a second embodiment of the present invention;
FIG. 3 is a schematic diagram of the main flow of a method of performance testing according to a third embodiment of the present invention;
3A-3D are diagrams of example code and interfaces according to a third embodiment of the invention;
FIG. 4 is a schematic diagram of the main modules of an apparatus for performance testing according to an embodiment of the present invention;
FIG. 5 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
fig. 6 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those 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 invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a performance test method according to a first embodiment of the present invention, and fig. 1A-1B are schematic diagrams of example codes. The performance test method shown in fig. 1 will be explained below in conjunction with fig. 1A and 1B.
As shown in fig. 1, in step S101, a first source code package and source code to be tested related to a module to be tested, which is part of the first source code package, are acquired, and a dependency relationship of the source code to be tested on the first source code package is determined.
Step S102, according to the dependency relationship, a file associated with the code to be tested is obtained from the first source code package, and a second source code package is formed based on the file and the source code to be tested.
The above operational flow will now be illustrated with Java code as shown in fig. 1A and 1B. As shown in fig. 1A, the first source code package contains nine files as follows: testA, testB, testC, testAService, testBService, testCService, testAServiceImpl, testBServiceImpl, testCServiceImpl, wherein TestA is the source code to be tested associated with the module to be tested.
Further, fig. 1B shows the dependency of the fragment TestA () method of the source code TestA to be tested, i.e. the method refers to the objects testAService and testBSerivce of the two interface classes TestAService, testBService, respectively. Notably, dependencies described herein include, but are not limited to, calls, references, inheritance, implementations, or other means of use of objects, methods, interfaces, etc. in a programming language.
By analyzing the dependency relationship of the source code to be tested in the first source code packet, the object which references two interface classes TestAService, testBService in the testA () method is known, and TestAServiceImpl, testBServiceImpl is the implementation class corresponding to the interface class TestAService, testBService respectively; while TestA does not reference an object of the interface class TestCService, the second source code, which includes TestA, testAService, testBService, testAServiceImpl, testBServiceImpl five files, need not include its unrelated TestCService and the implementation class testcserviceim corresponding to that class.
And step S103, running the second source code package to obtain the performance data of the module to be tested.
Still taking fig. 1A and 1B as an example, the second source code packet is run to obtain testA () performance data.
Alternatively, in the step S101, the first source code package may be uploaded through a page of the browser. In the step S103, the performance test data may also be presented through a page of the browser.
In one embodiment, the performance data indicates modules of the modules to be tested that consume more than a threshold period of time or that have a central processing unit occupancy that exceeds a threshold occupancy, and indicates call relationships associated with the modules. In this way, the developer will be prompted to pay attention to the codes that are time consuming and have a high CPU occupancy and learn other codes related to those codes.
Fig. 2 is a performance test method according to a second embodiment of the present invention.
As shown in fig. 2, the processing flow of step S201-step S202 with respect to the first source code packet and the source code to be tested is identical to that of step S101-S102, and will not be described herein.
In step S203, a code for performance analysis is added to the second source code packet to form a third source code packet.
Wherein the added code for performance analysis may be considered a monitoring portal for performance testing. That is, the code for performance analysis may be added according to monitoring needs, for example, regarding the occupancy rate of the module to be tested to the central processor, the time period taken for the module to be tested from the start to the end of the operation, and the like.
And S204, running a third source code packet to obtain the data of the tested module performance.
Specifically, when the third source code package is operated, the code of the performance analysis automatically tracks and records the operation process of the source code to be tested so as to obtain the performance data of the module to be tested.
In the step S204, the performance test data may also be presented through a page of the browser.
In one embodiment, the performance data indicates modules of the modules to be tested that consume more than a threshold period of time or that have a central processing unit occupancy that exceeds a threshold occupancy, and indicates call relationships associated with the modules. In this way, the developer will be prompted to pay attention to the codes that are time consuming and have a high CPU occupancy and learn other codes related to those codes.
Fig. 3 is a performance test method according to a third embodiment of the present invention, and fig. 3A to 3D are schematic diagrams of exemplary codes thereof. The performance test method shown in fig. 3 will be explained below mainly in conjunction with fig. 3A to 3D.
As shown in fig. 3, steps S301 to S303 are identical to S201 to S203 in terms of the processing of the first source code packet and the source code to be tested and the adding process of the performance test code, and are not described herein.
Step S304, automatically adding codes for the virtual third party component in the third source code package to form a fourth source code package.
Typically, execution of the first source code package as a complete software implementation requires the support of third party components (e.g., middleware), but when performing performance testing on a module, additional deployment of the third party components will also result in increased testing effort. Thus, in a preferred embodiment, code for a virtual (also referred to as a simulated) third party component may be added to the third party source code package for module calls to be tested. In this embodiment, according to the dependency relationship with the third party component indicated by the code of the module to be tested, the code for the virtual third party component is added to the code. The code of the virtual third party component is also referred to herein as a mock component or virtual object.
3A-3D, still taking FIGS. 1A and 1B as examples, FIG. 1A shows files contained in a first source code package; further, fig. 1B shows files contained in the source code of the module to be tested. Wherein TestA is the source code to be tested associated with the module to be tested and TestA () is the code segment to be tested for performance; by analyzing the dependency relationship of the source code to be tested in the first source code packet, it is known that the testA () method calls the testAService () method in the testAService object and the testbservce () method in the testbservce object.
Further, fig. 3A shows that the TestBService () method implemented as the implementation class TestBService of the interface class TestBService requires a return value of com.xx.xx.cli.cluster.set () method (hereinafter referred to as set () method) of a peripheral interface, which refers to an interface method of a third party component. That is, it can be considered that the set () method represents a third party component.
Further, as shown in fig. 3B, according to the dependency relationship of the source code to be tested in the analyzed first source code packet, the referenced peripheral interface set () method is presented to the developer, and the type of the return value (return data) of the set () method is presented; the return value is set and a new fourth source code package is generated using the interface developer as shown in fig. 3B.
Further, as shown in fig. 3C, the fourth source code packet includes a mock component for the set () method, that is, includes an automatically generated SetMock file, where the SetMock file implements the set () method required for the performance test and automatically generates the return value. That is, in this example, the SetMock file indicates code for a virtual third party component. Moreover, code for the virtual third party component is generated based on the input parameters and the return data of the third party component.
Optionally, the code in the SetMock file may also convert the type of incoming parameters for the third party component. For example, the module to be tested is data in json format for the incoming parameter of the set () method, and the input parameter format acceptable by the set () method is an array type, and in the generated fourth source code packet, the SetMock file realizes automatic conversion of the incoming parameter of the json type into the parameter of the array type. That is, the code for the virtual third party component in the fourth source code package is further configured to translate the type of the incoming parameters of the module under test for the third party component.
Optionally, the code in the SetMock file may also convert the type of return data for the third party component. As shown in fig. 3B, the return value rstetist (see fig. 3A) of the set () method is boolean (i.e., true or false) type data, and if the type of data required by the module to be tested to which the set () method is applied is int type, in the generated fourth source code packet, the SetMock file implements automatic conversion of boolean type return data into int type data for use by the module to be tested. That is, the code for the virtual third party component in the fourth source code package is further configured to translate the type of return data of the third party component to the module to be tested.
In a preferred embodiment, the sleep time may also be set at the end of the SetMock () file to more realistically simulate the response time of invoking a third party component.
Further, compared to the first embodiment shown in fig. 1B, as shown in fig. 3D, the fourth source code finally includes the following files: testA, testAService, testBService, testAServiceImpl, testBServiceImpl and SetMock. More specifically, since the implementation class TestBServiceImpl invokes the set () method of the third party component required for testing, the fourth source code package ultimately contains the SetMock file for the virtual third party component.
Step S305, running a fourth source code package to obtain performance data of the source code to be tested applied to the third party component. In this embodiment, a fourth source code packet is run to obtain performance data of the testA () method application set () method of the module to be tested.
In one embodiment, the performance data indicates modules of the modules to be tested that consume more than a threshold period of time or that have a central processing unit occupancy that exceeds a threshold occupancy, and indicates call relationships associated with the modules. In this way, the developer will be prompted to pay attention to the codes that are time consuming and have a high CPU occupancy and learn other codes related to those codes.
Optionally, in the step S305, the performance test data may also be presented through a page of the browser.
As shown in fig. 4, an embodiment of the present invention provides a performance testing apparatus 400, including: a source code analysis module 401 and a performance analysis module 402; wherein, the liquid crystal display device comprises a liquid crystal display device,
the source code analysis module 401 is configured to obtain a first source code packet and source code to be tested related to a module to be tested, which belongs to a part of the first source code packet, and determine a dependency relationship of the source code to be tested on the first source code packet; and acquiring a file associated with the code to be tested from the first source code package according to the dependency relationship, and forming a second source code package based on the file and the source code to be tested. The performance analysis module 402 is configured to run the second source code packet to obtain performance data of the module to be tested.
Optionally, the source code analysis module 401 is further configured to add a code for performance analysis to the second source code packet to form a third source code packet.
Optionally, the performance analysis module 402 is further configured to run the third source code packet to obtain performance data of the module under test. And when the third source code package is operated, the code of the performance analysis automatically tracks and records the operation process of the source code to be tested so as to obtain the performance data of the module to be tested.
Optionally, the source code analysis module 401 is further configured to add a code for a virtual third party component to the third source code to form a fourth source code packet;
optionally, the performance analysis module 402 is further configured to run the fourth source code packet to obtain performance data of the source code to be tested applied to the third party component; code in the fourth source code package for virtualizing the third party component is generated from incoming parameters and return data of the third party component; the code in the fourth source code package for virtualizing the third party component is further configured to convert a type of an incoming parameter of the module to be tested for the third party component and/or a type of return data of the third party component for the module to be tested.
Optionally, the performance analysis module 402 indicates that the performance data indicates a module that is time consuming more than a threshold duration or that the central processing unit occupancy rate exceeds a threshold occupancy rate in the module to be tested, and indicates a calling relationship related to the module.
The embodiment of the invention also provides a server for performance test, which comprises: one or more processors; and a storage device for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the method provided by any of the embodiments described above.
The embodiment of the invention also provides a computer readable medium, on which a computer program is stored, which when executed by a processor implements the method provided by any of the above embodiments.
Fig. 5 illustrates an exemplary system architecture 500 of a method of performance testing or an apparatus of performance testing to which embodiments of the present invention may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 is used as a medium to provide communication links between the terminal devices 501, 502, 503 and the server 505. The network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 505 via the network 504 using the terminal devices 501, 502, 503 to receive or send messages or the like. Various client applications may be installed on the terminal devices 501, 502, 503, such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, and social platform software, among others.
The terminal devices 501, 502, 503 may be a variety of electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 505 may be a server providing various services, such as a server implementing performance testing. For example, the server 505 may perform processing such as analysis on the performance test request received from the terminal device and the source code packet required for the performance test, implement the performance test method described in the above embodiment, and feed back the performance test result to the terminal device.
It should be noted that, the performance testing method provided by the embodiment of the present invention is generally executed by the server 505, and accordingly, the performance testing device is generally disposed in the server 505.
It should be understood that the number of terminal devices, networks and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, there is illustrated a schematic diagram of a computer system 600 suitable for use in implementing embodiments of the present invention. The terminal device shown in fig. 6 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU) 601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603, for example, performing the methods shown in fig. 1 to 3. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, mouse, etc.; an output portion 607 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The drive 610 is also connected to the I/O interface 605 as needed. Removable media 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on drive 610 so that a computer program read therefrom is installed as needed into storage section 608.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 609, and/or installed from the removable medium 611. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 601.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
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 invention. 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 or flowchart illustration, and combinations of blocks in the block diagrams 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 modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, as: a performance testing device comprises a source code analysis module and a performance analysis module. The names of these modules do not limit the module itself in some cases, for example, the source code analysis module may also be described as "a module for acquiring source code to be tested and a dependent file according to performance test requirements, and generating a new source code package".
As another aspect, the present invention 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 a device, cause the device to perform the method shown in fig. 1 to 3, comprising: acquiring a first source code package and source codes to be tested which belong to a part of the first source code package and are related to a module to be tested, and determining the dependency relationship of the source codes to be tested on the first source code package; the module comprises and not only comprises interface methods, functions and the like in a source code file; acquiring a file associated with the code to be tested from the first source code package according to the dependency relationship, and forming a second source code package based on the file and the source code to be tested; and running the second source code package to obtain the performance data of the module to be tested. The performance data indicates the module which consumes more time than a threshold time or the central processing unit occupancy rate exceeds the threshold occupancy rate in the module to be tested, and indicates the calling relation related to the module.
According to the technical scheme provided by the embodiment of the invention, the workload of a developer for testing the positioning code for performance is reduced, the testing time is further shortened, the interference of performance testing on related modules is reduced, the problem is more accurately positioned, and the testing efficiency is improved.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method for testing performance is characterized in that,
acquiring a first source code package and source codes to be tested which belong to a part of the first source code package and are related to a module to be tested, and determining the dependency relationship of the source codes to be tested on the first source code package;
acquiring a file associated with the source code to be tested from the first source code package according to the dependency relationship, and forming a second source code package based on the file and the source code to be tested;
adding codes for performance analysis into the second source code packet to form a third source code packet; operating the third source code package to obtain performance data of the module to be tested;
the method further comprises:
adding codes for the virtual third party component in the third source code to form a fourth source code package; running the fourth source code package to obtain performance data of the source code to be tested applied to the third party component; the code for virtualizing the third party component in the fourth source code package is further used for converting the type of the incoming parameters of the module to be tested for the third party component and/or the type of the return data of the third party component for the module to be tested.
2. The method of claim 1, wherein the step of determining the position of the substrate comprises,
and when the third source code package is operated, the code of the performance analysis automatically tracks and records the operation process of the source code to be tested so as to obtain the performance data of the module to be tested.
3. The method of claim 1, wherein the step of determining the position of the substrate comprises,
code in the fourth source code package for virtualizing the third party component is generated from incoming parameters and return data of the third party component.
4. A method according to any one of claims 1 to 3, wherein,
the performance data indicates a module which consumes more time than a threshold time period or the occupancy rate of the central processing unit exceeds the threshold occupancy rate in the module to be tested, and indicates a calling relation related to the module.
5. An apparatus for performance testing, comprising: the system comprises a source code acquisition module and a performance analysis module; wherein, the liquid crystal display device comprises a liquid crystal display device,
the source code acquisition module is used for acquiring a first source code package and source codes to be tested, which belong to a part of the first source code package and are related to a module to be tested, and determining the dependency relationship of the source codes to be tested on the first source code package; acquiring a file associated with the source code to be tested from the first source code package according to the dependency relationship, and forming a second source code package based on the file and the source code to be tested;
the source code acquisition module is used for adding codes for performance analysis into the second source code packet to form a third source code packet;
the performance analysis module is further used for running the third source code package to obtain performance data of the module to be tested;
the source code acquisition module is further configured to add a code for a virtual third party component to the third source code to form a fourth source code package;
the performance analysis module is further configured to run the fourth source code package to obtain performance data of the to-be-tested source code applied to the third party component, where code in the fourth source code package for virtualizing the third party component is further configured to convert a type of an incoming parameter of the to-be-tested module to the third party component, and/or a type of return data of the third party component to the to-be-tested module.
6. The apparatus of claim 5, wherein the device comprises a plurality of sensors,
and when the third source code package is operated, the code of the performance analysis automatically tracks and records the operation process of the source code to be tested so as to obtain the performance data of the module to be tested.
7. The apparatus of claim 5, wherein the device comprises a plurality of sensors,
code in the fourth source code package for virtualizing the third party component is generated from incoming parameters and return data of the third party component.
8. The apparatus according to any one of claims 5 to 7, wherein,
the performance data indicates a module which consumes more time than a threshold time period or the occupancy rate of the central processing unit exceeds the threshold occupancy rate in the module to be tested, and indicates a calling relation related to the module.
9. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs,
when executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-4.
10. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-4.
CN202010099617.9A 2020-02-18 2020-02-18 Performance test method and device Active CN113342633B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010099617.9A CN113342633B (en) 2020-02-18 2020-02-18 Performance test method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010099617.9A CN113342633B (en) 2020-02-18 2020-02-18 Performance test method and device

Publications (2)

Publication Number Publication Date
CN113342633A CN113342633A (en) 2021-09-03
CN113342633B true CN113342633B (en) 2023-09-22

Family

ID=77467026

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010099617.9A Active CN113342633B (en) 2020-02-18 2020-02-18 Performance test method and device

Country Status (1)

Country Link
CN (1) CN113342633B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104536890A (en) * 2014-12-26 2015-04-22 小米科技有限责任公司 Testing system, method and device
CN108009084A (en) * 2017-11-29 2018-05-08 北京中电普华信息技术有限公司 A kind of test method for mixing mobile application, apparatus and system
CN108415821A (en) * 2017-02-09 2018-08-17 腾讯科技(深圳)有限公司 The generation method and device of test report
CN109240905A (en) * 2018-07-02 2019-01-18 链家网(北京)科技有限公司 Method for testing software and system
CN109726109A (en) * 2018-06-04 2019-05-07 平安普惠企业管理有限公司 Code debugging method, apparatus, equipment and computer storage medium
CN110196809A (en) * 2019-05-30 2019-09-03 贝壳技术有限公司 Interface test method and device
CN110532185A (en) * 2019-08-29 2019-12-03 中国工商银行股份有限公司 Test method, device, electronic equipment and computer readable storage medium
CN110554965A (en) * 2019-09-05 2019-12-10 腾讯科技(深圳)有限公司 automated fuzz testing method, related equipment and computer readable storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9946634B2 (en) * 2013-12-09 2018-04-17 International Business Machines Corporation System and method for determining test coverage
US9575876B2 (en) * 2014-06-13 2017-02-21 International Business Machines Corporation Performance testing of software applications
US9971677B2 (en) * 2015-05-28 2018-05-15 International Business Machines Corporation Generation of test scenarios based on risk analysis
US10437714B2 (en) * 2017-01-25 2019-10-08 Wipro Limited System and method for performing script-less unit testing
US20190294531A1 (en) * 2018-03-26 2019-09-26 Ca, Inc. Automated software deployment and testing based on code modification and test failure correlation

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104536890A (en) * 2014-12-26 2015-04-22 小米科技有限责任公司 Testing system, method and device
CN108415821A (en) * 2017-02-09 2018-08-17 腾讯科技(深圳)有限公司 The generation method and device of test report
CN108009084A (en) * 2017-11-29 2018-05-08 北京中电普华信息技术有限公司 A kind of test method for mixing mobile application, apparatus and system
CN109726109A (en) * 2018-06-04 2019-05-07 平安普惠企业管理有限公司 Code debugging method, apparatus, equipment and computer storage medium
CN109240905A (en) * 2018-07-02 2019-01-18 链家网(北京)科技有限公司 Method for testing software and system
CN110196809A (en) * 2019-05-30 2019-09-03 贝壳技术有限公司 Interface test method and device
CN110532185A (en) * 2019-08-29 2019-12-03 中国工商银行股份有限公司 Test method, device, electronic equipment and computer readable storage medium
CN110554965A (en) * 2019-09-05 2019-12-10 腾讯科技(深圳)有限公司 automated fuzz testing method, related equipment and computer readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于工具检测的源代码静态测试技术研究;黄显果;王鹏;刘静静;张超永;;电脑编程技巧与维护(第05期);全文 *

Also Published As

Publication number Publication date
CN113342633A (en) 2021-09-03

Similar Documents

Publication Publication Date Title
CN111338623B (en) Method, device, medium and electronic equipment for developing user interface
CN111221572B (en) Method, device, medium and equipment for automatically adapting to running environment
CN110365724B (en) Task processing method and device and electronic equipment
US11934287B2 (en) Method, electronic device and computer program product for processing data
CN112631590B (en) Component library generation method, device, electronic equipment and computer readable medium
WO2019029451A1 (en) Method for publishing mobile applications and electronic apparatus
CN111309304B (en) Method, device, medium and electronic equipment for generating IDL file
CN110888639A (en) Business code compiling and packaging method and device
CN113360377B (en) Test method and device
CN113138768B (en) Application package generation method and device, electronic equipment and readable storage medium
CN108694120B (en) Method and device for testing service component
CN111414154A (en) Method and device for front-end development, electronic equipment and storage medium
CN113342633B (en) Performance test method and device
CN110806967A (en) Unit testing method and device
CN113032256A (en) Automatic test method, device, computer system and readable storage medium
CN113515271A (en) Service code generation method and device, electronic equipment and readable storage medium
CN112395194A (en) Method and device for accessing test platform
CN113010174A (en) Service monitoring method and device
CN112860447A (en) Interaction method and system between different applications
CN112068814A (en) Method, device, system and medium for generating executable file
CN117118962B (en) Method and system for deploying user methods across multiple cloud platforms
CN111026666A (en) Test data processing method, device, computer system and medium
CN117271301A (en) Test method, test device, electronic equipment and medium
CN109766246B (en) Method and apparatus for monitoring applications
CN116107908A (en) Unit test code generation 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
GR01 Patent grant
GR01 Patent grant