CN116775441A - Test method and device, electronic equipment and computer readable storage medium - Google Patents

Test method and device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN116775441A
CN116775441A CN202210215769.XA CN202210215769A CN116775441A CN 116775441 A CN116775441 A CN 116775441A CN 202210215769 A CN202210215769 A CN 202210215769A CN 116775441 A CN116775441 A CN 116775441A
Authority
CN
China
Prior art keywords
service
baffle
dependent
tested object
response data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210215769.XA
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.)
NetsUnion Clearing Corp
Original Assignee
NetsUnion Clearing Corp
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 NetsUnion Clearing Corp filed Critical NetsUnion Clearing Corp
Priority to CN202210215769.XA priority Critical patent/CN116775441A/en
Publication of CN116775441A publication Critical patent/CN116775441A/en
Pending legal-status Critical Current

Links

Abstract

The application discloses a testing method, a testing device, electronic equipment and a computer readable storage medium, wherein the testing method is applied to a baffle service system and comprises the following steps: registering baffle service according to the baffle service configuration information, wherein the baffle service is used for simulating the dependent service of the tested object; receiving test data sent by a tested object through a target baffle service, wherein the target baffle service is determined by the tested object in registered baffle services; generating dependent service response data according to the test data; and returning the dependent service response data to the tested object through the target baffle service so that the tested object completes the test flow according to the dependent service response data. According to the application, the dependence service of the tested object is simulated and registered as the baffle service, so that the code writing workload of the traditional baffle service is reduced, and the testing cost is reduced. The baffle service is used for forwarding the dependent service response data, so that the test logic in the tested object can be focused and the test flow can be completed rapidly, and the test efficiency is improved.

Description

Test method and device, electronic equipment and computer readable storage medium
Technical Field
The present application relates to the field of quality testing, and in particular, to a testing method and apparatus, an electronic device, and a computer readable storage medium.
Background
The barrier (mock) test refers to a method of using a virtual object to provide a service for performing a test for some objects that are not easily constructed or easily obtained during the test. For example, in the process of developing a single application test, functional coverage is generally required to be performed by designing test cases of different scenes according to the parameters of an application interface; for the situation that the application calls the external service through the interface, a baffle test mode can be adopted, and data returned by the called service is simulated through the baffle service, so that the tested object can be separated from the actual application environment to independently carry out the test.
However, the existing baffle service needs to be configured independently for a specific tested object, and is not easy to expand. For example, when the interface of the test object changes or an interface is newly added, it is often necessary to manually reconstruct the response data, and it is difficult to multiplex the test cases written before. Particularly, for the situations of more dependence and more complex system overall, a large number of baffle service codes need to be written, so that the working efficiency of testers is low, and the actual working requirements cannot be met.
Disclosure of Invention
The embodiment of the application provides a testing method, a testing device and electronic equipment, which are used for reducing testing cost and improving testing efficiency.
The embodiment of the application adopts the following technical scheme:
in a first aspect, an embodiment of the present application provides a testing method applied to a baffle service system, where the method includes:
registering baffle service according to the baffle service configuration information, wherein the baffle service is used for simulating the dependent service of the tested object;
receiving test data sent by the tested object through a target baffle service, wherein the target baffle service is determined by the tested object in registered baffle services;
generating dependent service response data according to the test data;
and returning the dependent service response data to the tested object through the target baffle service so that the tested object completes a test flow according to the dependent service response data.
Optionally, registering the baffle service according to the baffle service configuration information includes:
acquiring the baffle service configuration information;
and registering the baffle service in a service configuration table of a baffle service registration center according to the baffle service configuration information.
Optionally, the obtaining the baffle service configuration information includes:
acquiring a configuration file of the tested object;
obtaining the dependent service configuration information of the tested object by analyzing the configuration file of the tested object;
and generating the baffle service configuration information according to the dependent service configuration information.
Optionally, the obtaining the baffle service configuration information includes:
providing a first configuration page;
and acquiring baffle service configuration information input by a user through the first configuration page.
Optionally, the test data includes service request data and dependent service response data, and the generating the dependent service response data according to the test data includes:
extracting the dependent service response data from the test data.
Optionally, the test data only includes service request data, and generating the dependent service response data according to the test data includes:
calling a dependent service response data table of the baffle service registry;
and matching the dependent service response data in the dependent service response data table according to the keyword information carried in the service request data.
Optionally, the service-dependent response data table is obtained by:
Providing a second configuration page;
and acquiring the dependent service response data input by the user through the second configuration page, and storing the dependent service response data into a dependent service response data table of the baffle service registry.
In a second aspect, an embodiment of the present application provides a testing apparatus applied to a baffle service system, where the apparatus includes:
the registration unit is used for registering baffle service according to the baffle service configuration information, and the baffle service is used for simulating the dependent service of the tested object;
the receiving unit is used for receiving the test data sent by the tested object through a target baffle service, wherein the target baffle service is determined by the tested object in the registered baffle service;
a generating unit for generating dependent service response data according to the test data;
and the return unit is used for returning the dependent service response data to the tested object through the target baffle service so that the tested object completes a test flow according to the dependent service response data.
In a third aspect, an embodiment of the present application provides an electronic device, including:
a processor; and
a memory arranged to store computer executable instructions which, when executed, cause the processor to perform any of the methods described hereinbefore.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium storing one or more programs, which when executed by an electronic device comprising a plurality of application programs, cause the electronic device to perform any of the methods described above.
The above at least one technical scheme adopted by the embodiment of the application can achieve the following beneficial effects: the test method of the embodiment of the application is applied to a baffle service system, firstly, the baffle service is registered according to the baffle service configuration information, and the baffle service is used for simulating the dependent service of the tested object; then receiving test data sent by a tested object through a target baffle service, wherein the target baffle service is determined by the tested object in registered baffle services; then generating dependent service response data according to the test data; and finally, returning the dependent service response data to the tested object through the target baffle service so that the tested object completes the test flow according to the dependent service response data. According to the test method provided by the embodiment of the application, the dependent services of different tested objects are simulated and registered as the baffle service with the universal gateway function, the interface details of the tested objects do not need to be concerned, the code writing workload of the traditional baffle service is greatly reduced, and the test cost is reduced. In addition, the baffle service is used for forwarding the dependent service response data, so that the tested object can concentrate on the test logic in the tested object and quickly complete the test flow, and the test efficiency is improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
fig. 1 is a schematic diagram of an overall architecture of a service system according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an overall architecture of a baffle service system according to an embodiment of the present application;
FIG. 3 is a flow chart of a testing method according to an embodiment of the application;
FIG. 4 is a schematic diagram of a baffle service registration process according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a testing device according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be clearly and completely described below with reference to specific embodiments of the present application and corresponding drawings. It will be apparent that the described embodiments are only some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The following describes in detail the technical solutions provided by the embodiments of the present application with reference to the accompanying drawings.
In order to facilitate understanding of the embodiments of the present application, an application scenario of the present application is described herein. As shown in fig. 1, an overall architecture schematic of a service system in an embodiment of the present application is provided. Fig. 1 illustrates a business system, which is internally composed of a plurality of parts, and the parts have a dependency relationship. A specific example of a business process is as follows: the external institution 107 issues a transaction request to the institution pre-unit 102, and the institution pre-unit 102 forwards the transaction request to the service processing unit 101 according to the type and parameters of the transaction request, and the transaction request is processed by one or more service processing modules of the service processing unit 101. When the business processing module processes the transaction request, other dependent services need to be called, for example, the account pre-unit 103 sends a service request to the external system dependency 106 to call services or data of systems such as banks, funds and/or national libraries; for another example, sending a service request to other system dependencies 104 inside, invoking a service or data of a system such as a transaction system, a reconciliation system, a payment system, a clearing system, and/or an error handling system; as another example, a service request may be sent to other component dependencies 105 invoking a service or data of a component such as a configuration management component, a task scheduling component, a data management component, a transport services component, and/or a database component. It can be seen that there are more complex dependencies between the service processing modules of the service processing unit 101 and other systems and/or components.
When testing any one of the service processing modules of the service processing unit 101, in order to ensure the safety and stability of the whole service system running online, the tested object generally does not directly send a service request to other systems/components running online, but adopts a single application testing method in the testing system, and the response data of the called service is simulated through the baffle service, so that the tested object can be separated from the actual service system to independently perform the test.
Obviously, the existing test method has at least the following disadvantages: (1) An independent test environment is required to be established for a specific tested object, all external dependence service requests related to the independent test environment are required to be manually analyzed, test cases such as dependence service response programs, construction response data and the like are respectively written, and the workload is high. (2) The test program has poor expansibility, and for example, when the interface of the tested object changes or an interface is newly added, response data needs to be manually reconstructed, so that the test case written before is difficult to multiplex. (3) For the situations of more dependence and more complex whole system, a large number of baffle service codes need to be written one by one, so that the working efficiency of testers is low, the system development iteration speed is low, and the actual working requirements cannot be met.
Based on the above, the embodiment of the application provides a baffle service system, on one hand, the baffle service system of the embodiment of the application actively discovers, registers and manages the baffle service of the tested object based on the service discovery and registration functions provided by the Dubbo and other distributed service frameworks, thereby greatly reducing the code writing work of the traditional baffle service. On the other hand, the baffle service system of the embodiment of the application focuses on assembling response data by taking registered baffle service as a general gateway mode, so that the system can focus on constructing request data and response data, and finally can save a great deal of manpower and material resources and better assist in testing various business scenes.
Specifically, as shown in fig. 2, an overall architecture schematic of a baffle service system in an embodiment of the present application is provided. The baffle service system of the embodiment of the application specifically comprises the following parts: the system comprises a service scanning module, a service analysis module, a service treatment module, a baffle service configuration module and a baffle service response data module.
The service scanning module can actively discover the dependent service of the tested object in a scanning mode. For example, every fixed period, such as 1 hour, the configuration files of all the tested objects in the system are scanned, and the newly added or changed dependent services of the tested objects are found in time, so that corresponding baffle services are provided. Of course, a user autonomous configuration manner may be adopted, for example, depending services related to the tested object and corresponding baffle services are determined according to the configuration input by the user. The service analysis module is used for analyzing the dependent service of the tested object found by the service scanning module to obtain the dependent service for responding to the service request of the tested object. The service management module is used for simulating the dependent service of the tested object and registering the dependent service to the baffle service registration center. The baffle service configuration module is used for determining and maintaining baffle service configuration information, such as interface information of the baffle service, a processing mode of service requests and the like. The baffle service response data module is used for defining expected response result data according to the service request of the tested application and returning the expected response result data.
In addition, the baffle service system of the embodiment of the application further comprises a baffle service configuration database and a test database, wherein the baffle service configuration database is used for managing and maintaining the configuration information of the registered baffle service, and the test database is used for managing the test data.
Further, the embodiment of the present application further provides a testing method applied to the above-mentioned baffle service system, wherein, as shown in fig. 3, a flow schematic diagram of the testing method in the embodiment of the present application is provided, and the method at least includes steps S310 to S340 as follows:
in step S310, a baffle service is registered according to the baffle service configuration information, where the baffle service is used to simulate a dependent service of the tested object.
The test method of the embodiment of the application is applied to the baffle service system, when a single tested object is tested, the baffle service needs to be registered according to the baffle service configuration information, and the process of registering the baffle service can be regarded as a process of simulating the dependent service of the tested object.
The above-mentioned baffle service configuration information can be defined according to different service scenarios in advance, this process only needs to pay attention to the configuration information of the point, such as request data of the measured object and dependent service response data, etc., and does not need to pay attention to the interface details of the measured object, because the core of the baffle service is that an expected return result can be given to the measured object, and how to output or obtain the return result can be flexibly set according to actual requirements. Therefore, the mode of the baffle service registration replaces the traditional mode of coding the baffle service, the workload of coding can be greatly reduced, the testing flow is simplified, and the testing cost is reduced.
In step S320, test data sent by the tested object is received through a target baffle service, where the target baffle service is determined by the tested object in the registered baffle service.
Through the steps, a plurality of registered baffle services can be obtained, the baffle services can be uniformly managed and maintained in a baffle service registration center provided by a baffle service system, if a new dependent service is found, a new baffle service is correspondingly registered in the baffle service registration center, and if the registered baffle service is changed, the new baffle service is correspondingly changed in the baffle service registration center.
Each baffle service can be regarded as being abstracted based on the original dependent service of the tested object, namely, the baffle service and the dependent service of the tested object have a one-to-one correspondence, so that when the tested object sends test data, the tested object needs to determine which dependent service exists, and therefore, the target baffle service can be found out from a plurality of baffle services registered in the previous step, and then the test data is sent to the target baffle service. Test data herein may be understood as some basic data, such as service request data, necessary for testing the object under test.
For example, assuming that the object a to be tested has the dependent service B, if the barrier service B 'has been registered for the dependent service B in the foregoing step, then the test data of the object a to be tested may be received through the barrier service B' at this time.
And step S330, generating dependent service response data according to the test data.
After the target baffle service receives the test data, it needs to generate dependent service response data according to the test data, where the dependent service response data can be understood as an expected processing result that the dependent service should return to the tested object, the dependent service response data can be flexibly defined according to an actual service scene, and how to construct the dependent service response data is not an important point of the present application, as long as the dependent service response data can be obtained.
And step S340, returning the dependent service response data to the tested object through the target baffle service so that the tested object completes a test flow according to the dependent service response data.
After the target baffle service obtains the dependent service response data, the dependent service response data is directly returned to the tested object, so that the tested object obtains the expected processing result of the dependent service, the expected processing result of the dependent service can be processed to obtain the processing result of the tested object, and the processing result is compared with the final expected processing result of the tested object to obtain the test result of the tested object. By final expected processing results is generally meant that for a particular business testing scenario, it is expected that it is predictable in nature, and that this predicted result is used directly to verify that the application under test is expected. The final expected processing result can be obtained through a real system, wherein the real system refers to a set of reference systems, and the system can be a small-scale system of the latest online version, and whether the tested application accords with the expected application or not is verified through end-to-end.
Further by way of example, assume a business process is: the tested object A initiates a service request, the service request needs to be processed by the tested object A calling the dependent service B, a processing result B is obtained, then the dependent service B returns the processing result B to the tested object A, and the tested object A executes a subsequent test flow according to the processing result B. It can be seen that the key of the whole business flow is how to give the processing result of the dependent service to the tested object, so the application does not need to pay attention to how to generate the processing result of the dependent service, but extracts the response data of the dependent service to circulate in the test flow, thereby enabling the tested object to quickly obtain the desired processing result and quickly carry out the subsequent test flow, and greatly improving the test efficiency.
According to the test method provided by the embodiment of the application, the dependent services of different tested objects are simulated and registered as the baffle service with the universal gateway function, the interface details of the tested objects do not need to be concerned, the code writing workload of the traditional baffle service is greatly reduced, and the test cost is reduced. In addition, the baffle service is used for forwarding the dependent service response data, so that the tested object can concentrate on the test logic in the tested object and quickly complete the test flow, and the test efficiency is improved.
In one embodiment of the present application, the registering the barrier service according to the barrier service configuration information includes: acquiring the baffle service configuration information; and registering the baffle service in a service configuration table of a baffle service registration center according to the baffle service configuration information.
When the embodiment of the application registers the baffle service, the configuration information of the baffle service can be firstly obtained, and the configuration information of the baffle service mainly refers to information such as some configuration parameters of the baffle service, for example, the IP address, the port number, the processing mode of the request and the like of the baffle service. The acquisition mode of the baffle service configuration information can be flexibly set according to the actual service scene, for example, the baffle service configuration information can be automatically acquired from the configuration file of the tested object, and can be manually configured by a user.
After the configuration information of the baffle service is obtained, the baffle service can be registered in a baffle service registration center in the baffle service system, and particularly, the configuration information of all registered baffle services can be uniformly maintained and managed in a service configuration table (service registry) of the baffle service registration center.
The service registry may be a database containing services, instances of services and location information thereof, to which dependent service instances for the subject service request are registered at start-up and de-registered at shut-down. The object under test queries the service registry to find available service instances and requests related services through the generic gateway mode.
In one embodiment of the present application, the obtaining the baffle service configuration information includes: acquiring a configuration file of the tested object; obtaining the dependent service configuration information of the tested object by analyzing the configuration file of the tested object; and generating the baffle service configuration information according to the dependent service configuration information.
In an actual business scenario, one or more dependent services of a tested object may be provided, which may be determined by analyzing a configuration file of the tested object. Taking JAVA program as an example, in the process of program development, in order to avoid low development efficiency caused by recompilation of code for each modification of program parameters, some parameters are often not directly written in an executable program, but are stored in a configuration file, such as a properties file, and are usually located under an src file or in a package under the src file, and corresponding parameters are obtained in the program by reading parameter values in the configuration file. In general, for a tested object that is more externally dependent, the interface parameters are generally stored in a configuration file in consideration of the variability of an external service request interface of the tested object.
Based on this, when acquiring the configuration information of the baffle service, the embodiment of the application can acquire the configuration file of the tested object first, each tested object has its own consumer configuration file in the baffle service registry, and through scanning and analyzing the configuration file, some information related to the configuration parameters of the baffle service, such as the interface information of the tested object depending on the service, can be obtained, and extracted in a concise and abstract manner, so as to generate the configuration information of the baffle service, and store the configuration information in the service registry, thereby completing the registration of the baffle service.
For example, the configuration file of the tested object a records the dependent service B and the IP address of the dependent service B of the tested object a, so that the baffle service B 'corresponding to the dependent service B can be generated, and the IP address of the baffle service B' is consistent with the IP address of the dependent service B, so that the subsequent tested object can directly determine which baffle service to send the test data to through the IP address information recorded in the own consumer configuration file.
In one embodiment of the present application, the obtaining the baffle service configuration information includes: providing a first configuration page; and acquiring baffle service configuration information input by a user through the first configuration page.
As described above, when obtaining the configuration information of the baffle service, the embodiment of the present application may further provide a first configuration page in advance through the baffle service system, where the first configuration page is used to provide the configuration function of the configuration information of the baffle service to the user, that is, the user may input the relevant configuration information of the baffle service on the configuration page through a manual input manner, and register the configuration information in the service registry of the baffle service registry.
Under the actual application scene, the situation that the baffle service configuration information manually input by the user is inconsistent with the dependent service configuration information in the consumer configuration file of the tested object may occur, for example, the user changes the IP address of the dependent service B of the tested object A by manually inputting the baffle service B ' and generates the baffle service B ' accordingly, then the IP address of the newly generated baffle service B ' is different from the IP address of the baffle service generated based on the originally recorded dependent service configuration information in the consumer configuration file of the tested object, and if the tested object is to realize the forwarding of test data, the IP address of the dependent service recorded in the consumer configuration file of the tested object can be modified into the changed IP address, namely, the IP address in the consumer configuration file is ensured to be consistent with the IP address registered in the service registry.
In one embodiment of the present application, the test data includes service request data and dependent service response data, and the generating the dependent service response data according to the test data includes: extracting the dependent service response data from the test data.
The test data of the embodiment of the application can simultaneously contain the service request data and the dependent service response data, namely the constructed service request data and the dependent service response data can be sent to the tested object together, and the service request data can be regarded as specific service request data for actually testing the tested object and can comprise the requested interface information, the returned mode and the like. The dependent service response data refers to an expected processing result obtained after the dependent service of the tested object processes the service request data.
The test data in the two dimensions can be transmitted to the tested object together based on the Dubbo implicit parameter transmission function, after the tested object receives the test data, the tested object does not need to analyze the test data and the like, but directly transmits the test data to the corresponding target baffle service, and the target baffle service extracts the dependent service response data from the test data after receiving the test data and returns the dependent service response data to the tested object.
It should be noted here that the configuration of the test data can be flexibly set by a person skilled in the art according to the actual requirements. For example, test data can be obtained by using a test database set in the baffle service system, wherein the test data is preset in the test database, and the preset test data can be real transaction data which is transferred and stored, or can be preset data for simulating real business. According to the registered baffle service, the service request data and the dependent service response data can be directly determined in test data preset in a test database. Or the service request data and the dependent service response data can be directly generated according to the registered baffle service, for example, the service request of inquiring all transaction records of an account in a certain time period of a certain measured object can be automatically and randomly generated, and an expected return result of the service request after being processed by the dependent service can be generated. Alternatively, the data that is not preset in the test database and is not suitable for direct generation may be manually entered or imported by the user.
In one embodiment of the present application, the test data includes only service request data, and the generating dependent service response data according to the test data includes: calling a dependent service response data table of the baffle service registry; and matching the dependent service response data in the dependent service response data table according to the keyword information carried in the service request data.
The test data in the embodiment of the application may only contain the service request data, that is, the result-dependent response data is not transmitted with the service request data. In this case, the embodiment of the application also provides a dependent service response data table in the baffle service registration center in advance, so as to uniformly manage and maintain the dependent service response data under different service scenes.
Based on this, if the test data received by the target baffle service does not include the dependent service response data, the dependent service response data table may be called, and then the dependent service response data corresponding to the service request data is found in the dependent service response data table according to some key information carried in the service request data, such as the IP address of the request interface.
In one embodiment of the application, the dependent service response data table is obtained by: providing a second configuration page; and acquiring the dependent service response data input by the user through the second configuration page, and storing the dependent service response data into a dependent service response data table of the baffle service registry.
When the embodiment of the application establishes the dependent service response data table, a second configuration page can be provided first, the user can manually input the self-defined dependent service response data on the second configuration page, and finally the dependent service response data input by the user is stored in the dependent service response data table for unified maintenance.
Of course, as described above, instead of manually configuring by the user to obtain the dependent service response data, it may be determined from the test data provided in the test database, or directly generated from the registered baffle service, or the like, which are not listed herein.
In order to facilitate understanding of the foregoing embodiments, as shown in fig. 4, a schematic diagram of a baffle service registration procedure in an embodiment of the present application is provided. The transaction application under a certain service order system is taken as a tested object, firstly, the dependent service data of the transaction application can be obtained from two sources, one is obtained by analysis from a configuration file of the transaction application, and the other is obtained through a configuration page provided by the baffle service system of the embodiment of the application, and the generation of the configuration page can specifically comprise the definition of interface documents and message specifications.
Then, by the above-mentioned acquisition manner, it can be determined that the transaction application corresponds to three dependent services, namely, a marketing service for creating/pushing a marketing order, a transaction service for creating a payment order and pushing a marketing order, and a channel service for processing a transaction.
And finally, registering the relevant configuration information of the three dependent services into a baffle service registration center, thereby obtaining the corresponding baffle service. After the subsequent tested object receives the test data, the corresponding target baffle service can be found through the registered baffle to forward the test data.
The above-mentioned baffle service registration procedure extracts the key configuration information of the dependence service which needs to be simulated for each tested object in a concise and brief way and registers the key configuration information as the baffle service, and the key configuration information is uniformly managed in the baffle service registration center.
The embodiment of the application also provides a testing device 500, which is applied to a baffle service system, as shown in fig. 5, and provides a schematic structural diagram of the testing device in the embodiment of the application, where the testing device 500 at least includes: registration unit 510, receiving unit 520, generating unit 530, and returning unit 540, wherein:
a registration unit 510 for registering a barrier service for simulating a dependent service of a measured object according to the barrier service configuration information;
A receiving unit 520, configured to receive test data sent by the tested object through a target baffle service, where the target baffle service is determined by the tested object in a registered baffle service;
a generating unit 530 for generating dependent service response data according to the test data;
and a return unit 540, configured to return the dependent service response data to the tested object through the target baffle service, so that the tested object completes a test procedure according to the dependent service response data.
In one embodiment of the present application, the registration unit 510 is specifically configured to: acquiring the baffle service configuration information; and registering the baffle service in a service configuration table of a baffle service registration center according to the baffle service configuration information.
In one embodiment of the present application, the registration unit 510 is specifically configured to: acquiring a configuration file of the tested object; obtaining the dependent service configuration information of the tested object by analyzing the configuration file of the tested object; and generating the baffle service configuration information according to the dependent service configuration information.
In one embodiment of the present application, the registration unit 510 is specifically configured to: providing a first configuration page; and acquiring baffle service configuration information input by a user through the first configuration page.
In one embodiment of the present application, the generating unit 530 is specifically configured to: extracting the dependent service response data from the test data.
In one embodiment of the present application, the test data only includes service request data, and the generating unit 530 is specifically configured to: calling a dependent service response data table of the baffle service registry; and matching the dependent service response data in the dependent service response data table according to the keyword information carried in the service request data.
In one embodiment of the application, the dependent service response data table is obtained by: providing a second configuration page; and acquiring the dependent service response data input by the user through the second configuration page, and storing the dependent service response data into a dependent service response data table of the baffle service registry.
It can be understood that the above-mentioned testing device can implement each step of the testing method performed by the baffle service system provided in the foregoing embodiment, and the relevant explanation about the testing method is applicable to the testing device, which is not repeated herein.
Fig. 6 is a schematic structural view of an electronic device according to an embodiment of the present application. Referring to fig. 6, at the hardware level, the electronic device includes a processor, and optionally an internal bus, a network interface, and a memory. The Memory may include a Memory, such as a Random-Access Memory (RAM), and may further include a non-volatile Memory (non-volatile Memory), such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, network interface, and memory may be interconnected by an internal bus, which may be an ISA (Industry Standard Architecture ) bus, a PCI (Peripheral Component Interconnect, peripheral component interconnect standard) bus, or EISA (Extended Industry Standard Architecture ) bus, among others. The buses may be classified as address buses, data buses, control buses, etc. For ease of illustration, only one bi-directional arrow is shown in FIG. 6, but not only one bus or type of bus.
And the memory is used for storing programs. In particular, the program may include program code including computer-operating instructions. The memory may include memory and non-volatile storage and provide instructions and data to the processor.
The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs, and the testing device is formed on the logic level. The processor is used for executing the programs stored in the memory and is specifically used for executing the following operations:
registering baffle service according to the baffle service configuration information, wherein the baffle service is used for simulating the dependent service of the tested object;
Receiving test data sent by the tested object through a target baffle service, wherein the target baffle service is determined by the tested object in registered baffle services;
generating dependent service response data according to the test data;
and returning the dependent service response data to the tested object through the target baffle service so that the tested object completes a test flow according to the dependent service response data.
The method performed by the test apparatus disclosed in the embodiment of fig. 3 of the present application may be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or by instructions in the form of software. The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be embodied directly in the execution of a hardware decoding processor, or in the execution of a combination of hardware and software modules in a decoding processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in a memory, and the processor reads the information in the memory and, in combination with its hardware, performs the steps of the above method.
The electronic device may also execute the method executed by the testing device in fig. 3, and implement the function of the testing device in the embodiment shown in fig. 3, which is not described herein.
The embodiment of the present application also proposes a computer-readable storage medium storing one or more programs, the one or more programs including instructions, which when executed by an electronic device comprising a plurality of application programs, enable the electronic device to perform a method performed by the testing apparatus in the embodiment shown in fig. 3, and in particular to perform:
registering baffle service according to the baffle service configuration information, wherein the baffle service is used for simulating the dependent service of the tested object;
receiving test data sent by the tested object through a target baffle service, wherein the target baffle service is determined by the tested object in registered baffle services;
generating dependent service response data according to the test data;
and returning the dependent service response data to the tested object through the target baffle service so that the tested object completes a test flow according to the dependent service response data.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and variations of the present application will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the application are to be included in the scope of the claims of the present application.

Claims (10)

1. A test method applied to a baffle service system, wherein the method comprises:
registering baffle service according to the baffle service configuration information, wherein the baffle service is used for simulating the dependent service of the tested object;
receiving test data sent by the tested object through a target baffle service, wherein the target baffle service is determined by the tested object in registered baffle services;
generating dependent service response data according to the test data;
and returning the dependent service response data to the tested object through the target baffle service so that the tested object completes a test flow according to the dependent service response data.
2. The method of claim 1, wherein the registering the baffle service according to the baffle service configuration information comprises:
acquiring the baffle service configuration information;
and registering the baffle service in a service configuration table of a baffle service registration center according to the baffle service configuration information.
3. The method of claim 2, wherein the obtaining the baffle service configuration information comprises:
acquiring a configuration file of the tested object;
obtaining the dependent service configuration information of the tested object by analyzing the configuration file of the tested object;
And generating the baffle service configuration information according to the dependent service configuration information.
4. The method of claim 2, wherein the obtaining the baffle service configuration information comprises:
providing a first configuration page;
and acquiring baffle service configuration information input by a user through the first configuration page.
5. The method of claim 1, wherein the test data includes service request data and dependent service response data, and the generating the dependent service response data according to the test data includes:
extracting the dependent service response data from the test data.
6. The method of claim 1, wherein the test data includes only service request data, and the generating dependent service response data according to the test data includes:
calling a dependent service response data table of the baffle service registry;
and matching the dependent service response data in the dependent service response data table according to the keyword information carried in the service request data.
7. The method of claim 6, wherein the dependent service response data table is obtained by:
providing a second configuration page;
And acquiring the dependent service response data input by the user through the second configuration page, and storing the dependent service response data into a dependent service response data table of the baffle service registry.
8. A test apparatus for use in a baffle service system, wherein the apparatus comprises:
the registration unit is used for registering baffle service according to the baffle service configuration information, and the baffle service is used for simulating the dependent service of the tested object;
the receiving unit is used for receiving the test data sent by the tested object through a target baffle service, wherein the target baffle service is determined by the tested object in the registered baffle service;
a generating unit for generating dependent service response data according to the test data;
and the return unit is used for returning the dependent service response data to the tested object through the target baffle service so that the tested object completes a test flow according to the dependent service response data.
9. An electronic device, comprising:
a processor; and
a memory arranged to store computer executable instructions which, when executed, cause the processor to perform the method of any of claims 1 to 7.
10. A computer readable storage medium storing one or more programs, which when executed by an electronic device comprising a plurality of application programs, cause the electronic device to perform the method of any of claims 1-7.
CN202210215769.XA 2022-03-07 2022-03-07 Test method and device, electronic equipment and computer readable storage medium Pending CN116775441A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210215769.XA CN116775441A (en) 2022-03-07 2022-03-07 Test method and device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210215769.XA CN116775441A (en) 2022-03-07 2022-03-07 Test method and device, electronic equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN116775441A true CN116775441A (en) 2023-09-19

Family

ID=87990036

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210215769.XA Pending CN116775441A (en) 2022-03-07 2022-03-07 Test method and device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN116775441A (en)

Similar Documents

Publication Publication Date Title
CN108346028B (en) Business approval processing method, device and system
CN107122296B (en) Method and apparatus for data assertion for test interface
WO2019072110A1 (en) Method for generating application program, apparatus, system, device, and medium
CN110704037B (en) Rule engine implementation method and device
CN106648556B (en) Method and device for front-end and back-end integrated development test
CN110780870A (en) Service execution method, device, equipment and storage medium
CN111597120B (en) Interface test apparatus, method, electronic device, and computer-readable storage medium
CN111597058B (en) Data stream processing method and system
CN113495797A (en) Message queue and consumer dynamic creation method and system
CN111124480B (en) Method and device for generating application program package, electronic equipment and storage medium
CN114398293A (en) Interface test case generation method, electronic device and storage medium
CN110309669B (en) Data labeling method, device and equipment
CN104252413A (en) Automatic script generation method, device and system
CN111240987B (en) Method and device for detecting migration program, electronic equipment and computer readable storage medium
CN109542775B (en) Test script generation and execution method and device
CN110958278B (en) API gateway-based data processing method and system and API gateway
CN116300833A (en) Internet of vehicles simulation test method and device, electronic equipment and storage medium
CN116775441A (en) Test method and device, electronic equipment and computer readable storage medium
CN111443920B (en) Frame migration method and device
CN106548331B (en) Method and device for determining release sequence
CN114327941A (en) Service providing method and device
CN113419952A (en) Cloud service management scene testing device and method
CN113807969A (en) Parallel verification method for service system and related equipment
CN113377652A (en) Test data generation method and device
CN114629807A (en) Work order processing method, device and equipment

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