CN115952099A - Mock testing method, device and equipment based on intelligent routing strategy - Google Patents

Mock testing method, device and equipment based on intelligent routing strategy Download PDF

Info

Publication number
CN115952099A
CN115952099A CN202310025202.0A CN202310025202A CN115952099A CN 115952099 A CN115952099 A CN 115952099A CN 202310025202 A CN202310025202 A CN 202310025202A CN 115952099 A CN115952099 A CN 115952099A
Authority
CN
China
Prior art keywords
service
mock
request
information
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
CN202310025202.0A
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.)
Xiamen Youwei Technology Co ltd
Original Assignee
Xiamen Youwei 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 Xiamen Youwei Technology Co ltd filed Critical Xiamen Youwei Technology Co ltd
Priority to CN202310025202.0A priority Critical patent/CN115952099A/en
Publication of CN115952099A publication Critical patent/CN115952099A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The present disclosure relates to the field of software development, and in particular, to a mock testing method, device and apparatus based on an intelligent routing policy. The method comprises the following steps: determining whether the called service corresponding to the service calling request is a mock test service or not according to the test requirement; if so, classifying the service calling request according to the service name in the service calling request; determining a service calling request source and called service information in the same type of service calling request; splicing a service calling request source and called service information into a service calling request to form a new service calling request; matching corresponding configuration strategy information and mock response according to the new service calling request; and returning the configuration strategy information and the mock response to the calling party to carry out mock testing. The scheme can meet the test requirements of multiple sets of environments and different scenes of the same interface at the same moment of a team, and has the advantages of strong universality, simple deployment configuration and high expandability.

Description

Mock testing method, device and equipment based on intelligent routing strategy
Technical Field
The present disclosure relates to the field of software development, and in particular, to a mock testing method, device and apparatus based on an intelligent routing policy.
Background
At present, when a test team uses a Mock test, one scene generally corresponds to a Mock response, and response information needs to be manually switched for many times when a Mock test is carried out in multiple scenes. When the mock tests shared by a plurality of members have intersection, the tests need to be executed in sequence, and the parallel tests cannot be performed; even modifying the response information of the Mock interface can cause the results of the failure of the flow verification of others. Therefore, the existing mock testing mode is time-consuming, labor-consuming and mutually interfered, is not favorable for the verification of regression multi-scenes, and is not favorable for the cooperation among teams.
The prior art focuses on switching between real services and mock services, does not consider a specific test scene of an interface, does not consider whether multiple environments are supported to be used simultaneously, does not determine a response strategy of interface mock information, is not reusable and has limitations.
Disclosure of Invention
In order to solve the problem that the same mock test cannot simultaneously process multi-person and multi-environment tests in the prior art, embodiments of the present disclosure provide a mock test method, device and apparatus based on an intelligent routing policy.
The embodiment of the invention provides a mock testing method based on an intelligent routing strategy, which comprises the following steps: determining whether a called service corresponding to a service calling request initiated by a calling party is a mock test service or not according to the test requirement; if so, classifying the service calling requests according to the service names in the service calling requests to obtain service calling requests of different categories; determining a service calling request source and called service information in the same type of service calling request; splicing the service calling request source and the called service information into the service calling request to form a new service calling request; matching corresponding configuration strategy information and mock response according to the new service calling request; and returning the configuration strategy information and the mock response to the caller, and carrying out mock test by the caller.
According to one aspect of embodiments herein, the determining a service invocation request source and invoked service information according to request data of the service invocation request comprises: determining an environment interface and a service interface in a service calling request; and reading an environment label returned by the environment interface and a service address returned by the service interface, wherein the environment label belongs to a service calling request source, and the service address belongs to called service information.
According to an aspect of embodiments herein, the splicing the service invocation request source and the invoked service information into the service invocation request to form a new service invocation request includes: and splicing fields corresponding to the environment tag and the service address to the tail of the service call request to form a new service call request.
According to one aspect of embodiments herein, the method further comprises: determining whether the service invocation request contains a personal tag; and if so, splicing the field corresponding to the service address to the tail of the service calling request to form new service request data.
According to one aspect of embodiments herein, matching the corresponding configuration policy information and mock response according to the new service invocation request comprises: if the new service calling request contains a personal tag, directly matching a corresponding personal configuration strategy and mock response from a database according to the personal tag and the service address tag; and if the new service calling request does not contain the personal tag, matching a corresponding configuration strategy and mock response from a database according to the environment tag and the service address.
According to one aspect of embodiments herein, prior to determining the service invocation request origin and invoked service information, the method further comprises: carrying out validity check on the access parameter in the service calling request to obtain a check result; if the verification result is that the validity verification is not passed, returning the verification result to the calling party; and if the verification result is that the legality verification is passed, determining a service calling request source and called service information.
The embodiment of the invention also discloses a mock testing device based on the intelligent routing strategy, which comprises: the service calling request acquisition unit is used for acquiring a service calling request initiated by a calling party and determining whether the called service is a mock test service or not; if so, classifying the service calling requests according to the service names in the service calling requests to obtain service calling requests of different classes; the determining unit is used for determining a service calling request source and called service information in the same type of service calling request; a new service call request determining unit, configured to splice the service call request source and the called service information into the service call request to form a new service call request; the matching unit is used for matching the corresponding configuration strategy information and mock response according to the new service calling request; and the mock testing unit is used for returning the configuration strategy information and the mock response to the calling party and carrying out mock testing by the calling party.
Embodiments herein also provide a computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the mock testing method based on intelligent routing policies when executing the computer program.
Embodiments also provide a computer-readable storage medium storing a computer program, which when executed by a processor implements the mock testing method based on an intelligent routing policy.
Embodiments herein also provide a computer program product comprising a computer program that when executed by a processor implements the mock testing method based on intelligent routing policies.
The scheme can meet the test requirements of a team on a plurality of sets of environment different scenes at the same time and at the same interface, and helps a user to customize and configure the dedicated mock information according to specific service scenes and specific requirements; the method can realize the necessary transmission of the interface access parameter field, the correctness verification, the service logic verification and the like; the overall scheme is strong in universality, simple in deployment and configuration and high in expandability, and can improve the joint debugging and testing efficiency of the front end and the rear end based on the micro-service architecture.
Drawings
In order to more clearly illustrate the embodiments or technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart illustrating a mock testing method based on an intelligent routing policy according to an embodiment of the present disclosure;
FIG. 2 is a flowchart illustrating a method for determining a source of a service request and information about a called service according to an embodiment of the present disclosure;
fig. 3 is another flowchart illustrating a mock testing method based on an intelligent routing policy according to an embodiment of the present disclosure;
FIG. 4 is a flowchart illustrating a method for matching configuration policy information with mock responses according to an embodiment of the present disclosure;
FIG. 5 is a flowchart illustrating a method for verifying an entry in a service invocation request according to an embodiment of the present disclosure;
FIG. 6 is a diagram illustrating a same interface processing service invocation requests in different source environments according to an embodiment of the present disclosure;
FIG. 7 is a diagram illustrating a same environment and a same interface processing service invocation requests of different callers according to an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of a mock testing device based on an intelligent routing policy according to an embodiment of the present disclosure;
fig. 9 is a schematic structural diagram of a computer device according to an embodiment of the present disclosure.
Description of the symbols of the drawings:
801. a service invocation request acquisition unit;
802. a judgment unit;
803. a determination unit;
804. a new service invocation request determination unit;
805. a matching unit;
806. a mock test unit;
902. a computer device;
904. a processor;
906. a memory;
908. a drive mechanism;
910. an input/output module;
912. an input device;
914. an output device;
916. a presentation device;
918. a graphical user interface;
920. a network interface;
922. a communication link;
924. a communication bus.
Detailed Description
In order to make the technical solutions in the present specification better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments, but not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments herein without making any creative effort, shall fall within the scope of protection.
It should be noted that the terms "first," "second," and the like in the description and claims herein and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments herein described are capable of operation in sequences other than those illustrated or described herein. Moreover, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, apparatus, article, or device that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or device.
The present specification provides method steps as described in the examples or flowcharts, but may include more or fewer steps based on routine or non-inventive labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. In the actual implementation of the system or the device product, the method according to the embodiments or shown in the drawings can be executed in sequence or in parallel.
It should be noted that the mock testing method based on the intelligent routing strategy can be used in the field of software development and the field of financial technology, and the application field of the mock testing method and device based on the intelligent routing strategy is not limited in this document.
Fig. 1 is a flowchart of a mock testing method based on an intelligent routing policy according to an embodiment of the present disclosure, which specifically discloses the following steps:
step 101, determining whether a called service corresponding to a service calling request initiated by a calling party is a mock test service according to a test requirement. In this step, the caller is the party requesting to invoke the target service, and the caller initiates a service invocation request. Wherein, the service call request includes: uniform Resource Locator (URL), entry, header, method, etc. data. The URL includes data such as an interface name, a path, and a domain name. The service name of the invoked service.
In some embodiments of the present description, the URL in a caller-originated service request is as follows: http:// core-fund-ch-jmx-test-env-bus.test.abc.com.cn/service1/repayOffline.
The core-fund-ch-jmx-test-env-bus.test.abc.com.cn is a domain name and represents the address of the called service, and the/service 1/repayOffline is an interface path and represents the service name and the interface name of the called service.
And 102, if so, classifying the service calling requests according to the service names in the service calling requests to obtain service calling requests of different classes. In some embodiments of the present specification, service invocation requests for invoking the same service are classified into one class according to a service name in the service invocation request, and service invocation requests for invoking different services are classified into other classes respectively. Therefore, the step can distinguish a large number of service call requests so as to ensure that different call requests of the same service are processed in parallel in the subsequent step.
Step 103, determining the service call request source and the called service information in the service call request of the same category. This step determines different classes of service invocation requests based on the service invocation requests classified in step 102. And then respectively acquiring the source of the service calling requests and the called service information for the service calling requests of the same category. Specifically, the environment information of the caller and the service information of the called service can be obtained by analyzing the URL in the service calling request. The environment information represents the type of environment where the caller is located, and includes, but is not limited to: one or more of a test environment, a development environment, a production environment. The service information indicates information such as a service address and a service interface of the called service. The specific steps of this step can be described with reference to fig. 2, and this step is not described herein again.
And step 104, splicing the service calling request source and the called service information into the service calling request to form a new service calling request. In this step, a data tag module in the mock platform may execute a corresponding data dyeing service, specifically, the service request source and the called service information determined in step 103 are spliced into the service calling request as a data tag or a data identifier to form a new service calling request, or may be understood as dyeing an original service calling request. In some embodiments of the present specification, the service invocation request source and the invoked service information may be spliced into the original service invocation request in the form of a data tag or a data identifier. Specifically, the fields corresponding to the environment tag and the service address are spliced to the end of the service call request to form a new service call request.
And 105, matching corresponding configuration strategy information and mock response according to the new service calling request. In this step, the new service invocation request includes the environment where the caller is located, the address of the invoked service, and the interface, in addition to the information included in the original service invocation request.
In some embodiments of the present description, configuration policies include, but are not limited to: general strategies, access parameter analysis strategies, service inquiry strategies, customized response strategies and the like. The general strategy is to directly return the configured mock response to the calling party; the parameter entry analysis strategy is as follows: different mock responses are given according to the combination mode of some fields in the access of the service call request, and when the same service is requested, different response strategies are configured according to different request parameters. For example, the person A performs a borrowing test, the total borrowing amount is 1000 yuan, and the money is paid in 6 days; and the person B and the person A carry out borrowing test on the same interface, the borrowing amount is 2000 yuan, and the loan is paid in 3-period. Thus, different influence strategies are configured for the testers a and B. In the present application, the service query policy is: inquiring the stage where the service is located from the database, and giving different Mock responses; the customized response strategy is: the user can configure own exclusive Mock response, and other people cannot use the response information.
The configuration strategy information and the mock response in the application are response information which is pre-configured and stored in a database and corresponds to the service calling request one by one. These response messages correspond to different environments, different interfaces of the same service. Therefore, according to the new data label or the data identifier spliced in the new service calling request, the corresponding configuration strategy information and mock response are gathered and matched from the database. In the application, the configuration strategy can give quick response to the interface according to the service scene.
And 106, returning the configuration strategy information and the mock response to the calling party, and carrying out mock test by the calling party. In the step, the mock platform returns the matched configuration strategy information and the mock response to the calling party, and the calling party performs the mock test.
In some embodiments of the present description, the configuration policy information and mock response may be represented by the following code examples:
if($mock_uri=“/ajtrust/bindCardSmsSend”){
switch($mock::getSourceEnv()){
case1:$response_data=$mock::getMockJsonData(json_file:“data/bindCardSmsSend.json”);
case2:$response_data=$mock::getMockJsonData(json_file:“data/bindCardSmsSend_failure.json”);
break;
}}
where mock _ uri = "/ajstrut/bindcardsend" represents a service call request for a URL whose content is/ajstrut/bindcardsend, and provides a mock response. Wherein, case1 and case2 respectively represent two mock response results corresponding to the service invocation request. Case1 indicates a mock response result of successful configuration, and Case2 indicates a response result of failed configuration.
The forms of the service invocation request, the configuration policy information and the mock response are not limited in the present application.
Fig. 2 is a flowchart illustrating a method for determining a service request source and called service information according to an embodiment of the present disclosure, which includes the following steps:
step 201, determining an environment interface and a service interface in the service calling request. The step is executed by a mock platform, wherein the mock platform comprises a data label service and a routing strategy service. The step is executed by a check-entry module in the data tag service. In some embodiments of the present description, the context interface and the service interface of the service call may be obtained from specific parameters in a uniform resource locator URL.
For example, the URLs shown in FIG. 1 are:
the environment interface is an env interface, wherein the env interface belongs to a Springboot framework. And generating a list of all environment attributes available for the application program according to the env interface, and realizing refreshing configuration. In addition, the service interface is repayOffline in the URL, and repayOffline is a specific interface of the service jmx. In some embodiments of the present description, a service may include multiple interfaces, each of which can correspond to a different configuration response.
Step 202, reading an environment tag returned by the environment interface and a service address tag returned by the service interface, wherein the environment tag belongs to a service calling request source, and the service address belongs to called service information. In some embodiments of the present specification, the environment tag may be obtained by reading the environment information in the springboot framework according to the env environment interface. For example, env-150, env-151, env-152 and the like. Wherein each environment tag corresponds to an environment. In some other embodiments of the present specification, the address corresponding to a specific interface in the service may be determined by the service address returned by the service interface. In the application, by acquiring the environment and the service address in the service calling request, the source and destination of data can be distinguished, the environment source of a calling party and the address information of the called service are determined, and a user is helped to customize and configure the exclusive Mock information according to a specific service scene and a specific requirement.
Fig. 3 is another flowchart of a mock testing method based on an intelligent routing policy according to an embodiment of the present disclosure, which specifically includes the following steps:
step 301, determining whether the service invocation request contains a personal tag. In this step, the mock platform identifies the specific field in the service invocation request and determines whether the personal tag is included. Where the personal tag is defined by the caller and added to the service invocation request. In some embodiments of the present disclosure, if a developer or a tester is prepared to verify or test some special scenarios, and it is expected that the special scenarios can only be used by the developer itself, and the test or development of other developers is not affected, therefore, a personal tag is added to the corresponding service invocation request. Correspondingly, the caller pre-configures corresponding response information into the database. Thus, the service invocation request including the personal tag can be associated with the response information configured in advance.
And step 302, if yes, splicing the field corresponding to the service address to the end of the service call request to form new service request data. And if the personal tag is determined to be included in the service calling request, the personal tag is positioned at the end of the service calling request. For example, the personal tag is represented as: & self _ tag = xyz.
In the present application, the personal tag has the highest priority compared to the service invocation request source and the invoked service information. Therefore, if the personal tag exists in the service calling request, the corresponding configuration policy information and mock response can be directly matched according to the information in the personal tag. Further, in order to determine which interface of the service is called by the service call request corresponding to the personal tag, the service request tag needs to be acquired. That is, the field corresponding to the service address is spliced to the end of the service invocation request. For example, http:// core-fund-ch-jmx-test-env-bus.test.abc.com.cn/service 1/repayofflingesource _ env = en v-150 &self \/tag = xyz, wherein the new service call request comprises the environment tag source _ env = env _150 and the personal tag self _ tag = xyz. In some embodiments of the present specification, after splicing the fields corresponding to the service address to the end of the service invocation request, the form of forming new service request data may also be as follows: http:// core-fund-ch-jmx-test-env-bus.test.abc.com.cn/service 1/repayofflueself _ tag = xyz. If the service request data does not need the environment tag, self _ tag = xyz can be directly spliced at the end of the original service request data.
In this step, it is not necessary to splice the field corresponding to the environment tag to the end of the service invocation request.
Fig. 4 is a flowchart illustrating a method for matching configuration policy information with mock response according to an embodiment of the present disclosure. The method determines matching methods such as configuration strategies and mock responses according to the type of the tag contained in the service calling request. The method is executed by a routing policy service of a mock platform, and specifically comprises the following steps:
step 401, if the new service invocation request includes a personal tag, directly matching a corresponding personal configuration policy and mock response from a database according to the personal tag and the service address tag. In this step, the personal tag has the highest priority, and the specific interface of the service called by the service calling request is determined according to the service address tag. Thereby, the customized configuration policy and mock response corresponding to the interface and the personal tag are matched from the database. Specifically, the configuration strategy and the mock response are customized, that is, the caller/user can configure the own dedicated mock response, and other people cannot use the response information.
And step 402, if the new service calling request does not contain the personal tag, matching the corresponding configuration strategy and mock response from the database according to the environment tag and the service address. And if the new service calling request does not contain the personal tag, matching a configuration strategy and a mock response corresponding to the environmental tag and the service address from the database according to the environmental tag and the service address in the new service calling request. In some embodiments of the present description, a new service invocation request that does not contain a personal tag is as follows: http:// core-fund-ch-jmx-test-env-bus.test.abc.com.cn/service 1/repayoffhreslource _ env = en v _150.
Fig. 5 is a flowchart of a method for checking an entry in a service invocation request according to an embodiment of the present disclosure, which specifically includes the following steps:
step 501, judging whether the input parameter in the service calling request passes validity check to obtain a check result. This step is performed by the data tag service. After receiving the GateWay service request, the "join check" module will check the legality of the join of the interface: and if so, transferring to a data dyeing service.
In this step, the service invocation request includes a plurality of entries. Wherein the reference represents a specific parameter related to the called service in the service calling request. For example,
"CaseNo":"ABC_CF202206281922098jWJMbNAxX78";
"RequestSeqId":"REPAY_JMX_CF2022121318294066Vqzr",
"ReceiptId":"BO20200205000005001","RepayFlag":"0","PeriodNo":3,
"Amount":88.64,"RepayAmt":82.56。
in this step, the validity check is used to check whether the format of the input parameter is accurate, whether the input parameter is empty, and the like.
And 502, if the verification result is that the validity verification is not passed, returning the verification result to the calling party. In this step, if the entry in the service invocation request fails the validity check, the failed check result is returned to the caller and the log service.
In the present application, the results of the failed verification are as follows:
case2:$response_data=$mock::getMockJsonData(json_file:“data/bindCardSmsSend_failure.json”
step 503, if the verification result is that the validity is verified, determining the service invocation request source and the invoked service information. In this step, if the entry in the method invocation request passes the validity check, the aforementioned process of determining the service invocation request and the invoked service information is executed.
Fig. 6 is a schematic diagram illustrating a same interface processing service call requests in different source environments according to an embodiment of the present disclosure. Specifically, a test team runs in parallel for 3 sets of test environments at the same time, and borrowing trial calculation interfaces are used at the same time. Wherein, each environment scene is as follows:
the test environment a was: borrowing the real environment, wherein the borrowing amount is 1000 yuan, and the borrowing period is 6 days;
the test environment B was: performing Mock test, wherein the borrowing amount is 2000, and the borrowing period is 9 periods;
the test environment is as follows: and performing Mock test, wherein the borrowing amount is 3000, and the borrowing period is 12 periods.
And the gateway in the mock routing service directly calls the test environment A to the real service1, and obtains the response information A of the real service 1. And the gateway in the Mock routing service extracts specific fields in the service calling requests of the test environment B and the test environment C, forms new service calling requests corresponding to the two test environments respectively in a data label mode, and matches the new service calling requests with corresponding response information B and response information C. And further returning the response information B and the response information C to the caller testing environment B and the caller testing environment C. The response information B and the response information C are response strategy information which is preset and stored in a database.
Fig. 7 is a schematic diagram illustrating a same environment and a same interface processing service invocation requests of different callers according to an embodiment of the present disclosure. Specifically, the personal dimension, that is, the same interface request of the same set of test environment, can give different responses according to different users.
The tester A, the tester and the tester C call the same set of payment trial calculation interfaces of the service1 in the same set of environment. The borrowing and the corresponding repayment days of different testers are different, so the borrowing and the repayment days belong to different business stages. For example: under the same repayment trial interface, the current normal repayment test, the overdue repayment test, the early settlement test and the debt return purchase test can be carried out.
The repayment trial scenario in this schematic diagram is as follows:
the tester a: borrowing a total period of 6, and when the earlier period is the period 2, starting early settlement trial calculation from the period 2, wherein the early settlement trial calculation belongs to an early settlement testing stage;
the tester B: the borrowing is in 3 th period, the 2 nd period is overdue, and when the early period is the 3 rd period, the 2 nd period initiates normal repayment trial calculation, which belongs to a normal repayment test stage;
the tester C: borrow 9 periods altogether, 1 st period is the current period, launches early settlement trial calculation from 1 st period, belongs to early settlement test stage.
In the figure, a gateway service in a mock routing service determines that service call requests initiated by three testers are all mock services, and the mock routing service generates new service call requests for original service call requests of the three testers based on a data tag service, which includes: a new service invocation request of tester a, a new service invocation request of tester B, and a new service invocation request of tester C. In the application, the routing policy service further matches the corresponding configuration policy and mock response for the new service call request of 3 testers respectively according to the new service call request, so as to obtain mock response information a, mock response information B and mock response information C. The mock response information A, the mock response information B and the mock response information C are response strategy information which is preset and stored in a database.
Fig. 8 is a schematic structural diagram of a mock test device based on an intelligent routing policy according to an embodiment of the present disclosure, in which a basic structure of the mock test device based on the intelligent routing policy is described, where functional units and modules may be implemented in a software manner, or a general chip or a specific chip may be used to implement a mock test based on the intelligent routing policy, and the mock test device specifically includes:
a service invocation request obtaining unit 801, configured to obtain a service invocation request initiated by an invoker, and determine whether an invoked service is a mock test service;
a determining unit 802, configured to classify the service invocation requests according to service names in the service invocation requests if the service invocation requests are of the same category, so as to obtain service invocation requests of different categories;
a determining unit 803, configured to determine a service invocation request source and invoked service information in the same type of service invocation request;
a new service invocation request determining unit 804, configured to splice the service invocation request source and the invoked service information into the service invocation request to form a new service invocation request;
a matching unit 805, configured to match, according to the new service invocation request, the corresponding configuration policy information and mock response;
a Mock testing unit 806, configured to return the configuration policy information and the Mock response to the caller, and perform a Mock test by the caller.
The scheme can meet the test requirements of a team on a plurality of sets of environment different scenes at the same time and at the same interface, and helps a user to customize and configure the dedicated mock information according to specific service scenes and specific requirements; the method can realize the necessary transmission of the access parameter field of the interface, the correctness check, the service logic check and the like; the overall scheme has strong universality, simple deployment configuration and high expandability.
Fig. 9 is a diagram of a computer device provided in an embodiment herein. The mock testing method based on the intelligent routing strategy can be applied to the computer equipment. The computer device 902 may include one or more processors 904, such as one or more Central Processing Units (CPUs), each of which may implement one or more hardware threads. Computer device 902 may also include any memory 906 for storing any kind of information such as code, settings, data etc. For example, and without limitation, the memory 906 may include any one or combination of the following: any type of RAM, any type of ROM, flash memory devices, hard disks, optical disks, etc. More generally, any memory may use any technology to store information. Further, any memory may provide volatile or non-volatile retention of information. Further, any memory may represent fixed or removable components of computer device 902. In one case, when the processor 904 executes the associated instructions, which are stored in any memory or combination of memories, the computer device 902 can perform any of the operations of the associated instructions. The computer device 902 also includes one or more drive mechanisms 908, such as a hard disk drive mechanism, an optical disk drive mechanism, etc., for interacting with any memory.
Computer device 902 may also include an input/output module 910 (I/O) for receiving various inputs (via input device 912) and for providing various outputs (via output device 914). One particular output mechanism may include a presentation device 916 and an associated Graphical User Interface (GUI) 918. In other embodiments, input/output module 910 (I/O), input device 912, and output device 914 may also be excluded, acting as only one computer device in a network. Computer device 902 may also include one or more network interfaces 920 for exchanging data with other devices via one or more communication links 922. One or more communication buses 924 couple the above-described components together.
Communication link 922 may be implemented in any manner, such as over a local area network, a wide area network (e.g., the Internet), a point-to-point connection, etc., or any combination thereof. Communication link 922 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc., governed by any protocol or combination of protocols.
Corresponding to the methods in fig. 1 to 5, the embodiments herein also provide a computer-readable storage medium having stored thereon a computer program, which, when executed by a processor, performs the steps of the above-described method.
Embodiments herein also provide computer readable instructions, wherein when executed by a processor, a program thereof causes the processor to perform the method as shown in fig. 1-5.
Embodiments herein also provide a computer program product comprising a computer program which, when executed by a processor, implements the method as shown in fig. 1 to 5.
It should be understood that, in various embodiments herein, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments herein.
It should also be understood that, in the embodiments herein, the term "and/or" is only one kind of association relation describing an associated object, meaning that three kinds of relations may exist. For example, a and/or B, may represent: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present disclosure.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided herein, it should be understood that the disclosed system, apparatus, and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, 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 through some interfaces, devices or units, and may also be an electrical, mechanical or other form of connection.
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 elements may be selected according to actual needs to achieve the objectives of the embodiments herein.
In addition, functional units in the embodiments herein 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 integrated unit may be implemented in the form of hardware, or may also be implemented in the form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solutions in the present invention substantially or partially contribute to the prior art, or all or part of the technical solutions 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 methods described in the embodiments herein. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk, and various media capable of storing program codes.
The principles and embodiments of this document are explained herein using specific examples, which are presented only to aid in understanding the methods and their core concepts; meanwhile, for the general technical personnel in the field, according to the idea of this document, there may be changes in the concrete implementation and the application scope, in summary, this description should not be understood as the limitation of this document.

Claims (10)

1. A mock test method based on an intelligent routing strategy is characterized by comprising the following steps:
determining whether a called service corresponding to a service calling request initiated by a calling party is a mock test service or not according to the test requirement;
if so, classifying the service calling requests according to the service names in the service calling requests to obtain service calling requests of different categories;
determining a service calling request source and called service information in the same type of service calling request;
splicing the service calling request source and the called service information into the service calling request to form a new service calling request;
matching corresponding configuration strategy information and mock response according to the new service calling request;
and returning the configuration strategy information and the mock response to the caller, and carrying out mock test by the caller.
2. The mock test method according to claim 1, wherein said determining the service invocation request source and the invoked service information according to the request data of the service invocation request comprises:
determining an environment interface and a service interface in the service calling request;
and reading an environment label returned by the environment interface and a service address label returned by the service interface, wherein the environment label belongs to a service calling request source, and the service address label belongs to called service information.
3. The mock testing method according to claim 2, wherein the splicing the service invocation request source and the invoked service information into the service invocation request to form a new service invocation request comprises:
and splicing fields corresponding to the environment tag and the service address to the tail of the service call request to form a new service call request.
4. The mock testing method based on intelligent routing strategy according to claim 2, characterized in that said method further comprises:
determining whether the service invocation request contains a personal tag;
and if so, splicing the service address label to the tail of the service calling request to form new service request data.
5. The mock testing method according to claim 3 or 4, wherein the matching of the corresponding configuration policy information and mock response according to the new service invocation request comprises:
if the new service calling request contains a personal tag, directly matching a corresponding personal configuration strategy and mock response from a database according to the personal tag and a service address tag;
and if the new service calling request does not contain the personal tag, matching a corresponding configuration strategy and mock response from a database according to the environment tag and the service address.
6. The mock testing method according to claim 5, wherein before determining the service invocation request source and invoked service information, said method further comprises:
judging whether the access parameters in the service calling request pass validity check or not to obtain a check result;
if the verification result is that the validity verification is not passed, returning the verification result to the calling party;
and if the verification result is that the legality is verified, determining a service calling request source and called service information.
7. A mock testing device based on an intelligent routing policy, the device comprising:
the service calling request acquisition unit is used for acquiring a service calling request initiated by a calling party and determining whether the called service is a mock test service or not;
the judging unit is used for classifying the service calling requests according to the service names in the service calling requests to obtain different types of service calling requests if the service calling requests are the same;
the determining unit is used for determining a service calling request source and called service information in the same type of service calling request;
a new service call request determining unit, configured to splice the service call request source and the called service information into the service call request to form a new service call request;
the matching unit is used for matching the corresponding configuration strategy information and mock response according to the new service calling request;
and the mock testing unit is used for returning the configuration strategy information and the mock response to the calling party and carrying out mock testing by the calling party.
8. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, implements the method of any one of claims 1 to 6.
10. A computer program product, characterized in that the computer program product comprises a computer program which, when being executed by a processor, carries out the method of any one of claims 1 to 6.
CN202310025202.0A 2023-01-09 2023-01-09 Mock testing method, device and equipment based on intelligent routing strategy Pending CN115952099A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310025202.0A CN115952099A (en) 2023-01-09 2023-01-09 Mock testing method, device and equipment based on intelligent routing strategy

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310025202.0A CN115952099A (en) 2023-01-09 2023-01-09 Mock testing method, device and equipment based on intelligent routing strategy

Publications (1)

Publication Number Publication Date
CN115952099A true CN115952099A (en) 2023-04-11

Family

ID=87286001

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310025202.0A Pending CN115952099A (en) 2023-01-09 2023-01-09 Mock testing method, device and equipment based on intelligent routing strategy

Country Status (1)

Country Link
CN (1) CN115952099A (en)

Similar Documents

Publication Publication Date Title
WO2019153472A1 (en) Automated interface testing method, device, equipment, and storage medium
CA2281368C (en) Service contract for managing service systems
US8141043B2 (en) Automated business process testing that spans multiple platforms or applications
US7810072B2 (en) Exception thrower
US9465725B2 (en) Software defect reporting
WO2020029375A1 (en) Interface testing method and system, and computer device and storage medium
CN107241315B (en) Access method and device of bank gateway interface and computer readable storage medium
US10817267B2 (en) State machine representation of a development environment deployment process
US10452522B1 (en) Synthetic data generation from a service description language model
CN113227976A (en) Methods, systems, and computer readable media for data transformation using representational state transfer (REST) Application Programming Interfaces (APIs)
US7996840B2 (en) Method, system, and apparatus for scheduling pattern based web services
US7533383B2 (en) Method, system, and apparatus for scheduling pattern based web services
CN114564203A (en) Service operation method and device, electronic equipment and readable medium
CN114237994A (en) Test method and system for distributed system, electronic device and storage medium
CN111538659A (en) Interface testing method and system for service scene, electronic device and storage medium
CN114610598A (en) Test method, test device, electronic equipment and computer readable storage medium
CN117435513B (en) Test case generation method, terminal equipment and computer readable storage medium
Zhang et al. Model based testing for agent systems
US11232019B1 (en) Machine learning based test coverage in a production environment
CN115952099A (en) Mock testing method, device and equipment based on intelligent routing strategy
US20020095656A1 (en) Extensible software development using asynchronous messaging
CN115629743A (en) Service component arranging method, service scheduling method and device, electronic equipment and storage medium
CN110618943B (en) Security service test method and device, electronic equipment and readable storage medium
CN112860398A (en) Data processing method, device, equipment and medium based on rule engine
CN115964193B (en) Service calling method, computer equipment and storage medium for grid environment application

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