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

Multi-service testing method and device Download PDF

Info

Publication number
CN113821430B
CN113821430B CN202011019715.3A CN202011019715A CN113821430B CN 113821430 B CN113821430 B CN 113821430B CN 202011019715 A CN202011019715 A CN 202011019715A CN 113821430 B CN113821430 B CN 113821430B
Authority
CN
China
Prior art keywords
service
downstream
request
upstream
downstream service
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011019715.3A
Other languages
Chinese (zh)
Other versions
CN113821430A (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.)
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/CN113821430B/en
Publication of CN113821430A publication Critical patent/CN113821430A/en
Application granted granted Critical
Publication of CN113821430B publication Critical patent/CN113821430B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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)
  • Test And Diagnosis Of Digital Computers (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 the following steps: a request to configure an upstream service; transmitting the request of the upstream service to the upstream service, so that the upstream service constructs request data of a downstream service, transmitting 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 functional test coupling between the upstream service and the downstream service.

Description

Multi-service testing method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for testing multiple services.
Background
For services with upstream-downstream relationships, testing the upstream service requires using results returned by the downstream service, and testing the downstream service requires using requests sent by the upstream service. 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 the request data in the log.
In the process of implementing the present invention, the inventor finds that at least the following problems exist in the prior art:
The functional test coupling between the upstream service and the downstream service is strong; incomplete coverage of the test scene; downstream services cannot be tested individually for functionality.
Disclosure of Invention
In view of the above, the embodiments of the present invention provide a method and an apparatus for testing multiple services, so as to solve the technical problem of strong functional test coupling 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:
a request to configure an upstream service;
transmitting the request of the upstream service to the upstream service, so that the upstream service constructs request data of a downstream service, transmitting 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, further includes:
generating a unique identification of the request for 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;
Transmitting a 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 for the downstream service includes:
And 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 returned result into the 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 returned result of the downstream service.
In addition, according to another aspect of the embodiment of the present invention, there is provided a multi-service testing apparatus including:
a configuration module for configuring a request for an upstream service;
A sending module, configured to send a request of the upstream service to the upstream service, so that the upstream service constructs request data of a downstream service, send the request data of the downstream service to a stub service of the downstream service, and enable 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 identifier 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;
Transmitting a 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:
And 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 returned result into the 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 returned result of the downstream service.
According to another aspect of an embodiment of the present invention, there is also provided an electronic device including:
One or more processors;
Storage means for storing one or more programs,
The one or more processors implement the method of any of the embodiments described above when the one or more programs are executed by the one or more processors.
According to another aspect of an embodiment of the present invention, there is also provided a computer readable medium having stored thereon a computer program which, when executed by a processor, implements the method according to any of the embodiments described above.
One embodiment of the above invention has the following advantages or benefits: because the technical means of configuring the request of the upstream service, sending the request of the upstream service 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 functional test coupling between the upstream service and the downstream service in the prior art is solved. For projects involving multiple service changes, the downstream service is tested in a pile mode, so that strong coupling between upstream and downstream services is eliminated, and decoupling of service testing is realized; when one project relates to the need of upgrading a plurality of interdependent services, the upgraded services can be tested independently, and the need of waiting for the development of the interdependent services is eliminated, 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-described non-conventional alternatives are 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 present invention;
FIG. 2 is a schematic diagram of a remote procedure call framework according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a remoting procedure call framework modified in accordance with an embodiment of the invention;
FIG. 4 is a schematic illustration of a request for service upstream of a web page configuration in accordance with an embodiment of the invention;
FIG. 5 is a schematic diagram showing cached reads on a web page according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of the main flow of a multi-service testing method according to one referenceable embodiment of the invention;
FIG. 7 is a schematic illustration of a request for a service downstream of a web page configuration in accordance with an embodiment of the invention;
FIG. 8 is a schematic diagram of the main flow of a multi-service testing method according to another exemplary embodiment of the present invention;
FIG. 9 is a schematic diagram of a stub service loading profile according to an embodiment of the present invention;
FIG. 10 is a schematic diagram of the main modules of a multi-service testing 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 applied;
Fig. 12 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered 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 look up the request data in the log. Therefore, how to solve the technical problems in the prior art:
1) The functional test between the upstream service and the downstream service has strong coupling, and when the items related to the upstream service and the downstream service are updated, the functional tests of the services are dependent 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 are required to be returned by the downstream for the upstream service and the requests of various scenes are required to be sent by the upstream for the downstream service, so that the comprehensive test cannot be performed, and the coverage of the test scenes is incomplete.
3) Because the request sent from the upstream to the downstream needs to be acquired in a log printing mode, and the request cannot be independently sent to the downstream service after the request is acquired, the request sent from the upstream to the downstream is difficult to acquire, and the downstream service cannot independently perform functional test.
In order to solve the technical problems in the prior art, the embodiment of the invention provides a multi-service testing method, which decouples the function test between the upstream service and the downstream service, can cover more comprehensive testing scenes and can realize independent test of the downstream service.
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, a request for an upstream service is configured.
If an upstream service of a remote procedure call framework (such as an RPC framework or a BRPC framework, etc.) is to be tested, a request for 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 a service, B service, C service, etc., where a service is an upstream service, and B service and 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 a web client. As shown in fig. 3, to facilitate tester configuration requests, requests for upstream services may be configured on a web page, such as HTTP requests may be entered in a request input box of the web page.
Optionally, after step 101, the method further includes: generating a unique identification of the request for the upstream service, and configuring a traffic type of the upstream service. As shown in fig. 3, when a tester completes configuring a request on a web client page, 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 can configure the requested service type on the page, and since the upstream services have different service types and the downstream services accessed by the different service types are different, the requested service type needs to be configured. For example, using an advertisement service as an example, the service types may include home focus, recommendation, search, off-site, and so on.
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, 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.
Before step 102, each downstream service needs to be modified respectively to generate a stub service corresponding to each downstream service, so that after the stub service of the downstream service receives the request data sent by the upstream service, the request data is written into the cache without going through other business logic. The schematic diagram of the remote procedure call framework after transformation is shown in fig. 3, for example, when the service a requests the service B for the stub service, after the service B receives the request data, the request data is written into the cache and is retained, then the processing of the service B for the stub service is finished, and the service a continues to request the stub service of other downstream services. In the embodiment of the invention, the stub service of the downstream service defines the in-parameter and the out-parameter 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 after the tester completes configuration and clicks the button, the web server receives a sending instruction, and then sends the configured request to the service a. The A service constructs request data of various downstream services (B, C … …) according to own business logic, accesses stub services (stub) of the downstream services, and after receiving the request data sent by the A service, the stub services of the downstream services directly write the received request data into a cache.
In an embodiment of the present invention, the primary key (key) in the cache includes 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 request data of the downstream service.
Step 103, obtaining the request data of the downstream service from the cache.
After the post service of the downstream service writes the request data of the downstream service into the cache (close to real-time storage), the web server side can read the cache, so that the request data of the upstream service sent 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, the method further includes: and sending the request data of the downstream service to a web client to display the request data of the downstream service on a web page. The web server acquires request data sent by the upstream service to various downstream services from the cache, and then displays the read results on the web page, as shown in fig. 5, so that the results are convenient for a tester to check.
According to the various embodiments described above, it can be seen that the technical means of the embodiment of the present invention that by configuring a request of an upstream service, the request of the upstream service is sent to the upstream service, so that the upstream service constructs request data of a downstream service and sends the request data of the downstream service 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, solves the technical problem of strong functional test coupling between the upstream service and the downstream service in the prior art. For projects involving multiple service changes, the downstream service is tested in a pile mode, so that strong coupling between upstream and downstream services is eliminated, and decoupling of service testing is realized; when one project relates to the need of upgrading a plurality of interdependent services, the upgraded services can be tested independently, and the need of waiting for the development of the interdependent services is eliminated, 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 procedure call framework, a tester builds a whole set of environment from the upstream service to the downstream service, sends a request to the upstream service, and then checks the return result of the upstream service to determine 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 obtained from the cache to the downstream service to be tested, then obtains the result returned by the downstream service, and verifies whether the modification of the downstream service meets the expectations through checking the result.
Fig. 6 is a schematic diagram of the main flow of a multi-service testing method according to one reference embodiment of the present invention. As yet another embodiment of the present invention, as shown in fig. 6, the multi-service testing method may include:
step 601, configuring a service name, a request, an IP, and a port number of a 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 a tester to configure a service name, a request, an IP, and a port number of a downstream service, the service name, the request, the IP, and the port number of the downstream service may be configured on a web page.
Optionally, configuring the downstream service or the request for the stub service of the downstream service includes: and configuring the request of the downstream service acquired from the cache as the request of the downstream service or the stake service of the downstream service. For example, request data obtained from the cache is directly filled into a request data input box as shown in fig. 7, then a downstream service to be tested is selected (B, C, D, etc.), req1 represents a default request for 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, then default ones may be selected from the drop down box. When filled in manually, the selection in the drop down box is disabled.
Step 602, according to the IP and the port number, sending a request of the downstream service to the downstream service.
As shown in fig. 7, a request sending button is further provided on the web page, and after the tester completes configuration and clicks on the button, the web server receives a sending instruction, and then sends a request to the corresponding downstream service according to the options selected by the user. Thus, the downstream services can be tested independently, requests from the upstream services can be obtained, and the request data can be sent to the downstream services separately.
And 603, receiving a result returned by the downstream service.
In order to facilitate a tester to check the test result of the downstream service, after receiving the result returned by the downstream service, the web server sends the result returned by the downstream service to the web client so as to display the result returned by the downstream service on the web page. As shown in fig. 7, the result returned by the downstream service is displayed in the input box at the returned result, so that the tester can verify whether the modification of the current project is met according to the returned result.
It should be noted that, when the request for the downstream service is configured in step 601, the request data of the downstream service acquired from the cache may be optionally changed, and then the changed request data may be configured as the request for the downstream service. Because the upgrade points correspond to a plurality of test points each time, the parameters in the request data are modified to test different logics of the service, so that the comprehensiveness of the test scene is ensured.
According to the embodiment of the invention, the functional test between the upstream service and the downstream service is decoupled, when one project relates to the service which needs to be upgraded with a plurality of interdependencies, the service which is upgraded can be independently tested, the development of the interdependent service is not required to be completed, and the efficiency of testing and developing iteration is improved; 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 enable the service test to be more automatic, comprehensive and convenient, thereby improving the test and development iteration efficiency.
Fig. 8 is a schematic diagram of the main flow of a multi-service testing method according to another exemplary 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 server, may include:
Step 801, a test request sent by a web client is received, where the test request carries a request for an upstream service and a service type thereof, and then a unique identifier of the request for the upstream service is generated.
The tester can configure the request of the upstream service and the service type thereof on the page of the web client, the web client sends the configured request and the service type thereof to the web server, and the web server receives the test request sent by the web client and generates a unique identifier for the request of the upstream service.
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, 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.
The web service end sends the request of the upstream service to the upstream service, the upstream service constructs request data of various downstream services according to own business logic, then sends the request data to corresponding downstream service stake services respectively, and the downstream service stake services write the request data into a cache after receiving the request data sent by the upstream service. 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.
The web server acquires the request data of the downstream service from the cache, and then sends the acquired request data to the web client. After receiving the request data of the downstream service sent by the web server, the web client displays the request data on the web page, so that the request data is convenient for a tester to check.
Step 804, a test request sent by the web client is received, 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 a service name, a request, an IP, a 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, the request, the IP and the port number to the web server. In order to improve the test efficiency, a tester can directly configure the request data of the downstream service obtained from the cache as the request of the downstream service, and fill the request data into a request data input box.
And step 805, sending the request of the downstream service to the downstream service according to the IP and the port number.
After receiving the test request sent by the web client, the web server sends a request of downstream service to the downstream service according to the IP and the port number so as to test the downstream service.
And step 806, receiving a result returned by the downstream service.
And the downstream service returns the test result to the web server.
Step 807, writing the returned result into the configuration file.
After receiving the result returned by the downstream service, the web server writes the result into the configuration file. Or the return result of the write configuration file is a preset return result.
And 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, a single upgrade usually involves many changes of services, and when a testing process of one service needs to use a result of another service and the other service is not developed, the testing of the service can be performed only after the development of the other service is completed, which is a waste of time and does not accord with the concept of agile development. Therefore, the embodiment of the invention realizes decoupling test among services, and each service can be independently tested. As shown in FIG. 9, the embodiment of the invention develops a stub service for each service, which will load the configuration file, so that the stub service will return the results in the configuration file to the upstream service, thereby allowing independent testing of the upstream service.
In addition, in another embodiment of the present invention, the specific implementation of the page loading method is already described in detail in the page loading method, so that the description is not repeated here.
Fig. 10 is a schematic diagram of main modules of a multi-service testing apparatus according to an embodiment of the present invention, and as shown in fig. 10, the multi-service testing apparatus 1000 includes a configuration module 1001, a transmission module 1002, and an acquisition module 1003; wherein the configuration module 1001 is configured to configure a request of an upstream service; the sending module 1002 is configured to send a request of the upstream service to the upstream service, so that the upstream service constructs request data of a downstream service, send the request data of the downstream service to a stub service of the downstream service, and cause 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 identifier 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;
Transmitting a 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:
And 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 returned result into the 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 returned result of the downstream service.
According to the various embodiments described above, it can be seen that the technical means of the embodiment of the present invention that by configuring a request of an upstream service, the request of the upstream service is sent to the upstream service, so that the upstream service constructs request data of a downstream service and sends the request data of the downstream service 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, solves the technical problem of strong functional test coupling between the upstream service and the downstream service in the prior art. For projects involving multiple service changes, the downstream service is tested in a pile mode, so that strong coupling between upstream and downstream services is eliminated, and decoupling of service testing is realized; when one project relates to the need of upgrading a plurality of interdependent services, the upgraded services can be tested independently, and the need of waiting for the development of the interdependent services is eliminated, 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 specific implementation of the multi-service testing device according to the present invention is described in detail in the multi-service testing method described above, and thus the description thereof will not be repeated here.
Fig. 11 illustrates an exemplary system architecture 1100 to which the multi-service testing method or multi-service testing apparatus of embodiments of the present invention may be applied.
As shown in fig. 11, system architecture 1100 may include terminal devices 1101, 1102, 1103, a network 1104, and a server 1105. Network 1104 is the medium used to provide communication links between terminal devices 1101, 1102, 1103 and server 1105. Network 1104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 1105 via the network 1104 using the terminal devices 1101, 1102, 1103 to receive or transmit messages, etc. Various communication client applications such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, and the like (by way of example only) may be installed on terminal devices 1101, 1102, 1103.
The terminal devices 1101, 1102, 1103 may be a variety of electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 1105 may be a server that provides various services, such as a background management server (by way of example only) that provides support for shopping-type websites browsed by users using the terminal devices 1101, 1102, 1103. The background management server may analyze and process the received data such as the article information query request, and feedback the processing result (e.g., the target push information, the article information—only 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 device 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, there is illustrated a schematic diagram of a computer system 1200 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 12 is only an example, and should not impose any limitation on 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 according to 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 required for the operation of the system 1200 are also stored. The CPU 1201, ROM 1202, and RAM1203 are connected to each other through a bus 1204. An input/output (I/O) interface 1205 is also connected to the 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 Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 1208 including a hard disk or 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. The drive 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 installed as needed on the drive 1210 so that a computer program read out therefrom is installed into the storage section 1208 as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to 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 shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication portion 1209, and/or installed from the removable media 1211. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 1201.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any 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 context of this document, 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, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. 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 flowcharts 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 involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, as: a processor includes a configuration module, a transmission module, and an acquisition module, where the names of the modules do not constitute a limitation on the module itself in some cases.
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 present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, implement the method of: a request to configure an upstream service; transmitting the request of the upstream service to the upstream service, so that the upstream service constructs request data of a downstream service, transmitting 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, 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 and sends the request data of the downstream service to the post service of the downstream service, and the post service of the downstream service writes the request data of the downstream service into the cache is adopted, so that the technical problem of strong functional test coupling between the upstream service and the downstream service in the prior art is solved. For projects involving multiple service changes, the downstream service is tested in a pile mode, so that strong coupling between upstream and downstream services is eliminated, and decoupling of service testing is realized; when one project relates to the need of upgrading a plurality of interdependent services, the upgraded services can be tested independently, and the need of waiting for the development of the interdependent services is eliminated, 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 embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (8)

1. A multi-service testing method, comprising:
a request to configure an upstream service;
transmitting the request of the upstream service to the upstream service, so that the upstream service constructs request data of a downstream service, transmitting 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;
Acquiring request data of the downstream service from the cache;
Further comprises:
configuring a service name, a request, an IP and a port number of the downstream service;
Transmitting a request of the downstream service to the downstream service according to the IP and the port number;
receiving a result returned by the downstream service;
Writing the returned result into the 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.
2. The method of claim 1, further comprising, after configuring the request for upstream services:
generating a unique identification of the request for 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 includes a unique identification of the request for the upstream service and a service name of the downstream service, and wherein the value in the cache is request data for the downstream service.
4. The method of claim 1, wherein configuring the request for the downstream service comprises:
And configuring the request data of the downstream service acquired from the cache as the request of the downstream service.
5. The method of claim 1, wherein the returned result is a preset returned result or a returned result of the downstream service.
6. A multi-service testing apparatus, comprising:
a configuration module for configuring a request for an upstream service;
A sending module, configured to send a request of the upstream service to the upstream service, so that the upstream service constructs request data of a downstream service, send the request data of the downstream service to a stub service of the downstream service, and enable the stub service of the downstream service to write the request data of the downstream service into a cache;
The acquisition module is used for acquiring the request data of the downstream service from the cache;
the configuration module is further configured to:
configuring a service name, a request, an IP and a port number of the downstream service;
Transmitting a request of the downstream service to the downstream service according to the IP and the port number;
receiving a result returned by the downstream service;
Writing the returned result into the 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. An electronic device, comprising:
One or more processors;
Storage means for storing one or more programs,
The one or more processors implement the method of any of claims 1-5 when the one or more programs are executed by the one or more processors.
8. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-5.
CN202011019715.3A 2020-09-24 2020-09-24 Multi-service testing method and device Active CN113821430B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011019715.3A CN113821430B (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 CN113821430B (en) 2020-09-24 2020-09-24 Multi-service testing method and device

Publications (2)

Publication Number Publication Date
CN113821430A CN113821430A (en) 2021-12-21
CN113821430B true CN113821430B (en) 2024-08-16

Family

ID=78912253

Family Applications (1)

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

Country Status (1)

Country Link
CN (1) CN113821430B (en)

Families Citing this family (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 (1)

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

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104683386B (en) * 2013-11-26 2019-01-04 腾讯科技(深圳)有限公司 The stake service implementing method and device of customizable response
CN105721251B (en) * 2016-03-04 2019-03-08 深圳市分期乐网络科技有限公司 A kind of method and system of configurable test pile service
US10089219B1 (en) * 2017-01-20 2018-10-02 Intuit Inc. Mock server for testing

Patent Citations (1)

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

Also Published As

Publication number Publication date
CN113821430A (en) 2021-12-21

Similar Documents

Publication Publication Date Title
AU2018357874B2 (en) Integrating cloud applications into a cloud service broker platform using an automated, universal connector package
CN107302597B (en) Message file pushing method and device
CN111045653B (en) System generation method and device, computer readable medium and electronic equipment
CN113485927B (en) Test data generation method, device, equipment and storage medium
CN116881166A (en) Method, device and system for generating test script
CN112947919A (en) Method and device for constructing service model and processing service request
CN113821430B (en) Multi-service testing method and device
CN112486482A (en) Page display method and device
CN110807535A (en) Construction method and construction device of unified reservation platform and unified reservation platform system
CN111125503A (en) Method and apparatus for generating information
CN110489326B (en) IDS-based HTTPAPI debugging method device, medium and equipment
CN112579447A (en) Browser testing method and device
CN116561013A (en) Testing method and device based on target service framework, electronic equipment and medium
CN113378346A (en) Method and device for model simulation
CN113127335A (en) System testing method and device
CN110825622A (en) Software testing method, device, equipment and computer readable medium
CN111338928A (en) Chrome-based browser testing method and device
CN112579428B (en) Interface testing method, device, electronic equipment and storage medium
CN114610895A (en) Work order pushing method and device, electronic equipment and storage medium
CN114625458A (en) Page data processing method and device, electronic equipment and storage medium
CN109889402B (en) Method and apparatus for generating information
CN113760727A (en) Interface regression testing method and device
CN113065920B (en) Data processing method and system
CN113495747B (en) Gray scale release method and device
CN114281697A (en) Test data generation method and device

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