Search

CN-115757186-B - Performance test method, device, equipment and medium of software interface

CN115757186BCN 115757186 BCN115757186 BCN 115757186BCN-115757186-B

Abstract

The embodiment of the invention discloses a performance test method, device, equipment and medium of a software interface. The method comprises the steps of obtaining source codes to be used corresponding to interfaces to be tested in target software, inserting performance analysis code segments into the source codes to be used through a first container to obtain corresponding codes to be tested, deploying the first container and a second container in a computer operating system, performing performance test on the codes to be tested through the second container, determining call information of the target functions in the test process, and determining target performance test results of the interfaces to be tested based on the call information. The method solves the problems of low efficiency and inaccuracy caused by the fact that in the performance test of the target software, a developer is required to manually modify codes, the obtained performance test result is of an interface layer level, the automatic test of the software interface is realized, the test result is of a function layer, and the test efficiency and the test accuracy are improved.

Inventors

  • LI GAOHU
  • SHI CHEN

Assignees

  • 中邮信息科技(北京)有限公司

Dates

Publication Date
20260508
Application Date
20221206

Claims (5)

  1. 1. A method for testing performance of a software interface, comprising: Acquiring a source code to be used corresponding to an interface to be tested in target software, wherein the source code to be used comprises at least one target function, and the source code to be used comprises a source code address to be used, a source code download module, a target directory and a target software program, wherein the source code address to be used is input on a display interface of a performance test client; Inserting a performance analysis code segment into the source code to be used through a first container to obtain a corresponding code to be tested, wherein the first container and a second container are deployed in a computer operating system; Performing performance test on the code to be tested through a second container, determining calling information of the target function in the test process, and determining a target performance test result of the interface to be tested based on the calling information; The method comprises the steps of inserting a performance analysis code segment into a source code to be used through a first container to obtain a corresponding code to be tested, determining a syntax tree to be used corresponding to the source code to be used based on the first container and a syntax analysis function, determining a statement to be processed and a function to be processed in the syntax tree to be used based on a target traversal mode, wherein the function to be processed is a main function of the source code to be used, inserting the performance analysis code segment into code rows adjacent to the statement to be processed and the function to be processed to obtain a code to be tested corresponding to the source code to be used, and generating a code transformation completion identification, wherein the target traversal mode is a walk mode, and the performance analysis code refers to Cprofile performance analysis codes; The performance test is carried out on the code to be tested through a second container, the calling information of the target function in the test process is determined, and the target performance test result of the interface to be tested is determined based on the calling information, wherein the performance test comprises the steps of acquiring an image file corresponding to the second container when a transformation completion identification corresponding to the code to be tested is detected based on a timing task script; The performance test is carried out on the codes to be tested through a second container, calling information of the target function in the test process is determined, and a target performance test result of the interface to be tested is determined based on the calling information; and generating a target analysis result file based on the calling times and the running time, and sending the target analysis result file to the performance test client.
  2. 2. The method as recited in claim 1, further comprising: and carrying out central processing performance test on the code to be tested based on a central processing performance test script, and sending a central processing performance test result to the performance test client.
  3. 3. A performance testing apparatus for a software interface, comprising: The source code acquisition module is used for acquiring source codes to be used corresponding to interfaces to be tested in target software, wherein the source codes to be used comprise at least one target function; the system comprises a source code transformation module, a performance analysis code segment, a first container and a second container, wherein the source code transformation module is used for inserting the performance analysis code segment into the source code to be used through the first container to obtain a corresponding code to be tested; The target performance testing module is used for performing performance testing on the code to be tested through the second container, determining the calling information of the target function in the testing process, and determining a target performance testing result of the interface to be tested based on the calling information; The source code acquisition module includes: The system comprises a source code address acquisition module, a performance test client and a performance test module, wherein the source code address acquisition module is used for acquiring a source code address to be used which is input on a display interface of the performance test client; The source code storage module is used for downloading the source code to be used corresponding to the interface to be tested based on the source code address to be used and storing the source code to be used in a target directory; a source code reconstruction module comprising: The grammar tree establishing module is used for determining a grammar tree to be used corresponding to the source code to be used based on the first container and a grammar analysis function; The traversal module is used for determining a to-be-processed sentence and a to-be-processed function in the to-be-used grammar tree based on a target traversal mode, wherein the to-be-processed function is a main function of the to-be-used source code; The transformation module is used for inserting the performance analysis code segment into a code row adjacent to the statement to be processed and the function to be processed, obtaining a code to be tested corresponding to the source code to be used, and generating a code transformation completion mark, wherein the target traversal mode is a walk mode, and the performance analysis code refers to Cprofile performance analysis code; A target performance testing module comprising: The image file acquisition module is used for acquiring an image file corresponding to the second container when the transformation completion identification corresponding to the code to be tested is detected based on the timing task script; the testing module is used for starting the second container based on the image file, and performing performance test on the code to be tested in the target catalog based on a testing interface of the second container so as to determine the calling information of the target function in the testing process; A target performance testing module comprising: the test information determining module is used for performing performance test on the code to be tested in the target catalog based on the test interface of the second container so as to determine the calling times and the running time of the target function in the code to be tested; And the test result determining module is used for generating a target analysis result file based on the calling times and the operation time and sending the target analysis result file to the performance test client.
  4. 4. An electronic device, the electronic device comprising: At least one processor, and A memory communicatively coupled to the at least one processor, wherein, The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of testing the performance of the software interface of any one of claims 1-2.
  5. 5. A computer readable storage medium storing computer instructions for causing a processor to perform the method of testing the performance of the software interface of any one of claims 1-2.

Description

Performance test method, device, equipment and medium of software interface Technical Field The present invention relates to the field of software testing technologies, and in particular, to a method, an apparatus, a device, and a medium for testing performance of a software interface Background Each system function is now subjected to performance testing before being brought on-line. However, the performance test results given by the performance test team are interface levels, only knowing that each interface is time-consuming to call, and cannot accurately locate which function in the interface has a performance problem. There are many performance analysis tools aiming at python, and in the existing performance analysis technology, a developer is usually required to manually modify own codes, then execute a test script to check performance analysis results, which is time-consuming and labor-consuming, has large workload for the developer and has high skill requirements for the developer. Disclosure of Invention The invention provides a performance test method, device, equipment and medium for a software interface, which are used for realizing automatic test of the software interface, and the test result is of a function level, so that the test efficiency and the test accuracy are improved. According to an aspect of the present invention, there is provided a performance testing method of a software interface, including: Acquiring a source code to be used corresponding to an interface to be tested in target software, wherein the source code to be used comprises at least one target function; Inserting a performance analysis code segment into the source code to be used through a first container to obtain a corresponding code to be tested, wherein the first container and a second container are deployed in a computer operating system; and performing performance test on the code to be tested through a second container, determining the calling information of the target function in the test process, and determining the target performance test result of the interface to be tested based on the calling information. According to another aspect of the present invention, there is provided a performance testing apparatus of a software interface, comprising: The source code acquisition module is used for acquiring source codes to be used corresponding to interfaces to be tested in target software, wherein the source codes to be used comprise at least one target function; the system comprises a source code transformation module, a performance analysis code segment, a first container and a second container, wherein the source code transformation module is used for inserting the performance analysis code segment into the source code to be used through the first container to obtain a corresponding code to be tested; and the target performance testing module is used for performing performance testing on the code to be tested through the second container, determining the calling information of the target function in the testing process, and determining the target performance testing result of the interface to be tested based on the calling information. According to another aspect of the present invention, there is provided an electronic apparatus including: At least one processor, and A memory communicatively coupled to the at least one processor, wherein, The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of testing the performance of the software interface according to any one of the embodiments of the present invention. According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to execute a method for testing the performance of a software interface according to any embodiment of the present invention. According to the technical scheme, the source code to be used corresponding to the interface to be tested in the target software is obtained, the source code to be used comprises at least one target function, a performance analysis code segment is inserted into the source code to be used through a first container to obtain the corresponding code to be tested, the first container and a second container are deployed in a computer operating system, performance testing is conducted on the code to be tested through the second container, calling information of the target function in the testing process is determined, and a target performance testing result of the interface to be tested is determined based on the calling information. The method solves the problems of low efficiency and inaccuracy caused by the fact that in the performance test of the target software, a developer is required to manually modify codes, the obtained performance test result is of an interface layer level, the automatic test of the software interface is realized, the test