CN112148601A - Interface testing method and device, electronic equipment and storage medium - Google Patents
Interface testing method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN112148601A CN112148601A CN202010976575.2A CN202010976575A CN112148601A CN 112148601 A CN112148601 A CN 112148601A CN 202010976575 A CN202010976575 A CN 202010976575A CN 112148601 A CN112148601 A CN 112148601A
- Authority
- CN
- China
- Prior art keywords
- interface
- tested
- target data
- testing
- preset
- 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 75
- 238000000034 method Methods 0.000 claims abstract description 24
- 238000013075 data extraction Methods 0.000 claims abstract description 19
- 230000015654 memory Effects 0.000 claims description 35
- 238000010998 test method Methods 0.000 claims description 3
- 230000008569 process Effects 0.000 description 6
- 238000012545 processing Methods 0.000 description 6
- 239000000284 extract Substances 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000001360 synchronised effect Effects 0.000 description 4
- 230000006870 function Effects 0.000 description 3
- 230000003993 interaction Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 210000001072 colon Anatomy 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000007257 malfunction Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000000391 smoking effect Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000006467 substitution reaction 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/3668—Software testing
- G06F11/3672—Test management
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 embodiment of the invention relates to an interface testing method, an interface testing device, electronic equipment and a storage medium, wherein the method comprises the following steps: testing a first interface to be tested according to a preset interface execution sequence to obtain a return value of the first interface to be tested; performing data extraction on the return value based on a preset keyword to obtain target data corresponding to the keyword; and taking the target data as the input parameter of a second interface to be tested, and testing the second interface to be tested according to the interface execution sequence, wherein the second interface to be tested depends on the first interface to be tested. Therefore, the return value of the previous interface can be automatically extracted, and the extracted return value is used as the input parameter of the next interface.
Description
Technical Field
The embodiment of the invention relates to the technical field of testing, in particular to an interface testing method and device, electronic equipment and a storage medium.
Background
During the test process, it is often encountered that some interfaces are logically associated in business, and specifically, the return value of the previous interface is needed to be taken as the parameter of the next interface to be participated in. Currently, in this case, the next interface is typically referred to manually by the tester, i.e. a specific reference value is written in the interface code.
However, such processing not only results in an increase in the amount of code, but also easily results in technical problems of interface test failure or malfunction due to an entry parameter error, thereby reducing interface test efficiency.
Disclosure of Invention
In view of this, embodiments of the present invention provide an interface testing method, an apparatus, an electronic device, and a storage medium, so as to automatically extract a return value of a previous interface, and use the extracted return value as an input parameter of a next interface, thereby reducing a code amount and improving interface testing efficiency.
In a first aspect, an embodiment of the present invention provides an interface testing method, including:
testing a first interface to be tested according to a preset interface execution sequence to obtain a return value of the first interface to be tested;
performing data extraction on the return value based on preset keywords to obtain target data;
and taking the target data as the input parameter of a second interface to be tested, and testing the second interface to be tested according to the interface execution sequence, wherein the second interface to be tested depends on the first interface to be tested.
In a possible embodiment, after the obtaining the target data, the method further includes:
setting a corresponding variable name for the target data;
storing the variable name and the target data in a Map set in a key-value pair form.
In a possible embodiment, the taking the target data as an input parameter of the second interface to be tested includes:
finding a corresponding key value from the Map set based on the variable name contained in the second interface to be tested;
and taking the searched key value as the input parameter of the second interface to be tested.
In a possible implementation manner, the extracting data of the return value based on a preset keyword to obtain target data corresponding to the keyword includes:
inputting the return value into a preset data extractor, performing data extraction on the return value by the data extractor based on a preset keyword, and outputting extracted target data.
In one possible embodiment, the variable name is set by:
and the data extractor generates a variable name corresponding to the keyword according to a preset variable name generation rule based on the keyword.
In a second aspect, an embodiment of the present invention provides an interface testing apparatus, including:
the first testing module is used for testing a first interface to be tested according to a preset interface execution sequence to obtain a return value of the first interface to be tested;
the data extraction module is used for extracting data of the return value based on preset keywords to obtain target data corresponding to the keywords;
the parameter input module is used for taking the target data as parameters of a second interface to be tested;
and the second testing module is used for testing the second interface to be tested according to the interface execution sequence, and the second interface to be tested depends on the first interface to be tested.
In one possible embodiment, the apparatus further comprises:
and the storage module is used for storing the target data and a preset variable name in a Map set in a key-value pair mode.
In a possible implementation manner, the entering module takes the target data as an entering parameter of the second interface to be tested, and includes:
finding a corresponding key value from the Map set based on the variable name contained in the second interface to be tested;
and taking the searched key value as the input parameter of the second interface to be tested.
In a possible implementation manner, the data extraction module performs data extraction on the return value based on a preset keyword to obtain target data corresponding to the keyword, including:
inputting the return value into a preset data extractor, performing data extraction on the return value by the data extractor based on a preset keyword, and outputting extracted target data.
In a third aspect, an embodiment of the present invention provides an electronic device, including: a processor and a memory, the processor being configured to execute an interface test program stored in the memory to implement the interface test method of any one of the first aspect.
In a fourth aspect, an embodiment of the present invention provides a storage medium, where one or more programs are stored, and the one or more programs are executable by one or more processors to implement the interface testing method according to any one of the first aspects.
According to the technical scheme provided by the embodiment of the invention, the return value of the first interface to be tested is obtained by testing the first interface to be tested according to the preset interface execution sequence, the preset data extractor is called to extract the data of the return value to obtain the target data, and the second interface to be tested is tested according to the interface execution sequence, wherein when the second interface to be tested is tested, the target data is obtained and is used as the input parameter of the second interface to be tested, so that the return value of the previous interface can be automatically extracted in the interface testing process, and the extracted return value is used as the input parameter of the next interface.
Meanwhile, when a tester writes interface codes, specific input parameters do not need to be set for the interfaces, so that the code amount can be reduced, manual errors can be avoided, and the interface testing efficiency is improved.
Drawings
FIG. 1 is a schematic of an interface code;
FIG. 2 is a schematic of another interface code;
FIG. 3 is a flowchart illustrating an embodiment of a method for testing an interface according to an exemplary embodiment of the present invention;
FIG. 4 is a flowchart illustrating an embodiment of another method for testing an interface according to an exemplary embodiment of the present invention;
FIG. 5 is a block diagram of an embodiment of an interface testing apparatus according to an exemplary embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
During the test process, it is often encountered that some interfaces are logically related to each other in business, and specifically, the return value of the previous interface is needed to be taken as a parameter of the next interface to be participated in, that is, the next interface needs to depend on the previous interface. This involves extracting the data required by the next interface from the return value of the previous interface for the next interface to participate as a parameter.
For example, the return value of the interface shown in fig. 1 includes 4 data, which are "apply no", "code", "msg" and "traced", respectively, and the interface shown in fig. 2 needs the "apply no" therein as a parameter to be entered, so that a specific value of the "apply no" is extracted from the return value of the interface shown in fig. 1, so as to be entered as a parameter by the interface shown in fig. 2.
Based on the above, the invention provides an interface testing method, so as to automatically extract data required by a next interface from a return value of a previous interface in a testing process, and take the extracted data as a parameter of the next interface to be entered into a parameter.
It should be noted that the concept of the next interface described above is broad and may include all interfaces that are executed after the previous interface and depend on the previous interface. For example, assuming that the test case includes 3 interfaces in total, the interfaces are interface 1, interface 2, and interface 3 according to the execution order of the interfaces, and assuming that the return value of interface 1 is referred to as the parameter of interface 2 and interface 3, the next interface described above includes interface 2 and interface 3, and does not refer to only interface 2.
The interface testing method proposed by the present invention will be further explained with specific embodiments in conjunction with the drawings, and the embodiments do not limit the embodiments of the present invention.
Referring to fig. 3, a flowchart of an embodiment of an interface testing method provided for an exemplary embodiment of the present invention includes the following steps:
In the embodiment of the present invention, the first interface to be tested refers to the previous interface described above, that is, the interface whose return value needs to be referred to as a parameter of the next interface, such as the interface illustrated in fig. 1.
As an embodiment, in practice, the first interface to be tested is generally the first interface to be tested, i.e. the interface with the execution order of 1. In an exemplary scenario, it is assumed that the smoking test for the user registration process is divided into two steps, where in the first step, identity information of the user, such as an identification number, needs to be input to obtain personal information of the user, and in the second step, the personal information of the user needs to be obtained to query information of a bank card under a user name, so that input in the second step depends on output in the first step, that is, an interface 2 (an interface with an execution sequence of 2, referred to as interface 2) is entered with a return value of an interface 1 (an interface with an execution sequence of 1, referred to as interface 1 for short) as a parameter.
And 302, extracting data of the return value based on a preset keyword to obtain target data corresponding to the keyword.
As an embodiment, in this step 302, a preset data extractor may be called, the return value of the first interface to be tested is input into the data extractor, so that the data extractor performs data extraction on the input return value based on a preset keyword, so as to extract data (hereinafter referred to as target data) corresponding to the keyword, and output the target data. Optionally, the preset data extractor may be called by Dobbo (which is a distributed service framework) or jsf, or may be called by introducing a third-party toolkit.
In practice, before the interface test is performed, a tester sets the keywords to be extracted by the data extractor, for example, the keywords to be extracted by the data extractor may be input in an interface interaction manner. In this way, after the return value of the first interface to be tested is input into the data extractor, the data extractor may extract the target data corresponding to the preset keyword from the input return value.
Further, the data extractor performs data extraction on the input return value, and the data extractor includes: the data extractor first determines the data format of the incoming return value, where the data format includes, but is not limited to: json format, string format, after which the data extractor extracts the target data based on the data format of the return value and the keyword.
For example, the interface shown in FIG. 1 returns a json format, which writes a name/value pair that includes a field name (in a double quotation mark), followed by a colon, and then a value (in a double quotation mark). Based on this, the data extractor first finds the key from the double quotation marks, assuming applyNo, and then determines the data 1250976151300476929 located in the double quotation marks following the found key as the target data.
In addition, it should be noted that, in practice, one or more keywords to be extracted may be set for the data extractor according to actual service needs, that is, in different service scenarios, the keywords to be extracted by the data extractor may be different, and in the same service scenario, the keywords to be extracted by the data extractors corresponding to different interfaces may also be different.
And 303, taking the target data as the input parameter of the second interface to be tested, and testing the second interface to be tested according to the interface execution sequence, wherein the second interface to be tested depends on the first interface to be tested.
In this embodiment of the present invention, the second interface to be tested refers to the next interface described above, that is, an interface that needs to use the return value of the first interface to be tested as a parameter to enter into a parameter, such as the interface illustrated in fig. 2.
As can be seen from the above step 302, in practice, one or more parameters related to the next interface are preset as keywords to be extracted by the data extractor, and based on this, in this step 303, when the second interface to be tested is tested, the target data obtained in step 302 may be obtained, and the target data may be used as the input parameter of the second interface to be tested.
According to the technical scheme provided by the embodiment of the invention, the return value of the first interface to be tested is obtained by testing the first interface to be tested according to the preset interface execution sequence, the preset data extractor is called to extract the data of the return value to obtain the target data, and the second interface to be tested is tested according to the interface execution sequence, wherein when the second interface to be tested is tested, the target data is obtained and is used as the input parameter of the second interface to be tested, so that the return value of the previous interface can be automatically extracted in the interface testing process, and the extracted return value is used as the input parameter of the next interface.
Meanwhile, when a tester writes interface codes, specific input parameters do not need to be set for the interfaces, so that the code amount can be reduced, manual errors can be avoided, and the interface testing efficiency is improved.
Referring to fig. 4, a flowchart of another embodiment of an interface testing method according to an exemplary embodiment of the present invention is provided, where the flowchart includes the following steps based on the flowchart shown in fig. 3:
And step 402, calling a preset data extractor to extract data of the return value to obtain target data.
The detailed descriptions of steps 401-402 can be found in the descriptions of steps 301-302 above, and are not detailed here.
And step 403, storing the target data and the corresponding variable name in a Map set in a key-value pair mode.
As an embodiment, the data extractor may further output a variable name corresponding to the target data, based on which, in this step 403, the target data and the corresponding variable name may be stored in the Map set in a key-value pair manner.
As an optional implementation manner, the variable name corresponding to the target data is preset, for example, a tester may set the variable name corresponding to the target data to be extracted in an interface interaction manner before performing an interface test.
As another alternative implementation manner, the data extractor may automatically generate a variable name corresponding to a keyword, that is, a variable name corresponding to target data to be extracted, according to a preset variable name generation rule based on the keyword set by the tester.
In one example, the variable name generation rule is: the variable name is $ { applyNo }. The processing can meet the character string matching rule in the current java language.
It should be noted that, regardless of the way in which the variable name corresponding to the target data is set, the variable name is consistent with the variable name corresponding to the same variable in the second interface under test.
Further, in this step 403, the target data and the corresponding variable name may be stored in the Map set in the form of a key-value pair.
It should be noted that storing the variable name and the target data in the Map set in the form of a key-value pair is only one implementation way of storing the target data and the corresponding variable name, and in an application, the target data and the corresponding variable name may also be stored in other ways, for example, in the form of a table, which is not limited in this disclosure.
And 405, testing the second interface to be tested according to the interface execution sequence.
In the flow shown in fig. 4, target data and corresponding variable names are stored in the Map set in a key-value pair manner, so that when there are a plurality of interfaces that need to have the return value of more than one interface as a parameter to be entered, it is not necessary to repeatedly extract the return value of the previous interface many times, thereby improving the efficiency of interface testing.
Corresponding to the embodiment of the interface testing method, the invention also provides an embodiment of the interface testing device.
Referring to fig. 5, a block diagram of an embodiment of an interface testing apparatus according to an exemplary embodiment of the present invention is provided. As shown in fig. 5, the apparatus includes: a first testing module 51, a data extracting module 52, a parameter inputting module 53 and a second testing module 54.
The first testing module 51 is configured to test a first interface to be tested according to a preset interface execution sequence, so as to obtain a return value of the first interface to be tested.
The first interface to be tested refers to an interface for which a return value needs to be referred to as a parameter of a next interface, such as the interface illustrated in fig. 1.
The data extraction module 52 is configured to perform data extraction on the return value based on a preset keyword to obtain target data corresponding to the keyword;
as an embodiment, the data extraction module 52 may be a data extractor, and the return value of the first interface to be tested is input into the data extractor, so that the data extractor performs data extraction on the input return value based on a preset keyword to extract target data corresponding to the keyword.
And the parameter entering module 53 is configured to use the target data as a parameter entering the second interface to be tested.
The second interface to be tested refers to an interface that needs to use the return value of the first interface to be tested as a parameter, such as the interface illustrated in fig. 2.
A second testing module 54, configured to test the second interface to be tested according to the interface execution sequence, where the second interface to be tested depends on the first interface to be tested.
In a possible embodiment, the device further comprises (not shown in fig. 5):
and the storage module is used for storing the target data and a preset variable name in a Map set in a key-value pair mode.
In a possible embodiment, the entering module 53 uses the target data as an entering parameter of the second interface to be tested, including:
finding a corresponding key value from the Map set based on the variable name contained in the second interface to be tested;
and taking the searched key value as the input parameter of the second interface to be tested. Therefore, the target data and the corresponding variable names are stored in the Map set in the form of key value pairs, so that the return value of the previous interface does not need to be repeatedly extracted for many times under the condition that a plurality of interfaces which need the return value of the previous interface as a parameter are accessed into the parameter, and the interface testing efficiency is improved.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, where the electronic device 600 shown in fig. 6 includes: at least one processor 601, memory 602, at least one network interface 604, and other user interfaces 603. The various components in the electronic device 600 are coupled together by a bus system 605. It is understood that the bus system 605 is used to enable communications among the components. The bus system 605 includes a power bus, a control bus, and a status signal bus in addition to a data bus. For clarity of illustration, however, the various buses are labeled as bus system 605 in fig. 6.
The user interface 603 may include, among other things, a display, a keyboard, or a pointing device (e.g., a mouse, trackball, touch pad, or touch screen, among others.
It will be appreciated that the memory 602 in embodiments of the invention may be either volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The non-volatile memory may be a Read-only memory (ROM), a programmable Read-only memory (PROM), an erasable programmable Read-only memory (erasabprom, EPROM), an electrically erasable programmable Read-only memory (EEPROM), or a flash memory. The volatile memory may be a Random Access Memory (RAM) which functions as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (staticiram, SRAM), dynamic random access memory (dynamic RAM, DRAM), synchronous dynamic random access memory (syncronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM ), Enhanced Synchronous DRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and direct memory bus RAM (DRRAM). The memory 602 described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
In some embodiments, memory 602 stores the following elements, executable units or data structures, or a subset thereof, or an expanded set thereof: an operating system 6021 and application programs 6022.
The operating system 6021 includes various system programs, such as a framework layer, a core library layer, a driver layer, and the like, and is used for implementing various basic services and processing hardware-based tasks. The application program 6022 includes various application programs such as a media player (MediaPlayer), a Browser (Browser), and the like, and is used to implement various application services. A program implementing the method of an embodiment of the invention can be included in the application program 6022.
In the embodiment of the present invention, by calling a program or an instruction stored in the memory 602, specifically, a program or an instruction stored in the application program 6022, the processor 601 is configured to execute the method steps provided by the method embodiments, for example, including:
testing a first interface to be tested according to a preset interface execution sequence to obtain a return value of the first interface to be tested;
performing data extraction on the return value based on a preset keyword to obtain target data corresponding to the keyword;
and taking the target data as the input parameter of a second interface to be tested, and testing the second interface to be tested according to the interface execution sequence, wherein the second interface to be tested depends on the first interface to be tested.
The method disclosed by the above-mentioned embodiment of the present invention can be applied to the processor 601, or implemented by the processor 601. The processor 601 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 601. The processor 601 may be a general-purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, or discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software elements in the decoding processor. The software elements may be located in ram, flash, rom, prom, or eprom, registers, among other storage media that are well known in the art. The storage medium is located in the memory 602, and the processor 601 reads the information in the memory 602 and completes the steps of the method in combination with the hardware thereof.
It is to be understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or any combination thereof. For a hardware implementation, the processing units may be implemented within one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), general purpose processors, controllers, micro-controllers, microprocessors, other electronic units configured to perform the functions described herein, or a combination thereof.
For a software implementation, the techniques described herein may be implemented by means of units performing the functions described herein. The software codes may be stored in a memory and executed by a processor. The memory may be implemented within the processor or external to the processor.
The electronic device provided in this embodiment may be the electronic device shown in fig. 6, and may perform all the steps of the interface testing method shown in fig. 3 to 4, so as to achieve the technical effect of the interface testing method shown in fig. 3 to 4, and for brevity, it is described with reference to fig. 3 to 4, which is not described herein again.
The embodiment of the invention also provides a storage medium (computer readable storage medium). The storage medium herein stores one or more programs. Among others, the storage medium may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk; the memory may also comprise a combination of memories of the kind described above.
When one or more programs in the storage medium are executable by one or more processors, the interface testing method executed on the electronic device side is realized.
The processor is used for executing the interface test program stored in the memory to realize the following steps of the interface test method executed on the electronic equipment side:
testing a first interface to be tested according to a preset interface execution sequence to obtain a return value of the first interface to be tested;
performing data extraction on the return value based on a preset keyword to obtain target data corresponding to the keyword;
and taking the target data as the input parameter of a second interface to be tested, and testing the second interface to be tested according to the interface execution sequence, wherein the second interface to be tested depends on the first interface to be tested.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware, a software module executed by a processor, or a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.
Claims (10)
1. An interface testing method, comprising:
testing a first interface to be tested according to a preset interface execution sequence to obtain a return value of the first interface to be tested;
performing data extraction on the return value based on a preset keyword to obtain target data corresponding to the keyword;
and taking the target data as the input parameter of a second interface to be tested, and testing the second interface to be tested according to the interface execution sequence, wherein the second interface to be tested depends on the first interface to be tested.
2. The method of claim 1, further comprising, after said obtaining target data:
and storing the target data and a preset variable name in a Map set in a key-value pair mode.
3. The method of claim 2, wherein the referencing the target data to the second interface under test comprises:
finding a corresponding key value from the Map set based on the variable name contained in the second interface to be tested;
and taking the searched key value as the input parameter of the second interface to be tested.
4. The method according to claim 2, wherein the data extraction of the return value based on a preset keyword to obtain target data corresponding to the keyword comprises:
inputting the return value into a preset data extractor, performing data extraction on the return value by the data extractor based on a preset keyword, and outputting extracted target data.
5. The method of claim 4, wherein the variable name is set by:
and the data extractor generates a variable name corresponding to the keyword according to a preset variable name generation rule based on the keyword.
6. An interface testing apparatus, comprising:
the first testing module is used for testing a first interface to be tested according to a preset interface execution sequence to obtain a return value of the first interface to be tested;
the data extraction module is used for extracting data of the return value based on preset keywords to obtain target data corresponding to the keywords;
the parameter input module is used for taking the target data as parameters of a second interface to be tested;
and the second testing module is used for testing the second interface to be tested according to the interface execution sequence, and the second interface to be tested depends on the first interface to be tested.
7. The apparatus of claim 6, further comprising:
and the storage module is used for storing the target data and a preset variable name in a Map set in a key-value pair mode.
8. The apparatus of claim 7, wherein the reference module references the target data as a reference to the second interface under test, comprising:
finding a corresponding key value from the Map set based on the variable name contained in the second interface to be tested;
and taking the searched key value as the input parameter of the second interface to be tested.
9. An electronic device, comprising: a processor and a memory, the processor is used for executing the interface test program stored in the memory to realize the interface test method of any one of claims 1-5.
10. A storage medium storing one or more programs executable by one or more processors to implement the interface testing method of any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010976575.2A CN112148601A (en) | 2020-09-16 | 2020-09-16 | Interface testing method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010976575.2A CN112148601A (en) | 2020-09-16 | 2020-09-16 | Interface testing method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112148601A true CN112148601A (en) | 2020-12-29 |
Family
ID=73893939
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010976575.2A Pending CN112148601A (en) | 2020-09-16 | 2020-09-16 | Interface testing method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112148601A (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107861870A (en) * | 2017-11-02 | 2018-03-30 | 平安科技(深圳)有限公司 | Interface testing and test data generating method, device, terminal and storage medium |
CN109597754A (en) * | 2018-10-22 | 2019-04-09 | 中国平安财产保险股份有限公司 | Operation flow interface test method, device, computer equipment and storage medium |
CN110990250A (en) * | 2019-10-12 | 2020-04-10 | 平安医疗健康管理股份有限公司 | Interface test method, device, equipment and storage medium |
CN111026629A (en) * | 2018-10-09 | 2020-04-17 | 北京京东尚科信息技术有限公司 | Method and device for automatically generating test script |
WO2020155778A1 (en) * | 2019-02-03 | 2020-08-06 | 苏州市龙测智能科技有限公司 | Interface automation test method, test apparatus, test device and storage medium |
-
2020
- 2020-09-16 CN CN202010976575.2A patent/CN112148601A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107861870A (en) * | 2017-11-02 | 2018-03-30 | 平安科技(深圳)有限公司 | Interface testing and test data generating method, device, terminal and storage medium |
CN111026629A (en) * | 2018-10-09 | 2020-04-17 | 北京京东尚科信息技术有限公司 | Method and device for automatically generating test script |
CN109597754A (en) * | 2018-10-22 | 2019-04-09 | 中国平安财产保险股份有限公司 | Operation flow interface test method, device, computer equipment and storage medium |
WO2020155778A1 (en) * | 2019-02-03 | 2020-08-06 | 苏州市龙测智能科技有限公司 | Interface automation test method, test apparatus, test device and storage medium |
CN110990250A (en) * | 2019-10-12 | 2020-04-10 | 平安医疗健康管理股份有限公司 | Interface test method, device, equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110941546A (en) | Automatic test method, device, equipment and storage medium for WEB page case | |
CN112765023B (en) | Test case generation method and device | |
CN110928802A (en) | Test method, device, equipment and storage medium based on automatic generation of case | |
WO2023155940A1 (en) | Mini program compiling method and apparatus, mini program running method and apparatus, and storage medium | |
CN109614325B (en) | Method and device for determining control attribute, electronic equipment and storage medium | |
CN106406913B (en) | Method and system for extracting codes from project | |
CN110955608A (en) | Test data processing method and device, computer equipment and storage medium | |
CN107463485B (en) | Method stack-based log acquisition method and device and terminal | |
CN113434395A (en) | Automatic generation method, device, equipment and medium of test case | |
US20160239407A1 (en) | Small scale integration test generation | |
JP7409197B2 (en) | Elaboration of repair patterns for static analysis violations in software programs | |
JP6567212B2 (en) | Equivalence verification device and equivalence verification program | |
CN112148601A (en) | Interface testing method and device, electronic equipment and storage medium | |
CN109344385B (en) | Natural language processing method, device, computer equipment and storage medium | |
CN113282476B (en) | Interface performance testing method and device and electronic equipment | |
CN112417020B (en) | Service expansion realization method, device, computer equipment and storage medium | |
US20220156174A1 (en) | Automated identification of lines of code related to errors field | |
CN114201215A (en) | Interface document generation method and device, electronic equipment and storage medium | |
CN112540755A (en) | Front-end-based component processing method, device, equipment and storage medium | |
CN113901025A (en) | Database management method, device, equipment and storage medium | |
CN114171205A (en) | Medical data processing method and device and digital model editor | |
CN114371986A (en) | User interface test case updating method, device and storage medium | |
CN112445461A (en) | Business rule generation method and device, electronic equipment and readable storage medium | |
CN116567100A (en) | Method and device for configuring message segments | |
CN112286579B (en) | Data processing method, device, computer readable storage medium and computer equipment |
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 | ||
CB02 | Change of applicant information |
Address after: Room 221, 2 / F, block C, 18 Kechuang 11th Street, Daxing District, Beijing, 100176 Applicant after: Jingdong Technology Holding Co.,Ltd. Address before: Room 221, 2 / F, block C, 18 Kechuang 11th Street, Daxing District, Beijing, 100176 Applicant before: Jingdong Digital Technology Holding Co., Ltd |
|
CB02 | Change of applicant information |