CN113434409A - Micro-service test method and device - Google Patents

Micro-service test method and device Download PDF

Info

Publication number
CN113434409A
CN113434409A CN202110712380.1A CN202110712380A CN113434409A CN 113434409 A CN113434409 A CN 113434409A CN 202110712380 A CN202110712380 A CN 202110712380A CN 113434409 A CN113434409 A CN 113434409A
Authority
CN
China
Prior art keywords
service
test
micro
data
testing
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
CN202110712380.1A
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202110712380.1A priority Critical patent/CN113434409A/en
Publication of CN113434409A publication Critical patent/CN113434409A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management

Landscapes

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

Abstract

The invention provides a micro-service testing method and device, belongs to the technical field of micro-services, and can be applied to the financial field or other fields. The micro-service test method comprises the following steps: acquiring test micro-service data and test micro-service calling relation data according to a micro-service name input by a user; generating test micro-service combination data according to the test micro-service data and the test micro-service calling relation data; and testing the test micro-service data, the test micro-service calling relation data and the test micro-service combination data in sequence to generate a test result. The invention reduces the error cascade effect to the maximum extent and improves the efficiency of the micro-service test.

Description

Micro-service test method and device
Technical Field
The invention relates to the technical field of micro-services, which can be applied to the financial field or other fields, in particular to a micro-service testing method and a device.
Background
With the demand of bank business development for flexibility of bank systems, quick response to business changes and the like becoming higher and higher, the bank systems have gradually transformed from single application to micro-service architecture. The micro-service architecture disassembles the functions in the single application mode into a series of micro-services, and provides an effective way for the bank to flexibly respond to the business requirements and rapidly deliver the services to a certain extent. However, the transformation brings the following difficulties for acceptance test:
(1) more nodes of the transaction link are changed, and the variable influencing the testing efficiency is increased. Under a micro-service architecture, a transaction function provided by an application in a single application mode may become dozens of or even hundreds of micro-services to be completed cooperatively, a failure of one micro-service may cause the whole transaction scene to be impossible, a whole acceptance test may become a process of checking the micro-service failures on a link one by one, and most of time is occupied by analyzing and checking the failures; meanwhile, the exception of one micro service may cascade and affect a large-area transaction scene exception, and the test efficiency is seriously affected.
(2) Interactive consistency verification is labor intensive. Hundreds of single applications are disassembled and then become the interaction among thousands of micro services, and the verification workload of the interaction consistency among the micro services is multiplied.
Under the traditional acceptance test method, a tester directly completes acceptance by executing a transaction function, and the method has the problems that the whole business process is not communicated due to a certain micro service under a micro service architecture, the problem positioning is long in time consumption, test data possibly needs to be prepared again, and the test efficiency is influenced.
Disclosure of Invention
The embodiment of the invention mainly aims to provide a method and a device for testing micro-services, which reduce the error cascade effect to the greatest extent and improve the efficiency of testing the micro-services.
In order to achieve the above object, an embodiment of the present invention provides a micro service testing method, including:
acquiring test micro-service data and test micro-service calling relation data according to a micro-service name input by a user;
generating test micro-service combination data according to the test micro-service data and the test micro-service calling relation data;
and testing the test micro-service data, the test micro-service calling relation data and the test micro-service combination data in sequence to generate a test result.
The embodiment of the invention also provides a micro-service testing device, which comprises:
the acquisition module is used for acquiring test micro-service data and test micro-service calling relation data according to the micro-service name input by the user;
the combination module is used for generating test micro-service combination data according to the test micro-service data and the test micro-service calling relation data;
and the test module is used for testing the test micro-service data, the test micro-service calling relation data and the test micro-service combination data in sequence to generate a test result.
The embodiment of the invention also provides computer equipment which comprises a memory, a processor and a computer program which is stored on the memory and runs on the processor, wherein the processor realizes the steps of the micro-service test method when executing the computer program.
The embodiment of the invention also provides a computer readable storage medium, on which a computer program is stored, and the computer program realizes the steps of the micro-service testing method when being executed by a processor.
The micro-service testing method and the device of the embodiment of the invention firstly generate the testing micro-service combination data according to the testing micro-service data and the testing micro-service calling relation data, and then sequentially test the testing micro-service data, the testing micro-service calling relation data and the testing micro-service combination data to generate the testing result, thereby reducing the error cascade effect to the maximum extent and improving the micro-service testing efficiency.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments will be briefly introduced 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 based on these drawings without creative efforts.
FIG. 1 is a flow chart of a method for microservice testing in an embodiment of the present invention;
FIG. 2 is a flow chart of a method for testing microservice in another embodiment of the present invention;
fig. 3 is a flowchart of S101 in the embodiment of the present invention;
fig. 4 is a flowchart of S103 in the embodiment of the present invention;
FIG. 5 is a flow chart illustrating testing of micro-service invocation relationship data in an embodiment of the present invention;
FIG. 6 is a flowchart of S302 in an embodiment of the present invention;
FIG. 7 is a block diagram of a microservice test apparatus in an embodiment of the present invention;
FIG. 8 is a block diagram of a microservice testing apparatus in another embodiment of the present invention;
fig. 9 is a block diagram of a computer device in the embodiment of the present invention.
Detailed Description
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 of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As will be appreciated by one skilled in the art, embodiments of the present invention may be embodied as a system, apparatus, device, method, or computer program product. Accordingly, the present disclosure may be embodied in the form of: entirely hardware, entirely software (including firmware, resident software, micro-code, etc.), or a combination of hardware and software.
Under the traditional testing method, the acceptance tester directly logs in the testing environment and executes the transaction according to the flow of the business scenario, for example, the No. 001 business scenario will sequentially call the following micro-service a1-a2-a3-a4-a5-a6-a7, if the a5 is abnormally functional due to the program or the testing environment or the contract conflict between the a6 and the a7, the whole business scenario will be caused to return the testing data which fails and may need to be prepared for invalidation. The acceptance tester needs to firstly define the call link of the service scene and then troubleshoot the log positioning problem service one by one, and the problem positioning analysis and the troubleshooting consume a large amount of time. After the 001 number service scene is confirmed to be verified, the invention automatically finishes the check of 7 micro services a1-a7, checks whether the contracts between two adjacent micro services of a1-a2-a3-a4-a5-a6-a7 are consistent or not based on the contract test method after a single micro service program or an environmental problem is checked, and executes the acceptance of the whole service scene after the contract test is passed.
The invention defines each test micro service data (including component micro service data and combined micro service data) as a point, and defines the interactive relation between micro services (test micro service call relation data) as an edge; a service scene (micro-service combination data) needing acceptance test is defined as a 'graph'; a "graph" can be viewed as an ordered combination of "points" and "edges". For example: in the banking financial field, the customer periodic transfer is the graph data, and under the micro service architecture, the customer periodic transfer is completed by a micro service (combined micro service data) a01 with an attribute of combined service. The customer periodic transfers are completed by a transaction acceptance registration (microservice Q1), media check (microservice Q2), periodic product check (microservice Q3), settlement account debit ((microservice Q4)), certificate opening (microservice Q5), and teller cash-out (microservice Q6). The micro-service a01 does not contain business process logic itself, but the micro-services of each business process are combined in order, with the attribute being a combined service. Q1-Q6 are micro services having a business processing function, and attributes are component services (component micro service data). The relationship between A01 and Q1-Q6 is a calling relationship, and the calling relationship is an edge. For example, there is another microservice W1, but there is no calling relationship with a01, there is no edge between the two. A01 and Q1-Q6 both belong to point data, but differ in attributes. The "point" data, "edge" data, and "graph" data may be obtained in two ways: (1) in the research and development stage, developers register test micro-service data, test micro-service calling relation data and service combinations; (2) and actively discovering the target through a distributed tracking system based on a span model. In the point-edge-graph test method provided by the invention, verification is completed by sequentially completing point, edge and graph.
The present invention will be described in detail below with reference to the accompanying drawings.
FIG. 1 is a flow chart of a method for micro-service testing in an embodiment of the invention. Fig. 2 is a flowchart of a method for testing micro-services in another embodiment of the present invention. As shown in fig. 1 and 2, the micro service test method includes:
s101: and acquiring test micro-service data and test micro-service calling relation data according to the micro-service name input by the user.
Wherein the test microservice data includes component microservice data and combined microservice data.
Before executing S101, the method further includes: through a distributed tracking system, the calling relation between the micro-service and the micro-service is actively discovered based on a span model, or the calling relation data between the micro-service and the micro-service of the whole bank system is collected based on service data manually registered by research personnel. Storing the micro service (including component micro service and combined micro service) and micro service calling relation data into a graph database, and storing micro service combined data defined as graph data and business scene corresponding relation data (scene mapping data) into a relational database. The combined services attribute micro service (combined micro service) is a business scene capable of realizing user value in a banking system, such as the micro service A01 in the foregoing, which is defined as a customer regular transfer, and the micro service can be associated with the business scene of regular transfer. The storage of the business scene corresponding relation data is to match the business scene data according to the test micro-service combination data at the later stage and output the business scene needing acceptance.
The test micro-service data comprises direct test micro-service data and indirect test micro-service data, and the test micro-service calling relation data comprises direct test micro-service calling relation data and indirect test micro-service calling relation data. Fig. 3 is a flowchart of S101 in the embodiment of the present invention. As shown in fig. 3, S101 includes:
s201: and acquiring micro-service data according to the micro-service name input by the user.
In specific implementation, the user01 logs in the system, inputs the modified microservice name a001 at this time, and accesses the graph database through the restful interface to obtain microservice data.
S202: and traversing the micro service data to obtain direct test micro service data and direct test micro service calling relation data.
For example, when other services related to the a1 service need to be queried, a subgraph starting from the a1 service can be obtained by graph traversal in the graph database by using the egonet algorithm with the a1 service as a starting point, and then direct test micro service data and direct test micro service call relation data are obtained.
S203: and expanding the direct test micro-service data to obtain indirect test micro-service data and indirect test micro-service call relation data.
For example, an x-degree expansion subgraph (including indirect test micro-service data and indirect test micro-service call relation data) taking the a1 service as a starting point can be obtained from the top point of the subgraph by using a K-layer expansion algorithm, and the summarized "point" data information of the x-degree expansion subgraph is all associated services (test micro-service data and test micro-service call relation data) of the a1 service.
Therefore, the test micro-service data and the test micro-service calling relation data are stored in the graph database, all services which directly or indirectly call the combined micro-service A1 can be directly inquired by using graph inquiry by using a K-layer expansion and an egonet algorithm, and a mode of repeated communication confirmation through a multi-user inquiry system under the traditional test method is replaced. The application of the graph database and the related algorithm is in fit with the micro-service architecture and the componentized research and development idea, and the mode of system and algorithm replaces the mode of manual reasoning and experience judgment, so that the accuracy and the speed of determining the acceptance range are greatly improved.
After executing S203, the method further includes: and converting the test micro-service data and the test micro-service calling relation data into json format data (association point edge data), outputting the json format data to a relational database and synchronously pushing the json format data to a driving unit of the engine module.
S102: and generating test micro-service combination data according to the test micro-service data and the test micro-service calling relation data.
S103: and testing the test micro-service data, the test micro-service calling relation data and the test micro-service combination data in sequence to generate a test result.
Before executing S103, the method further includes: the driving unit of the engine module sends the test micro-service data, the test micro-service call relation data and the test micro-service combined data to the input/output unit of the verification module, the input/output unit sends the test micro-service data (point data) to the point verification unit for testing, the test micro-service call relation data (side data, such as the call relation between the customer regular transfer combined service A01 and the component micro-service data Q1) is sent to the side verification unit for testing, and the test micro-service combined data (graph data) is sent to the graph verification unit for testing. S103, the influence of error cascade can be reduced to the maximum extent, and meanwhile, an automation technology is used to the maximum extent according to different test objects, so that the test efficiency is improved.
Fig. 4 is a flowchart of S103 in the embodiment of the present invention. As shown in fig. 4, S103 includes:
s301: and testing the test micro-service data, and testing the test micro-service calling relation data according to the test result of the test micro-service.
In specific implementation, the point verification unit completes the test of the test micro-service data in the modes of static code inspection, boundary value test and the like. If the test is not passed, directly returning a prompt message 'asking for debugging the test environment or submitting a program problem' to the user; and if the test is passed, returning point verification unit test pass information.
FIG. 5 is a flowchart illustrating testing micro-service invocation relationship data in an embodiment of the present invention. As shown in fig. 5, the testing the test microservice calling relationship data according to the test microservice test result includes:
s401: and when the test result of the test micro-service is that the test is passed, determining the relation matching data corresponding to the test micro-service calling relation data.
In specific implementation, the relationship matching data corresponding to the test micro service call relationship data (the "edge" data) can be matched from the contract library managed by the swagger framework.
S402: and generating simulation background data according to the matching data.
And the simulation background data is mock data.
S403: and testing the test micro-service calling relation data according to the simulation background data to generate a micro-service calling relation test result.
If the test is not passed, directly returning to a prompt message 'contract test is not passed, please submit the program question' of the user; and if the test is passed, returning the test passing information of the edge verification unit.
S302: and testing the micro-service combination data according to the micro-service calling relation test result to generate a micro-service combination test result.
Fig. 6 is a flowchart of S302 in the embodiment of the present invention. As shown in fig. 6, S302 includes:
s501: and when the micro-service calling relation test result is that the test is passed, performing smoking test on the component micro-service in the test micro-service combined data.
In one embodiment, performing a smoking test on a component microservice in test microservice composition data comprises:
determining a component micro-service test script corresponding to the component micro-service; and executing the component micro-service test script, matching the component micro-service test execution result with the corresponding expected return result, and generating a smoking test result.
In specific implementation, a smoke test execution script and an expected return result (micro-service test script) of each component service are stored in the system in advance. When the graph verification unit is started for testing, extracting the corresponding script from the script library to start execution, automatically matching the execution result with the expected return result, finishing the smoking test when the smoking test execution results of the component micro-service are all successfully matched, and confirming that the current acceptance range has no blocking type defects.
S502: and calling an execution script corresponding to the test micro-service combined data according to the smoking test result to execute the transaction, so as to obtain a transaction execution result.
After the smoking test is passed, the test micro-service combined data (namely 'graph data') and the corresponding automatic execution script are called to execute the transaction, and the log information in the transaction link tracking system is synchronously captured to obtain a transaction execution result.
S503: and generating a micro-service combination test result according to the transaction execution result and the matching result of the preset check point.
During specific implementation, the transaction execution result is matched with a preset check point in the micro-service key check point library to generate a micro-service combination test result. If the test is not passed, directly returning to a user prompt message that the transaction test is not passed and the program problem is submitted; and if the test is passed, returning the test passing information of the graph verification unit.
The execution subject of the micro service test method shown in fig. 1 may be a computer. As can be seen from the flow shown in fig. 1, in the embodiment of the present invention, the test microservice combination data is generated according to the test microservice data and the test microservice calling relationship data, and then the test microservice data, the test microservice calling relationship data, and the test microservice combination data are sequentially tested to generate the test result, so that the cascading effect of errors is reduced to the maximum extent, and the microservice testing efficiency is improved.
In one embodiment, after executing S103, the method further includes: and pushing the test result to the user.
In specific implementation, after receiving a system instruction, a log matching unit of the push module starts to execute log information and checkpoint data archiving, a message subscription unit of the push module inquires message subscription, and a result of the push module pushes a test result to a related user according to a message subscription condition.
In the aspect of confirming the acceptance test range, one microservice under the microservice architecture may be used by dozens or hundreds of business scenes, one business scene may be a call chain containing dozens or hundreds of microservices, and the complex interaction and frequent updating make the rapid and accurate identification of the test range a big problem. Under the traditional acceptance test method, all the micro-services A01-A20 (first-layer calling) calling the micro-service A1 need to be inquired according to system registration for modifying the micro-service A1, then the micro-services A001-A200 (second-layer calling) calling the micro-service A01-A20 are inquired respectively, and by analogy, a final calling chain and a service scene channel calling party are combed out, the range needing acceptance test is confirmed, and due to the fact that a bank service scene transaction link is long, the process needs manual registration and experience judgment of multiple persons, and communication confirmation is conducted repeatedly within hours or even days. Moreover, because the service scenes are more in branches, the range possibly influenced by the change of each micro service is wider, testers are difficult to comb all the service scenes, and the test is difficult to cover in full.
In an embodiment, as shown in fig. 2, the micro service testing method further includes: matching the test micro-service combination data with preset service scene mapping data to obtain an acceptance service scene; and pushing an acceptance service scene to the user, and defining an acceptance range.
The invention directly queries all services of the direct and indirect calling combined microservice A1 and matches the business scene and the graph data in the relational database. For example, by using test microservice combination data (such as B1 service and C1 service) as a screening condition, querying a business scenario associated with B1 service and C1 service in a microservice combination data and business scenario association table (business scenario mapping data) in a relational database, and obtaining a business scenario affected by modification of a1 service, thereby confirming an acceptance range, solving the problem that an acceptance test user is difficult to determine which scenarios should be accepted from a business perspective after a certain microservice modification, without repeated communication, the time consumed by system processing can be controlled at a second level, and based on a system algorithm rather than manual experience, the full coverage can be ensured.
To sum up, the micro service testing method of the embodiment of the invention has the following specific procedures:
1. and acquiring test micro-service data and test micro-service calling relation data according to the micro-service name input by the user.
2. And generating test micro-service combination data according to the test micro-service data and the test micro-service calling relation data.
3. And matching the test micro-service combination data with preset service scene mapping data to obtain an acceptance service scene.
4. And testing the test micro-service data, and determining the relation matching data corresponding to the test micro-service calling relation data when the test micro-service test result is that the test is passed.
5. And generating simulation background data according to the matching data.
6. And testing the test micro-service calling relation data according to the simulation background data to generate a micro-service calling relation test result.
7. And when the micro-service calling relation test result is that the test is passed, determining a component micro-service test script corresponding to the component micro-service in the test micro-service combination data.
8. And executing the component micro-service test script, matching the component micro-service test execution result with the corresponding expected return result, and generating a smoking test result.
9. And calling an execution script corresponding to the test micro-service combined data according to the smoking test result to execute the transaction, so as to obtain a transaction execution result.
10. And generating a micro-service combination test result according to the transaction execution result and the matching result of the preset check point.
11. And pushing the micro-service combination test result and the acceptance service scene to the user.
In summary, the micro-service testing method provided by the embodiment of the invention has the following beneficial effects:
(1) the test of the component micro-service data, the test micro-service calling relation data and the micro-service combination data is completed in sequence, so that the error cascade influence is reduced to the maximum extent, and the test cost is reduced;
(2) the test efficiency is improved by using automation and a new technology aiming at the characteristics of the test objects to the maximum extent by classifying the test objects;
(3) and a graph algorithm is introduced, so that feasibility is provided for accurately identifying the acceptance range in a complex interactive network.
Based on the same inventive concept, the embodiment of the invention also provides a micro-service testing device, and as the principle of solving the problems of the device is similar to the micro-service testing method, the implementation of the device can refer to the implementation of the method, and repeated parts are not described again.
FIG. 7 is a block diagram of a microservice testing apparatus in an embodiment of the invention. Fig. 8 is a block diagram of a microservice testing apparatus according to another embodiment of the present invention. As shown in fig. 7 to 8, the micro service test apparatus includes:
the acquisition module is used for acquiring test micro-service data and test micro-service calling relation data according to the micro-service name input by the user;
the combination module is used for generating test micro-service combination data according to the test micro-service data and the test micro-service calling relation data;
and the test module is used for testing the test micro-service data, the test micro-service calling relation data and the test micro-service combination data in sequence to generate a test result.
As shown in fig. 8, in practical applications, the micro service testing apparatus includes an identification module, an engine module, a verification module, and a push module.
The identification module comprises an acquisition module and a combination module and is used for respectively defining all micro services and micro service calling relations of the bank system as points and edges and storing the points and the edges into the graph database. In a componentized research and development mode, services are divided into composite services and component services, and the composite services have no functions and only call a plurality of component services to complete a business scene which is valuable to a client or a user. A "point" in the graph database contains a microservice having an attribute of service type and a value of composite service or component service. In addition, the service scenario and the service scenario correspondence data (scenario mapping data) are stored in the relational database. A user accesses the graph database through a restful interface, the input parameters are one or more micro-service names (such as current reconstruction micro-service), all related micro-service and calling relation data are inquired in the graph database through K-layer expansion and an egonet algorithm, and a query result in a json format is returned. And the acceptance range unit generates micro-service combination data according to the query result and inputs the micro-service combination data into the relational database to return a service scene, so that an acceptance test range is identified.
The starting unit of the engine module inputs the query result in the json format to the verification module. The engine module also contains a contract library.
The verification module comprises a test module and is used for finishing component point data verification, edge data verification and graph data verification in sequence aiming at the content pushed by the engine module. The input and output unit of the verification module classifies the query results, the test micro-service data is input into the point verification unit, the test micro-service call relation data is input into the edge verification unit, and the test micro-service combination data is input into the graph verification unit.
The point verification unit of the verification module completes verification of the test micro service, and the initial boundary value test is completed at this stage by statically checking and verifying the grammar, the structure, the process, the method, the array boundary, the character string boundary and the like of the test micro service through codes. And starting the verification of the edge verification unit after the point verification unit passes the verification.
And the side verification unit of the verification module manages the contract library by using the swagger interface framework based on the contract test method, matches side data with the contract library, automatically generates mock data, and verifies whether the micro service has the condition of connecting other micro services or not through the mock.
And the graph verification unit of the verification module adopts a smoking test method to complete smoking test on the component micro-service in the test micro-service combined data, so that the current acceptance range is ensured to have no blocking type defects. And then starting an automatic transaction initiating process, tracking the micro-service link, and matching data in the micro-service key check point library to complete verification. And after the verification is passed, entering a pushing module.
The push module is responsible for visualizing the final verification result. The log matching unit of the pushing module completes log execution and matching result filing, the message subscription unit of the pushing module inquires message subscription, and the result of the pushing module pushes the test result to related users according to the message subscription condition.
To sum up, the micro-service testing device of the embodiment of the invention generates the testing micro-service combination data according to the testing micro-service data and the testing micro-service calling relation data, and then tests the testing micro-service data, the testing micro-service calling relation data and the testing micro-service combination data in sequence to generate the testing result, thereby reducing the error cascade effect to the maximum extent and improving the micro-service testing efficiency.
The embodiment of the invention also provides a specific implementation mode of the computer equipment, which can realize all the steps in the micro-service testing method in the embodiment. Fig. 9 is a block diagram of a computer device in an embodiment of the present invention, and referring to fig. 9, the computer device specifically includes the following:
a processor (processor)901 and a memory (memory) 902.
The processor 901 is configured to call a computer program in the memory 902, and the processor implements all the steps in the micro service test method in the above embodiments when executing the computer program, for example, the processor implements the following steps when executing the computer program:
acquiring test micro-service data and test micro-service calling relation data according to a micro-service name input by a user;
generating test micro-service combination data according to the test micro-service data and the test micro-service calling relation data;
and testing the test micro-service data, the test micro-service calling relation data and the test micro-service combination data in sequence to generate a test result.
To sum up, the computer device of the embodiment of the present invention generates the test micro service combination data according to the test micro service data and the test micro service invocation relation data, and then sequentially tests the test micro service data, the test micro service invocation relation data and the test micro service combination data to generate the test result, thereby reducing the error cascade effect to the maximum extent and improving the micro service test efficiency.
An embodiment of the present invention further provides a computer-readable storage medium capable of implementing all the steps in the micro service testing method in the foregoing embodiment, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements all the steps in the micro service testing method in the foregoing embodiment, for example, when the processor executes the computer program, the processor implements the following steps:
acquiring test micro-service data and test micro-service calling relation data according to a micro-service name input by a user;
generating test micro-service combination data according to the test micro-service data and the test micro-service calling relation data;
and testing the test micro-service data, the test micro-service calling relation data and the test micro-service combination data in sequence to generate a test result.
To sum up, the computer-readable storage medium of the embodiment of the present invention generates the test microservice combination data according to the test microservice data and the test microservice calling relationship data, and then sequentially tests the test microservice data, the test microservice calling relationship data, and the test microservice combination data to generate the test result, thereby reducing the cascading effect of errors to the maximum extent and improving the microservice test efficiency.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.
Those of skill in the art will further appreciate that the various illustrative logical blocks, units, and steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate the interchangeability of hardware and software, various illustrative components, elements, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as hardware or software depends upon the particular application and design requirements of the overall system. 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 embodiments.
The various illustrative logical blocks, or elements, or devices described in connection with the embodiments disclosed herein may be implemented or performed with a general purpose processor, a digital signal processor, an Application Specific Integrated Circuit (ASIC), a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described herein. A general-purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a digital signal processor and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a digital signal processor core, or any other similar configuration.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may be stored in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. For example, a storage medium may be coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an ASIC, which may be located in a user terminal. In the alternative, the processor and the storage medium may reside in different components in a user terminal.
In one or more exemplary designs, the functions described above in connection with the embodiments of the invention may be implemented in hardware, software, firmware, or any combination of the three. If implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media that facilitate transfer of a computer program from one place to another. Storage media may be any available media that can be accessed by a general purpose or special purpose computer. For example, such computer-readable media can include, but is not limited to, RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to carry or store program code in the form of instructions or data structures and which can be read by a general-purpose or special-purpose computer, or a general-purpose or special-purpose processor. Additionally, any connection is properly termed a computer-readable medium, and, thus, is included if the software is transmitted from a website, server, or other remote source via a coaxial cable, fiber optic cable, twisted pair, Digital Subscriber Line (DSL), or wirelessly, e.g., infrared, radio, and microwave. Such discs (disk) and disks (disc) include compact disks, laser disks, optical disks, DVDs, floppy disks and blu-ray disks where disks usually reproduce data magnetically, while disks usually reproduce data optically with lasers. Combinations of the above may also be included in the computer-readable medium.

Claims (10)

1. A method for testing micro-services, comprising:
acquiring test micro-service data and test micro-service calling relation data according to a micro-service name input by a user;
generating test micro-service combination data according to the test micro-service data and the test micro-service calling relation data;
and sequentially testing the test micro-service data, the test micro-service calling relation data and the test micro-service combination data to generate a test result.
2. The method of claim 1, wherein the step of sequentially testing the test micro-service data, the test micro-service invocation relationship data, and the test micro-service combination data, and the step of generating a test result comprises:
testing the test micro-service data, and testing the test micro-service calling relation data according to a test micro-service test result;
and testing the test micro-service combination data according to the micro-service calling relation test result to generate a micro-service combination test result.
3. The method of claim 2, wherein testing the test microservice invocation relationship data according to the test microservice test result comprises:
when the test result of the test micro-service is that the test is passed, determining the relation matching data corresponding to the test micro-service calling relation data;
generating simulation background data according to the matching data;
and testing the test micro-service calling relation data according to the simulation background data to generate a micro-service calling relation test result.
4. The method of claim 2, wherein the testing the microservice composition data according to the microservice invocation relationship test result, and the generating of the microservice composition test result comprises:
when the micro-service calling relation test result is that the test is passed, performing smoking test on the component micro-service in the test micro-service combination data;
calling an execution script corresponding to the test micro-service combination data according to the smoking test result to execute the transaction, and obtaining a transaction execution result;
and generating a micro-service combination test result according to the transaction execution result and a matching result of a preset check point.
5. The method of claim 4, wherein performing a smoking test on the component microservices in the test microservice composition data comprises:
determining a component micro-service test script corresponding to the component micro-service;
and executing the component micro-service test script, matching the component micro-service test execution result with the corresponding expected return result, and generating a smoking test result.
6. The method of claim 1, wherein obtaining the test microservice data and the test microservice call relationship data according to a microservice name entered by a user comprises:
acquiring micro-service data according to a micro-service name input by a user;
performing graph traversal on the microservice data to obtain direct test microservice data and direct test microservice calling relation data;
and expanding the direct test micro-service data to obtain indirect test micro-service data and indirect test micro-service calling relation data.
7. The micro-service testing method of claim 1, further comprising:
matching the test micro-service combination data with preset service scene mapping data to obtain an acceptance service scene;
and pushing the acceptance service scene to the user.
8. A microservice testing apparatus, comprising:
the acquisition module is used for acquiring test micro-service data and test micro-service calling relation data according to the micro-service name input by the user;
the combination module is used for generating test micro-service combination data according to the test micro-service data and the test micro-service calling relation data;
and the test module is used for sequentially testing the test micro-service data, the test micro-service calling relation data and the test micro-service combination data to generate a test result.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and running on the processor, characterized in that the steps of the microservice testing method of any of claims 1 to 7 are implemented by the processor when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the microservice testing method of any one of claims 1 to 7.
CN202110712380.1A 2021-06-25 2021-06-25 Micro-service test method and device Pending CN113434409A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110712380.1A CN113434409A (en) 2021-06-25 2021-06-25 Micro-service test method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110712380.1A CN113434409A (en) 2021-06-25 2021-06-25 Micro-service test method and device

Publications (1)

Publication Number Publication Date
CN113434409A true CN113434409A (en) 2021-09-24

Family

ID=77754542

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110712380.1A Pending CN113434409A (en) 2021-06-25 2021-06-25 Micro-service test method and device

Country Status (1)

Country Link
CN (1) CN113434409A (en)

Similar Documents

Publication Publication Date Title
CN110309071B (en) Test code generation method and module, and test method and system
US9632906B2 (en) Automated software system validity testing
US10083027B2 (en) Systems and methods for managing software development environments
US8074204B2 (en) Test automation for business applications
US10341214B2 (en) Scenario coverage in test generation
Gulzar et al. Perception and practices of differential testing
US9558105B2 (en) Transactional boundaries for virtual model generation
US10296445B2 (en) Automated system documentation generation
CN110968437A (en) Method, device, equipment and medium for parallel execution of single contract based on Java intelligent contract
CN109815141A (en) A kind of test method and device
CN112559525B (en) Data checking system, method, device and server
CN111917729B (en) Dynamic injection test method and device and related equipment
CN113220597A (en) Test method, test device, electronic apparatus, and storage medium
CN113434409A (en) Micro-service test method and device
CN115658452A (en) Buried point checking method, buried point checking device, readable storage medium and electronic equipment
US20230007894A1 (en) Intelligent Dynamic Web Service Testing Apparatus in a Continuous Integration and Delivery Environment
CN115048359A (en) Universal data processing architecture design method for multi-type access data sources
US7516048B2 (en) Externalized metric calculation engine
CN114510497A (en) Variable processing method, device and equipment and readable storage medium
CN113553250A (en) Code testing method and device
CN113360365A (en) Flow testing method and flow testing system
Bicevskis et al. Data quality model-based testing of information systems
CN113050925B (en) Block chain intelligent contract repairing method and device
US11687441B2 (en) Intelligent dynamic web service testing apparatus in a continuous integration and delivery environment
Hamed et al. A Data warehouse Testing Strategy for Banks

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