CN113821430A - Multi-service testing method and device - Google Patents

Multi-service testing method and device Download PDF

Info

Publication number
CN113821430A
CN113821430A CN202011019715.3A CN202011019715A CN113821430A CN 113821430 A CN113821430 A CN 113821430A CN 202011019715 A CN202011019715 A CN 202011019715A CN 113821430 A CN113821430 A CN 113821430A
Authority
CN
China
Prior art keywords
service
downstream
request
upstream
request data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011019715.3A
Other languages
Chinese (zh)
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.)
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Wodong Tianjun Information Technology Co 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 Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Wodong Tianjun Information Technology Co Ltd
Priority to CN202011019715.3A priority Critical patent/CN113821430A/en
Publication of CN113821430A publication Critical patent/CN113821430A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a multi-service testing method and device, and relates to the technical field of computers. One embodiment of the method comprises: configuring a request for an upstream service; sending the request of the upstream service to the upstream service so that the upstream service constructs request data of a downstream service, sending the request data of the downstream service to a stub service of the downstream service, and enabling the stub service of the downstream service to write the request data of the downstream service into a cache; and acquiring the request data of the downstream service from the cache. The implementation mode can solve the technical problem of strong coupling of the function test between the upstream service and the downstream service.

Description

Multi-service testing method and device
Technical Field
The invention relates to the technical field of computers, in particular to a multi-service testing method and device.
Background
For services with upstream and downstream relationships, testing upstream services requires the results returned by downstream services, and testing downstream services requires requests from upstream services. Currently, for services that interact through a remote procedure call framework, a way to obtain a request sent by an upstream service to a downstream service is to print the request into a log, and then search for request data in the log.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
the coupling of the function test between the upstream service and the downstream service is stronger; incomplete coverage of a test scene; downstream services cannot be individually functionally tested.
Disclosure of Invention
In view of this, embodiments of the present invention provide a multi-service testing method and apparatus to solve the technical problem of strong coupling of function testing between upstream and downstream services.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a multi-service testing method including:
configuring a request for an upstream service;
sending the request of the upstream service to the upstream service so that the upstream service constructs request data of a downstream service, sending the request data of the downstream service to a stub service of the downstream service, and enabling the stub service of the downstream service to write the request data of the downstream service into a cache;
and acquiring the request data of the downstream service from the cache.
Optionally, after configuring the request of the upstream service, the method further includes:
generating a unique identification of the request of the upstream service, and configuring a traffic type of the upstream service.
Optionally, the primary key in the cache includes a unique identifier of the request of the upstream service and a service name of the downstream service, and the value in the cache is request data of the downstream service.
Optionally, the method further comprises:
configuring a service name, a request, an IP and a port number of the downstream service;
sending the request of the downstream service to the downstream service according to the IP and the port number;
and receiving a result returned by the downstream service.
Optionally, configuring the request of the downstream service includes:
configuring the request data of the downstream service acquired from the cache as the request of the downstream service.
Optionally, the method further comprises:
writing the return result into a configuration file;
and loading the configuration file through the stub service of the downstream service so that the stub service of the downstream service returns the return result to the upstream service.
Optionally, the returned result is a preset returned result, or a result returned by the downstream service.
In addition, according to another aspect of an embodiment of the present invention, there is provided a multi-service test apparatus including:
a configuration module to configure a request for an upstream service;
a sending module, configured to send the request of the upstream service to the upstream service, so that the upstream service constructs request data of a downstream service, sends the request data of the downstream service to a stub service of the downstream service, and causes the stub service of the downstream service to write the request data of the downstream service into a cache;
and the acquisition module is used for acquiring the request data of the downstream service from the cache.
Optionally, the configuration module is further configured to:
after configuring the request of the upstream service, generating a unique identification of the request of the upstream service, and configuring the service type of the upstream service.
Optionally, the primary key in the cache includes a unique identifier of the request of the upstream service and a service name of the downstream service, and the value in the cache is request data of the downstream service.
Optionally, the configuration module is further configured to:
configuring a service name, a request, an IP and a port number of the downstream service;
sending the request of the downstream service to the downstream service according to the IP and the port number;
and receiving a result returned by the downstream service.
Optionally, the configuration module is further configured to:
configuring the request data of the downstream service acquired from the cache as the request of the downstream service.
Optionally, the configuration module is further configured to:
writing the return result into a configuration file;
and loading the configuration file through the stub service of the downstream service so that the stub service of the downstream service returns the return result to the upstream service.
Optionally, the returned result is a preset returned result, or a result returned by the downstream service.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any of the embodiments described above.
According to another aspect of the embodiments of the present invention, there is also provided a computer readable medium, on which a computer program is stored, which when executed by a processor implements the method of any of the above embodiments.
One embodiment of the above invention has the following advantages or benefits: the technical means that the request of the upstream service is configured, the request of the upstream service is sent to the upstream service, so that the upstream service constructs the request data of the downstream service, the request data of the downstream service is sent to the stub service of the downstream service, and the stub service of the downstream service writes the request data of the downstream service into the cache is adopted, and therefore the technical problem of strong coupling of function test between the upstream service and the downstream service in the prior art is solved. For projects related to a plurality of service changes, the embodiment of the invention tests the downstream services in a pile mode, thus removing strong coupling between the upstream services and the downstream services and realizing decoupling of service test; when one project relates to the condition that a plurality of interdependent services need to be upgraded, the upgraded services can be tested independently without waiting for the completion of the development of the dependent services, so that the testing efficiency and the iteration efficiency are improved; and the request data sent by the upstream service to various downstream services can be directly obtained from the cache, and the log searching is not needed.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main flow of a multi-service testing method according to an embodiment of the invention;
FIG. 2 is a schematic diagram of a remote procedure call framework according to an embodiment of the invention;
FIG. 3 is a schematic diagram of a remote procedure call framework adapted in accordance with an embodiment of the present invention;
FIG. 4 is a schematic diagram of a request to configure an upstream service at a web page in accordance with an embodiment of the present invention;
FIG. 5 is a schematic diagram of a cached read result being presented on a web page according to an embodiment of the invention;
FIG. 6 is a schematic view of a main flow of a multi-service test method according to a referential embodiment of the present invention;
FIG. 7 is a schematic diagram of a request to configure a downstream service at a web page in accordance with an embodiment of the present invention;
FIG. 8 is a schematic view of a main flow of a multi-service test method according to another referential embodiment of the present invention;
FIG. 9 is a schematic diagram of a stub service loading configuration file according to an embodiment of the invention;
FIG. 10 is a schematic diagram of the main modules of a multi-service test apparatus according to an embodiment of the present invention;
FIG. 11 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 12 is a schematic structural diagram of a computer system suitable for implementing a terminal device or a server according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Currently, for services that interact through a remote procedure call framework (such as an RPC framework or a BRPC framework), a way to obtain a request sent by an upstream service to a downstream service is to print the request into a log, and then search the log for request data. Therefore, the prior art has the technical problems that:
1) the functional test coupling between the upstream service and the downstream service is strong, when the items related to the upgrading of the upstream service and the downstream service are involved, the functional tests of the services depend on each other, and if the two services are not developed and completed at the same time, the test of the other service is blocked.
2) The results of various scenes need to be returned downstream for the upstream service and the requests of various scenes need to be sent upstream for the downstream service, so that the comprehensive test cannot be carried out, and the test scene coverage is not complete.
3) Since the request sent upstream to the downstream needs to be acquired by printing the log, and the request cannot be sent to the downstream service independently after the request is acquired, it is difficult to acquire the request sent upstream to the downstream, so that the downstream service cannot perform the function test independently.
In order to solve the technical problems in the prior art, the embodiment of the invention provides a multi-service testing method, which is used for decoupling the function test between upstream and downstream services, can cover a more comprehensive testing scene, and can realize the independent test of the downstream services.
Fig. 1 is a schematic diagram of a main flow of a multi-service testing method according to an embodiment of the present invention. As an embodiment of the present invention, as shown in fig. 1, the multi-service testing method may include:
step 101, configure a request for an upstream service.
If an upstream service of a remote procedure call framework (such as an RPC framework or a BRPC framework, etc.) is to be tested, the request of the upstream service needs to be configured. As shown in fig. 2, the remote procedure call framework may include a plurality of services, such as an a service, a B service, a C service, and the like, wherein the a service is an upstream service, and the B service and the C service are both downstream services.
In an embodiment of the present invention, the request for the upstream service may be configured in a script, or may be configured on a page of the web client. As shown in FIG. 3, to facilitate the tester to configure the request, the request for the upstream service may be configured on a web page, such as an HTTP request may be entered in a request entry box of the web page.
Optionally, after step 101, further comprising: generating a unique identification of the request of the upstream service, and configuring a traffic type of the upstream service. As shown in fig. 3, when the tester configures a request on the page of the web client, the web server automatically generates a unique identifier (sid) for the request, and sends the unique identifier of the request to the web client, so as to be displayed on the web page. Further, the tester may also configure the requested service type on the page, and since the upstream service has different service types and the downstream services accessed by different service types are also different, the requested service type needs to be configured. For example, in the case of an advertisement service, the service type may include home focus, recommendations, searches, off-site, and the like.
Step 102, sending the request of the upstream service to the upstream service, so that the upstream service constructs request data of a downstream service, sends the request data of the downstream service to a stub service of the downstream service, and causes the stub service of the downstream service to write the request data of the downstream service into a cache.
Before step 102, each downstream service needs to be modified, and a stub service corresponding to each downstream service is generated, so that after receiving request data sent by an upstream service, the stub service of the downstream service writes the request data into a cache without other business logic. For example, when the service a requests the stub service of the service B, the stub service of the service B writes the request data into the cache to be retained after receiving the request data, and then the processing of the stub service of the service B is finished this time, and the service a continues to request the stub services of other downstream services. In the embodiment of the invention, the stub service of the downstream service defines the entry and exit of the downstream service, but the stub service has no business logic, so the stub service does not logically process the request data sent by the upstream service.
As shown in fig. 4, a request sending button is further provided on the web page, and when the tester completes configuration and clicks the button, the web service end sends a sending instruction, and then sends the configured request to the a service. The A service constructs the request data of various downstream services (B, C … …) according to the business logic of the A service, accesses the stub service (stub) of the downstream service, and writes the received request data into the cache directly after the stub service of the downstream service receives the request data sent by the A service.
In an embodiment of the invention, the primary key (key) in the cache comprises a unique identifier (sid) of the request of the upstream service and a service name of the downstream service, and the value (value) in the cache is the request data of the downstream service.
Step 103, obtaining the request data of the downstream service from the cache.
After the stub service of the downstream service writes the request data of the downstream service into the cache (close to real-time storage), the web service end reads the cache, so that the request data sent by the upstream service to various downstream services can be obtained. The tester does not need to search the log for the request data sent by the upstream service to various downstream services, and can also test the upstream service independently.
Optionally, after step 103, further comprising: and sending the request data of the downstream service to a web client so as to display the request data of the downstream service on a web page. The web server obtains the request data sent by the upstream service to various downstream services from the cache, and then displays the read results on a web page, as shown in fig. 5, which is convenient for a tester to view the results.
According to the various embodiments described above, it can be seen that the technical problem of strong coupling in function test between upstream and downstream services in the prior art is solved by a technical means that a request of an upstream service is configured, the request of the upstream service is sent to the upstream service, so that the upstream service constructs request data of a downstream service, the request data of the downstream service is sent to a stub service of the downstream service, and the stub service of the downstream service writes the request data of the downstream service into a cache. For projects related to a plurality of service changes, the embodiment of the invention tests the downstream services in a pile mode, thus removing strong coupling between the upstream services and the downstream services and realizing decoupling of service test; when one project relates to the condition that a plurality of interdependent services need to be upgraded, the upgraded services can be tested independently without waiting for the completion of the development of the dependent services, so that the testing efficiency and the iteration efficiency are improved; and the request data sent by the upstream service to various downstream services can be directly obtained from the cache, and the log searching is not needed.
When testing the downstream service of the remote process call framework, testers build a whole set of upstream service to downstream service environment, send requests to the upstream service, and then check the return results of the upstream service to judge whether the downstream service has problems. Therefore, the embodiment of the invention decouples the test between the upper service and the lower service, and realizes the direct test of the downstream service. The embodiment of the invention directly sends the request data acquired from the cache to the downstream service to be tested, then obtains the result returned by the downstream service, and verifies whether the change of the downstream service is in accordance with the expectation or not through the verification of the result.
Fig. 6 is a schematic diagram of a main flow of a multi-service test method according to a referential embodiment of the present invention. As still another embodiment of the present invention, as shown in fig. 6, the multi-service testing method may include:
step 601, configuring the service name, request, IP and port number of the downstream service.
In the embodiment of the invention, the service name, the request, the IP and the port number of the downstream service can be configured in the script, and the service name, the request, the IP and the port number of the downstream service can also be configured on the page of the web client. As shown in fig. 7, in order to facilitate the tester to configure the service name, request, IP, and port number of the downstream service, the service name, request, IP, and port number of the downstream service may be configured on the web page.
Optionally, configuring the request of the downstream service or the stub service of the downstream service includes: configuring the request of the downstream service acquired from the cache as a request of the downstream service or a stub service of the downstream service. For example, the request data obtained from the cache is directly filled into the request data input box shown in fig. 7, and then the downstream service to be tested is selected (B, C, D, etc.), and req1 represents the default request of the service. Then, the environment machine ip where the service to be tested is located and the port number of the service are selected. If the request is not manually filled in the request data entry box, default ones of the requests may be selected from the drop-down boxes. When filled in manually, the selection in the drop-down box is disabled.
Step 602, sending the request of the downstream service to the downstream service according to the IP and the port number.
As shown in fig. 7, a request sending button is further provided on the web page, and when the tester completes configuration and clicks the button, the web service end sends and receives a sending instruction, and then sends the request to the corresponding downstream service according to the options selected by the user. Therefore, the downstream service can be independently tested, the request sent by the upstream service can be acquired, and the request data can be sent to the downstream service independently.
Step 603, receiving the result returned by the downstream service.
In order to facilitate the tester to view the test result of the downstream service, after receiving the result returned by the downstream service, the web service end sends the result returned by the downstream service to the web client, so that the result returned by the downstream service is displayed on a web page. As shown in fig. 7, the result returned by the downstream service is displayed in the input box where the result is returned, so that the tester can verify whether the change of the project is met according to the returned result.
It should be noted that, when configuring the request of the downstream service in step 601, the request data of the downstream service acquired from the cache may be optionally changed, and then the changed request data is configured as the request of the downstream service. Because each upgrading point needs to correspond to a plurality of test points, parameters in the request data are modified to test different logics of the service, and therefore the comprehensiveness of the test scene is guaranteed.
The embodiment of the invention decouples the function test between the upstream service and the downstream service, and when one project relates to a plurality of interdependent services which need to be upgraded, the upgraded services can be independently tested without waiting for the development of the depended services to be completed, thereby improving the test and development iteration efficiency; and the requests sent by the upstream service to various downstream services can be directly obtained from the cache, and the log searching is not needed. Therefore, the embodiment of the invention can lead the service test to be more automatic, comprehensive and convenient, thereby improving the test and development iteration efficiency.
Fig. 8 is a schematic view of a main flow of a multi-service test method according to another referential embodiment of the present invention. As another embodiment of the present invention, as shown in fig. 8, the multi-service testing method, applied to a web service, may include:
step 801, receiving a test request sent by a web client, where the test request carries a request of an upstream service and a service type thereof, and then generating a unique identifier of the request of the upstream service.
The method comprises the steps that a tester can configure a request of an upstream service and a service type of the upstream service on a page of a web client, the web client sends the configured request and the service type of the upstream service to the web server, and the web server generates a unique identifier for the request of the upstream service after receiving a test request sent by the web client.
Step 802, sending the request of the upstream service to the upstream service, so that the upstream service constructs request data of a downstream service, sends the request data of the downstream service to a stub service of the downstream service, and causes the stub service of the downstream service to write the request data of the downstream service into a cache.
The web service side sends the request of the upstream service to the upstream service, the upstream service constructs request data of various downstream services according to the service logic of the upstream service, then the request data are respectively sent to corresponding stub services of the downstream service, and the stub services of the downstream service write the request data into the cache after receiving the request data sent by the upstream service. Wherein the primary key in the cache comprises a unique identifier of the request of the upstream service and a service name of the downstream service, and the value in the cache is request data of the downstream service.
Step 803, obtaining the request data of the downstream service from the cache, and sending the request data of the downstream service to a web client, so that the request data of the downstream service is displayed on a web page.
And the web server side acquires the request data of the downstream service from the cache and then sends the acquired request data to the web client side. After receiving the request data of the downstream service sent by the web server, the web client displays the request data on a web page, so that a tester can conveniently check the request data.
Step 804, receiving a test request sent by the web client, where the test request carries a service name, a request, an IP, and a port number of the downstream service.
In order to realize independent testing of the downstream service, a tester can also configure the service name, request, IP, port number and the like of the downstream service on a page of the web client, and the web client sends the configured service name, request, IP and port number to the web server. In order to improve the testing efficiency, the tester can directly configure the request data of the downstream service acquired from the cache into the request of the downstream service, and fill the request data into the request data input box.
Step 805, sending the request of the downstream service to the downstream service according to the IP and the port number.
And after receiving the test request sent by the web client, the web service end sends the request of the downstream service to the downstream service according to the IP and the port number so as to test the downstream service.
Step 806, receiving the result returned by the downstream service.
And the downstream service returns the test result to the web service end.
Step 807, write the returned result into the configuration file.
And after receiving the result returned by the downstream service, the web service end writes the result into the configuration file. Or the return result written into the configuration file is a preset return result.
Step 808, loading the configuration file through the stub service of the downstream service, so that the stub service of the downstream service returns the return result to the upstream service.
In a large project, usually, one upgrade involves many changes of services, and when a test process of one service requires results of another service and the other service is not developed, for the test, the test of the service can be performed only after the development of the other service is completed, which is time-consuming and not in line with the idea of agile development. Therefore, the embodiment of the invention realizes the decoupling test among the services, and each service can be independently tested. As shown in fig. 9, in the embodiment of the present invention, a stub service for each service is developed, and the stub service loads a configuration file, so that the stub service returns a result in the configuration file to an upstream service, thereby performing independent testing on the upstream service.
In addition, in another embodiment of the present invention, the detailed implementation of the page loading method is described in detail above, so that the repeated content is not described again.
FIG. 10 is a schematic diagram of the main blocks of a multi-service test apparatus according to an embodiment of the present invention, and as shown in FIG. 10, the multi-service test apparatus 1000 includes a configuration module 1001, a sending module 1002, and an obtaining module 1003; wherein, the configuration module 1001 is used for configuring the request of the upstream service; the sending module 1002 is configured to send the request of the upstream service to the upstream service, so that the upstream service constructs request data of a downstream service, sends the request data of the downstream service to a stub service of the downstream service, and causes the stub service of the downstream service to write the request data of the downstream service into a cache; the obtaining module 1003 is configured to obtain the request data of the downstream service from the cache.
Optionally, the configuration module 1001 is further configured to:
after configuring the request of the upstream service, generating a unique identification of the request of the upstream service, and configuring the service type of the upstream service.
Optionally, the primary key in the cache includes a unique identifier of the request of the upstream service and a service name of the downstream service, and the value in the cache is request data of the downstream service.
Optionally, the configuration module 1001 is further configured to:
configuring a service name, a request, an IP and a port number of the downstream service;
sending the request of the downstream service to the downstream service according to the IP and the port number;
and receiving a result returned by the downstream service.
Optionally, the configuration module 1001 is further configured to:
configuring the request data of the downstream service acquired from the cache as the request of the downstream service.
Optionally, the configuration module 1001 is further configured to:
writing the return result into a configuration file;
and loading the configuration file through the stub service of the downstream service so that the stub service of the downstream service returns the return result to the upstream service.
Optionally, the returned result is a preset returned result, or a result returned by the downstream service.
According to the various embodiments described above, it can be seen that the technical problem of strong coupling in function test between upstream and downstream services in the prior art is solved by a technical means that a request of an upstream service is configured, the request of the upstream service is sent to the upstream service, so that the upstream service constructs request data of a downstream service, the request data of the downstream service is sent to a stub service of the downstream service, and the stub service of the downstream service writes the request data of the downstream service into a cache. For projects related to a plurality of service changes, the embodiment of the invention tests the downstream services in a pile mode, thus removing strong coupling between the upstream services and the downstream services and realizing decoupling of service test; when one project relates to the condition that a plurality of interdependent services need to be upgraded, the upgraded services can be tested independently without waiting for the completion of the development of the dependent services, so that the testing efficiency and the iteration efficiency are improved; and the request data sent by the upstream service to various downstream services can be directly obtained from the cache, and the log searching is not needed.
It should be noted that, in the embodiment of the multi-service testing apparatus of the present invention, the details of the multi-service testing method are already described in detail above, and therefore, the repeated description is not repeated here.
FIG. 11 illustrates an exemplary system architecture 1100 of a multi-service testing method or multi-service testing apparatus to which embodiments of the present invention may be applied.
As shown in fig. 11, the system architecture 1100 may include terminal devices 1101, 1102, 1103, a network 1104, and a server 1105. The network 1104 is a medium to provide communication links between the terminal devices 1101, 1102, 1103 and the server 1105. Network 1104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use terminal devices 1101, 1102, 1103 to interact with a server 1105 over a network 1104 to receive or send messages or the like. Various messaging client applications, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, etc. (examples only) may be installed on the terminal devices 1101, 1102, 1103.
The terminal devices 1101, 1102, 1103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 1105 may be a server that provides various services, such as a backend management server (for example only) that provides support for shopping-like websites browsed by users using the terminal devices 1101, 1102, 1103. The background management server may analyze and otherwise process the received data such as the item information query request, and feed back a processing result (for example, target push information, item information — just an example) to the terminal device.
It should be noted that the multi-service testing method provided by the embodiment of the present invention is generally executed by the server 1105, and accordingly, the multi-service testing apparatus is generally disposed in the server 1105.
It should be understood that the number of terminal devices, networks, and servers in fig. 11 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 12, shown is a block diagram of a computer system 1200 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 12 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 12, the computer system 1200 includes a Central Processing Unit (CPU)1201, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)1202 or a program loaded from a storage section 1208 into a Random Access Memory (RAM) 1203. In the RAM1203, various programs and data necessary for the operation of the system 1200 are also stored. The CPU 1201, ROM 1202, and RAM1203 are connected to each other by a bus 1204. An input/output (I/O) interface 1205 is also connected to bus 1204.
The following components are connected to the I/O interface 1205: an input section 1206 including a keyboard, a mouse, and the like; an output portion 1207 including a display device such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 1208 including a hard disk and the like; and a communication section 1209 including a network interface card such as a LAN card, a modem, or the like. The communication section 1209 performs communication processing via a network such as the internet. A driver 1210 is also connected to the I/O interface 1205 as needed. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like, is mounted on the drive 1210 as necessary, so that a computer program read out therefrom is mounted into the storage section 1208 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 1209, and/or installed from the removable medium 1211. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 1201.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer programs according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a configuration module, a sending module, and an obtaining module, where the names of the modules do not in some cases constitute a limitation on the modules themselves.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, implement the method of: configuring a request for an upstream service; sending the request of the upstream service to the upstream service so that the upstream service constructs request data of a downstream service, sending the request data of the downstream service to a stub service of the downstream service, and enabling the stub service of the downstream service to write the request data of the downstream service into a cache; and acquiring the request data of the downstream service from the cache.
According to the technical scheme of the embodiment of the invention, because the technical means that the request of the upstream service is configured and sent to the upstream service so that the upstream service constructs the request data of the downstream service and sends the request data of the downstream service to the stub service of the downstream service and the stub service of the downstream service writes the request data of the downstream service into the cache is adopted, the technical problem of strong coupling of the function test between the upstream service and the downstream service in the prior art is solved. For projects related to a plurality of service changes, the embodiment of the invention tests the downstream services in a pile mode, thus removing strong coupling between the upstream services and the downstream services and realizing decoupling of service test; when one project relates to the condition that a plurality of interdependent services need to be upgraded, the upgraded services can be tested independently without waiting for the completion of the development of the dependent services, so that the testing efficiency and the iteration efficiency are improved; and the request data sent by the upstream service to various downstream services can be directly obtained from the cache, and the log searching is not needed.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A multi-service testing method, comprising:
configuring a request for an upstream service;
sending the request of the upstream service to the upstream service so that the upstream service constructs request data of a downstream service, sending the request data of the downstream service to a stub service of the downstream service, and enabling the stub service of the downstream service to write the request data of the downstream service into a cache;
and acquiring the request data of the downstream service from the cache.
2. The method of claim 1, wherein configuring the request for upstream services further comprises:
generating a unique identification of the request of the upstream service, and configuring a traffic type of the upstream service.
3. The method of claim 2, wherein the primary key in the cache comprises a unique identifier of the request of the upstream service and a service name of the downstream service, and wherein the value in the cache is request data of the downstream service.
4. The method of claim 1, further comprising:
configuring a service name, a request, an IP and a port number of the downstream service;
sending the request of the downstream service to the downstream service according to the IP and the port number;
and receiving a result returned by the downstream service.
5. The method of claim 4, wherein configuring the request for the downstream service comprises:
configuring the request data of the downstream service acquired from the cache as the request of the downstream service.
6. The method of claim 4, further comprising:
writing the return result into a configuration file;
and loading the configuration file through the stub service of the downstream service so that the stub service of the downstream service returns the return result to the upstream service.
7. The method of claim 6, wherein the returned result is a preset returned result or a result returned by the downstream service.
8. A multi-service testing apparatus, comprising:
a configuration module to configure a request for an upstream service;
a sending module, configured to send the request of the upstream service to the upstream service, so that the upstream service constructs request data of a downstream service, sends the request data of the downstream service to a stub service of the downstream service, and causes the stub service of the downstream service to write the request data of the downstream service into a cache;
and the acquisition module is used for acquiring the request data of the downstream service from the cache.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
the one or more programs, when executed by the one or more processors, implement the method of any of claims 1-7.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN202011019715.3A 2020-09-24 2020-09-24 Multi-service testing method and device Pending CN113821430A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011019715.3A CN113821430A (en) 2020-09-24 2020-09-24 Multi-service testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011019715.3A CN113821430A (en) 2020-09-24 2020-09-24 Multi-service testing method and device

Publications (1)

Publication Number Publication Date
CN113821430A true CN113821430A (en) 2021-12-21

Family

ID=78912253

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011019715.3A Pending CN113821430A (en) 2020-09-24 2020-09-24 Multi-service testing method and device

Country Status (1)

Country Link
CN (1) CN113821430A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115914381A (en) * 2022-10-27 2023-04-04 北京沃东天骏信息技术有限公司 Upstream and downstream platform communication method and device and electronic equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200183822A1 (en) * 2017-01-20 2020-06-11 Intuit Inc. Mock server for testing
CN111382056A (en) * 2018-12-29 2020-07-07 北京字节跳动网络技术有限公司 Service testing method and device, server and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200183822A1 (en) * 2017-01-20 2020-06-11 Intuit Inc. Mock server for testing
CN111382056A (en) * 2018-12-29 2020-07-07 北京字节跳动网络技术有限公司 Service testing method and device, server and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
郑炜;付伟强;王晓允;: "基于桩和驱动的电子支付系统自动测试平台设计", 西北工业大学学报, no. 06 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115914381A (en) * 2022-10-27 2023-04-04 北京沃东天骏信息技术有限公司 Upstream and downstream platform communication method and device and electronic equipment

Similar Documents

Publication Publication Date Title
CN109683998B (en) Internationalization realization method, device and system
WO2018223717A1 (en) Webpage front-end testing method, device, system, apparatus and readable storage medium
CN110442524B (en) Method and device for testing web service interface with authentication authorization
CN111045653B (en) System generation method and device, computer readable medium and electronic equipment
CN108347356B (en) Multi-protocol unit testing method and device, electronic equipment and storage medium
US10382313B2 (en) Test building for testing server operation
CN115587575A (en) Data table creation method, target data query method, device and equipment
CN111444077A (en) Method and device for generating flow node test data
CN116881166A (en) Method, device and system for generating test script
CN113760722A (en) Test system and test method
CN112947919A (en) Method and device for constructing service model and processing service request
CN114489916A (en) Method and device for loading visual large-screen page component
CN110807535A (en) Construction method and construction device of unified reservation platform and unified reservation platform system
CN110888794A (en) Interface test method and device
CN113821430A (en) Multi-service testing method and device
CN110489326B (en) IDS-based HTTPAPI debugging method device, medium and equipment
CN110955449A (en) Method and device for releasing gray scale of client
CN110825622A (en) Software testing method, device, equipment and computer readable medium
CN111666201A (en) Regression testing method, device, medium and electronic equipment
CN107247661B (en) Method and system for supporting automatic verification of installation package of application
CN111367500A (en) Data processing method and device
CN112579428A (en) Interface testing method and device, electronic equipment and storage medium
CN112783903B (en) Method and device for generating update log
CN111400623A (en) Method and apparatus for searching information
CN114363172B (en) Decoupling management method, device, equipment and medium for container group

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