CN108268369B - Test data acquisition method and device - Google Patents
Test data acquisition method and device Download PDFInfo
- Publication number
- CN108268369B CN108268369B CN201611260051.3A CN201611260051A CN108268369B CN 108268369 B CN108268369 B CN 108268369B CN 201611260051 A CN201611260051 A CN 201611260051A CN 108268369 B CN108268369 B CN 108268369B
- Authority
- CN
- China
- Prior art keywords
- interface
- test data
- access request
- request
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 92
- 238000000034 method Methods 0.000 title claims abstract description 34
- 238000011161 development Methods 0.000 abstract description 11
- 230000018109 developmental process Effects 0.000 abstract description 11
- 230000033772 system development Effects 0.000 abstract description 5
- 238000010586 diagram Methods 0.000 description 14
- 238000004590 computer program Methods 0.000 description 8
- 230000008569 process Effects 0.000 description 6
- 238000012545 processing Methods 0.000 description 6
- 230000006870 function Effects 0.000 description 5
- 230000008901 benefit Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000001960 triggered effect Effects 0.000 description 3
- 230000003993 interaction Effects 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000000977 initiatory effect Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 230000003068 static effect Effects 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
- G06F11/3684—Test management for test design, e.g. generating new test cases
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)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses a method and a device for acquiring test data, which firstly judge whether a rear-end interface is available or not after receiving an interface access request, if the rear-end interface is unavailable, substitute data of the test data corresponding to the rear-end interface is acquired from other places, and only when the rear-end interface is available, the test data is acquired from the rear-end interface, so that the dependence of the front-end interface and the rear-end interface is decoupled, the front-end and rear-end separated development is supported, and the system development efficiency is improved.
Description
Technical Field
The present invention relates to the field of network application technologies, and in particular, to a method and an apparatus for obtaining test data.
Background
In the development process of a front-end/back-end system, such as a front-end/back-end system, a browser/server system, a client/server system, and the like, a front-end (e.g., a front-end of a website, a browser system, a client) often depends on data provided by a back-end (e.g., a back-end of a website, a server system) to perform a test. Generally, the front end and the back end perform data interaction through the interfaces, so that if the interfaces of the back end are not developed or the interfaces are not communicated, the front end and the back end cannot perform data interaction, the development progress of the front end is hindered, and the development efficiency of the system is reduced.
Therefore, how to decouple the interface dependency in the front-end and back-end development processes to improve the development efficiency of the system becomes an urgent problem to be solved.
Disclosure of Invention
In view of the above, the present invention has been made to provide a test data acquisition method and apparatus that overcomes or at least partially solves the above-mentioned problems.
In order to achieve the purpose, the invention provides the following technical scheme:
a test data acquisition method, comprising:
receiving an interface access request, wherein the interface access request carries an identification mark of a back-end interface;
judging whether the back-end interface is available or not based on the identification mark;
if the back-end interface is available, acquiring test data from the back-end interface;
and if the back-end interface is unavailable, acquiring a jump address of the interface access request so as to acquire the substitute data of the test data through the jump address.
Preferably, the determining, based on the identification mark, whether the backend interface is available includes:
judging whether the identification mark is positioned in a preset list or not;
if the identification mark is located in the preset list, determining that the rear-end interface is unavailable;
and if the identification mark is not in the preset list, determining that the back-end interface is available.
Preferably, before determining whether the identification mark is located in the preset list, the method further includes:
judging whether a preset interface interception switch is turned on or not;
if the interface interception switch is turned on, executing the judgment of whether the identification mark is positioned in a preset list;
and if the interface interception switch is closed, judging that the rear-end interface is available, and executing the step of obtaining the test data from the rear-end interface.
In the above method, preferably, the interface access request includes one or more request types, and after determining that the backend interface is unavailable, the method further includes:
and converting the request type in the interface access request except the GET request into a GET request so as to obtain the substitute data of the test data through the jump address.
In the above method, preferably, the obtaining the substitute data of the test data by the jump address includes:
accessing a data file stored at the jump address;
and acquiring substitute data of the test data from the data file.
A test data acquisition apparatus comprising:
the receiving module is used for receiving an interface access request, wherein the interface access request carries an identification mark of a back-end interface;
the first judging module is used for judging whether the back-end interface is available or not based on the identification mark;
the first acquisition module is used for acquiring test data from the back-end interface if the back-end interface is available;
and the second acquisition module is used for acquiring the jump address of the interface access request if the rear-end interface is unavailable so as to acquire the substitute data of the test data through the jump address.
Preferably, in the apparatus, the first determining module includes:
the first judging unit is used for judging whether the identification mark is positioned in a preset list or not;
a first determining unit, configured to determine that the backend interface is unavailable if the identification identifier is located in the preset list; and if the identification mark is not in the preset list, determining that the back-end interface is available.
The above apparatus, preferably, further comprises:
the second judgment module is used for judging whether a preset interface interception switch is turned on or not;
the first judging unit is used for judging whether the rear-end interface is available or not based on the identification mark if the interface interception switch is turned on;
the first judging module further comprises:
and the second determining unit is used for determining that the rear-end interface is available if the interface interception switch is closed.
Preferably, in the apparatus, the interface access request includes one or more request types, and the second obtaining module is specifically configured to: if the back-end interface is unavailable, converting the request type in the interface access request, which is other than the GET request, into a GET request, and acquiring a jump address of the interface access request so as to acquire the substitute data of the test data through the jump address.
Preferably, in the apparatus, the second obtaining module obtains the substitute data of the test data through the jump address, and includes:
the second acquisition module accesses the data file stored at the jump address; and acquiring substitute data of the test data from the data file.
By means of the technical scheme, the test data acquisition method and the test data acquisition device provided by the invention firstly judge whether the back-end interface is available after receiving the interface access request, if the back-end interface is unavailable, substitute data of the test data corresponding to the back-end interface is acquired from other places, and only when the back-end interface is available, the test data is acquired from the back-end interface, so that the dependence of the front-end interface and the back-end interface is decoupled, the front-end and back-end separated development is supported, and the system development efficiency is improved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a flow chart of an implementation of a test data acquisition method according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating an implementation of determining whether a backend interface is available based on an identifier of the backend interface according to an embodiment of the present invention;
FIG. 3 is a flow chart of another implementation of a test data acquisition method according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating an implementation of obtaining substitute data for test data corresponding to a backend interface via a jump address according to an embodiment of the present invention;
FIG. 5 is a flowchart of an implementation of a method for obtaining test data for a website front end according to an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of a test data acquisition apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a first determining module according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram illustrating a test data acquisition apparatus according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Referring to fig. 1, fig. 1 is a flowchart of an implementation of a test data obtaining method according to an embodiment of the present invention, which may include:
step S11: receiving an interface access request, wherein the interface access request carries an identification mark of a back-end interface;
the interface access request is triggered at the front end for accessing the interface access request of the back-end interface.
Step S12: judging whether the back-end interface is available or not based on the identification mark;
in an alternative embodiment, the interface access request may be sent directly to the backend interface based on the identifier of the backend interface to determine whether the backend interface is available. If the back-end interface is available, the test data can be directly obtained from the back-end interface; if the backend interface is not available, an error message is returned. That is, if the backend interface returns an error message, it indicates that the backend interface is not available, and if the backend interface does not return an error message, it indicates that the backend interface is available.
The unavailability of the backend interface may be because the backend interface is not developed and completed, or may be because the backend interface, although already developed and completed, is not yet available.
Step S13: if the back-end interface is available, acquiring test data from the back-end interface;
and if the back-end interface is available, directly acquiring the test data from the back-end interface.
Step S14: and if the back-end interface is unavailable, acquiring a jump address of the interface access request so as to acquire the substitute data of the test data corresponding to the back-end interface through the jump address.
And if the back-end interface is unavailable, acquiring a jump address of the interface access request, and acquiring substitute data of the test data corresponding to the back-end interface from the jump address.
In an optional embodiment, a correspondence list between the identification identifier of the unavailable backend interface and the jump address may be preset, so that the jump address of the interface access request may be obtained according to the correspondence list.
That is, in the embodiment of the present invention, for an unavailable backend interface, substitute data of test data corresponding to the backend interface is stored in advance. The substitute data of the test data corresponding to the backend interface refers to data in a data format (such as name, structure, etc.) that meets the requirements of the backend interface. That is, the backend interface should return data that satisfies what condition, and the data that satisfies the condition is stored in advance at the jump address.
According to the test data acquisition method provided by the embodiment of the invention, after the interface access request is received, whether the back-end interface is available is judged firstly, if the back-end interface is unavailable, the substitute data of the test data corresponding to the back-end interface is acquired from other places, and only when the back-end interface is available, the test data is acquired from the back-end interface, so that the dependence of the front-end interface and the back-end interface is decoupled, the front-end and back-end separated development is supported, and the system development efficiency is improved.
For example, when the data format (such as name, structure, etc.) of the backend interface needs to be changed, the data format of the substitute data of the data corresponding to the backend interface at the jump address can be modified first, and then the backend interface is adjusted, so that when the front end needs to acquire the data of the backend for testing, even if the data format of the backend interface is not modified, the front end can acquire the corresponding substitute data for testing first, thereby avoiding adjusting the backend interface to make the front end unable to acquire the data required for testing from the backend interface.
In an alternative embodiment, an implementation flowchart for determining whether the backend interface is available based on the identification of the backend interface is shown in fig. 2, and may include:
step S21: judging whether the identification mark is positioned in a preset list or not;
in the embodiment of the invention, an unavailable back-end interface list is preset, and the list stores the identification marks of the unavailable back-end interface.
Step S22: if the identification mark is positioned in the preset list, determining that the rear-end interface is unavailable;
step S23: and if the identification mark is not in the preset list, determining that the back-end interface is available.
In the embodiment of the invention, the preset list is also recorded with the jump address corresponding to the back-end interface, and when the identification mark is judged to be positioned in the preset list, the jump address of the interface access request can be obtained from the list according to the identification mark of the back-end interface.
On the basis of the embodiment shown in fig. 2, another implementation flowchart of the test data acquisition method provided by the embodiment of the present invention is shown in fig. 3, and may include:
step S31: receiving an interface access request, wherein the interface access request carries an identification mark of a back-end interface;
the interface access request is triggered at the front end for accessing the interface access request of the back-end interface.
Step S32: judging whether a preset interface interception switch is turned on or not; if the preset interface interception switch is turned on, executing step S33; if the preset interface interception switch is turned off, executing step S36;
whether the interface interception switch is turned on or not can be manually set by a developer according to actual conditions. For example, if the backend interfaces are developed and available, the interface intercept switch may be turned off, and if at least a portion of the backend interfaces are not available, the interface intercept switch may be turned on.
Step S33: judging whether the identification mark is in a preset list or not; if the identification mark is located in the preset list, go to step S34; if the identification mark is not in the preset list, executing step S36;
step S34: determining that the backend interface is unavailable;
step S35: acquiring a jump address of the interface access request so as to acquire substitute data of the test data through the jump address;
step S36: determining that the backend interface is available;
step S37: acquiring test data from the rear-end interface;
in the embodiment of the invention, an interface interception switch is preset, and before judging whether the identification mark is positioned in a preset list, whether the interface interception switch is turned on is judged; if the interface interception switch is turned on, it is indicated that a back-end interface is unavailable, part of interfaces may be unavailable, or all back-end interfaces may be unavailable, and at this time, whether the identification mark is located in a preset list is judged. And if the interface interception switch is closed, the rear-end interfaces are all available.
In an alternative embodiment, an implementation flowchart of obtaining the substitute data of the test data corresponding to the backend interface through the jump address is shown in fig. 4, and may include:
step S41: accessing the data file stored at the jump address;
in the embodiment of the invention, corresponding to the inaccessible backend interface, the data (namely the substitute data of the test data) in the preset format, which should be returned by the backend interface, is written into the data file in advance, and the data file is stored at the jump address.
Step S42: and acquiring substitute data of the test data corresponding to the backend interface from the data file.
In an optional embodiment, the interface access request includes one or more request types, for example, the request type of the interface access request may be: GET, POST, PUT, DELETE, etc.
After determining that the backend interface is unavailable, converting a request type in the interface access request, which is other than the GET request, into a GET request so as to obtain the substitute data of the test data through the jump address by using the GET request.
In the embodiment of the present invention, the execution sequence of the process of converting the request type in the interface access request other than the GET request into the GET request and obtaining the jump address of the interface access request is not specifically limited, and the request type in the interface access request other than the GET request may be first converted into the GET request, and then the jump address of the interface access request is obtained; or, obtaining the jump address of the interface access request, and then converting the request type in the interface access request, which is other than the GET request, into the GET request; or, both may be performed simultaneously.
The embodiment of the present invention is described below by taking a test of a front end in a website development process as an example. Referring to fig. 5, fig. 5 is a flowchart of an implementation of a method for acquiring test data of a website front end according to an embodiment of the present invention, which may include:
step S51: the request service of the front end of the website receives an interface access request, and the interface access request carries an identification mark of the back end interface of the website.
In the embodiment of the invention, a uniform request service is added in the website, all types of requests initiated by the page in the website to the website backend interface are initiated to the website backend through the request service, and the request service returns the result to the page after receiving the response. The interface access request may be a GET type request or a non-GET type request, for example, a POST type request or a PUT type request, or a DELETE type request.
Step S52: the request service judges whether the interface interception switch is turned on, if so, step S53 is executed; if not, step S55 is executed.
Step S53: the request service determines whether the identifier is in a preset list, if so, step S54 is executed; if not, step S55 is executed.
Step S54: the request service converts the non-GET type request into a GET type request, acquires a jump address, and acquires substitute data of the test data corresponding to the rear-end interface of the website from a data file at the jump address.
In the embodiment of the invention, if the interface access request is a non-GET type interface access request, the type of the interface access request is modified into a GET type request, and then the substitute data of the test data corresponding to the rear-end interface of the website is read from the data file at the jump address. If the interface access request is a GET type interface access request, the type of the interface access request does not need to be modified.
Step S55: and directly initiating a request to the website back-end interface to acquire the test data from the website back-end interface.
Corresponding to the method embodiment, the embodiment of the invention also provides a test data acquisition device. A schematic structural diagram of the test data acquisition apparatus provided in the embodiment of the present invention is shown in fig. 6, and may include:
a receiving module 61, a first judging module 62, a first obtaining module 63 and a second obtaining module 64; wherein,
the receiving module 61 is configured to receive an interface access request, where the interface access request carries an identification of a backend interface;
the interface access request is triggered at the front end for accessing the interface access request of the back-end interface.
The first judging module 62 is configured to judge whether the backend interface is available based on the identification mark;
in an alternative embodiment, the determining module 62 may directly send the interface access request to the backend interface according to the identification of the backend interface to determine whether the backend interface is available. If the back-end interface is available, the test data can be directly obtained from the back-end interface; if the backend interface is not available, an error message is returned. That is, if the backend interface returns an error message, it indicates that the backend interface is not available, and if the backend interface does not return an error message, it indicates that the backend interface is available.
The unavailability of the backend interface may be because the backend interface is not developed and completed, or may be because the backend interface, although already developed and completed, is not yet available.
The first obtaining module 63 is configured to obtain test data from the backend interface if the backend interface is available;
and if the back-end interface is available, directly acquiring the test data from the back-end interface.
The second obtaining module 64 is configured to obtain a jump address of the interface access request if the backend interface is unavailable, so as to obtain substitute data of the test data corresponding to the backend interface through the jump address.
If the backend interface is not available, the second obtaining module 64 obtains the jump address of the interface access request, and obtains the substitute data of the test data corresponding to the backend interface from the jump address.
In an optional embodiment, a correspondence list between the identification identifier of the unavailable backend interface and the jump address may be preset, so that the jump address of the interface access request may be obtained according to the correspondence list.
That is, in the embodiment of the present invention, for an unavailable backend interface, substitute data of test data corresponding to the backend interface is stored in advance. The substitute data of the test data corresponding to the backend interface refers to data in a data format (such as name, structure, etc.) that meets the requirements of the backend interface. That is, the backend interface should return data that satisfies what condition, and the data that satisfies the condition is stored in advance at the jump address.
The test data acquisition device provided by the embodiment of the invention firstly judges whether the rear-end interface is available or not after receiving the interface access request, if the rear-end interface is unavailable, the substitute data of the test data corresponding to the rear-end interface is acquired from other places, and only when the rear-end interface is available, the test data is acquired from the rear-end interface, so that the dependence of the front-end interface and the rear-end interface is decoupled, the front-end and rear-end separated development is supported, and the system development efficiency is improved.
In an alternative embodiment, a schematic structural diagram of the first determining module 62 is shown in fig. 7, and may include:
a first judgment unit 71 and a first determination unit 72; wherein,
the first judging unit 71 is configured to judge whether the identification mark is located in a preset list;
in the embodiment of the invention, an unavailable back-end interface list is preset, and the list stores the identification marks of the unavailable back-end interface.
The first determining unit 72 is configured to determine that the backend interface is unavailable if the identifier is located in the preset list; and if the identification mark is not in the preset list, determining that the back-end interface is available.
In the embodiment of the invention, the preset list is also recorded with the jump address corresponding to the back-end interface, and when the identification mark is judged to be positioned in the preset list, the jump address of the interface access request can be obtained from the list according to the identification mark of the back-end interface.
On the basis of the embodiment shown in fig. 7, another schematic structural diagram of the test data acquisition apparatus provided in the embodiment of the present invention is shown in fig. 8, and may further include:
the second judging module 82 is used for judging whether a preset interface interception switch is turned on or not;
whether the interface interception switch is turned on or not can be manually set by a developer according to actual conditions. For example, if the backend interfaces are developed and available, the interface intercept switch may be turned off, and if at least a portion of the backend interfaces are not available, the interface intercept switch may be turned on.
The first judging unit 71 is specifically configured to, if the interface interception switch is turned on, judge whether the backend interface is available based on the identification mark;
the first determining module 62 may further include:
and a second determining unit 83, configured to determine that the backend interface is available if the interface interception switch is turned off.
In the embodiment of the invention, an interface interception switch is preset, and before judging whether the identification mark is positioned in a preset list, whether the interface interception switch is turned on is judged; if the interface interception switch is turned on, it is indicated that a back-end interface is unavailable, part of interfaces may be unavailable, or all back-end interfaces may be unavailable, and at this time, whether the identification mark is located in a preset list is judged. And if the interface interception switch is closed, the rear-end interfaces are all available.
In an optional embodiment, the obtaining, by the second obtaining module 64, the substitute data of the test data corresponding to the backend interface through the jump address may include:
the second obtaining module 64 accesses the data file stored at the jump address; and acquiring substitute data of the test data corresponding to the backend interface from the data file.
In the embodiment of the invention, corresponding to the inaccessible backend interface, the data (namely the test data) in the preset format, which should be returned by the backend interface, is written into the data file in advance, and the data file is stored at the jump address.
In an optional embodiment, the interface access request includes one or more request types, for example, the request type of the interface access request may be: GET, POST, PUT, DELETE, etc.
The second obtaining module 64 may specifically be configured to: if the back-end interface is unavailable, converting the request type in the interface access request, which is other than the GET request, into a GET request, and acquiring a jump address of the interface access request so as to acquire the substitute data of the test data through the jump address.
In the embodiment of the present invention, the execution sequence of the process of converting the request type in the interface access request other than the GET request into the GET request and obtaining the jump address of the interface access request is not specifically limited, and the request type in the interface access request other than the GET request may be first converted into the GET request, and then the jump address of the interface access request is obtained; or, obtaining the jump address of the interface access request, and then converting the request type in the interface access request, which is other than the GET request, into the GET request; or, both may be performed simultaneously.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
In an optional embodiment, the test data acquiring apparatus includes a processor and a memory, the receiving module, the first determining module, the first acquiring module, the second acquiring module, and the like are all stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more, and the dependency of the front-end interface and the back-end interface is decoupled by adjusting the kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
The test data acquisition device provided by the embodiment of the invention firstly judges whether the rear-end interface is available or not after receiving the interface access request, if the rear-end interface is unavailable, the substitute data of the test data corresponding to the rear-end interface is acquired from other places, and only when the rear-end interface is available, the test data is acquired from the rear-end interface, so that the dependence of the front-end interface and the rear-end interface is decoupled, the front-end and rear-end separated development is supported, and the system development efficiency is improved.
The present application further provides a computer program product adapted to perform program code for initializing the following method steps when executed on a data processing device:
receiving an interface access request, wherein the interface access request carries an identification mark of a back-end interface;
judging whether the back-end interface is available or not based on the identification mark of the back-end interface;
if the back-end interface is available, acquiring test data from the back-end interface;
if the back-end interface is unavailable, acquiring a jump address of the interface access request; and reading the substitute data of the test data corresponding to the back-end interface through the jump address.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, apparatus, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims (6)
1. A method for test data acquisition, comprising:
receiving an interface access request, wherein the interface access request carries an identification mark of a back-end interface;
judging whether a preset interface interception switch is turned on or not;
if the interface interception switch is turned on, judging whether the identification mark is positioned in a preset list;
if the identification mark is located in the preset list, determining that the rear-end interface is unavailable;
if the identification mark is not in the preset list, determining that the back-end interface is available;
if the interface interception switch is closed, judging that the rear-end interface is available;
if the back-end interface is available, acquiring test data from the back-end interface;
and if the back-end interface is unavailable, acquiring a jump address of the interface access request so as to acquire the substitute data of the test data through the jump address.
2. The method of claim 1, wherein the interface access request comprises one or more request types, and wherein after determining that the backend interface is unavailable, the method further comprises:
and converting the request type in the interface access request except the GET request into a GET request so as to obtain the substitute data of the test data through the jump address.
3. The method according to any one of claims 1 to 2, wherein the obtaining the substitute data of the test data through the jump address comprises:
accessing a data file stored at the jump address;
and acquiring substitute data of the test data from the data file.
4. A test data acquisition apparatus, comprising:
the receiving module is used for receiving an interface access request, wherein the interface access request carries an identification mark of a back-end interface;
the second judgment module is used for judging whether a preset interface interception switch is turned on or not;
the first judging module is used for judging whether the back-end interface is available or not based on the identification mark; the method comprises the following steps: the first judgment unit is used for judging whether the identification mark is positioned in a preset list or not if the interface interception switch is turned on; a first determining unit, configured to determine that the backend interface is unavailable if the identification identifier is located in the preset list; if the identification mark is not in the preset list, determining that the back-end interface is available; a second determining unit, configured to determine that the backend interface is available if the interface interception switch is turned off;
the first acquisition module is used for acquiring test data from the back-end interface if the back-end interface is available;
and the second acquisition module is used for acquiring the jump address of the interface access request if the rear-end interface is unavailable so as to acquire the substitute data of the test data through the jump address.
5. The apparatus of claim 4, wherein the interface access request includes one or more request types, and the second obtaining module is specifically configured to: if the back-end interface is unavailable, converting the request type in the interface access request, which is other than the GET request, into a GET request, and acquiring a jump address of the interface access request so as to acquire the substitute data of the test data through the jump address.
6. The apparatus according to any one of claims 4 to 5, wherein the second obtaining module obtains the substitute data of the test data through the jump address, including:
the second acquisition module accesses the data file stored at the jump address; and acquiring substitute data of the test data from the data file.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611260051.3A CN108268369B (en) | 2016-12-30 | 2016-12-30 | Test data acquisition method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611260051.3A CN108268369B (en) | 2016-12-30 | 2016-12-30 | Test data acquisition method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108268369A CN108268369A (en) | 2018-07-10 |
CN108268369B true CN108268369B (en) | 2021-04-02 |
Family
ID=62754906
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611260051.3A Active CN108268369B (en) | 2016-12-30 | 2016-12-30 | Test data acquisition method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108268369B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109688202B (en) * | 2018-12-04 | 2021-07-02 | 北京腾云天下科技有限公司 | Interface data processing method and device, computing equipment and storage medium |
CN110427324B (en) * | 2019-07-30 | 2023-09-08 | 中国工商银行股份有限公司 | Joint debugging system, joint debugging method, computer equipment and storage medium |
CN112199281A (en) * | 2020-09-30 | 2021-01-08 | 中国平安财产保险股份有限公司 | Data processing method and device, terminal equipment and readable storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102955714A (en) * | 2011-08-17 | 2013-03-06 | 阿里巴巴集团控股有限公司 | Device and method for implementing dynamic analog remote interface |
CN103001815A (en) * | 2011-09-13 | 2013-03-27 | 阿里巴巴集团控股有限公司 | Method, device and system for acquiring test data |
CN104503768A (en) * | 2015-01-04 | 2015-04-08 | 华为技术有限公司 | Call method and device for application programming interface (API) |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
IN2015DE01395A (en) * | 2015-05-18 | 2015-06-26 | Hcl Technologies Ltd |
-
2016
- 2016-12-30 CN CN201611260051.3A patent/CN108268369B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102955714A (en) * | 2011-08-17 | 2013-03-06 | 阿里巴巴集团控股有限公司 | Device and method for implementing dynamic analog remote interface |
CN103001815A (en) * | 2011-09-13 | 2013-03-27 | 阿里巴巴集团控股有限公司 | Method, device and system for acquiring test data |
CN104503768A (en) * | 2015-01-04 | 2015-04-08 | 华为技术有限公司 | Call method and device for application programming interface (API) |
Also Published As
Publication number | Publication date |
---|---|
CN108268369A (en) | 2018-07-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110058856B (en) | Page configuration method and device | |
CN107122296B (en) | Method and apparatus for data assertion for test interface | |
CN112532490A (en) | Regression testing system and method and electronic equipment | |
CN108268369B (en) | Test data acquisition method and device | |
CN108228443B (en) | Web application testing method and device | |
CN110958278B (en) | API gateway-based data processing method and system and API gateway | |
CN109598526B (en) | Method and device for analyzing media contribution | |
CN110874315A (en) | Test method, test device, electronic equipment and storage medium | |
CN105354195B (en) | Information searching method and device | |
CN107480056B (en) | Software testing method and device | |
CN109977317B (en) | Data query method and device | |
CN110968333B (en) | Configuration information replacement method and device, machine-readable storage medium and processor | |
CN112256984B (en) | Method and device for acquiring interface background screenshot corresponding to webpage | |
CN111061977A (en) | Website updating method, device and system | |
CN110019357B (en) | Database query script generation method and device | |
CN107766385B (en) | Method and equipment for converting file format of virtual disk | |
CN108228145A (en) | Data processing method, system and the mobile equipment of mixed type application program | |
CN110769017A (en) | Data request processing method and device, storage medium and processor | |
CN110908876B (en) | Method and device for acquiring hardware performance data | |
CN110839053B (en) | Device communication method, device and storage medium | |
CN107766216A (en) | It is a kind of to be used to obtain the method and apparatus using execution information | |
CN108135000B (en) | Authentication method and equipment | |
CN107404397B (en) | Method and equipment for determining user service state information | |
CN107844484B (en) | Method and device for identifying exposure code | |
CN112367414B (en) | External link processing method and device, storage medium and processor |
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: 100080 No. 401, 4th Floor, Haitai Building, 229 North Fourth Ring Road, Haidian District, Beijing Applicant after: Beijing Guoshuang Technology Co.,Ltd. Address before: 100086 Cuigong Hotel, 76 Zhichun Road, Shuangyushu District, Haidian District, Beijing Applicant before: Beijing Guoshuang Technology Co.,Ltd. |
|
CB02 | Change of applicant information | ||
GR01 | Patent grant | ||
GR01 | Patent grant |