CN110798445A - Public gateway interface testing method and device, computer equipment and storage medium - Google Patents

Public gateway interface testing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN110798445A
CN110798445A CN201910867033.9A CN201910867033A CN110798445A CN 110798445 A CN110798445 A CN 110798445A CN 201910867033 A CN201910867033 A CN 201910867033A CN 110798445 A CN110798445 A CN 110798445A
Authority
CN
China
Prior art keywords
gateway interface
public gateway
tested
public
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.)
Granted
Application number
CN201910867033.9A
Other languages
Chinese (zh)
Other versions
CN110798445B (en
Inventor
易李军
魏万勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN201910867033.9A priority Critical patent/CN110798445B/en
Publication of CN110798445A publication Critical patent/CN110798445A/en
Application granted granted Critical
Publication of CN110798445B publication Critical patent/CN110798445B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/133Protocols for remote procedure calls [RPC]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the application belongs to the field of software development, and relates to a method and a device for testing a public gateway interface, computer equipment and a storage medium, wherein the method comprises the following steps: acquiring request information of a client at an access layer, wherein the request information comprises public gateway interface information to be tested and request parameters; inputting the request parameters into a full-text search engine in real time through a data import tool; analyzing the request parameters through a full-text search engine to obtain public gateway interface test data corresponding to the public gateway interface to be tested; and matching the public gateway interface to be tested to a corresponding interface test platform according to the public gateway interface to be tested information, testing the public gateway interface to be tested by using the public gateway interface test data, and generating a test report. The test data of the public gateway interface is automatically extracted through the full-text search engine, and the public gateway interface is matched with the interface test platform for automatic test, so that the software development efficiency is improved.

Description

Public gateway interface testing method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer software development technologies, and in particular, to a method and an apparatus for testing a public gateway interface, a computer device, and a storage medium.
Background
Currently, in the web software development test process, data needs to be acquired from the front end to test interfaces of the back end, and the interfaces generally conform to Common Gateway Interface (CGI) standard. CGI workflow, from the view of Web server, defines that CGI program can be run at specific location (URL, such as http:// www.example.com/wiki. CGI), when receiving a client request matching URL, the corresponding program will be called, and the data sent by client will be used as input; the output of the program is collected by the Web server and sent back to the client with the appropriate headers added.
When testing the common gateway interface, in the prior art, firstly, a packet capturing tool such as a fiddler, httpwatch and the like is needed to obtain data related to communication of the CGI interface; secondly, manually analyzing data acquired by packet capturing, and manually constructing and modifying test data of the CGI interface; finally, the tester must know the programming technique and have a certain understanding and experience on the interface calling method and the verification method. Resulting in a time consuming development process and also requiring the tester to be familiar with interface test code, which is inefficient.
Disclosure of Invention
The embodiment of the application aims to provide a method and a device for testing a public gateway interface, computer equipment and a storage medium, so that the software development efficiency is improved.
In order to solve the above technical problem, an embodiment of the present application provides a method for testing a public gateway interface, which adopts the following technical solutions:
the method comprises the following steps:
acquiring request information of a client at an access layer, wherein the request information comprises public gateway interface information to be tested and request parameters;
inputting the request parameters into a full-text search engine in real time through a data import tool;
analyzing the request parameters through a full-text search engine to obtain public gateway interface test data corresponding to the public gateway interface to be tested;
and matching the public gateway interface to be tested to a corresponding interface test platform according to the public gateway interface to be tested information, testing the public gateway interface to be tested by using the public gateway interface test data, and generating a test report.
Further, the step of acquiring the request information of the client at the access stratum specifically includes:
intercepting communication flow at an access layer gateway server;
and acquiring the request information of the client from the communication traffic.
Further, the step of analyzing the request parameter by the full-text search engine to obtain the public gateway interface test data corresponding to the public gateway interface to be tested specifically includes:
scanning each field of the request parameters and corresponding data through a full-text search engine and storing the fields and the corresponding data in a database;
and acquiring the public gateway interface test data from the database according to the typical public gateway interface field.
Further, the step of obtaining the test data of the public gateway interface from the database according to the typical public gateway interface field further includes:
establishing indexes for each field and corresponding data stored in the database;
and acquiring the index of the field according to the typical public gateway interface field, and further acquiring corresponding public gateway interface test data from a database.
Further, the step of matching the public gateway interface to be tested to the corresponding interface test platform according to the public gateway interface to be tested information specifically includes:
analyzing the information of the public gateway interface to be tested to obtain the public gateway interface to be tested;
and calling a corresponding public gateway interface program to be tested from the public gateway server according to the public gateway interface to be tested and importing the program to be tested to the testing platform.
Further, the step of analyzing the information of the public gateway interface to be tested to obtain the public gateway interface to be tested specifically includes:
extracting data corresponding to a uniform resource locator field from the public gateway interface information to be tested;
and mapping data corresponding to the uniform resource locator field to obtain the public gateway interface to be tested.
Further, before the step of testing the public gateway interface to be tested by using the public gateway interface test data, the method further includes:
and carrying out deduplication processing on the test data of the public gateway interface.
In order to solve the above technical problem, an embodiment of the present application further provides a testing apparatus for a public gateway interface, which adopts the following technical solutions:
the testing device for the public gateway interface specifically comprises:
the system comprises an acquisition module, a service module and a service module, wherein the acquisition module is used for acquiring request information of a client at an access layer, and the request information comprises public gateway interface information to be tested and request parameters;
the input module is used for inputting the request parameters into a full-text search engine in real time through a data import tool;
the analysis module is used for analyzing the request parameters through a full-text search engine to obtain public gateway interface test data corresponding to the public gateway interface to be tested;
and the testing module is used for matching the public gateway interface to be tested to a corresponding interface testing platform according to the information of the public gateway interface to be tested, testing the public gateway interface to be tested by using the public gateway interface testing data and generating a testing report.
In order to solve the above technical problem, an embodiment of the present application further provides a computer device, which adopts the following technical solutions:
the computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor realizes the steps of the public gateway interface testing method provided by any one of the embodiments when executing the computer program.
In order to solve the above technical problem, an embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solutions:
the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the common gateway interface testing method of any one of the embodiments set forth herein.
Compared with the prior art, the embodiment of the application mainly has the following beneficial effects: acquiring request information of a client at an access layer, wherein the request information comprises public gateway interface information to be tested and request parameters; inputting the request parameters into a full-text search engine in real time through a data import tool; analyzing the request parameters through a full-text search engine to obtain public gateway interface test data corresponding to the public gateway interface to be tested; and matching the public gateway interface to be tested to a corresponding interface test platform according to the public gateway interface to be tested information, testing the public gateway interface to be tested by using the public gateway interface test data, and generating a test report. By acquiring the request information at the access layer and importing the request information into the full-text search engine, the test data of the public gateway interface can be automatically extracted, and the trouble of installing and configuring a packet capturing tool and the low efficiency of manually constructing the test data are avoided; meanwhile, the public gateway interface is matched with the interface test platform, automatic test can be carried out, manual programming test is not needed, and therefore software development efficiency is improved.
Drawings
In order to more clearly illustrate the solution of the present application, the drawings needed for describing the embodiments of the present application will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a method for testing a common gateway interface according to the present application;
FIG. 3 is a flow diagram for one embodiment of step 201 of FIG. 2;
FIG. 4 is a flow diagram of one embodiment of step 203 of FIG. 2;
FIG. 5 is a flow diagram for one embodiment of step 402 in FIG. 4;
FIG. 6 is a flow diagram for one embodiment of step 204 of FIG. 2;
FIG. 7 is a flowchart of one embodiment of step 601 of FIG. 6;
FIG. 8 is a flowchart of one embodiment of the steps included prior to the testing step in step 204 of FIG. 2;
FIG. 9 is a schematic block diagram of one embodiment of a common gateway interface test apparatus according to the present application;
fig. 10 is a schematic structural diagram illustrating an embodiment of an obtaining module 901;
FIG. 11 is a block diagram of one embodiment of the parsing module 903;
fig. 12 is a schematic structural diagram of an embodiment of the obtaining sub-module 9032;
FIG. 13 is a block diagram of one embodiment of a test module 904;
fig. 14 is a schematic structural diagram of an embodiment of parsing submodule 9041;
FIG. 15 is a schematic block diagram of one embodiment of a computer device according to the present application.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "including" and "having," and any variations thereof, in the description and claims of this application and the description of the above figures are intended to cover non-exclusive inclusions. The terms "first," "second," and the like in the description and claims of this application or in the above-described drawings are used for distinguishing between different objects and not for describing a particular order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have various communication client applications installed thereon, such as a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture experts Group Audio Layer III, mpeg compression standard Audio Layer 3), MP4 players (Moving Picture experts Group Audio Layer IV, mpeg compression standard Audio Layer 4), laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background server providing support for pages displayed on the terminal devices 101, 102, 103.
It should be noted that, the method for testing the public gateway interface provided in the embodiment of the present application is generally executed by a server, and accordingly, the device for testing the public gateway interface is generally disposed in the server.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to fig. 2, a flow diagram of one embodiment of a method of common gateway interface testing is shown, in accordance with the present application. The testing method of the public gateway interface comprises the following steps:
step 201, obtaining request information of a client at an access layer, where the request information includes public gateway interface information to be tested and request parameters.
In this embodiment, the electronic device (for example, the server shown in fig. 1) on which the common gateway interface test method operates may receive request information from a client (for example, the terminal device shown in fig. 1) through a wired connection manner or a wireless connection manner. It should be noted that the wireless connection means may include, but is not limited to, a 3G/4G connection, a WiFi connection, a bluetooth connection, a WiMAX connection, a Zigbee connection, a uwb (ultra wideband) connection, and other wireless connection means now known or developed in the future.
Generally, the server on which the common gateway interface test method operates needs to be installed with an HTTP static server (such as APACHE, NGINX, etc.) as an access layer, and receives and preprocesses request information of a client and then forwards the request information to a CGI interface program of a back end. In this example, the request information of the client may not be preprocessed and forwarded by the HTTP static server, but the original request information may be directly obtained in the data buffer of the server.
The CGI interface program is a program stored or running on the system architecture server 105, and the program may be a program written in a programming language such as C, python, perl, etc. and can be directly executed, and generally, a CGI program processes a request of a client, including checking input data, calling a resource of the server to generate a web page, and returning the web page to the client.
And 202, inputting the request parameters into a full-text search engine in real time through a data import tool.
In this embodiment, the used full-text search engine, namely, the elastic search engine, is an open-source program, and can be used to quickly establish indexes, store, search and analyze massive text data, and also can be built into a cluster to provide distributed real-time storage and index services for massive text data, so that the method has good expansibility. In this embodiment, the request parameters of the client obtained from the access layer of the HTTP static server may be quickly imported in real time into the full-text search engine ElasticSearch through a data import tool such as logstack, and then data parsing is performed.
The logstash tool mainly comprises components such as input, filter and output, wherein the input is used for reading content, and commonly used stdin (directly input from a console), file (reading file), redis (database) and the like; the filter is used for carrying out primary processing on the input information so as to accord with a certain format; the output is used to output the content obtained by the stub to a specified receiving end, and is typically an elastic search engine, a file (output to file), an stdout (output directly to console), and the like.
Step 203, analyzing the request parameter through a full text search engine, and acquiring public gateway interface test data corresponding to the public gateway interface to be tested.
In this embodiment, the full-text search engine elastic search may be used to automatically extract all the fields and corresponding data in the data message from which the request parameter is obtained, and then build and store indexes in a one-to-one correspondence manner as test data of the public gateway interface; when the query is carried out, the retrieval program of the full-text search engine carries out the search according to the index established in advance and returns the search result.
And 204, matching the public gateway interface to be tested to a corresponding interface test platform according to the public gateway interface to be tested information, testing the public gateway interface to be tested by using the public gateway interface test data, and generating a test report.
The test efficiency can be improved by using a test platform such as a Yapi server to carry out automatic interface test, so that testers can concentrate on the establishment and development of new test modules, and the test coverage rate is improved; the Yapi server is a server system capable of managing and testing the web application program interface online.
In this embodiment, the request information of the client acquired from the access layer of the HTTP static server includes information of a public gateway interface to be tested, which is generally data corresponding to a requested URL, and a public gateway interface to be called by a back end can be obtained by analyzing the data, and then the public gateway interface is matched to the test platform in a back end library of the server 105 storing or running a public gateway interface program in the system architecture, and the test data of the public gateway interface acquired in the step 203 is input to the test platform to test the public gateway interface to be tested, and finally a test report generated by the test platform is obtained.
The public gateway interface to be tested can be tested in the following aspects:
in the program, input data is checked, such as whether the types of the data match and are within the range, and if the check fails, exception information is recorded and a test report is written.
Further, whether the resource requested by the client exists on the server is checked in the program, and if the resource exists, the resource is read and returned to the client; if the resource is not found, returning the information that the resource is not found to the client, recording abnormal information and writing the abnormal information into the test report.
In some cases, it is necessary to check the user information in the client request, such as a username, a password, a cookie, etc., and to test whether the corresponding program can be processed correctly, and if it fails, the failure information may be written into the test report.
It should be noted that the method for testing a public gateway interface provided in the embodiment of the present application may be applied to a public gateway interface testing device, for example: computers, servers, workstations, etc. may perform common gateway interface testing.
In the embodiment, request information of a client is obtained at an access layer, wherein the request information comprises public gateway interface information to be tested and request parameters; inputting the request parameters into a full-text search engine in real time through a data import tool; analyzing the request parameters through a full-text search engine to obtain public gateway interface test data corresponding to the public gateway interface to be tested; and matching the public gateway interface to be tested to a corresponding interface test platform according to the public gateway interface to be tested information, testing the public gateway interface to be tested by using the public gateway interface test data, and generating a test report. By acquiring the request information at the access layer and importing the request information into the full-text search engine, the test data of the public gateway interface can be automatically extracted, and the trouble of installing and configuring a packet capturing tool and the low efficiency of manually constructing the test data are avoided; meanwhile, the public gateway interface is matched with the interface test platform, automatic test can be carried out, manual programming test is not needed, and therefore software development efficiency is improved.
Further, as shown in fig. 3, the step 201 may include:
step 301, intercepting communication traffic at an access stratum gateway server.
The access layer gateway server may be the above-mentioned HTTP static server such as APACHE, NGINX, etc. In a possible implementation manner, the communication traffic (i.e. the data packet conforming to the HTTP/HTTPs protocol) between the client and the server may be read in the data cache area on the access stratum gateway server, without the gateway server forwarding the data packet to an application layer interface program (e.g. a CGI interface program) for processing or storing the data packet to a disk or a database;
optionally, a thread may be used on the access stratum gateway server to read the data packet in parallel to a data cache region of the server, so as to accelerate the reading speed;
in another possible implementation manner, a single process is used to obtain the communication data packet through inter-process communication manners such as a message queue, a shared memory, a pipeline, and the like.
Or, the original data packets which are not processed by the static server can be obtained from the bottom socket of the HTTP static server.
Step 302, obtaining the request information of the client from the communication flow.
The request information of the client may be main data (load) in a communication data packet actively sent to the remote server by a client browser program, and generally includes fields such as a request URL (resource path information of the request, corresponding to public gateway interface information), a request mode, a status code, an address of the remote server of the request, and a type and a length of a datagram; in other cases, the requested information from the client typically includes datagrams that the remote server returns to the server when requesting browser user data, and may include fields such as a username, password, security authentication code, token, or cookie in addition to the fields described above. The request data of the client can be extracted by removing some unnecessary data according to the data message format of the HTTP/HTTPS protocol.
Further, as shown in fig. 4, the step 203 may include:
step 401, scanning each field of the request parameter and corresponding data through a full-text search engine and storing the fields and the corresponding data in a database.
In this embodiment, each field in the obtained request data packet is scanned by the full-text search engine Elasti cSearch, then data of the corresponding field is extracted to serve as test data of a public gateway interface, and finally the field and the corresponding data are stored in a database so as to be reused.
At step 402, public gateway interface test data is obtained from a database according to typical public gateway interface fields.
Typical common gateway CGI interface fields include, but are not limited to, SERVER _ NAME, REQUEST _ METHOD, PATH _ INFO, QUERY _ STRING, REMOTE _ HOST, CONTENT _ TYPE, CONTENT _ LENGTH, SCRIPT _ NAME, ACCEPT, etc., corresponding data can be retrieved from the database according to these fields, and then these typical CGI interface fields and corresponding data are written into a JSON or XML formatted file or database, and can also be temporarily placed into a memory so that these common gateway interface test data can be quickly retrieved.
Further, as shown in fig. 5, the step 402 may include:
step 501, establishing an index for each field and corresponding data stored in the database.
In this embodiment, an index is established for each field in the scanned request data packet by the full-text search engine, where the index includes the number of times and the position of the field appearing in the packet; then extracting the data of the corresponding field, and finally storing the field and the corresponding data.
For example, a total index is set for the obtained request datagram, and then a sub-index is assigned to each field in the datagram to generate a record, or called Document. A record or Document is represented using JSON format, such as { "method": "GET" }, { "URL": "https:// www.jianshu.com/p/5696f7d0d 011" }, { "Remote Address": 183.66.109.247:443 "} and the like, which records or documents together constitute a total index.
Step 502, obtaining the index of the typical public gateway interface field according to the field, and further obtaining the corresponding public gateway interface test data from the database.
In step 501, the JSON-formatted data index of the entire REQUEST datagram is obtained according to the total index set for the REQUEST datagram by the full-text search engine elastic search, then the JSON-formatted data index of the entire REQUEST datagram is queried and obtained according to the typical common gateway CGI interface fields such as SERVER _ NAME, REQUEST _ METHOD, PATH _ INFO, QUERY _ training, REMOTE _ HOST, ent _ TYPE, CONTENT _ LENGTH, SCRIPT _ NAME, ACCEPT, etc., in the JSON-formatted data index, and finally the corresponding data is obtained from the database according to the indexes to serve as the test data of the common gateway interface.
Further, as shown in fig. 6, the step of matching the public gateway interface to be tested to the corresponding interface test platform according to the public gateway interface to be tested in step 204 may include:
step 601, analyzing the information of the public gateway interface to be tested to obtain the public gateway interface to be tested.
In this embodiment, the public gateway interface information to be tested refers to the request URL in the request information, that is, the requested resource path information, and the resource path information is analyzed to obtain the back-end resource requested by the client, and accordingly obtain the interface name responding to the client request, and call the corresponding public gateway interface in the back-end program to process the client request and return the requested resource data.
Step 602, calling a corresponding public gateway interface program to be tested from a public gateway server according to the public gateway interface to be tested and importing the program to be tested to a test platform.
In step 601, the name of the back-end public gateway interface to be tested to be used in response to the request of the client can be obtained by analyzing the request URL in the request information, and then the corresponding public gateway interface program to be tested is loaded on the gateway server storing the public gateway interface to be tested according to the interface name and is imported to the test platform.
The test platform, such as the Yapi server, is a server system capable of managing and testing the web application program interface on line, and can perform interface management, automatic test and the like, so that the test efficiency can be improved.
Further, as shown in fig. 7, the step 601 may include:
step 701, extracting data corresponding to a uniform resource locator field from the public gateway interface information to be tested.
In this embodiment, the path information and the related parameters of the requested data may be obtained by parsing the information of the common gateway interface to be tested in the client Request information, that is, parsing a Request URL (uniform resource locator) field, where the Request URL is as follows:
https:// www.patenthub.cn/patent/CN107179984A. html? ds & cn & d m & list & p 1& ps 20& s score! AND ═ none & q ═ 20 AND% 20(ipc (G06)) (% E6% 8E% a 5% E5% 8F% A3% E6% B5% 8B% E8% AF% 95) (% 20 AND? Html is obtained through the path https:// www.patenthub.cn/patent/CN107179984A of the requested page, and parameters of the data query such as ds ═ cn, ps ═ 20and the like.
Step 702, mapping the data corresponding to the uniform resource locator field to obtain the public gateway interface to be tested.
In step 701, after a Uniform Resource Locator (URL) is analyzed to obtain a page requested by the client and parameters of data query, the page and the parameters are mapped to a corresponding public gateway interface program through a routing program, and then parameter check is performed in the public gateway interface program and a response is made.
It should be noted that the above-mentioned router program may be provided at the bottom layer of a web framework (e.g., django), or may be a program written by itself to implement binding of a Uniform Resource Locator (URL) and a public gateway interface, and has been loaded into a memory during the operation of the server.
Further, as shown in fig. 8, the step of testing the public gateway interface to be tested by using the public gateway interface test data in the step 204 may further include the following steps:
step 801, performing deduplication processing on the public gateway interface test data.
Optionally, in order to prevent a large amount of repeated test data stored in the server from occupying server resources, the generated test data of the common gateway interface needs to be deduplicated and classified before the test starts according to the data already recorded by the interface test platform.
For example, scanning a field in the test data, judging whether the field exists in a file or a database of the interface test platform, and if not, saving the field and the corresponding data; if yes, continuing to compare whether the data are the same, if yes, removing the data, and otherwise, saving the data in a file or a database of the test platform.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the computer program is executed. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a Random Access Memory (RAM).
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
With further reference to fig. 9, as an implementation of the method shown in fig. 2, the present application provides an embodiment of a testing apparatus for a common gateway interface, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 2, and the apparatus may be specifically applied to various electronic devices.
As shown in fig. 9, the testing apparatus 900 for a public gateway interface according to this embodiment includes: an acquisition module 901, an input module 902, a parsing module 903, and a testing module 904. Wherein:
the obtaining module 901 is configured to obtain request information of a client in an access stratum, where the request information includes public gateway interface information to be tested and request parameters;
the input module 902 is used for inputting the request parameters to a full-text search engine in real time through a data import tool;
the analysis module 903 is used for analyzing the request parameter through a full-text search engine to obtain public gateway interface test data corresponding to the public gateway interface to be tested;
the testing module 904 is configured to match the public gateway interface to be tested to a corresponding interface testing platform according to the information of the public gateway interface to be tested, test the public gateway interface to be tested by using the public gateway interface testing data, and generate a testing report.
The testing device for the public gateway interface provided in the embodiment of the present application can implement each implementation manner in the method embodiments of fig. 2 to fig. 8, and has corresponding beneficial effects, and for avoiding repetition, details are not repeated here.
Referring to fig. 10, in order to illustrate a structure of a specific embodiment of the obtaining module 901, the obtaining module 901 includes a first obtaining submodule 9011 and a second obtaining submodule 9012. The first obtaining submodule 9011 is configured to intercept a communication traffic at an access stratum gateway server. The second obtaining sub-module 9012 is configured to obtain request information of the client from the communication traffic.
Referring to fig. 11, which is a schematic structural diagram of a specific embodiment of the parsing module 903, the parsing module 903 includes a scanning sub-module 9031 and an obtaining sub-module 9032. The scanning sub-module 9031 is configured to scan each field of the request parameter and corresponding data through a full-text search engine, and store the fields and the corresponding data in a database. The obtaining sub-module 9032 is configured to obtain the common gateway interface test data from the database according to the typical common gateway interface field.
Further, referring to fig. 12, which is a schematic structural diagram of an embodiment of the obtaining sub-module 9032, the obtaining sub-module 9032 includes a creating sub-unit 90321 and a obtaining sub-unit 90322. The establishing subunit 90321 is configured to establish an index for each field stored in the database and corresponding data. The obtaining sub-unit 90322 is configured to obtain an index of the typical public gateway interface field according to the field, and further obtain corresponding public gateway interface test data from the database.
Referring to fig. 13, which is a schematic structural diagram of a specific embodiment of the test module 904, the test module 904 includes a parsing submodule 9041, a importing submodule 9042, and a testing submodule 9043. The analysis submodule 9041 is configured to analyze the information of the public gateway interface to be tested, so as to obtain the public gateway interface to be tested. And the import sub-module 9042 is configured to invoke a corresponding public gateway interface program to be tested from the public gateway server according to the public gateway interface to be tested, and import the program to be tested to the test platform. The testing sub-module 9043 is configured to test the common gateway interface to be tested using the common gateway interface testing data and generate a testing report.
Further, referring to fig. 14, which is a schematic structural diagram of an embodiment of the parsing submodule 9041, the parsing submodule 9041 includes an extracting subunit 90411 and a mapping subunit 90412. The extracting subunit 90411 is configured to extract data corresponding to the uniform resource locator field from the public gateway interface information to be tested. The mapping subunit 90412 is configured to map data corresponding to the uniform resource locator field to obtain the public gateway interface to be tested.
In some optional implementations of this embodiment, the apparatus 900 further includes: a deduplication module 905, configured to perform deduplication processing on the public gateway interface test data before testing the public gateway interface to be tested by using the public gateway interface test data.
The testing device for the public gateway interface provided in the embodiment of the present application can implement each implementation manner in the method embodiments of fig. 2 to fig. 8, and has corresponding beneficial effects, and for avoiding repetition, details are not repeated here.
In order to solve the technical problem, an embodiment of the present application further provides a computer device. Referring to fig. 15, fig. 15 is a block diagram of a basic structure of a computer device according to the present embodiment.
The computer device 15 includes a memory 151, a processor 152, and a network interface 153 communicatively connected to each other via a system bus. It is noted that only computer device 15 having components 151 and 153 is shown, but it is understood that not all of the illustrated components are required and that more or fewer components may alternatively be implemented. As will be understood by those skilled in the art, the computer device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer equipment can carry out man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch panel or voice control equipment and the like.
The memory 151 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the storage 151 may be an internal storage unit of the computer device 15, such as a hard disk or a memory of the computer device 15. In other embodiments, the memory 151 may also be an external storage device of the computer device 15, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like, provided on the computer device 15. Of course, the memory 151 may also include both internal and external storage devices of the computer device 15. In this embodiment, the memory 151 is generally used for storing an operating system installed in the computer device 15 and various application software, such as program codes of a common gateway interface testing method. In addition, the memory 151 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 152 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 152 is typically used to control the overall operation of the computer device 15. In this embodiment, the processor 152 is configured to run a program code stored in the memory 151 or process data, for example, a program code for running the testing method of the public gateway interface.
The network interface 153 may include a wireless network interface or a wired network interface, and the network interface 153 is generally used for establishing communication connection between the computer device 15 and other electronic devices.
The present application further provides another embodiment, which is to provide a computer readable storage medium storing a common gateway interface test program, which is executable by at least one processor to cause the at least one processor to perform the steps of the common gateway interface test method as described above.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
It is to be understood that the above-described embodiments are merely illustrative of some, but not restrictive, of the broad invention, and that the appended drawings illustrate preferred embodiments of the invention and do not limit the scope of the invention. This application is capable of embodiments in many different forms and is provided for the purpose of enabling a thorough understanding of the disclosure of the application. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to one skilled in the art that the present application may be practiced without modification or with equivalents of some of the features described in the foregoing embodiments. All equivalent structures made by using the contents of the specification and the drawings of the present application are directly or indirectly applied to other related technical fields and are within the protection scope of the present application.

Claims (10)

1. A public gateway interface test method is characterized by comprising the following steps:
acquiring request information of a client at an access layer, wherein the request information comprises public gateway interface information to be tested and request parameters;
inputting the request parameters into a full-text search engine in real time through a data import tool;
analyzing the request parameters through a full-text search engine to obtain public gateway interface test data corresponding to the public gateway interface to be tested;
and matching the public gateway interface to be tested to a corresponding interface test platform according to the public gateway interface to be tested information, testing the public gateway interface to be tested by using the public gateway interface test data, and generating a test report.
2. The method of claim 1, wherein the step of obtaining the request information of the client at the access stratum specifically comprises:
intercepting communication flow at an access layer gateway server;
and acquiring the request information of the client from the communication traffic.
3. The method of claim 1, wherein the step of parsing the request parameters by a full text search engine to obtain the public gateway interface test data corresponding to the public gateway interface to be tested specifically comprises:
scanning each field of the request parameters and corresponding data through a full-text search engine and storing the fields and the corresponding data in a database;
and acquiring the public gateway interface test data from the database according to the typical public gateway interface field.
4. The method of claim 3, wherein the step of obtaining the public gateway interface test data from the database according to the representative public gateway interface field specifically comprises:
establishing indexes for each field and corresponding data stored in the database;
and acquiring the index of the field according to the typical public gateway interface field, and further acquiring corresponding public gateway interface test data from a database.
5. The method of claim 1, wherein the step of matching the common gateway interface to be tested to the corresponding interface test platform according to the information of the common gateway interface to be tested further comprises:
analyzing the information of the public gateway interface to be tested to obtain the public gateway interface to be tested;
and calling a corresponding public gateway interface program to be tested from the public gateway server according to the public gateway interface to be tested and importing the program to be tested to the testing platform.
6. The method of claim 5, wherein the step of parsing the information of the public gateway interface to be tested to obtain the public gateway interface to be tested specifically comprises:
extracting data corresponding to a uniform resource locator field from the public gateway interface information to be tested;
and mapping data corresponding to the uniform resource locator field to obtain the public gateway interface to be tested.
7. The method of claim 6, wherein said step of testing said public gateway interface under test using said public gateway interface test data further comprises, prior to said step of:
and carrying out deduplication processing on the test data of the public gateway interface.
8. A testing apparatus for a public gateway interface, comprising:
the system comprises an acquisition module, a service module and a service module, wherein the acquisition module is used for acquiring request information of a client at an access layer, and the request information comprises public gateway interface information to be tested and request parameters;
the input module is used for inputting the request parameters into a full-text search engine in real time through a data import tool;
the analysis module is used for analyzing the request parameters through a full-text search engine to obtain public gateway interface test data corresponding to the public gateway interface to be tested;
and the testing module is used for matching the public gateway interface to be tested to a corresponding interface testing platform according to the information of the public gateway interface to be tested, testing the public gateway interface to be tested by using the public gateway interface testing data and generating a testing report.
9. A computer arrangement, characterized by a memory in which a computer program is stored and a processor which, when executing the computer program, carries out the steps of the public gateway interface testing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps of the public gateway interface testing method according to any one of claims 1 to 7.
CN201910867033.9A 2019-09-12 2019-09-12 Public gateway interface testing method and device, computer equipment and storage medium Active CN110798445B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910867033.9A CN110798445B (en) 2019-09-12 2019-09-12 Public gateway interface testing method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910867033.9A CN110798445B (en) 2019-09-12 2019-09-12 Public gateway interface testing method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110798445A true CN110798445A (en) 2020-02-14
CN110798445B CN110798445B (en) 2022-06-10

Family

ID=69427157

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910867033.9A Active CN110798445B (en) 2019-09-12 2019-09-12 Public gateway interface testing method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110798445B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111770004A (en) * 2020-06-26 2020-10-13 武汉众邦银行股份有限公司 Fiddler-based HTTP (S) flow content automatic verification method and storage medium
CN112346976A (en) * 2020-11-09 2021-02-09 深圳市安软科技股份有限公司 Interface document generation method, device and system based on webpage and computer equipment
CN112559362A (en) * 2020-12-23 2021-03-26 平安银行股份有限公司 Automatic testing method and testing device for dynamic user interface
CN114500348A (en) * 2021-12-22 2022-05-13 天翼云科技有限公司 CDN gateway test method and system
CN115396501A (en) * 2022-08-31 2022-11-25 北京奇艺世纪科技有限公司 Information processing method and device, electronic equipment and readable storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6381604B1 (en) * 1999-07-30 2002-04-30 Cisco Technology, Inc. Test information management system
US6741967B1 (en) * 1998-11-02 2004-05-25 Vividence Corporation Full service research bureau and test center method and apparatus
CN106776289A (en) * 2016-11-24 2017-05-31 山东交通学院 Multitask self adaptation cloud method of testing
CN106844188A (en) * 2015-12-04 2017-06-13 北京奇虎科技有限公司 A kind of test agent method, device and test system
CN108345540A (en) * 2018-02-07 2018-07-31 平安证券股份有限公司 Application test systems, method, equipment based on privately owned cloud platform and storage medium
CN108519948A (en) * 2018-04-04 2018-09-11 上海携程商务有限公司 The automatic interface testing method and system of daily record driving
CN109491891A (en) * 2018-10-17 2019-03-19 深圳壹账通智能科技有限公司 Full-automatic interface pressure surveys method, apparatus, computer equipment and storage medium
CN109522202A (en) * 2017-09-18 2019-03-26 北京京东尚科信息技术有限公司 A kind of method and apparatus of software test
CN109542786A (en) * 2018-11-20 2019-03-29 北京千丁互联科技有限公司 Visual testing method and device
CN110083540A (en) * 2019-04-29 2019-08-02 北京口袋时尚科技有限公司 Interface test method and device
CN110209578A (en) * 2019-05-21 2019-09-06 苏州浪潮智能科技有限公司 A kind of information on-line testing platform

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6741967B1 (en) * 1998-11-02 2004-05-25 Vividence Corporation Full service research bureau and test center method and apparatus
US6381604B1 (en) * 1999-07-30 2002-04-30 Cisco Technology, Inc. Test information management system
CN106844188A (en) * 2015-12-04 2017-06-13 北京奇虎科技有限公司 A kind of test agent method, device and test system
CN106776289A (en) * 2016-11-24 2017-05-31 山东交通学院 Multitask self adaptation cloud method of testing
CN109522202A (en) * 2017-09-18 2019-03-26 北京京东尚科信息技术有限公司 A kind of method and apparatus of software test
CN108345540A (en) * 2018-02-07 2018-07-31 平安证券股份有限公司 Application test systems, method, equipment based on privately owned cloud platform and storage medium
CN108519948A (en) * 2018-04-04 2018-09-11 上海携程商务有限公司 The automatic interface testing method and system of daily record driving
CN109491891A (en) * 2018-10-17 2019-03-19 深圳壹账通智能科技有限公司 Full-automatic interface pressure surveys method, apparatus, computer equipment and storage medium
CN109542786A (en) * 2018-11-20 2019-03-29 北京千丁互联科技有限公司 Visual testing method and device
CN110083540A (en) * 2019-04-29 2019-08-02 北京口袋时尚科技有限公司 Interface test method and device
CN110209578A (en) * 2019-05-21 2019-09-06 苏州浪潮智能科技有限公司 A kind of information on-line testing platform

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111770004A (en) * 2020-06-26 2020-10-13 武汉众邦银行股份有限公司 Fiddler-based HTTP (S) flow content automatic verification method and storage medium
CN111770004B (en) * 2020-06-26 2021-09-07 武汉众邦银行股份有限公司 HTTP (hyper text transport protocol) (S) flow content automatic verification method and storage medium
CN112346976A (en) * 2020-11-09 2021-02-09 深圳市安软科技股份有限公司 Interface document generation method, device and system based on webpage and computer equipment
CN112559362A (en) * 2020-12-23 2021-03-26 平安银行股份有限公司 Automatic testing method and testing device for dynamic user interface
CN114500348A (en) * 2021-12-22 2022-05-13 天翼云科技有限公司 CDN gateway test method and system
CN114500348B (en) * 2021-12-22 2023-06-23 天翼云科技有限公司 CDN gateway testing method and system
CN115396501A (en) * 2022-08-31 2022-11-25 北京奇艺世纪科技有限公司 Information processing method and device, electronic equipment and readable storage medium
CN115396501B (en) * 2022-08-31 2024-01-30 北京奇艺世纪科技有限公司 Information processing method and device, electronic equipment and readable storage medium

Also Published As

Publication number Publication date
CN110798445B (en) 2022-06-10

Similar Documents

Publication Publication Date Title
CN110798445B (en) Public gateway interface testing method and device, computer equipment and storage medium
WO2021003818A1 (en) Interface test case generating method and apparatus, computer device, and storage medium
US10839038B2 (en) Generating configuration information for obtaining web resources
CN109936621B (en) Information security multi-page message pushing method, device, equipment and storage medium
CN110808868B (en) Test data acquisition method and device, computer equipment and storage medium
AU2014400621B2 (en) System and method for providing contextual analytics data
CN111552633A (en) Interface abnormal call testing method and device, computer equipment and storage medium
CN103347092A (en) Method and device for recognizing cacheable file
CN112631924A (en) Automatic testing method and device, computer equipment and storage medium
CN111475705A (en) SQ L query-based network service monitoring method, device, equipment and storage medium
CN112631911A (en) Automatic testing method and device, computer equipment and storage medium
CN112181835A (en) Automatic testing method and device, computer equipment and storage medium
CN115794437A (en) Calling method and device of microservice, computer equipment and storage medium
CN107368407B (en) Information processing method and device
CN111797297B (en) Page data processing method and device, computer equipment and storage medium
CN113010542A (en) Service data processing method and device, computer equipment and storage medium
CN108011936A (en) Method and apparatus for pushed information
CN110727576A (en) Web page testing method, device, equipment and storage medium
CN110071921B (en) Internet of things platform access method, device, computer readable storage medium and system
CN114124883A (en) Data access method and device based on cloud storage address, computer equipment and medium
CN114765599A (en) Sub-domain name acquisition method and device
CN114371866A (en) Version reconfiguration test method, device and equipment of service system
CN112860538A (en) Method and device for performing interface regression test based on online log
CN110365633B (en) Communication flow control method, communication flow control device, computer equipment and storage medium
CN111131369A (en) APP use condition transmission method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant