CN110808868A - Test data acquisition method and device, computer equipment and storage medium - Google Patents

Test data acquisition method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN110808868A
CN110808868A CN201910865770.5A CN201910865770A CN110808868A CN 110808868 A CN110808868 A CN 110808868A CN 201910865770 A CN201910865770 A CN 201910865770A CN 110808868 A CN110808868 A CN 110808868A
Authority
CN
China
Prior art keywords
test
server
characteristic field
analysis result
webpage
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
CN201910865770.5A
Other languages
Chinese (zh)
Other versions
CN110808868B (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 CN201910865770.5A priority Critical patent/CN110808868B/en
Publication of CN110808868A publication Critical patent/CN110808868A/en
Application granted granted Critical
Publication of CN110808868B publication Critical patent/CN110808868B/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
    • 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]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application belongs to the field of software research and development, and relates to a test data acquisition method, a test data acquisition device, computer equipment and a storage medium, wherein the method comprises the following steps: reading a preset configuration file, and configuring a proxy server, wherein the configuration file comprises the server address information and the port information; acquiring request data through the proxy server, wherein the request data comprises a data packet corresponding to a hypertext transfer protocol or a hypertext transfer security protocol; analyzing the acquired request data to obtain an analysis result, wherein the analysis result comprises a characteristic field; extracting the characteristic field from the analysis result and displaying the characteristic field on a preset webpage; and editing the characteristic field displayed on the webpage to obtain a target characteristic field for testing. The data are acquired by the proxy server, so that the problems caused by a packet capturing tool can be avoided and the interface test is convenient; the data are analyzed and displayed on the webpage, so that the problems can be conveniently checked and positioned by multiple people at the same time, and the testing efficiency is improved.

Description

Test data acquisition method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of software research and development technologies, and in particular, to a method and an apparatus for acquiring test data, a computer device, and a storage medium.
Background
In recent years, the proportion of Web applications based on the HTTP protocol in all network applications is increasing, and companies, organizations and individuals develop their own websites. In the development and test process of the website application program, a large amount of data is needed to test each functional module and interface of the website, and especially most people use mobile devices such as mobile phones to visit the website today, so the acquisition of test data of a mobile terminal is particularly important. However, in the prior art, the capturing of http communication traffic at the mobile phone end needs to install a packet capturing tool such as fiddler, Charles and the like on a PC computer, and it is very troublesome to perform special configuration and modification, and the packet capturing tool is inconvenient to provide a general interface mock test.
Disclosure of Invention
An object of the embodiments of the present application is to provide a method and an apparatus for obtaining test data, a computer device, and a storage medium, so as to improve test efficiency.
In order to solve the above technical problem, an embodiment of the present application provides a method for acquiring test data, which adopts the following technical solutions:
the method comprises the following steps:
reading a preset configuration file, and configuring a proxy server, wherein the configuration file comprises the server address information and the port information;
obtaining request data through the proxy server, wherein the request data comprises a data packet corresponding to an http hypertext transfer protocol or an https hypertext transfer security protocol;
analyzing the acquired request data to obtain an analysis result, wherein the analysis result comprises a characteristic field;
extracting the characteristic field from the analysis result and displaying the characteristic field on a preset webpage;
and editing the characteristic field displayed on the webpage to obtain a target characteristic field for testing.
Further, the step of reading the preset configuration file specifically includes:
and acquiring the preset configuration file from a local server or a network server.
Further, the step of analyzing the acquired request data to obtain an analysis result specifically includes:
the acquired request data is transferred to a buffer area of the proxy server;
and extracting the request data stored in the buffer area according to a template predefined based on a hypertext transfer protocol or a hypertext transfer security protocol to obtain the analysis result.
Further, the step of extracting the feature field from the analysis result and displaying the feature field on a preset webpage specifically further includes:
extracting the characteristic field from the analysis result through a regular expression;
and synchronously displaying the extracted characteristic fields on the preset webpage.
Further, the step of synchronously displaying the extracted characteristic fields on a preset webpage specifically further includes:
presetting a uniform resource locator and a corresponding webpage;
and synchronously displaying the characteristic field to the webpage page through the uniform resource locator.
Further, the step of editing the feature field displayed on the web page to obtain a target feature field for testing specifically includes:
acquiring a template of test data of a test server;
and editing the characteristic field displayed on the webpage according to a test data template of the test server.
Further, after the step of editing the feature field displayed on the web page according to the test data template of the test server, the method further includes:
importing a target program to be tested into the test server;
and sending the edited characteristic field to a target program for automatic interface testing, and acquiring a test report aiming at the target program.
In order to solve the above technical problem, an embodiment of the present application further provides a test data obtaining apparatus, which adopts the following technical solutions:
the test data acquisition device includes:
the configuration module is used for reading a preset configuration file and configuring a proxy server, wherein the configuration file comprises the server address information and the port information;
the acquisition module is used for acquiring request data through the proxy server, and the request data comprises a data packet corresponding to an http hypertext transfer protocol or an https hypertext transfer security protocol;
the analysis module is used for analyzing the acquired request data to obtain an analysis result, and the analysis result comprises a characteristic field;
the display module is used for extracting the characteristic field from the analysis result and displaying the characteristic field on a preset webpage;
and the editing module is used for editing the characteristic field displayed on the webpage to obtain a target characteristic field for testing.
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 implements the steps of the test data acquisition 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 test data acquisition method set forth in any one of the embodiments of the present application.
Compared with the prior art, the embodiment of the application mainly has the following beneficial effects: reading a preset configuration file, and configuring a proxy server, wherein the configuration file comprises the server address information and the port information; obtaining request data through the proxy server, wherein the request data comprises a data packet corresponding to an http hypertext transfer protocol or an https hypertext transfer security protocol; analyzing the acquired request data to obtain an analysis result, wherein the analysis result comprises a characteristic field; extracting the characteristic field from the analysis result and displaying the characteristic field on a preset webpage; and editing the characteristic field displayed on the webpage to obtain a target characteristic field for testing. The data packet is acquired through the configuration proxy server, the problem of installation configuration brought by a packet capturing tool can be avoided, the situation that the interface between modules is influenced by the inconvenient interface, the environment of interface mock test is unstable, the data packet is analyzed and displayed on a webpage, a tester can conveniently check and position the data packet, and the test 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 test data acquisition method 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 204 of FIG. 2;
FIG. 6 is a flow diagram for one embodiment of step 502 in FIG. 5;
FIG. 7 is a flowchart of one embodiment of step 205 of FIG. 2;
FIG. 8 is a flow diagram of one embodiment after step 702 in FIG. 7 is performed;
FIG. 9 is a schematic block diagram of one embodiment of a test data acquisition device according to the present application;
FIG. 10 is a schematic block diagram of one embodiment of the configuration module shown in FIG. 9;
FIG. 11 is a block diagram illustrating an embodiment of the parsing module of FIG. 9;
FIG. 12 is a schematic diagram of one embodiment of the display module of FIG. 9;
FIG. 13 is a schematic diagram of one embodiment of the display sub-module of FIG. 12;
FIG. 14 is a block diagram illustrating one embodiment of an editing module of FIG. 9;
FIG. 15 is a block diagram illustrating one embodiment of a test module after the edit module of the apparatus of FIG. 9;
FIG. 16 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 test data obtaining method provided in the embodiments of the present application is generally executed by a server, and accordingly, the test data obtaining apparatus 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 test data acquisition is shown, in accordance with the present application. The test data acquisition method comprises the following steps:
step 201, reading a preset configuration file, and configuring a proxy server, where the configuration file includes the server address information and the port information.
In this embodiment, the proxy server (the server 105 in the system architecture) needs to be statically configured first, even if the server has a fixed network address (IP) and port, so that various terminal devices in the system architecture can access the server through the network address (IP) and port to request corresponding data. The configuration mode may be that a configuration file is preset, the fixed network address (IP) and port of the server are written into the file, and then the proxy server automatically reads the file and performs corresponding configuration. The network function module can be manually started for manual setting under other possible conditions.
Step 202, obtaining request data through the proxy server, where the request data includes a data packet corresponding to an http hypertext transfer protocol or an https hypertext transfer security protocol.
In this embodiment, the electronic device (for example, the server shown in fig. 1) on which the test data acquisition method operates may receive request information of various terminal devices in the system architecture in 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.
The proxy server is another server between the client (Web application of various terminal devices in the system architecture) and the Web server, through which the client browser sends a request to the proxy server instead of directly requesting a Web page from the Web server, and the request information is first sent to the proxy server, and then the proxy server requests the background Web server for information required by the browser and transmits the information to the browser.
For example, the destination website to be accessed is a, and the user cannot directly access the website a for some reason or does not want to directly access the destination website a, or wants to intercept the communication data, at this time, the user may use the proxy server, but needs to perform corresponding configuration (writing into the IP address and port of the proxy server) on the client browser (mobile phone, computer or other electronic device) to point to the proxy server; when the website A is actually accessed, the same website as before is input in the address bar of the client browser, the browser automatically accesses the proxy server first, and then the proxy server automatically switches to the target website A.
Step 203, analyzing the acquired request data to obtain an analysis result, wherein the analysis result comprises a characteristic field.
In this embodiment, the obtained data may be cached, and then one or more processes or threads may be started to synchronously analyze the request data. An http message generally includes a general purpose (generic) portion and a message header (Request headers or response headers), where the general purpose portion includes fields such as Request URL (uniform resource locator), Request Method, Status Code, Remote Address, and so on, for example, if a Request Method field of the general purpose portion of the message obtains a corresponding value, if the Request Method field is GET, or POST, the data is http Request data, and the message header is Request headers.
And 204, extracting the characteristic field from the analysis result and displaying the characteristic field on a preset webpage.
In this embodiment, the relevant feature fields and the corresponding values thereof in the analysis result of step 203, such as host, url, cookie, method, Connection, User-Agent, etc., may be extracted through a regular expression, and the extracted relevant feature fields and the corresponding values thereof are synchronously displayed on a pre-programmed web page, and then a unified url is provided to the outside for multiple users to view and analyze the data at the same time.
And 205, editing the characteristic field displayed on the webpage to obtain a target characteristic field for testing.
In this embodiment, the data of the feature fields extracted and displayed on the web page needs to be edited to conform to the data format of the test server, and usually, a template of the test data of the test server is obtained first, and then the fields and values are edited according to the format and content of the template to obtain the target feature fields for testing, and then the target feature fields and values are sent to the test server for the automated interface test; furthermore, the sequence of the interfaces to be tested can be adjusted through the test server, so that the problem of interface dependence among modules is solved, and influences caused by unstable environment are isolated.
It should be noted that the test data acquisition method provided in the embodiment of the present application may be applied to a test data acquisition device, for example: computers, servers, workstations, etc. may perform test data acquisition.
In this embodiment, a preset configuration file is read, and a proxy server is configured, where the configuration file includes the server address information and the port information; obtaining request data through the proxy server, wherein the request data comprises a data packet corresponding to an http hypertext transfer protocol or an https hypertext transfer security protocol; analyzing the acquired request data to obtain an analysis result, wherein the analysis result comprises a characteristic field; extracting the characteristic field from the analysis result and displaying the characteristic field on a preset webpage; and editing the characteristic field displayed on the webpage to obtain a target characteristic field for testing. The data packet is acquired through the configuration proxy server, the problem of installation configuration brought by a packet capturing tool can be avoided, the situation that the interface between modules is influenced by the inconvenient interface, the environment of interface mock test is unstable, the data packet is analyzed and displayed on a webpage, a tester can conveniently check and position the data packet, and the test efficiency is improved.
Further, as shown in fig. 3, the step 201 may include:
step 301, obtaining the preset configuration file from a local server or a network server.
The configuration file is the configuration file of the proxy server and comprises network address information and port information of the proxy server; the configuration file can be stored in a file system or a database local to the proxy server in a file form, or can be stored on other servers or electronic equipment in the same network with the proxy server, and then the proxy server acquires the configuration file through the network.
By acquiring the configuration file of the proxy server from the local server or the network server, the configuration of the proxy server can be correspondingly modified only by modifying the configuration file after the server is moved.
Further, as shown in fig. 4, the step 203 may further include the following steps:
step 401, the acquired request data is transferred to a buffer area of the proxy server.
Optionally, if the traffic of accessing the background web server through the proxy server is too large, which may cause congestion, delay, and the like, the obtained request or response data may be cached in the data buffer of the proxy server to increase the processing speed; further, the data can be saved in a database so as to be used as historical data for inquiring and comparing.
Step 402, extracting the request data stored in the buffer according to a template predefined based on the hypertext transfer protocol or the hypertext transfer security protocol, and obtaining the analysis result.
In this embodiment, the analysis may be performed according to the hypertext transfer protocol or the hypertext transfer security protocol message format, or a parsing template may be predefined according to the message format, and then the field in the request data is extracted through the template. Generally, an http message generally includes a general (general) portion and a header (Request headers or response headers), where the general (general) portion further includes fields such as a Request URL (uniform resource locator for Request), a Request method, a Status Code, a Remote Address, and corresponding values, for example, if a Request method field of the general (general) portion of the message is analyzed to obtain a corresponding value, if the value is GET, POST, and the like, the data is http Request data, and the header is Request headers.
In some possible cases, when the proxy server receives https request data, the proxy server may replace the certificate first, and then parse the request in plaintext; and the processing flow of the http request after the plaintext analysis is consistent with the http.
The acquired request data is transferred to the buffer area of the proxy server, and the request data transferred in the buffer area is extracted based on a predefined template, so that the access and analysis rate of the data can be increased.
Further, as shown in fig. 5, the step 204 specifically includes the following steps:
step 501, extracting the characteristic field from the analysis result through a regular expression.
The regular expression is a logical formula for operating on character strings (including common characters, such as letters between a and z, and special characters (called "meta characters")), that is, a "regular character string" is formed by using specific characters defined in advance and a combination of the specific characters, and the "regular character string" is used to express a filtering logic for the character string. Regular expression (regular expression) describes a pattern (pattern) for matching a character string, which can be used to check whether a string contains a certain substring, to replace the matching substring, or to extract a substring that meets a certain condition from a certain string, etc. By writing a regular expression rule, the characteristic field and the corresponding data can be extracted from the analysis result, for example, [ a-zA-Z ] can match all letters, and then 'method: [ a-zA-Z ]' can obtain the request mode in the data message corresponding to the field of method.
Step 502, synchronously displaying the extracted characteristic fields on the preset webpage.
In this embodiment, optionally, fields and corresponding values obtained by analyzing the request data acquired by the proxy server through the above steps, such as field host, URL, connection, cookie, method, User-Agent, Content-Length, Content-Type, and the like, are displayed on the web page in a waterfall flow manner, and a uniform URL interface is provided to the outside to acquire and display the fields and the values, so that a plurality of users can view and locate the analysis problem through the URL interface at the same time. Furthermore, the obtained fields and the corresponding values thereof can be stored in a database so as to be taken out and displayed again as historical data at any time.
And extracting the characteristic fields from the analysis result through a regular expression and synchronously displaying the characteristic fields on the preset webpage, so that a plurality of people can conveniently check and position the analysis problem at the same time, and the test and development efficiency is improved.
Further, as shown in fig. 6, the step 502 specifically includes the following steps:
step 601, presetting a uniform resource locator and a corresponding webpage.
A Uniform Resource Locator (URL) is a compact representation of the location and access method of a Resource available from the internet, and is an address of a standard Resource on the internet. Each resource on the internet has a unique URL that contains information indicating the location of the resource and how the browser should handle it. The basic URL contains the protocol type, the server name (domain name or IP address), the path and the file name, such as "protocol:// authorized access path? Query string ", e.g., https:// www.patenthub.cn/s? p ═ 5& q ═ 28 tscd% 3A% 28.
In this embodiment, it is necessary to write web pages for displaying the extracted feature fields in advance using the hypertext markup language HTML, and store the web pages in a path specified by the preset uniform resource locator for access.
Step 602, synchronously displaying the characteristic field to the webpage page through the uniform resource locator.
In this embodiment, an independent backend interface program may be written to process a request for acquiring a web page and corresponding data through the uniform resource locator, and specifically, a thread or a process may be started to read the characteristic field and a corresponding numerical value, and then the characteristic field and the corresponding numerical value are returned to the web page to be rendered and then displayed in a specific form in real time through the uniform resource locator, such as a waterfall flow graph, bubbles, and the like, so that a plurality of people can view and analyze problems through the uniform resource locator interface at the same time, and efficiency is improved.
Further, as shown in fig. 7, the step 205 specifically includes the following steps:
step 701, obtaining a template of test data of a test server.
In this embodiment, a Yapi test server, which is a server capable of managing and testing the api interface of the web application on line, may be used. Before the test is started, a program interface needs to be imported and test data of a test server needs to be satisfied, generally, the test data has a universal template, and the data format of the Yapi test server is met, and json, xml and other formats can be used.
And 702, editing the characteristic field displayed on the webpage according to a test data template of the test server.
In this embodiment, the test data template of the test server may be in the data format of the Yapi test server, and may use a json format, and is generally written in a regular expression manner as follows:
Figure BDA0002201227890000111
Figure BDA0002201227890000121
optionally, a request method, a connection, a cookie, and the like may be edited to meet the test requirement.
According to the test data template of the test server, the request data is edited through the regular expression, and the test data can be conveniently customized according to the test requirements.
In some optional implementations of this embodiment, as shown in fig. 8, after the step 702 is executed, this embodiment may further include the following steps:
step 801, importing a target program to be tested into the test server.
In this embodiment, the target program to be tested is an api interface of a web backend application program written in a backend programming language such as JAVA, PYTHON, and C + +/C #, where generally, one request corresponds to one backend interface, which may also be referred to as a processing function, and is used to check whether the incoming test data conforms to the parameter definition of the function and return the result to the client in the form of a web page after the request is processed, and these interface programs may be imported into the Yapi test server for unified management and scheduling, and the order between the interfaces may be adjusted to meet the test requirements, thereby solving the problems of inter-module interface dependence and environmental instability, and improving the reliability of the test.
And 802, sending the edited characteristic field to a target program for automatic interface test, and acquiring a test report aiming at the target program.
Optionally, the edited feature field of the test data template based on the test server is reversely proxied to the Yapi test server through the nginx service program on the proxy server to perform automatic test, so that the test efficiency is improved. The configuration file implementation of the nginx service program may be modified, for example, by changing the value of the proxy _ pass field to the address of the background Yapi test server (Yapi. xxx. com) plus the item (2817) number of the web application program and the url (/ baseapi) corresponding to the api interface:
{proxy_pass http://yapi.xxx.com/mock/2817/baseapi};
finally, generating a corresponding test report on the Yapi test server, and adjusting a corresponding interface program according to the test report to enable the interface to meet the functional requirements; or re-edit the extracted data and repeat the interface test until the requirements are met. The target interface program to be tested can be conveniently managed through the test server, automatic test can be carried out, and test efficiency is improved.
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 test data obtaining apparatus, 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 test data acquiring apparatus 900 according to the present embodiment includes: a configuration module 901, an acquisition module 902, a parsing module 903, a display module 904, and an editing module 905. Wherein:
the configuration module 901 is configured to read a preset configuration file, and configure a proxy server, where the configuration file includes the server address information and the port information.
The obtaining module 902 is configured to obtain request data through the proxy server, where the request data includes a data packet corresponding to an http hypertext transfer protocol or an https hypertext transfer security protocol.
The analysis module 903 is configured to analyze the acquired request data to obtain an analysis result, where the analysis result includes a feature field.
The display module 904 is configured to extract the feature field from the parsing result and display the feature field on a preset webpage.
The editing module 905 is configured to edit the feature field displayed on the web page to obtain a target feature field for testing.
Referring to fig. 10, which is a schematic structural diagram of an embodiment of the configuration module 901, the configuration module 901 further includes: sub-module 9011 is obtained.
The obtaining sub-module 9011 is configured to obtain the preset configuration file from a local server or a network server.
Referring to fig. 11, which is a schematic structural diagram of an embodiment of the analysis module 903, the analysis module 903 further includes: a dump submodule 9031 and an extract submodule 9032.
The dump sub-module 9031 is configured to dump the acquired request data to the buffer of the proxy server.
The extraction sub-module 9032 is configured to extract the request data stored in the buffer according to a template predefined based on a hypertext transfer protocol or a hypertext transfer security protocol, so as to obtain the parsing result.
Referring to fig. 12, which is a schematic structural diagram of an embodiment of the display module 904, the display module 904 further includes: an extraction sub-module 9041 and a display sub-module 9042.
The extraction submodule 9041 is configured to extract the feature field from the analysis result through a regular expression.
The display sub-module 9042 is configured to synchronously display the extracted feature fields on the preset webpage.
Referring to fig. 13, which is a schematic structural diagram of an embodiment of the display sub-module 9042, the display sub-module 9042 further includes: a preset unit 90421 and a synchronization display unit 90422.
The preset sub-unit 90421 is used to preset a uniform resource locator and a corresponding web page.
The synchronous display sub-unit 90422 is configured to synchronously display the characteristic field to the web page through the uniform resource locator.
Referring to fig. 14, which is a schematic structural diagram of an embodiment of the editing module 905, the editing module 905 further includes: an acquisition sub-module 9051 and an editing sub-module 9052.
The obtaining sub-module 9051 is configured to obtain a template of test data of the test server.
The editing submodule 9052 is configured to edit the feature field displayed on the web page according to a test data template of the test server.
In some optional implementations of this embodiment, the apparatus 900 may further include: further, as shown in fig. 15, the testing module 906 further includes: import submodule 9061 and test submodule 9062. Wherein:
the import submodule 9061 is configured to import the target program to be tested into the test server.
The test sub-module 9062 is configured to send the edited feature field to a target program for an automated interface test, and obtain a test report for the target program.
The test data acquisition device provided in the embodiment of the present application can implement each implementation manner in the method embodiments of fig. 2 to 8, and 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. 16, fig. 16 is a block diagram of a basic structure of a computer device according to the present embodiment.
The computer device 16 includes a memory 161, a processor 162, and a network interface 163 communicatively coupled to each other via a system bus. It is noted that only computer device 16 having components 161 and 163 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 161 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 161 may be an internal storage unit of the computer device 16, such as a hard disk or a memory of the computer device 16. In other embodiments, the memory 161 may also be an external storage device of the computer device 16, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, provided on the computer device 16. Of course, the memory 161 may also include both internal and external storage devices of the computer device 16. In this embodiment, the memory 161 is generally used for storing an operating system installed in the computer device 16 and various types of application software, such as program codes of the test data acquisition method. In addition, the memory 161 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 162 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 162 is typically used to control the overall operation of the computer device 16. In this embodiment, the processor 162 is configured to execute the program code stored in the memory 161 or process data, for example, execute the program code of the test data acquisition method.
The network interface 163 may include a wireless network interface or a wired network interface, and the network interface 163 is typically used to establish communication links between the computer device 16 and other electronic devices.
The present application further provides another embodiment, which is to provide a computer-readable storage medium storing a test data acquisition program, which is executable by at least one processor to cause the at least one processor to perform the steps of the test data acquisition 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 test data acquisition method is characterized by comprising the following steps:
reading a preset configuration file, and configuring a proxy server, wherein the configuration file comprises the server address information and the port information;
obtaining request data through the proxy server, wherein the request data comprises a data packet corresponding to an http hypertext transfer protocol or an https hypertext transfer security protocol;
analyzing the acquired request data to obtain an analysis result, wherein the analysis result comprises a characteristic field;
extracting the characteristic field from the analysis result and displaying the characteristic field on a preset webpage;
and editing the characteristic field displayed on the webpage to obtain a target characteristic field for testing.
2. The method according to claim 1, wherein the step of reading the preset configuration file specifically includes:
and acquiring the preset configuration file from a local server or a network server.
3. The method according to claim 2, wherein the step of analyzing the acquired request data to obtain an analysis result specifically includes:
the acquired request data is transferred to a buffer area of the proxy server;
and extracting the request data stored in the buffer area according to a template predefined based on a hypertext transfer protocol or a hypertext transfer security protocol to obtain the analysis result.
4. The method according to claim 1, wherein the step of extracting the feature field from the analysis result and displaying the feature field on a preset web page specifically includes:
extracting the characteristic field from the analysis result through a regular expression;
and synchronously displaying the extracted characteristic fields on the preset webpage.
5. The method according to claim 4, wherein the step of synchronously displaying the extracted characteristic fields on a preset webpage specifically comprises:
presetting a uniform resource locator and a corresponding webpage;
and synchronously displaying the characteristic field to the webpage page through the uniform resource locator.
6. The method for acquiring test data according to claim 1, wherein the step of editing the feature field displayed on the web page to obtain a target feature field for testing specifically comprises:
acquiring a template of test data of a test server;
and editing the characteristic field displayed on the webpage according to a test data template of the test server.
7. The test data acquisition method according to claim 6, further comprising, after the step of editing the characteristic fields displayed on the web page according to the test data template of the test server:
importing a target program to be tested into the test server;
and sending the edited characteristic field to a target program for automatic interface testing, and acquiring a test report aiming at the target program.
8. A test data acquisition apparatus, comprising:
the configuration module is used for reading a preset configuration file and configuring a proxy server, wherein the configuration file comprises the server address information and the port information;
the acquisition module is used for acquiring request data through the proxy server, and the request data comprises a data packet corresponding to an http hypertext transfer protocol or an https hypertext transfer security protocol;
the analysis module is used for analyzing the acquired request data to obtain an analysis result, and the analysis result comprises a characteristic field;
the display module is used for extracting the characteristic field from the analysis result and displaying the characteristic field on a preset webpage;
and the editing module is used for editing the characteristic field displayed on the webpage to obtain a target characteristic field for testing.
9. A computer device, characterized by comprising a memory in which a computer program is stored and a processor which, when executing the computer program, implements the steps of the test data acquisition method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that a computer program is stored thereon, which computer program, when being executed by a processor, carries out the steps of the test data acquisition method according to one of claims 1 to 7.
CN201910865770.5A 2019-09-12 2019-09-12 Test data acquisition method and device, computer equipment and storage medium Active CN110808868B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910865770.5A CN110808868B (en) 2019-09-12 2019-09-12 Test data acquisition method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910865770.5A CN110808868B (en) 2019-09-12 2019-09-12 Test data acquisition method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110808868A true CN110808868A (en) 2020-02-18
CN110808868B CN110808868B (en) 2023-04-07

Family

ID=69487585

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910865770.5A Active CN110808868B (en) 2019-09-12 2019-09-12 Test data acquisition method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110808868B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111427797A (en) * 2020-04-12 2020-07-17 广州通达汽车电气股份有限公司 Automatic interface testing method and device, electronic equipment and storage medium
CN112069060A (en) * 2020-08-13 2020-12-11 北京达佳互联信息技术有限公司 Data processing method and device, electronic equipment and storage medium
CN113220584A (en) * 2021-05-26 2021-08-06 京东科技控股股份有限公司 Page testing method and device, computer equipment and readable storage medium
CN115086206A (en) * 2022-06-14 2022-09-20 工银科技有限公司 Client software debugging method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110302298A1 (en) * 2010-06-07 2011-12-08 Salesforce.Com, Inc. Method and system for testing multiple components of a multi-tenant, multi-domain, multi-tiered website
CN106708726A (en) * 2015-11-17 2017-05-24 北京京东尚科信息技术有限公司 Page compatibility testing system and method
CN107133180A (en) * 2017-06-07 2017-09-05 腾讯科技(深圳)有限公司 Method of testing, test device and the storage medium of dynamic page
CN107547312A (en) * 2017-09-21 2018-01-05 广州四三九九信息科技有限公司 Applied program testing method and system
CN108197021A (en) * 2017-12-28 2018-06-22 深圳市彬讯科技有限公司 A kind of web system automated testing method, device, equipment and storage medium
CN108363662A (en) * 2018-01-29 2018-08-03 深圳壹账通智能科技有限公司 A kind of applied program testing method, storage medium and terminal device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110302298A1 (en) * 2010-06-07 2011-12-08 Salesforce.Com, Inc. Method and system for testing multiple components of a multi-tenant, multi-domain, multi-tiered website
CN106708726A (en) * 2015-11-17 2017-05-24 北京京东尚科信息技术有限公司 Page compatibility testing system and method
CN107133180A (en) * 2017-06-07 2017-09-05 腾讯科技(深圳)有限公司 Method of testing, test device and the storage medium of dynamic page
CN107547312A (en) * 2017-09-21 2018-01-05 广州四三九九信息科技有限公司 Applied program testing method and system
CN108197021A (en) * 2017-12-28 2018-06-22 深圳市彬讯科技有限公司 A kind of web system automated testing method, device, equipment and storage medium
CN108363662A (en) * 2018-01-29 2018-08-03 深圳壹账通智能科技有限公司 A kind of applied program testing method, storage medium and terminal device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
PURPLELAVENDER: "fiddler配置及使用教程", 《博客园HTTPS://WWW.CNBLOGS.COM/WOAIXUEXI9999/P/9247705.HTML》 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111427797A (en) * 2020-04-12 2020-07-17 广州通达汽车电气股份有限公司 Automatic interface testing method and device, electronic equipment and storage medium
CN111427797B (en) * 2020-04-12 2023-12-05 广州通达汽车电气股份有限公司 Automatic interface testing method and device, electronic equipment and storage medium
CN112069060A (en) * 2020-08-13 2020-12-11 北京达佳互联信息技术有限公司 Data processing method and device, electronic equipment and storage medium
CN113220584A (en) * 2021-05-26 2021-08-06 京东科技控股股份有限公司 Page testing method and device, computer equipment and readable storage medium
CN115086206A (en) * 2022-06-14 2022-09-20 工银科技有限公司 Client software debugging method and device

Also Published As

Publication number Publication date
CN110808868B (en) 2023-04-07

Similar Documents

Publication Publication Date Title
CN110808868B (en) Test data acquisition method and device, computer equipment and storage medium
CN109936621B (en) Information security multi-page message pushing method, device, equipment and storage medium
US10839038B2 (en) Generating configuration information for obtaining web resources
US8935798B1 (en) Automatically enabling private browsing of a web page, and applications thereof
US9485240B2 (en) Multi-account login method and apparatus
CN110493030B (en) Network optimization method and device, computer equipment and storage medium
US10187444B2 (en) System and method of automatic generation and insertion of analytic tracking codes
CN111414407A (en) Data query method and device of database, computer equipment and storage medium
CN110798445B (en) Public gateway interface testing method and device, computer equipment and storage medium
US9934206B2 (en) Method and apparatus for extracting web page content
CN109683998A (en) Internationalize implementation method, device and system
WO2017124692A1 (en) Method and apparatus for searching for conversion relationship between form pages and target pages
TW201409273A (en) Method and Apparatus of Responding to Webpage Access Request
JP5112401B2 (en) Web action history acquisition system, Web action history acquisition method, gateway device, and program
CN104023046A (en) Mobile terminal recognition method and device
CN101916283B (en) Method for acquiring link information from dynamic webpage and server thereof
CN111797297B (en) Page data processing method and device, computer equipment and storage medium
CN110677506A (en) Network access method, device, computer equipment and storage medium
CN108011936A (en) Method and apparatus for pushed information
CN110633432A (en) Method, device, terminal equipment and medium for acquiring data
CN105338091A (en) High-transmission-efficiency personalized information interface display method and apparatus
CN116304403A (en) Webpage access method and device, computer equipment and storage medium
CN102663063B (en) System and method for showing general information of multiple user platforms based on XSLT (extensible stylesheet language transformation)
CN111756744B (en) H5 user identification method, device, equipment and storage medium
CN110365633B (en) Communication flow control method, communication flow control device, computer equipment and storage medium

Legal Events

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