CN112486838A - Interface testing method and device, computer equipment and storage medium - Google Patents
Interface testing method and device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN112486838A CN112486838A CN202011471641.7A CN202011471641A CN112486838A CN 112486838 A CN112486838 A CN 112486838A CN 202011471641 A CN202011471641 A CN 202011471641A CN 112486838 A CN112486838 A CN 112486838A
- Authority
- CN
- China
- Prior art keywords
- test
- interface
- data
- script
- target
- 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.)
- Pending
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 511
- 238000003860 storage Methods 0.000 title claims abstract description 21
- 238000012545 processing Methods 0.000 claims abstract description 36
- 238000000034 method Methods 0.000 claims abstract description 30
- 238000009530 blood pressure measurement Methods 0.000 claims abstract description 23
- 230000004044 response Effects 0.000 claims abstract description 13
- 238000004590 computer program Methods 0.000 claims description 23
- 238000011056 performance test Methods 0.000 description 7
- 238000002360 preparation method Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 238000004519 manufacturing process Methods 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 3
- 238000012812 general test Methods 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 238000011161 development Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000010998 test method Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3664—Environments for testing or debugging software
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application relates to an interface testing method, an interface testing device, computer equipment and a storage medium. The method comprises the following steps: determining a target interface associated with the pressure measurement instruction in response to the pressure measurement instruction; acquiring original test data for testing a target interface, and determining the data source type of the original test data, wherein the data source type of the original test data is an offline source or an online source; processing the original test data according to a processing mode corresponding to the data source type to obtain target test data; and obtaining a test script corresponding to the pressure test instruction, running the test script under a preset test environment, and testing the target interface based on target test data after the test script is run. The method can reduce the memory space occupied by the interface test, simplify the operation process during the test and improve the test efficiency.
Description
Technical Field
The present application relates to the field of interface testing technologies, and in particular, to an interface testing method and apparatus, a computer device, and a storage medium.
Background
With the development of computer technology and internet technology, more and more enterprises are beginning to build service systems to provide services to meet customer needs. In order to monitor the system performance more intuitively and clearly, a performance test needs to be performed on the service system, the performance test is to test each performance index of the system by simulating a load condition through a performance test tool, and actually, each interface in the system is respectively tested through the test tool.
However, in the current interface test method, different test frames need to be constructed for processing the online data and the offline data, so that two sets of test frames need to be opened simultaneously for operation when the online data and the offline data are used for testing, which not only occupies a large amount of memory space, but also has a complicated operation process and further reduces the test efficiency; in addition, because the system version is frequently updated, the corresponding new version script needs to be repeatedly written every time the system version is updated, the time for writing the script is long, the test preparation time is long, and the test efficiency is reduced.
Disclosure of Invention
Therefore, it is necessary to provide an interface testing method, an interface testing apparatus, a computer device, and a storage medium for solving the above technical problems, so that the memory space occupied by the interface testing can be reduced, the operation process during the testing is simplified, and the testing efficiency is improved.
An interface testing method, the method comprising:
determining a target interface associated with the pressure measurement instruction in response to the pressure measurement instruction;
acquiring original test data for testing a target interface, and determining the data source type of the original test data, wherein the data source type of the original test data is an offline source or an online source;
processing the original test data according to a processing mode corresponding to the data source type to obtain target test data;
and obtaining a test script corresponding to the pressure test instruction, running the test script under a preset test environment, and testing the target interface based on target test data after the test script is run.
In one embodiment, the step of processing the original test data according to the processing mode corresponding to the data source type to obtain the target test data includes:
when the data source type of the original test data is determined to be an offline source, user configuration parameter information is obtained, and target test data are obtained according to the user configuration parameter information and the original test data;
and when the data source type of the original test data is determined to be an online source, analyzing the original test data to obtain target test data.
In one embodiment, the step of obtaining target test data according to the user configuration parameter information and the original test data includes:
generating an interface request template according to the user configuration parameter information, wherein the interface request template comprises a plurality of replaceable parameters, and the original test data comprises a plurality of parameter data for replacing each parameter in the interface request template;
and replacing each parameter in the interface request template by using each parameter data in the offline original test data to obtain test data, and taking the obtained test data as target test data.
In one embodiment, the method further includes:
after a test script is operated to test a target interface, obtaining test index information corresponding to the target interface;
and sending the test index information corresponding to the target interface to a preset address for storage, and/or displaying the test index information corresponding to the target interface on the terminal interface.
In one embodiment, the target interface includes at least one interface in an OSP system to be tested, the pressure test instruction includes a version number of the OSP system to be tested, the preset test environment is a JMeter test environment, and the step of obtaining a test script corresponding to the pressure test instruction includes:
acquiring a JMeter script of a version corresponding to the version number of the OSP system to be tested, and taking the JMeter script of the version corresponding to the version number of the OSP system to be tested as a test script;
or acquiring a JMeter script template of a version corresponding to the version number of the OSP system to be tested and JMeter script configuration parameters corresponding to the JMeter script template, generating a JMeter script according to the JMeter script configuration parameters and the JMeter script template, and taking the generated JMeter script as a test script; preferably, the pressure test instructions further comprise JMeter script configuration parameters.
In one embodiment, the determining, in response to the pressure test instruction, a target interface associated with the pressure test instruction includes:
and determining the target interface according to the service name, the service version number and the interface name of the interface to be tested.
In one embodiment, the user configuration parameter information includes a domain name of a domain where the target interface is located, a service name of a service where the target interface is located, an interface name of the target interface, host information where the target interface is located, and test thread setting information; preferably, the test thread setup information includes the number of bus threads of the JMeter thread expected to be used, the time of creating the expected use of all JMeter threads, the gradual boosting identification information, and the test duration.
An interface test apparatus, the apparatus comprising:
the target interface determining module is used for responding to the pressure measuring instruction to determine a target interface associated with the pressure measuring instruction;
the first acquisition module is used for acquiring original test data for testing the target interface and determining the data source type of the original test data, wherein the data source type of the original test data is an offline source or an online source;
the second acquisition module is used for processing the original test data according to the processing mode corresponding to the data source type to obtain target test data;
and the test operation module is used for acquiring a test script corresponding to the pressure test instruction, operating the test script in a preset test environment, and testing the target interface based on the target test data after the test script is operated.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of an embodiment of any of the methods described above when executing the computer program.
A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of an embodiment of any of the methods described above.
In the embodiment of the invention, a target interface associated with a pressure test instruction is determined in response to the pressure test instruction, original test data for testing the target interface is obtained, a data source type of the original test data is determined, the data source type of the original test data is an offline source or an online source, the original test data is processed according to a processing mode corresponding to the data source type to obtain target test data, a test script corresponding to the pressure test instruction is obtained, the test script is operated in a preset test environment, and the target interface is tested based on the target test data after the test script is operated. The universal test frame adopted by the embodiment of the invention can prepare the finally used target test data according to different data source types, particularly can determine the data source type of the original test data, and then processes the original test data according to the processing mode corresponding to the data source type so as to obtain the target test data.
Furthermore, the test script corresponding to the pressure test instruction acquired by the universal test framework can be a pre-compiled test script or a test script generated according to the test script template corresponding to the pressure test instruction and the script configuration parameters, and the script does not need to be re-compiled in each test, so that the test preparation time is shortened, and the test efficiency is further improved.
Drawings
FIG. 1 is a diagram of an application environment of a method for interface testing in one embodiment;
FIG. 2 is a flow chart illustrating a method for testing an interface according to an embodiment;
FIG. 3 is a flowchart illustrating the target test data acquisition step when the data source type is an offline source in one embodiment;
FIG. 4 is a flowchart illustrating the test script obtaining step in one embodiment;
FIG. 5 is a flowchart showing the test script obtaining step in another embodiment;
FIG. 6 is a block diagram of an interface test apparatus according to an embodiment;
FIG. 7 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The interface testing method provided by the application can be applied to the application environment shown in fig. 1. The terminal 102 communicates with the test server 104 through a network, the test server 104 communicates with the service system 106 of the enterprise through the network, the service system is an OSP system including a plurality of interfaces, and a generic test framework for testing the interfaces of the OSP system may be disposed in the test server 104. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the test server 104 and the service system 106 may be implemented by independent servers or a server cluster composed of a plurality of servers, or may be implemented by a distributed system.
In an embodiment, as shown in fig. 2, an interface testing method is provided, which is described by taking the method as an example applied to the testing server in fig. 1, and includes the following steps:
in step 202, a target interface associated with a pressure measurement instruction is determined in response to the pressure measurement instruction.
The pressure measurement instruction may include interface identification information corresponding to the interface to be measured, the target interface is the interface to be measured corresponding to the interface identification information, and the number of the target interfaces may be one or more.
Specifically, the present embodiment may be applied to a scenario of performance test of an OSP system, where the interface to be tested is an interface in the OSP system, and the performance test of the OSP system may be implemented by performing performance test on each interface in the OSP system. The OSP (open Service platform) system is a high-performance, high-extensible and Service-oriented RPC framework system which is secondarily developed based on an Apache thread remote call framework.
In an embodiment, the pressure test instruction includes an interface name of at least one interface to be tested, and a service name and a service version number of a service in which the interface to be tested is located, at this time, step 202 may be: and determining the target interface according to the service name, the service version number and the interface name of the interface to be tested. Specifically, the interface name of the interface to be tested in the pressure test instruction, the service name of the service of the interface to be tested, and the service version number may be manually set by a technician, or may be automatically selected from the system interfaces to be tested by a universal test framework, for example, an interface is selected at regular time for automatic testing.
Specifically, the pressure test instruction may include an interface name of the interface to be tested, a domain name of a domain where the interface to be tested is located, a service name and a service version number of a service where the interface to be tested is located, an address of the host to be tested, and a port to be tested on the host, so that the universal test framework can accurately locate the target interface to be tested.
In one application scenario, the data source type of the raw test data is either an offline source or an online source. It should be noted that, in other possible application scenarios, the number of data source types of the original test data may be more than two.
The original test data is unprocessed test data directly acquired from a data source, and the data source is generally divided into an online source and an offline source, and the data source type of one original test data is the offline source or the online source. In particular, the original test data with the data source type of offline source is generally a data.csv file, and the original test data with the data source type of online source generally includes a plurality of online traffic files with formats such as xxx.dat.
Here, the original test data of the offline source is generally data that meets the requirements of the interface test data and is obtained by technicians through data manufacturing, and often data manufacturing needs to be performed in advance, the manufactured test data can be stored in a system cache, and a general test frame can directly acquire the test data from the system cache before testing the interface, so that the acquisition speed is high, but the previous data manufacturing process is complicated, and the compiled test data may be different from the interface request data actually initiated by the client, and is not close to the actual situation; the original test data of the online source is network flow data acquired from the online directly by the general test framework in a packet grabbing mode of an online physical machine or a container, for example, the general test framework can grab client access flow data received by a target interface from the online in a certain time period as the original test data of the online source, the online data is closer to the actual client access condition, the interface can be tested more closely and practically, the original data can be acquired automatically from the online without data manufacturing, and the preparation time of the test data is reduced.
Specifically, in some embodiments, the universal test framework may first obtain original test data for testing the target interface, and then determine a data source type of the original test data according to the original test data to determine a subsequent processing manner for the original test data; in other embodiments, the universal test framework may further obtain a data source type of the original test data, that is, determine a processing manner of the original test data, and then obtain the corresponding original test data.
the processing modes corresponding to different data source types are different, the target test data are test data used in the interface test, and the target test data obtained by processing the original data of different data source types in different ways meet the calling requirement of a test script used in the final interface test.
In one embodiment, when the data source type of the original test data is determined to be an offline source, the universal test framework obtains user configuration parameter information, and obtains target test data according to the user configuration parameter information and the original test data.
More specifically, as shown in fig. 3, when it is determined that the data source type of the original test data is an offline source, the step of obtaining the target test data according to the user configuration parameter information and the original test data includes:
and step 304, replacing each parameter in the interface request template by using each parameter data in the offline original test data to obtain test data, and taking the obtained test data as target test data.
In this embodiment, the user configuration parameter information may include a domain name of a domain where the target interface is located, a service name of a service where the target interface is located, an interface name of the target interface, host information where the target interface is located, and test thread setting information; further, the test thread setting information includes the number of bus threads of the JMeter thread expected to be used, the time of creating the expected use of all JMeter threads, the gradual boosting identification information, and the test duration.
In another embodiment, when the data source type of the original test data is determined to be an online source, the original test data is analyzed to obtain target test data. At the moment, the original test data is the flow data directly captured by the universal test framework from the line, the flow data is analyzed, interface address information, interface flow type, interface request parameters, request header information and the like can be obtained through analysis, and the information is integrated to obtain the target test data required by the universal test framework.
Specifically, the generic test framework may adopt an existing traffic data parsing method when parsing the original test data from the online source, and in an application scenario of the OSP system performance test, the generic test framework may convert the captured online traffic data dat file into a target test data cvs file (a processing format commonly used by the OSP system) required by the generic test framework according to information required by the interface test.
And 208, acquiring a test script corresponding to the pressure test instruction, running the test script in a preset test environment, and testing the target interface based on the target test data after the test script is run.
The test script can be a pre-programmed test script or a test script generated according to a test script template corresponding to the pressure test instruction and the script configuration parameters, the preset test environment can be a JMeter test environment, and the test script is a JMeter script under the JMeter test environment.
Specifically, the universal test framework can directly obtain a test script corresponding to the pressure test instruction, the test script is operated in a preset test environment, the test script tests the target interface based on the target test data after being operated, that is, the test script calls the target test data to test the target interface, the script does not need to be rewritten for each test, and the test preparation time is reduced.
In the embodiment of the invention, a target interface associated with a pressure test instruction is determined in response to the pressure test instruction, original test data for testing the target interface is obtained, a data source type of the original test data is determined, the data source type of the original test data is an offline source or an online source, the original test data is processed according to a processing mode corresponding to the data source type to obtain target test data, a test script corresponding to the pressure test instruction is obtained, the test script is operated in a preset test environment, and the target interface is tested based on the target test data after the test script is operated. The universal test frame adopted by the embodiment of the invention can prepare the finally used target test data according to different data source types, particularly can determine the data source type of the original test data, and then processes the original test data according to the processing mode corresponding to the data source type so as to obtain the target test data.
The universal test frame adopted by the embodiment of the invention can prepare the finally used target test data according to different data source types, particularly can determine the data source type of the original test data, and then processes the original test data according to the processing mode corresponding to the data source type so as to obtain the target test data.
Based on the above embodiment, the interface testing method may further include:
after the target interface is tested by running the test script, test index information corresponding to the target interface is obtained, and the test index information corresponding to the target interface is sent to a preset address to be stored.
Or, the interface testing method may further include: and after the target interface is tested by running the test script, obtaining test index information corresponding to the target interface, and displaying the test index information corresponding to the target interface on the terminal interface.
Or, the interface testing method may further include: after the target interface is tested by running the test script, test index information corresponding to the target interface is obtained, the test index information corresponding to the target interface is sent to a preset address to be stored, and the test index information corresponding to the target interface is displayed on a terminal interface.
In each embodiment, the universal test framework can send the test index information to the preset address for storage, so that technicians can call the test index information for reference and analysis when needed, test index information corresponding to the target interface can be displayed on the terminal interface, and the test index information is visually displayed to the technicians so as to be referred.
In an embodiment, the target interface includes at least one interface in an OSP system to be tested, the pressure test instruction includes a version number of the OSP system to be tested, the preset test environment is a JMeter test environment, and the step of obtaining a test script corresponding to the pressure test instruction includes, as shown in fig. 4:
In another embodiment, the step of obtaining the test script corresponding to the pressure test instruction, as shown in fig. 5, includes:
And step 504, generating a JMeter script according to the JMeter script configuration parameters and the JMeter script template, and taking the generated JMeter script as a test script.
In the above embodiment, the test script corresponding to the pressure test instruction obtained by the universal test framework may be a pre-compiled test script, or a test script generated according to the test script template corresponding to the pressure test instruction and the script configuration parameters, and it is not necessary to re-compile the script every time of the test, which reduces the test preparation time and further improves the test efficiency.
In specific implementation, in order to improve the generation efficiency of the test script, the pressure test instruction may further include a JMeter script configuration parameter, and at this time, the universal test framework may directly acquire the JMeter script configuration parameter from the pressure test instruction when receiving the pressure test instruction, and then generate the required test script according to the JMeter script configuration parameter and the JMeter script template.
It should be understood that although the various steps in the flow charts of fig. 2-5 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-5 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternating with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 6, there is provided an interface test apparatus including:
a target interface determination module 120, configured to determine, in response to the pressure measurement instruction, a target interface associated with the pressure measurement instruction;
a first obtaining module 140, configured to obtain original test data for testing a target interface, and determine a data source type of the original test data, where the data source type of the original test data is an offline source or an online source;
the second obtaining module 160 is configured to process the original test data according to a processing manner corresponding to the data source type to obtain target test data;
and the test operation module 180 is configured to obtain a test script corresponding to the pressure test instruction, operate the test script in a preset test environment, and test the target interface based on the target test data after the test script is operated.
In one embodiment, the second obtaining module 160 includes:
the offline acquisition unit is used for acquiring user configuration parameter information when the data source type of the original test data is determined to be an offline source, and acquiring target test data according to the user configuration parameter information and the original test data;
and the on-line acquisition unit is used for analyzing the original test data to obtain the target test data when the data source type of the original test data is determined to be the on-line source.
In an embodiment, the offline acquisition unit may be configured to generate an interface request template according to the user configuration parameter information, where the interface request template includes a plurality of replaceable parameters, and the original test data includes a plurality of parameter data for replacing each parameter in the interface request template; and replacing each parameter in the interface request template by using each parameter data in the offline original test data to obtain test data, and taking the obtained test data as target test data.
In one embodiment, the above apparatus further comprises:
the test index information acquisition module is used for acquiring test index information corresponding to the target interface after the target interface is tested by running the test script;
the device comprises a test index information storage module and/or a test index information display module, wherein the test index information storage module is used for sending the test index information corresponding to the target interface to a preset address for storage, and/or the test index information display module is used for displaying the test index information corresponding to the target interface on the terminal interface.
In an embodiment, the target interface includes at least one interface in the OSP system to be tested, the pressure test instruction includes a version number of the OSP system to be tested, the preset test environment is a JMeter test environment, the test running module 180 may be configured to obtain a JMeter script of a version corresponding to the version number of the OSP system to be tested, and use the JMeter script of the version corresponding to the version number of the OSP system to be tested as the test script; or, the test running module 180 may be configured to obtain a JMeter script template of a version corresponding to the version number of the OSP system to be tested and a JMeter script configuration parameter corresponding to the JMeter script template, generate a JMeter script according to the JMeter script configuration parameter and the JMeter script template, and use the generated JMeter script as a test script; preferably, the pressure test instructions further comprise JMeter script configuration parameters.
In an embodiment, the pressure test instruction includes an interface name of at least one interface to be tested, and a service name and a service version number of a service in which the interface to be tested is located, and the target interface determining module 120 may be configured to determine the target interface according to the service name, the service version number, and the interface name of the interface to be tested.
In one embodiment, the user configuration parameter information includes a domain name of a domain where the target interface is located, a service name of a service where the target interface is located, an interface name of the target interface, host information where the target interface is located, and test thread setting information; preferably, the test thread setup information includes the number of bus threads of the JMeter thread expected to be used, the time of creating the expected use of all JMeter threads, the gradual boosting identification information, and the test duration.
For the specific definition of the interface testing device, reference may be made to the definition of the interface testing method above, and details are not described here. The modules in the interface testing device can be wholly or partially implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 7. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement an interface testing method.
Those skilled in the art will appreciate that the architecture shown in fig. 7 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program: determining a target interface associated with the pressure measurement instruction in response to the pressure measurement instruction; acquiring original test data for testing a target interface, and determining the data source type of the original test data, wherein the data source type of the original test data is an offline source or an online source; processing the original test data according to a processing mode corresponding to the data source type to obtain target test data; and obtaining a test script corresponding to the pressure test instruction, running the test script under a preset test environment, and testing the target interface based on target test data after the test script is run.
In an embodiment, when the processor executes the computer program to perform the step of processing the original test data according to the processing mode corresponding to the data source type to obtain the target test data, the following steps are specifically performed: when the data source type of the original test data is determined to be an offline source, user configuration parameter information is obtained, and target test data are obtained according to the user configuration parameter information and the original test data; and when the data source type of the original test data is determined to be an online source, analyzing the original test data to obtain target test data.
In one embodiment, when the processor executes the computer program to implement the step of obtaining the target test data according to the user configuration parameter information and the original test data, the following steps are specifically implemented: generating an interface request template according to the user configuration parameter information, wherein the interface request template comprises a plurality of replaceable parameters, and the original test data comprises a plurality of parameter data for replacing each parameter in the interface request template; and replacing each parameter in the interface request template by using each parameter data in the offline original test data to obtain test data, and taking the obtained test data as target test data.
In one embodiment, the processor, when executing the computer program, further performs the steps of: after a test script is operated to test a target interface, obtaining test index information corresponding to the target interface; and sending the test index information corresponding to the target interface to a preset address for storage, and/or displaying the test index information corresponding to the target interface on the terminal interface.
In one embodiment, the target interface includes at least one interface in an OSP system to be tested, the pressure test instruction includes a version number of the OSP system to be tested, the preset test environment is a JMeter test environment, and when the processor executes the computer program, the step of obtaining the test script corresponding to the pressure test instruction is implemented, the following steps are implemented specifically: acquiring a JMeter script of a version corresponding to the version number of the OSP system to be tested, and taking the JMeter script of the version corresponding to the version number of the OSP system to be tested as a test script; or acquiring a JMeter script template of a version corresponding to the version number of the OSP system to be tested and JMeter script configuration parameters corresponding to the JMeter script template, generating a JMeter script according to the JMeter script configuration parameters and the JMeter script template, and taking the generated JMeter script as a test script; preferably, the pressure test instructions further comprise JMeter script configuration parameters.
In one embodiment, the pressure measurement instruction includes an interface name of at least one interface to be measured, and a service name and a service version number of a service in which the interface to be measured is located, and when the processor executes the computer program, the following steps are specifically implemented when determining the target interface associated with the pressure measurement instruction in response to the pressure measurement instruction: and determining the target interface according to the service name, the service version number and the interface name of the interface to be tested.
In one embodiment, the user configuration parameter information includes a domain name of a domain where the target interface is located, a service name of a service where the target interface is located, an interface name of the target interface, host information where the target interface is located, and test thread setting information; preferably, the test thread setup information includes the number of bus threads of the JMeter thread expected to be used, the time of creating the expected use of all JMeter threads, the gradual boosting identification information, and the test duration.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of: determining a target interface associated with the pressure measurement instruction in response to the pressure measurement instruction; acquiring original test data for testing a target interface, and determining the data source type of the original test data, wherein the data source type of the original test data is an offline source or an online source; processing the original test data according to a processing mode corresponding to the data source type to obtain target test data; and obtaining a test script corresponding to the pressure test instruction, running the test script under a preset test environment, and testing the target interface based on target test data after the test script is run.
In an embodiment, when the computer program is executed by the processor to implement the step of processing the original test data according to the processing mode corresponding to the data source type to obtain the target test data, the following steps are specifically implemented: when the data source type of the original test data is determined to be an offline source, user configuration parameter information is obtained, and target test data are obtained according to the user configuration parameter information and the original test data; and when the data source type of the original test data is determined to be an online source, analyzing the original test data to obtain target test data.
In one embodiment, when the computer program is executed by the processor to implement the step of obtaining the target test data according to the user configuration parameter information and the original test data, the following steps are specifically implemented: generating an interface request template according to the user configuration parameter information, wherein the interface request template comprises a plurality of replaceable parameters, and the original test data comprises a plurality of parameter data for replacing each parameter in the interface request template; and replacing each parameter in the interface request template by using each parameter data in the offline original test data to obtain test data, and taking the obtained test data as target test data.
In one embodiment, the computer program when executed by the processor further performs the steps of: after a test script is operated to test a target interface, obtaining test index information corresponding to the target interface; and sending the test index information corresponding to the target interface to a preset address for storage, and/or displaying the test index information corresponding to the target interface on the terminal interface.
In one embodiment, the target interface includes at least one interface in an OSP system to be tested, the pressure test instruction includes a version number of the OSP system to be tested, the preset test environment is a JMeter test environment, and when the computer program is executed by the processor to implement the step of obtaining the test script corresponding to the pressure test instruction, the following steps are specifically implemented: acquiring a JMeter script of a version corresponding to the version number of the OSP system to be tested, and taking the JMeter script of the version corresponding to the version number of the OSP system to be tested as a test script; or acquiring a JMeter script template of a version corresponding to the version number of the OSP system to be tested and JMeter script configuration parameters corresponding to the JMeter script template, generating a JMeter script according to the JMeter script configuration parameters and the JMeter script template, and taking the generated JMeter script as a test script; preferably, the pressure test instructions further comprise JMeter script configuration parameters.
In an embodiment, the pressure measurement instruction includes an interface name of at least one interface to be measured, and a service name and a service version number of a service in which the interface to be measured is located, and when the computer program is executed by the processor, the following steps are specifically implemented when the target interface associated with the pressure measurement instruction is determined in response to the pressure measurement instruction: and determining the target interface according to the service name, the service version number and the interface name of the interface to be tested.
In one embodiment, the user configuration parameter information includes a domain name of a domain where the target interface is located, a service name of a service where the target interface is located, an interface name of the target interface, host information where the target interface is located, and test thread setting information; preferably, the test thread setup information includes the number of bus threads of the JMeter thread expected to be used, the time of creating the expected use of all JMeter threads, the gradual boosting identification information, and the test duration.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.
Claims (10)
1. An interface testing method, the method comprising:
determining a target interface associated with a pressure measurement instruction in response to the pressure measurement instruction;
acquiring original test data for testing the target interface, and determining the data source type of the original test data, wherein the data source type of the original test data is an offline source or an online source;
processing the original test data according to a processing mode corresponding to the data source type to obtain target test data;
and acquiring a test script corresponding to the pressure test instruction, operating the test script in a preset test environment, and testing the target interface based on the target test data after the test script is operated.
2. The method of claim 1, wherein the processing the original test data according to the processing manner corresponding to the data source type to obtain target test data comprises:
when the data source type of the original test data is determined to be an offline source, acquiring user configuration parameter information, and acquiring the target test data according to the user configuration parameter information and the original test data;
and when the data source type of the original test data is determined to be an online source, analyzing the original test data to obtain the target test data.
3. The method of claim 2, wherein obtaining the target test data according to the user configuration parameter information and the raw test data comprises:
generating an interface request template according to the user configuration parameter information, wherein the interface request template comprises a plurality of replaceable parameters, and the original test data comprises a plurality of parameter data for replacing each parameter in the interface request template;
and replacing each parameter in the interface request template by using each parameter data in the offline original test data to obtain test data, and using the obtained test data as the target test data.
4. The method of claim 1, further comprising:
after the test script is operated to test the target interface, acquiring test index information corresponding to the target interface;
and sending the test index information corresponding to the target interface to a preset address for storage, and/or displaying the test index information corresponding to the target interface on a terminal interface.
5. The method according to any one of claims 1 to 4, wherein the target interface comprises at least one interface in an OSP system to be tested, the pressure test command comprises a version number of the OSP system to be tested, the preset test environment is a JMeter test environment, and the obtaining of the test script corresponding to the pressure test command comprises:
acquiring a JMeter script of a version corresponding to the version number of the OSP system to be tested, and taking the JMeter script of the version corresponding to the version number of the OSP system to be tested as the test script;
or acquiring a JMeter script template of a version corresponding to the version number of the OSP system to be tested and JMeter script configuration parameters corresponding to the JMeter script template, generating a JMeter script according to the JMeter script configuration parameters and the JMeter script template, and taking the generated JMeter script as the test script; preferably, the pressure test instruction further comprises the JMeter script configuration parameter.
6. The method according to claim 5, wherein the pressure test instruction includes an interface name of at least one interface to be tested, and a service name and a service version number of a service in which the interface to be tested is located, and the determining, in response to the pressure test instruction, a target interface associated with the pressure test instruction includes:
and determining the target interface according to the service name, the service version number and the interface name of the interface to be tested.
7. The method according to claim 2, wherein the user configuration parameter information includes a domain name of a domain where the target interface is located, a service name of a service where the target interface is located, an interface name of the target interface, host information where the target interface is located, and test thread setting information; preferably, the test thread setting information includes the number of bus threads of the JMeter thread expected to be used, the time of creating the expected use of all the JMeter threads, the gradual boosting identification information, and the test duration.
8. An interface testing apparatus, the apparatus comprising:
the target interface determining module is used for responding to a pressure measurement instruction to determine a target interface associated with the pressure measurement instruction;
the first obtaining module is used for obtaining original test data for testing the target interface and determining the data source type of the original test data, wherein the data source type of the original test data is an offline source or an online source;
the second acquisition module is used for processing the original test data according to a processing mode corresponding to the data source type to obtain target test data;
and the test operation module is used for acquiring a test script corresponding to the pressure test instruction, operating the test script in a preset test environment, and testing the target interface based on the target test data after the test script is operated.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method of any of claims 1 to 7 are implemented when the computer program is executed by the processor.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011471641.7A CN112486838A (en) | 2020-12-14 | 2020-12-14 | Interface testing method and device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011471641.7A CN112486838A (en) | 2020-12-14 | 2020-12-14 | Interface testing method and device, computer equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112486838A true CN112486838A (en) | 2021-03-12 |
Family
ID=74917060
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011471641.7A Pending CN112486838A (en) | 2020-12-14 | 2020-12-14 | Interface testing method and device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112486838A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113342670A (en) * | 2021-06-22 | 2021-09-03 | 平安普惠企业管理有限公司 | Interface test method, device, equipment and medium |
CN113742217A (en) * | 2021-08-03 | 2021-12-03 | 北京达佳互联信息技术有限公司 | Performance test method, equipment and storage medium |
Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104410542A (en) * | 2014-11-18 | 2015-03-11 | 小米科技有限责任公司 | Method and device for simulation test |
CN106383786A (en) * | 2016-09-27 | 2017-02-08 | 北京金山安全软件有限公司 | Interface pressure performance testing method and device and electronic equipment |
US20180173812A1 (en) * | 2016-12-19 | 2018-06-21 | American Express Travel Related Services Company, Inc. | Systems and methods for parsing and ingesting data in big data environments |
CN108804327A (en) * | 2018-06-12 | 2018-11-13 | 北京京东金融科技控股有限公司 | A kind of method and apparatus of automatic Data Generation Test |
CN109165168A (en) * | 2018-09-14 | 2019-01-08 | 杭州云创共享网络科技有限公司 | A kind of method for testing pressure, device, equipment and medium |
CN109873731A (en) * | 2017-12-05 | 2019-06-11 | 北京京东尚科信息技术有限公司 | Test method, device and system |
CN110287120A (en) * | 2019-06-28 | 2019-09-27 | 深圳前海微众银行股份有限公司 | A kind of unit test system and test method |
CN111274115A (en) * | 2018-12-04 | 2020-06-12 | 北京京东尚科信息技术有限公司 | Verification method and device for system reconfiguration |
CN111309570A (en) * | 2019-11-19 | 2020-06-19 | 天津网之易创新科技有限公司 | Pressure testing method, medium, device and computing equipment |
CN111324526A (en) * | 2018-12-14 | 2020-06-23 | 北京金山云网络技术有限公司 | Interface test system, method and server |
CN111400179A (en) * | 2020-03-13 | 2020-07-10 | 苏宁云计算有限公司 | Method and device for terminal application program interaction, computer equipment and storage medium |
-
2020
- 2020-12-14 CN CN202011471641.7A patent/CN112486838A/en active Pending
Patent Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104410542A (en) * | 2014-11-18 | 2015-03-11 | 小米科技有限责任公司 | Method and device for simulation test |
CN106383786A (en) * | 2016-09-27 | 2017-02-08 | 北京金山安全软件有限公司 | Interface pressure performance testing method and device and electronic equipment |
US20180173812A1 (en) * | 2016-12-19 | 2018-06-21 | American Express Travel Related Services Company, Inc. | Systems and methods for parsing and ingesting data in big data environments |
CN109873731A (en) * | 2017-12-05 | 2019-06-11 | 北京京东尚科信息技术有限公司 | Test method, device and system |
CN108804327A (en) * | 2018-06-12 | 2018-11-13 | 北京京东金融科技控股有限公司 | A kind of method and apparatus of automatic Data Generation Test |
CN109165168A (en) * | 2018-09-14 | 2019-01-08 | 杭州云创共享网络科技有限公司 | A kind of method for testing pressure, device, equipment and medium |
CN111274115A (en) * | 2018-12-04 | 2020-06-12 | 北京京东尚科信息技术有限公司 | Verification method and device for system reconfiguration |
CN111324526A (en) * | 2018-12-14 | 2020-06-23 | 北京金山云网络技术有限公司 | Interface test system, method and server |
CN110287120A (en) * | 2019-06-28 | 2019-09-27 | 深圳前海微众银行股份有限公司 | A kind of unit test system and test method |
CN111309570A (en) * | 2019-11-19 | 2020-06-19 | 天津网之易创新科技有限公司 | Pressure testing method, medium, device and computing equipment |
CN111400179A (en) * | 2020-03-13 | 2020-07-10 | 苏宁云计算有限公司 | Method and device for terminal application program interaction, computer equipment and storage medium |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113342670A (en) * | 2021-06-22 | 2021-09-03 | 平安普惠企业管理有限公司 | Interface test method, device, equipment and medium |
CN113742217A (en) * | 2021-08-03 | 2021-12-03 | 北京达佳互联信息技术有限公司 | Performance test method, equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109302522B (en) | Test method, test device, computer system, and computer medium | |
CN109460527B (en) | Product data configuration method, device, computer equipment and storage medium | |
CN108388515B (en) | Test data generation method, device, equipment and computer readable storage medium | |
CN111078339B (en) | Interface element positioning method and device, computer equipment and storage medium | |
CN109491891A (en) | Full-automatic interface pressure surveys method, apparatus, computer equipment and storage medium | |
CN109683982B (en) | MES system control method, MES system control device, computer equipment, and storage medium | |
CN110764998B (en) | Data comparison method, device, equipment and storage medium based on Django framework | |
CN110704312B (en) | Method, device, computer equipment and storage medium for pressure test | |
CN112115005B (en) | Test data acquisition method and device, computer equipment and storage medium | |
CN111240984A (en) | Abnormal page identification method and device, computer equipment and storage medium | |
CN112486838A (en) | Interface testing method and device, computer equipment and storage medium | |
CN111414309B (en) | Automatic test method of application program, computer equipment and storage medium | |
CN110798376A (en) | Interface testing method and device, computer equipment and storage medium | |
CN107045475B (en) | Test method and device | |
CN111797026A (en) | Test case generation method and device, computer equipment and storage medium | |
CN114465937A (en) | Network card testing method, device, server, medium, and computer program product | |
CN112395187A (en) | Test method, test system, computer device and storage medium | |
CN110750443A (en) | Webpage testing method and device, computer equipment and storage medium | |
CN115617780A (en) | Data import method, device, equipment and storage medium | |
CN114385485A (en) | Interface test method, device, equipment and storage medium | |
CN112416762A (en) | API test method and device, equipment and computer readable storage medium | |
CN109783377A (en) | Test data acquisition methods, tool, computer equipment and storage medium | |
CN110704218B (en) | Data processing method, data processing device, computer equipment and storage medium | |
CN112486824B (en) | Case code generation method, device, computer equipment and storage medium | |
CN112416781A (en) | Cross-system interface determination method and device, computer equipment and storage medium |
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 |