CN112579473A - Test system, test method, computer equipment and storage medium - Google Patents

Test system, test method, computer equipment and storage medium Download PDF

Info

Publication number
CN112579473A
CN112579473A CN202011607040.4A CN202011607040A CN112579473A CN 112579473 A CN112579473 A CN 112579473A CN 202011607040 A CN202011607040 A CN 202011607040A CN 112579473 A CN112579473 A CN 112579473A
Authority
CN
China
Prior art keywords
request
test
tested
server
calling
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
CN202011607040.4A
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 Baijia Technology Group Co ltd
Original Assignee
Beijing Baijia Technology Group 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 Baijia Technology Group Co ltd filed Critical Beijing Baijia Technology Group Co ltd
Priority to CN202011607040.4A priority Critical patent/CN112579473A/en
Publication of CN112579473A publication Critical patent/CN112579473A/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
    • 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/3684Test management for test design, e.g. generating new test cases
    • 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/3692Test management for test results analysis

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 present disclosure provides a test system, a method, a computer device and a storage medium, wherein the system comprises: a processing server and a testing server; services which are depended by the object to be tested and/or virtual services corresponding to the interfaces are deployed in the test server; the processing server is used for acquiring a first calling request initiated by an object to be tested; under the condition that the first calling request comprises first test indication information, sending the first calling request to the test server; the test server is used for receiving a first calling request sent by the processing server; generating a response result based on the virtual service and the first invocation request; and sending the response result to the object to be tested. The method and the device are simple to operate, do not need to add special fields to the tested object, and reduce redundancy of the item codes of the tested object.

Description

Test system, test method, computer equipment and storage medium
Technical Field
The present disclosure relates to the field of software testing technologies, and in particular, to a testing system, a testing method, a computer device, and a storage medium.
Background
In the development process of software, when the development process is performed to a certain stage, the implemented program function is usually required to be tested to eliminate various problems existing in the code corresponding to the program function, and the tested program function is the object to be tested.
The current testing mode needs to modify the code of the object to be tested, resulting in code redundancy of the object to be tested.
Disclosure of Invention
The embodiment of the disclosure at least provides a test system, a test method, computer equipment and a storage medium.
In a first aspect, an embodiment of the present disclosure provides a test system, including: a processing server and a testing server; services which are depended by the object to be tested and/or virtual services corresponding to the interfaces are deployed in the test server; the processing server is used for acquiring a first calling request initiated by an object to be tested; under the condition that the first calling request comprises first test indication information, sending the first calling request to the test server; the test server is used for receiving a first calling request sent by the processing server; generating a response result based on the virtual service and the first invocation request; and sending the response result to the object to be tested.
In one possible implementation, the processing server is further configured to: and sending the first calling request to a service and/or an interface depended by the object to be tested under the condition that the first calling request does not include the first testing indication information.
In one possible implementation, the first invocation request includes: a hypertext transfer protocol request (HTTP) or a hypertext transfer security protocol request (HTTPS); the first test indication information includes: the path information is requested.
In a possible implementation manner, the processing server, when sending the first invocation request to the testing server, is configured to: detecting whether the first calling request carries the request path information or not; and sending the first calling request to the test server under the condition that the request path information is carried in the first calling request.
In a possible implementation manner, the processing server is specifically configured to: and detecting whether the first call request carries the request path information or not based on a mapping relation between the request path information and the virtual service which is established in advance.
In a possible implementation manner, after receiving the first invocation request sent by the processing server, the testing server is further configured to: detecting whether the first calling request carries a preset instruction or not; wherein the preset instruction comprises: the instruction is generated when the object to be tested calls the virtual service of the service and/or the interface which the object to be tested depends on; under the condition that the preset instruction is not carried in the first calling request, generating a second calling request based on the first calling request and preset second test indication information, and sending the second calling request to the processing server; and the processing server is further configured to send the second invocation request to a service and/or an interface on which the object to be tested depends based on second test indication information carried in the second invocation request after receiving the second invocation request.
In a possible implementation manner, when generating a second invocation request based on the first invocation request and preset second test instruction information, the test server is configured to: and adding the second test indication information to a target field of the first call request to generate the second call request.
In one possible implementation, the processing server is further configured to: and analyzing a target field of the second calling request, and sending the second calling request to a service and/or an interface which the object to be tested depends on under the condition that the analysis result comprises the second test indication information.
In one possible embodiment, the test server, when generating the response result based on the virtual service and the first invocation request, is configured to: and under the condition that the preset instruction is carried in the first calling request, generating a response result based on the virtual service and the first calling request.
In a second aspect, an embodiment of the present disclosure further provides a testing method, applied to a processing server, including: acquiring a first call request initiated by an object to be tested; under the condition that the first calling request comprises first test indication information, sending the first calling request to a test server; the testing server is provided with services which are depended by the object to be tested and/or virtual services corresponding to the interfaces; the first calling request is used for the test server to generate a response result based on the virtual service.
In one possible embodiment, the testing method further includes: and sending the first calling request to a service and/or an interface depended by the object to be tested under the condition that the first calling request does not include the first testing indication information.
In one possible implementation, the first invocation request includes: a hypertext transfer protocol request (HTTP) or a hypertext transfer security protocol request (HTTPS); the first test indication information includes: the path information is requested.
In a possible implementation manner, the sending the first invocation request to the test server includes: detecting whether the first calling request carries the request path information or not; and sending the first calling request to the test server under the condition that the request path information is carried in the first calling request.
In a possible implementation manner, the detecting whether the first invocation request carries the request path information includes: and detecting whether the first call request carries the request path information or not based on a mapping relation between the request path information and the virtual service which is established in advance.
In one possible embodiment, the testing method further includes: receiving a second calling request sent by the test server; the second call request is generated based on the first call request and preset second test indication information when the test server detects that the first call request does not carry a preset instruction; and sending the second calling request to a service and/or an interface which is depended by the object to be tested.
In one possible embodiment, the testing method further includes: analyzing a target field of the second calling request; and sending the second calling request to a service and/or an interface depended by the object to be tested under the condition that the analysis result comprises the second test indication information.
In a third aspect, an embodiment of the present disclosure further provides a testing method, which is applied to a testing server, where a service that an object to be tested depends on and/or a virtual service corresponding to an interface are deployed in the testing server; the test comprises the following steps: receiving a first calling request sent by the processing server; wherein the first call request is initiated by the object to be tested; generating a response result based on the virtual service and the first invocation request; and sending the response result to the object to be tested.
In a possible implementation manner, after receiving the first invocation request sent by the processing server, the method further includes: detecting whether the first calling request carries a preset instruction or not; wherein the preset instruction comprises: the instruction is generated when the object to be tested calls the virtual service of the service and/or the interface which the object to be tested depends on; and under the condition that the preset instruction is not carried in the first calling request, generating a second calling request based on the first calling request and preset second test indication information, and sending the second calling request to the processing server.
In a possible implementation manner, the generating a second invocation request based on the first invocation request and preset second test indication information includes: and adding the second test indication information to a target field of the first call request to generate the second call request.
In one possible embodiment, the generating a response result based on the virtual service and the first invocation request includes: and under the condition that the preset instruction is carried in the first calling request, generating a response result based on the virtual service and the first calling request.
In a fourth aspect, an embodiment of the present disclosure further provides a testing apparatus, applied to a processing server, including: the acquisition module is used for acquiring a first calling request initiated by an object to be tested; the first sending module is used for sending the first calling request to a test server under the condition that the first calling request comprises first test indication information; the testing server is provided with services which are depended by the object to be tested and/or virtual services corresponding to the interfaces; the first calling request is used for the test server to generate a response result based on the virtual service.
In a possible implementation manner, the first sending module is further configured to send the first invocation request to a service and/or an interface on which the object to be tested depends, if the first invocation request does not include the first test indication information.
In one possible implementation, the first invocation request includes: a hypertext transfer protocol request (HTTP) or a hypertext transfer security protocol request (HTTPS); the first test indication information includes: the path information is requested.
In a possible embodiment, the apparatus further comprises a first detection module; when the first call request is sent to the test server, the first detection module is configured to detect whether the request path information is carried in the first call request; the first sending module is configured to send the first invocation request to the test server under the condition that the request path information is carried in the first invocation request.
In a possible implementation manner, when detecting whether the first invocation request carries the request path information, the first detection module is specifically configured to detect whether the first invocation request carries the request path information based on a mapping relationship between the request path information and the virtual service, which is established in advance.
In a possible implementation manner, the obtaining module is further configured to receive a second invocation request sent by the test server; the second call request is generated based on the first call request and preset second test indication information when the test server detects that the first call request does not carry a preset instruction; the first sending module is further configured to send the second call request to a service and/or an interface on which the object to be tested depends.
In a possible embodiment, the apparatus further comprises: an analysis module; the analysis module is used for analyzing the target field of the second calling request; the first sending module is further configured to send the second invocation request to a service and/or an interface on which the object to be tested depends, under the condition that the analysis result includes the second test indication information.
In a fifth aspect, an embodiment of the present disclosure further provides a testing apparatus, which is applied to a testing server, where a service that an object to be tested depends on and/or a virtual service corresponding to an interface are deployed in the testing server; the test comprises the following steps: the receiving module is used for receiving a first calling request sent by the processing server; wherein the first call request is initiated by the object to be tested; a generating module, configured to generate a response result based on the virtual service and the first invocation request; and the second sending module is used for sending the response result to the object to be tested.
In a possible embodiment, the apparatus further comprises: the second detection module and the processing module; the second detection module is used for detecting whether the first calling request carries a preset instruction or not; wherein the preset instruction comprises: the instruction is generated when the object to be tested calls the virtual service of the service and/or the interface which the object to be tested depends on; the processing module is configured to generate a second call request based on the first call request and preset second test indication information and send the second call request to the processing server when the preset instruction is not carried in the first call request.
In a possible implementation manner, when a second invocation request is generated based on the first invocation request and preset second test indication information, the processing module is specifically configured to add the second test indication information to a target field of the first invocation request to generate the second invocation request.
In a possible implementation manner, when a response result is generated based on the virtual service and the first invocation request, the generation module is specifically configured to generate the response result based on the virtual service and the first invocation request under the condition that the first invocation request carries the preset instruction.
In a sixth aspect, this disclosure also provides a computer device, a processor, a memory, and a storage, where the memory stores machine-readable instructions executable by the processor, and the processor is configured to execute the machine-readable instructions stored in the memory, and when the machine-readable instructions are executed by the processor, the processor and the storage communicate with each other through a bus, and when the machine-readable instructions are executed by the processor, the steps in any one of the possible implementations of the second and third aspects are performed.
In a seventh aspect, alternative implementations of the present disclosure further provide a computer-readable storage medium having a computer program stored thereon, where the computer program is executed by a processor to perform the steps in any one of the possible implementations of the second and third aspects.
For the description of the effects of the test method, the test device, the computer device, and the computer-readable storage medium, reference is made to the description of the test system, which is not repeated herein.
In the test system, the test method, the computer device and the storage medium provided by the embodiment of the disclosure, the object to be tested sends the first call request to the processing server; the processing server sends a first calling request to the testing server based on first testing indication information in the first calling request; the testing server deploys services which are depended by the object to be tested and/or virtual services corresponding to the interface, and returns corresponding response results to the object to be tested based on the virtual services and the first calling request, so that the object to be tested can complete detection of the testing content.
In order to make the aforementioned objects, features and advantages of the present disclosure more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the embodiments will be briefly described below, and the drawings herein incorporated in and forming a part of the specification illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the technical solutions of the present disclosure. It is appreciated that the following drawings depict only certain embodiments of the disclosure and are therefore not to be considered limiting of its scope, for those skilled in the art will be able to derive additional related drawings therefrom without the benefit of the inventive faculty.
FIG. 1 is a block diagram illustrating a test system provided by an embodiment of the present disclosure;
FIG. 2 is a flow chart illustrating a testing method applied to a processing server according to an embodiment of the present disclosure;
FIG. 3 is a flowchart illustrating a testing method applied to a testing server according to an embodiment of the present disclosure;
FIG. 4 is a logic flow diagram illustrating an overall implementation of a test system provided by an embodiment of the present disclosure;
FIG. 5 is a schematic diagram illustrating a testing apparatus applied to a processing server according to an embodiment of the disclosure;
fig. 6 is a schematic diagram illustrating a testing apparatus applied to a testing server according to an embodiment of the present disclosure;
fig. 7 shows a schematic structural diagram of a computer device provided by an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only a part of the embodiments of the present disclosure, not all of the embodiments. The components of embodiments of the present disclosure, as generally described and illustrated herein, may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present disclosure is not intended to limit the scope of the disclosure, as claimed, but is merely representative of selected embodiments of the disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the disclosure without making creative efforts, shall fall within the protection scope of the disclosure.
The research shows that the following two methods are mainly adopted to test the object to be tested:
in the first mode, the test content of the object to be tested needs to be modified, that is: adding special fields in a call request which needs to call a service and/or an interface which an object to be tested depends on in test content; when the object to be tested executes the test case, a call request for the dependent service and/or interface is generated based on the special field, and then the call request is sent to the service and/or interface which the object to be tested depends on; and after receiving the call request, the service and/or the interface which the object to be tested depends on returns a corresponding test response result based on the special field. And after the object to be tested receives the test response result, finishing the processing logic of the test case based on the response result. In the test mode, special fields required to be added to the object to be tested are not separated from the item codes of the object to be tested, so that code redundancy is caused.
In the second mode, virtual services are set for services and/or interfaces depended by the object to be tested, the virtual services are deployed in other servers, and configuration files are set in the object to be tested; in the configuration file, hypertext Transfer Protocol (HTTP) addresses of other servers where virtual services are deployed are stored; in the process of testing an object to be tested, when the object to be tested generates a call instruction for calling a dependent service and/or an interface, a call request is sent to a server with virtual service deployed based on an HTTP (hyper text transport protocol) address in a configuration file; and the server deployed with the virtual service generates a test response result based on the calling request and feeds the test response result back to the object to be tested. And after the object to be tested receives the test response result, finishing the processing logic of the test case based on the response result. In this way, a complex configuration file needs to be set in the object to be tested, and the object to be tested is modified in an invasive manner; and once the test rule needs to be added, the configuration file needs to be changed and the object to be tested needs to be restarted, so that the operation is complex.
Based on the research, the present disclosure provides a test system, a test method, a computer device, and a storage medium, in which a virtual service corresponding to a service and/or an interface on which an object to be tested depends is deployed in a test server, a first call request sent by the object to be tested is forwarded by a processing server, and the first call request for calling the virtual service is sent to the test server, so that the test server returns a corresponding response result to the object to be tested, thereby avoiding the need of modification in the object to be tested and reducing redundancy of a project code of the object to be tested.
In addition, the object to be tested does not need to send the call request to the test server through the configuration file, but the processing server judges the object to be sent by the first call request sent by the object to be tested, and sends the first call request out, so that invasive modification on the object to be tested is not needed, and the operation is simpler.
The above-mentioned drawbacks are the results of the inventor after practical and careful study, and therefore, the discovery process of the above-mentioned problems and the solutions proposed by the present disclosure to the above-mentioned problems should be the contribution of the inventor in the process of the present disclosure.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
Referring to fig. 1, a block diagram of a test system provided for an embodiment of the present disclosure includes: a processing server 10 and a test server 20; wherein, the test server 20 is deployed with services and/or virtual services corresponding to interfaces on which the object to be tested depends.
The processing server 10 is configured to obtain a first call request initiated by an object to be tested; under the condition that the first calling request comprises first test indication information, sending the first calling request to a test server;
the test server 20 is used for receiving a first calling request sent by the processing server; generating a response result based on the virtual service and the first calling request; and sending a response result to the object to be tested.
According to the embodiment of the disclosure, the object to be tested sends the first call request to the processing server; the processing server sends a first calling request to the testing server based on first testing indication information in the first calling request; the testing server deploys services which are depended by the object to be tested and/or virtual services corresponding to the interface, and returns corresponding response results to the object to be tested based on the virtual services and the first calling request, so that the object to be tested can complete detection of the testing content.
The processing server 10 and the test server 20 will be described in detail below.
The processing server 10 obtains a first invocation request initiated by an object to be tested, and detects whether first test indication information exists in the first invocation request.
The object to be tested can be at least part of a service and/or interface in software, for example. The first invocation request is a request initiated by the object to be tested and may include, for example: a hypertext Transfer Protocol (HTTP) request or a hypertext Transfer Protocol over Secure Socket Layer (HTTPs) request; the first call request can be a service request generated by the object to be tested for the dependent service and/or interface; the first call request may also be a test request generated by the object to be tested for testing whether the operation of the object to be tested is normal, the test request being generated for a service on which the object to be tested depends and/or a virtual service corresponding to an interface.
For example, in a case that the first invocation request is a test request generated for a virtual service, the first test indication information includes, for example, identification information for establishing a mapping relationship with the virtual service corresponding to the service and/or the interface on which the object to be tested depends in advance, and may include, for example, request path information.
In the processing server 10, the mapping relationship between the request path information and the virtual service may be stored in advance. After receiving the first invocation request, the processing server 10 matches a request path carried in the first invocation request with a request path pre-stored by the processing server 10; if the matching is successful, the processing server 10 determines that the first invocation request needs to be sent to the test server 20.
In case the first invocation request does not include the first test indication information, the processing server 10 will also send the first invocation request to the service and/or the interface on which the object to be tested depends. At this time, after receiving the first call request, the service and/or the interface on which the object to be tested depends executes the corresponding processing logic, generates a real response result corresponding to the first call request, and feeds back the real response result to the object to be tested.
In the test server 20, services and/or virtual services corresponding to interfaces on which the test object depends are deployed.
The service and/or interface on which the object to be tested depends may be another service and/or interface belonging to the same software system as the object to be tested, or may be another service and/or interface belonging to a different software system from the object to be tested.
Illustratively, the object to be tested is an application program A for social contact, wherein the application program A comprises functional modules a, b, c and d; b is a shopping application program comprising functional modules e, f and g; the service and/or interface on which the functional module a of a depends may be at least one of the functional modules B, c, d of a, or may be at least one of the functional modules e, f, g of the application B.
The virtual service corresponding to the service and/or interface on which the object to be tested depends is deployed in the test server 20, and the virtual service refers to returning a corresponding response result after receiving a test request sent by the object to be tested based on a preset rule; the response result may be predefined based on the test request or may be input by the tester at the time.
Exemplarily, the object to be tested a sends a test request m, and the virtual service may send a response result n corresponding to m to the object to be tested a after receiving m; the virtual service does not need to execute the processing logic of n obtained by m, and n can be stored in the test server 20 with the virtual service deployed in advance or can be input by a tester in real time.
After receiving the first invocation request sent by the processing server 10, the test server 20 may directly obtain a corresponding response result from the pre-stored data based on the first invocation request and feed back the corresponding result to the object to be tested, or may receive a response result input by a tester and feed back the response result to the object to be tested.
In another embodiment of the present disclosure, there may be a case where a device performing a test on an object to be tested initiates a normal service request, and in this case, a call request initiated by the device, although including request path information, should be sent to a service and/or an interface on which the object to be tested depends to perform a normal call. In this case, since the normal service request sent by the device is consistent with the request path information carried in the test service request, the test server 20 is further required to determine whether the received first invocation request is an invocation request for testing the object to be tested; if yes, generating a response result based on the virtual service and the first calling request; if the first invocation request is not a request for testing the object to be tested, the first invocation request needs to be sent back to the processing server 10, so that the processing server 10 sends the first invocation request to the service and/or the interface which the object to be tested depends on.
For example, when determining whether the received first invocation request is an invocation request for testing the object to be tested, the testing server 20 may adopt the following manners:
detecting whether an instruction carried in the first calling request comprises a preset instruction or not; wherein, the preset instruction comprises: the instruction is generated when the object to be tested calls the service and/or the virtual service of the interface which the object to be tested depends on; here, for example, the first call request may be parsed, and based on a result of the parsing, whether a preset instruction exists in a result of the parsing is searched.
Illustratively, the code is written to parse a header, a parameter or a data portion in the first call request, and whether a preset instruction exists is determined according to the parsed content.
And under the condition that the instruction carried in the first calling request does not include a preset instruction, generating a second calling request based on the first calling request and preset second test indication information, and sending the second calling request to the processing server 10. The second test indication information may be, for example, predefined identification information; in particular implementation, the second test indication information may be added to a target field of the first invocation request, so as to generate a second invocation request. The second test indication information is mockTag ═ false, the target field is the header of the first call request, and the mockTag ═ false is written into the header of the first call request to obtain a second call request.
Under the condition that the instruction carried in the first invocation request includes a preset instruction, the test server 20 generates a response result based on the virtual service and the first invocation request, and sends the response result to the object to be tested.
Here, the test server 20 may directly send the response result to the object to be tested, or may send the response result to the processing server 10, and after receiving the response result, the processing server 10 performs protocol conversion on the response result by using a communication protocol between the processing server 10 and the object to be tested to obtain a target response result, and sends the target response result to the object to be tested.
In this case, the processing server 10 is further configured to, after receiving the second invocation request, send the second invocation request to a service and/or an interface on which the object to be tested depends based on the second test indication information carried in the second invocation request.
In another possible implementation, in a case that the processing server cannot determine the source of the invocation request, after receiving the invocation request (including the first invocation request and the second invocation request), the processing server may determine whether the invocation request includes the first test indication information, and determine whether the use request carries the second test indication information; when the first test instruction information is carried and the second test instruction information is not carried, the received call request is sent to the test server 20. And under the condition that the received call request does not carry the first test indication information and/or carries the second test indication information, sending the received call request to a service and/or an interface which is depended by the object to be tested.
Through the process, in the process of testing the object to be tested, the object to be tested can receive the response result fed back by the test server after sending the first call request; after receiving the response result, the object to be tested can execute the test case based on the response result to obtain the test case execution result.
Then, based on the execution result of the test case and the expected result of the test case, the test result of the object to be tested can be obtained.
Based on the same inventive concept, a testing method corresponding to the testing system is also provided in the embodiments of the present disclosure, and since the principle of solving the problem of the device in the embodiments of the present disclosure is similar to that of the testing system in the embodiments of the present disclosure, the implementation of the device may refer to the implementation of the method, and repeated details are not repeated.
To facilitate an understanding of the present embodiment, a testing method disclosed in the embodiments of the present disclosure is described in detail, and in some possible implementations, the testing method may be implemented by a processor calling a computer-readable instruction stored in a memory.
The following describes a test method provided by the embodiments of the present disclosure by taking an execution subject as a processing server.
Referring to fig. 2, a flowchart of a testing method applied to a processing server according to an embodiment of the present disclosure includes the following steps:
s201: acquiring a first call request initiated by an object to be tested;
s202: under the condition that the first calling request comprises first test indication information, sending the first calling request to a test server; the testing server is provided with services which are depended by the object to be tested and/or virtual services corresponding to the interfaces; the first calling request is used for generating a response result by the test server based on the virtual service.
In one possible embodiment, the testing method further includes: and sending the first call request to a service and/or an interface depended by the object to be tested under the condition that the first test indication information is not included in the first call request.
In one possible implementation, the first invocation request includes: a hypertext transfer protocol request (HTTP) or a hypertext transfer security protocol request (HTTPS); the first test indication information includes: the path information is requested.
In one possible embodiment, sending the first invocation request to the test server includes: detecting whether the first calling request carries request path information or not; and sending the first calling request to the test server under the condition that the first calling request carries the request path information.
In a possible implementation manner, detecting whether the first invocation request carries request path information includes: and detecting whether the first calling request carries the request path information or not based on a mapping relation between the pre-established request path information and the virtual service.
In one possible embodiment, the testing method further includes: receiving a second calling request sent by the test server; the second calling request is generated based on the first calling request and preset second test indication information when the test server detects that the first calling request does not carry a preset instruction; and sending a second calling request to the service and/or the interface depended by the object to be tested.
In one possible embodiment, the testing method further includes: analyzing a target field of the second calling request; and sending a second calling request to the service and/or the interface depended by the object to be tested under the condition that the analysis result comprises second test indication information.
The following describes a test method provided by the embodiments of the present disclosure by taking an execution subject as a test server.
Referring to fig. 3, a flowchart of a testing method applied to a testing server provided by the embodiment of the present disclosure includes the following steps:
s301: receiving a first calling request sent by a processing server; wherein, the first call request is initiated by the object to be tested;
s302: generating a response result based on the virtual service and the first calling request;
s303: and sending a response result to the object to be tested.
In a possible implementation manner, after receiving the first invocation request sent by the processing server, the method further includes: detecting whether the first calling request carries a preset instruction or not; wherein, the preset instruction comprises: the instruction is generated when the object to be tested calls the service and/or the virtual service of the interface which the object to be tested depends on; and under the condition that the first calling request does not carry a preset instruction, generating a second calling request based on the first calling request and preset second test indication information, and sending the second calling request to the processing server.
In a possible implementation manner, generating the second invocation request based on the first invocation request and preset second test indication information includes: and adding the second test indication information to the target field of the first call request to generate a second call request.
In one possible embodiment, generating the response result based on the virtual service and the first invocation request includes: and under the condition that the first calling request carries a preset instruction, generating a response result based on the virtual service and the first calling request.
It will be understood by those skilled in the art that in the method of the present invention, the order of writing the steps does not imply a strict order of execution and any limitations on the implementation, and the specific order of execution of the steps should be determined by their function and possible inherent logic.
Referring to fig. 4, an overall implementation logic flowchart of a test system provided in the embodiment of the present disclosure includes:
step 1: the processing server 10 obtains a first call request initiated by the object to be tested, detects whether the first call request contains first test indication information, if yes, jumps to the step 2, otherwise jumps to the step 6;
step 2: the processing server 10 sends the first call request to the test server 20, the test server 20 detects whether the first call request contains a preset instruction, if yes, the step 3 is skipped, and if not, the step 4 is skipped;
and step 3: the test server 20 generates a response result based on the virtual service and the first call request, sends the response result to the object to be tested, and ends the process.
And 4, step 4: the test server 20 adds the second test instruction information to the target field of the first call request, generates a second call request, and sends the second call request to the processing server 10;
and 5: after receiving the second invocation request, the processing server 10, in case that it is detected that the second invocation request includes the second test indication information, sends the second invocation request to the service and/or the interface on which the object to be tested depends, and ends the flow.
Step 6: and sending the first calling request to a service and/or an interface which is depended by the object to be tested.
Referring to fig. 5, a schematic diagram of a testing apparatus applied to a processing server according to an embodiment of the present disclosure is shown, where the apparatus includes: an obtaining module 501 and a first sending module 502; wherein the content of the first and second substances,
an obtaining module 501, configured to obtain a first invocation request initiated by an object to be tested;
a first sending module 502, configured to send the first invocation request to a test server if the first invocation request includes first test indication information; the testing server is provided with services which are depended by the object to be tested and/or virtual services corresponding to the interfaces; the first calling request is used for the test server to generate a response result based on the virtual service.
In a possible implementation manner, the first sending module is further configured to send the first invocation request to a service and/or an interface on which the object to be tested depends, if the first invocation request does not include the first test indication information.
In one possible implementation, the first invocation request includes: a hypertext transfer protocol request (HTTP) or a hypertext transfer security protocol request (HTTPS); the first test indication information includes: the path information is requested.
In a possible embodiment, the apparatus further comprises a first detection module; when the first call request is sent to the test server, the first detection module is configured to detect whether the request path information is carried in the first call request; the first sending module is configured to send the first invocation request to the test server under the condition that the request path information is carried in the first invocation request.
In a possible implementation manner, when detecting whether the first invocation request carries the request path information, the first detection module is specifically configured to detect whether the first invocation request carries the request path information based on a mapping relationship between the request path information and the virtual service, which is established in advance.
In a possible implementation manner, the obtaining module is further configured to receive a second invocation request sent by the test server; the second call request is generated based on the first call request and preset second test indication information when the test server detects that the first call request does not carry a preset instruction; the first sending module is further configured to send the second call request to a service and/or an interface on which the object to be tested depends.
In a possible embodiment, the apparatus further comprises: an analysis module; the analysis module is used for analyzing the target field of the second calling request; the first sending module is further configured to send the second invocation request to a service and/or an interface on which the object to be tested depends, under the condition that the analysis result includes the second test indication information.
Referring to fig. 6, a schematic diagram of a testing apparatus applied to a testing server according to an embodiment of the present disclosure is shown, where the apparatus includes: a receiving module 601, a generating module 602 and a second sending module 603; wherein the content of the first and second substances,
a receiving module 601, configured to receive a first call request sent by the processing server; wherein the first call request is initiated by the object to be tested;
a generating module 602, configured to generate a response result based on the virtual service and the first invocation request;
a second sending module 603, configured to send the response result to the object to be tested.
In a possible embodiment, the apparatus further comprises: the second detection module and the processing module; the second detection module is used for detecting whether the first calling request carries a preset instruction or not; wherein the preset instruction comprises: the instruction is generated when the object to be tested calls the virtual service of the service and/or the interface which the object to be tested depends on; the processing module is configured to generate a second call request based on the first call request and preset second test indication information and send the second call request to the processing server when the preset instruction is not carried in the first call request.
In a possible implementation manner, when a second invocation request is generated based on the first invocation request and preset second test indication information, the processing module is specifically configured to add the second test indication information to a target field of the first invocation request to generate the second invocation request.
In a possible implementation manner, when a response result is generated based on the virtual service and the first invocation request, the generation module is specifically configured to generate the response result based on the virtual service and the first invocation request under the condition that the first invocation request carries the preset instruction.
The description of the processing flow of each module in the device and the interaction flow between the modules may refer to the related description in the above method embodiments, and will not be described in detail here.
An embodiment of the present disclosure further provides a computer device, as shown in fig. 7, which is a schematic structural diagram of the computer device provided in the embodiment of the present disclosure, and includes:
a processor 71 and a memory 72; the memory 72 stores machine-readable instructions executable by the processor 71, the processor 71 being configured to execute the machine-readable instructions stored in the memory 72, the processor 71 performing the following steps when the machine-readable instructions are executed by the processor 71:
acquiring a first call request initiated by an object to be tested;
under the condition that the first calling request comprises first test indication information, sending the first calling request to a test server; the testing server is provided with services which are depended by the object to be tested and/or virtual services corresponding to the interfaces; the first calling request is used for the test server to generate a response result based on the virtual service.
Or when the machine readable instructions are executed by the processor 71, the processor 71 performs the steps of:
receiving a first calling request sent by the processing server; wherein the first call request is initiated by the object to be tested;
generating a response result based on the virtual service and the first invocation request;
and sending the response result to the object to be tested.
The memory 72 includes a memory 721 and an external memory 722; the memory 721 is also referred to as an internal memory, and temporarily stores operation data in the processor 71 and data exchanged with an external memory 722 such as a hard disk, and the processor 71 exchanges data with the external memory 722 through the memory 721.
The specific execution process of the instruction may refer to the steps of the test method described in the embodiments of the present disclosure, and details are not described here.
The embodiments of the present disclosure also provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, performs the steps of the test method described in the above method embodiments. The storage medium may be a volatile or non-volatile computer-readable storage medium.
The embodiments of the present disclosure also provide a computer program product, where the computer program product carries a program code, and instructions included in the program code may be used to execute the steps of the test method described in the foregoing method embodiments, which may be referred to specifically for the foregoing method embodiments, and are not described herein again.
The computer program product may be implemented by hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK), or the like.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, apparatus, and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present disclosure may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present disclosure may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present disclosure. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Finally, it should be noted that: the above-mentioned embodiments are merely specific embodiments of the present disclosure, which are used for illustrating the technical solutions of the present disclosure and not for limiting the same, and the scope of the present disclosure is not limited thereto, and although the present disclosure is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive of the technical solutions described in the foregoing embodiments or equivalent technical features thereof within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present disclosure, and should be construed as being included therein. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (15)

1. A test system, comprising: a processing server and a testing server; services which are depended by the object to be tested and/or virtual services corresponding to the interfaces are deployed in the test server;
the processing server is used for acquiring a first calling request initiated by an object to be tested; under the condition that the first calling request comprises first test indication information, sending the first calling request to the test server;
the test server is used for receiving a first calling request sent by the processing server; generating a response result based on the virtual service and the first invocation request; and sending the response result to the object to be tested.
2. The test system of claim 1, wherein the first invocation request includes: a hypertext transfer protocol request (HTTP) or a hypertext transfer security protocol request (HTTPS);
the first test indication information includes: the path information is requested.
3. The testing system of claim 2, wherein the processing server is specifically configured to:
and detecting whether the first call request carries the request path information or not based on a mapping relation between the request path information and the virtual service which is established in advance.
4. The testing system of claim 1, wherein the testing server, after receiving the first invocation request sent by the processing server, is further configured to:
detecting whether the first calling request carries a preset instruction or not; wherein the preset instruction comprises: the instruction is generated when the object to be tested calls the virtual service of the service and/or the interface which the object to be tested depends on;
under the condition that the preset instruction is not carried in the first calling request, generating a second calling request based on the first calling request and preset second test indication information, and sending the second calling request to the processing server;
and the processing server is further configured to send the second invocation request to a service and/or an interface on which the object to be tested depends based on second test indication information carried in the second invocation request after receiving the second invocation request.
5. The test system according to claim 4, wherein the test server, when generating a second invocation request based on the first invocation request and preset second test indication information, is configured to:
and adding the second test indication information to a target field of the first call request to generate the second call request.
6. The testing system of claim 5, wherein the processing server is further configured to: and analyzing a target field of the second calling request, and sending the second calling request to a service and/or an interface which the object to be tested depends on under the condition that the analysis result comprises the second test indication information.
7. A testing method is applied to a processing server and comprises the following steps:
acquiring a first call request initiated by an object to be tested;
under the condition that the first calling request comprises first test indication information, sending the first calling request to a test server; the testing server is provided with services which are depended by the object to be tested and/or virtual services corresponding to the interfaces; the first calling request is used for the test server to generate a response result based on the virtual service.
8. The test method of claim 7, wherein the first invocation request includes: a hypertext transfer protocol request (HTTP) or a hypertext transfer security protocol request (HTTPS);
the first test indication information includes: the path information is requested.
9. The method according to claim 8, wherein the detecting whether the first invocation request carries the request path information includes:
and detecting whether the first call request carries the request path information or not based on a mapping relation between the request path information and the virtual service which is established in advance.
10. The testing method of claim 7, further comprising:
receiving a second calling request sent by the test server; the second call request is generated based on the first call request and preset second test indication information when the test server detects that the first call request does not carry a preset instruction;
and sending the second calling request to a service and/or an interface which is depended by the object to be tested.
11. The testing method of claim 10, further comprising:
analyzing a target field of the second calling request;
and sending the second calling request to a service and/or an interface depended by the object to be tested under the condition that the analysis result comprises the second test indication information.
12. A testing method is characterized in that the testing method is applied to a testing server, and services and/or virtual services corresponding to interfaces which objects to be tested depend on are deployed in the testing server; the test comprises the following steps:
receiving a first calling request sent by a processing server; wherein the first call request is initiated by the object to be tested;
generating a response result based on the virtual service and the first invocation request;
and sending the response result to the object to be tested.
13. The method according to claim 12, further comprising, after receiving the first invocation request sent by the processing server:
detecting whether the first calling request carries a preset instruction or not; wherein the preset instruction comprises: the instruction is generated when the object to be tested calls the virtual service of the service and/or the interface which the object to be tested depends on;
and under the condition that the preset instruction is not carried in the first calling request, generating a second calling request based on the first calling request and preset second test indication information, and sending the second calling request to the processing server.
14. A computer device, comprising: a processor, a memory storing machine readable instructions executable by the processor, the processor for executing machine readable instructions stored in the memory, the machine readable instructions when executed by the processor, the processor performing the steps of the test method of any of claims 7 to 13.
15. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a computer device, performs the steps of the test method according to any one of claims 7 to 13.
CN202011607040.4A 2020-12-30 2020-12-30 Test system, test method, computer equipment and storage medium Pending CN112579473A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011607040.4A CN112579473A (en) 2020-12-30 2020-12-30 Test system, test method, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011607040.4A CN112579473A (en) 2020-12-30 2020-12-30 Test system, test method, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112579473A true CN112579473A (en) 2021-03-30

Family

ID=75144390

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011607040.4A Pending CN112579473A (en) 2020-12-30 2020-12-30 Test system, test method, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112579473A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107547312A (en) * 2017-09-21 2018-01-05 广州四三九九信息科技有限公司 Applied program testing method and system
CN109101430A (en) * 2018-08-24 2018-12-28 阿里巴巴集团控股有限公司 Test method, device and equipment
CN111782535A (en) * 2020-06-30 2020-10-16 京东数字科技控股股份有限公司 Test method and device
CN112035344A (en) * 2020-08-13 2020-12-04 天津智融创新科技发展有限公司 Multi-scenario test method, device, equipment and computer readable storage medium
CN112131118A (en) * 2020-09-25 2020-12-25 平安国际智慧城市科技股份有限公司 Mock testing method, Mock testing device, electronic equipment and computer readable storage medium
US10877877B1 (en) * 2020-08-06 2020-12-29 Coupang Corp. Computerized systems and methods for generating and modifying data for module implementation

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107547312A (en) * 2017-09-21 2018-01-05 广州四三九九信息科技有限公司 Applied program testing method and system
CN109101430A (en) * 2018-08-24 2018-12-28 阿里巴巴集团控股有限公司 Test method, device and equipment
CN111782535A (en) * 2020-06-30 2020-10-16 京东数字科技控股股份有限公司 Test method and device
US10877877B1 (en) * 2020-08-06 2020-12-29 Coupang Corp. Computerized systems and methods for generating and modifying data for module implementation
CN112035344A (en) * 2020-08-13 2020-12-04 天津智融创新科技发展有限公司 Multi-scenario test method, device, equipment and computer readable storage medium
CN112131118A (en) * 2020-09-25 2020-12-25 平安国际智慧城市科技股份有限公司 Mock testing method, Mock testing device, electronic equipment and computer readable storage medium

Similar Documents

Publication Publication Date Title
CN109492378B (en) Identity verification method based on equipment identification code, server and medium
CN106919509B (en) Client generation method and device and electronic equipment
US11237844B2 (en) Method and apparatus for loading kernel module
US10073916B2 (en) Method and system for facilitating terminal identifiers
CN107704479B (en) File generation method and device
US9811356B2 (en) Automated software configuration management
US9934229B2 (en) Telemetry file hash and conflict detection
CN110048879A (en) Micro services register method, device, electronic equipment and computer readable storage medium
CN110659206A (en) Simulation architecture establishing method, device, medium and electronic equipment based on microservice
Queiroz et al. A web browser fingerprinting method based on the web audio API
CN112153012A (en) Multi-terminal contact access method, device and storage medium
CN110619022A (en) Node detection method, device, equipment and storage medium based on block chain network
CN111061637B (en) Interface testing method, interface testing device and storage medium
CN108881320B (en) Authentication processing method for user login, server and client
CN114895879B (en) Management system design scheme determining method, device, equipment and storage medium
CN112579473A (en) Test system, test method, computer equipment and storage medium
CN105162799A (en) Method for checking whether client is legal mobile terminal or not and server
CN110545296A (en) Log data acquisition method, device and equipment
CN109086145B (en) Data generation method and device and computer storage medium
CN113986676A (en) Server health check method and device, electronic equipment and storage medium
CN112597067B (en) Test method, test system, electronic device and test medium
CN109933573B (en) Database service updating method, device and system
US20170302541A1 (en) System and method for monitoring service
CN114942730B (en) Method and device for determining residual storage space and electronic equipment
CN114398279A (en) Application program testing method, device, equipment and storage medium

Legal Events

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