CN112463634A - Software testing method and device under micro-service architecture - Google Patents

Software testing method and device under micro-service architecture Download PDF

Info

Publication number
CN112463634A
CN112463634A CN202011449518.5A CN202011449518A CN112463634A CN 112463634 A CN112463634 A CN 112463634A CN 202011449518 A CN202011449518 A CN 202011449518A CN 112463634 A CN112463634 A CN 112463634A
Authority
CN
China
Prior art keywords
service
micro
test
unit
under
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.)
Granted
Application number
CN202011449518.5A
Other languages
Chinese (zh)
Other versions
CN112463634B (en
Inventor
不公告发明人
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
National Clearing Center People's Bank Of China
Original Assignee
National Clearing Center People's Bank Of China
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 National Clearing Center People's Bank Of China filed Critical National Clearing Center People's Bank Of China
Priority to CN202011449518.5A priority Critical patent/CN112463634B/en
Publication of CN112463634A publication Critical patent/CN112463634A/en
Application granted granted Critical
Publication of CN112463634B publication Critical patent/CN112463634B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • 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 embodiment of the application provides a software testing method and a device under a micro-service architecture, wherein the method comprises the following steps: acquiring a dependency calling relationship among micro services under a preset micro service architecture to obtain a calling relationship configuration file among the services; determining the basic test code of each micro service according to the calling relation configuration file among the services; receiving a target micro-service test case sent by a user, and executing micro-service test operation according to the target micro-service test case and the basic test code corresponding to the target micro-service to obtain a micro-service test result; the method and the device can automatically, conveniently and accurately complete software testing work under the micro-service architecture.

Description

Software testing method and device under micro-service architecture
Technical Field
The application relates to the field of software testing, in particular to a software testing method and device under a micro-service architecture.
Background
The micro-service is a framework and an organization method for developing software, and consists of small services which run independently, communication is carried out between the services through a defined interface, and the services can be updated, deployed and expanded independently so as to meet the requirements on specific functions of an application program.
The inventor finds that after the conventional application system is split into a plurality of individual micro services, the unit test program of a single micro service may depend on a plurality of micro services, thereby causing the problem that the local writing and running are not easy.
Disclosure of Invention
Aiming at the problems in the prior art, the application provides a software testing method and device under a micro-service architecture, which can automatically, conveniently and accurately complete software testing work under the micro-service architecture.
In order to solve at least one of the above problems, the present application provides the following technical solutions:
in a first aspect, the present application provides a software testing method under a micro service architecture, including:
acquiring a dependency calling relationship among micro services under a preset micro service architecture to obtain a calling relationship configuration file among the services;
determining the basic test code of each micro service according to the calling relation configuration file among the services;
and receiving a target micro-service test case sent by a user, and executing micro-service test operation according to the target micro-service test case and the basic test code corresponding to the target micro-service to obtain a micro-service test result.
Further, the obtaining of the dependent call relationship between the micro services under the preset micro service architecture to obtain the inter-service call relationship configuration file includes:
acquiring service class files under each micro-service source code directory under a preset micro-service architecture;
and determining the dependence calling relationship among the micro services according to the service class file and writing the dependence calling relationship into a preset calling relationship configuration file among the services.
Further, the determining the basic test code of each micro service according to the inter-service call relationship configuration file includes:
determining the dependent call information of each service method under each service class in each micro service according to the dependent call relation in the call relation configuration file between services;
and generating a basic test code according to the dependent call information.
Further, the receiving a target micro-service test case sent by a user, and executing a micro-service test operation according to the target micro-service test case and the basic test code corresponding to the target micro-service to obtain a micro-service test result includes:
receiving a unit test case sent by a user, introducing a basic test code corresponding to the unit test case, generating a test unit and executing the test unit;
and monitoring whether variable values and branch circulation in the execution process of the test unit are abnormal, if not, judging that the micro-service test is passed, otherwise, judging that the micro-service test is not passed.
In a second aspect, the present application provides a software testing apparatus under a micro service architecture, including:
the configuration file determining module is used for acquiring a dependent calling relationship between micro services under a preset micro service architecture to obtain a calling relationship configuration file between the services;
a basic test code determining module, configured to determine a basic test code of each microservice according to the inter-service call relationship configuration file;
and the micro-service test operation module is used for receiving a target micro-service test case sent by a user, and executing micro-service test operation according to the target micro-service test case and the basic test code corresponding to the target micro-service to obtain a micro-service test result.
Further, the profile determination module comprises:
the system comprises a service file acquisition unit, a service file storage unit and a service file processing unit, wherein the service file acquisition unit is used for acquiring service files under various micro-service source code directories under a preset micro-service architecture;
and the dependent call relation determining unit is used for determining the dependent call relation among the micro services according to the service class file and writing the dependent call relation into a preset inter-service call relation configuration file.
Further, the base test code determination module includes:
the dependent call information determining unit is used for determining the dependent call information of each service method under each service class in each micro service according to the dependent call relation in the call relation configuration file between the services;
and the basic test code generating unit is used for generating a basic test code according to the dependent call information.
Further, the microservice test operation module comprises:
the test unit execution unit is used for receiving a unit test case sent by a user, introducing a basic test code corresponding to the unit test case, generating a test unit and executing the test unit;
and the test unit monitoring unit is used for monitoring whether variable values and branch circulation in the execution process of the test unit are abnormal or not, if not, the micro-service test is judged to pass, and otherwise, the micro-service test is judged not to pass.
In a third aspect, the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the software testing method under the microservice architecture when executing the program.
In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the software testing method under the microservice architecture.
According to the technical scheme, by automatically acquiring the dependency calling relationship among the micro services under the preset micro service architecture and generating the basic test codes corresponding to the micro services, development and test personnel do not need to spend effort on simulating other service calls, can concentrate on the service logic to be verified in the test codes, and meanwhile, the test iteration speed is improved, so that the software test process is simple and visual.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart illustrating a software testing method under a micro service architecture according to an embodiment of the present application;
FIG. 2 is a second flowchart illustrating a software testing method under the micro service architecture according to an embodiment of the present application;
FIG. 3 is a third schematic flowchart illustrating a software testing method under the micro service architecture according to an embodiment of the present application;
FIG. 4 is a fourth flowchart illustrating a software testing method under the micro service architecture in the embodiment of the present application;
FIG. 5 is a block diagram of a software testing apparatus under the micro service architecture according to an embodiment of the present application;
FIG. 6 is a second block diagram of a software testing apparatus under the micro service architecture according to an embodiment of the present application;
FIG. 7 is a third block diagram of a software testing apparatus under the micro service architecture according to an embodiment of the present application;
FIG. 8 is a fourth block diagram of a software testing apparatus under the micro service architecture in the embodiment of the present application;
FIG. 9 is a diagram illustrating a dependency call relationship between services in a micro service architecture according to an embodiment of the present application;
FIG. 10 is a diagram illustrating a process for generating an inter-service call relationship configuration file in an embodiment of the present application;
FIG. 11 is a diagram illustrating an exemplary implementation of a microservice test operation;
fig. 12 is a schematic structural diagram of an electronic device in an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all 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 application.
Considering that after a conventional application system is split into a plurality of micro services for each of its own functions, a unit test program of a single micro service may depend on the plurality of micro services, thereby causing the problem that the local writing and running are not easy, the application provides a software test method and device under a micro service architecture.
In order to automatically, conveniently and accurately complete software testing work under a micro-service architecture, the application provides an embodiment of a software testing method under the micro-service architecture, and referring to fig. 1, the software testing method under the micro-service architecture specifically includes the following contents:
step S101: and acquiring a dependent calling relationship between micro services under a preset micro service architecture to obtain a calling relationship configuration file between services.
It can be understood that, referring to fig. 9, the micro service architecture is characterized in that the number of micro services is large, and the function of one service interface needs to call a plurality of associated services, so that local writing and running are not easy, but the present application can obtain the dependent call relationship between the micro services under the preset micro service architecture, so as to prepare the code block or the code unit corresponding to the dependent call relationship before executing the specific software test work.
Alternatively, referring to fig. 10, the application may identify a Service class file (class declares java file annotated by @ Service as a microservice class file) by querying a specified microservice source code directory (which may contain one or more microservice codes), then read the Service class file to identify dependent microservices (declared by dependent services using @ RpcReference marks), and record dependent Service information (whose microservice names are microserviceName and schema id), and then continue reading the common methods of the Service class file, identify which methods of the dependent microservices are called by each method of the Service, record calling information of the dependent Service methods, write the recorded microservice dependent information into an inter-Service calling relation configuration file, and save to the specified directory for later use, thereby making development testers more focused on the business logic aspects in the test code that want to be verified, and the aim of automatically and accurately realizing the dependence on the calling relation when writing the test code program is achieved without spending effort on simulating other service calls.
Optionally, in some possible embodiments of the present application, the present application may obtain the test result by receiving a test case (EXCEL or other) provided by a user, extracting and forming a configuration file according to the case content, and combining the configuration file generated by the test case with the basic test code when running the test.
Specifically, the specific execution program for extracting the case content from the test case to form the configuration file includes:
Figure BDA0002831531570000051
step S102: and determining the basic test code of each micro service according to the calling relation configuration file among the services.
Optionally, the application may read in the inter-service call relationship configuration file, and traverse the inter-service call relationship configuration file, so as to obtain the dependency information of each service method under each specific service class under each micro service, and generate the basic test code of the service method according to the dependency information.
Alternatively, a specific service class for each microservice may generate a test class (i.e., base test code) that contains service-dependent reference declarations or other corresponding and necessary code.
Step S103: and receiving a target micro-service test case sent by a user, and executing micro-service test operation according to the target micro-service test case and the basic test code corresponding to the target micro-service to obtain a micro-service test result.
Optionally, the application may use jmoclit to simulate the behavior of the external system, so that the test program may run locally.
It can be understood that the jmoclit is a framework for JAVA unit testing using a mock method, and a mock test is a test method created for testing by using a virtual object for some objects that are not easily constructed or easily obtained during testing.
Optionally, referring to fig. 11, a user writes a unit test case code, adds a service logic verification that is desired to be made in the unit test case code, and then automatically introduces a corresponding basic test code to implement a dependent call relation required when the unit test case runs.
Optionally, when the unit test case is run, whether the running processing is normal or not may be determined by observing whether variable values and branch flows in the running process are normal or not.
Optionally, the unit case is run locally, the variable values and branch flows in the running process are observed, and whether the running processing is normal or not is confirmed.
As can be seen from the above description, the software testing method under the micro service architecture provided in the embodiment of the present application can automatically obtain the dependent call relationship between the micro services under the preset micro service architecture, and generate the basic test codes corresponding to the micro services, so that a developer and a tester do not need to spend effort on simulating other service calls, and can concentrate more on the service logic to be verified in the test codes, and meanwhile, the test iteration speed is also improved, so that the software testing process is simple and intuitive.
In order to automatically and accurately obtain the dependent call relationship between the micro services, in an embodiment of the software testing method under the micro service architecture of the present application, referring to fig. 2, the step S101 may further include the following steps:
step S201: and acquiring service class files under each micro-service source code directory under a preset micro-service architecture.
Step S202: and determining the dependence calling relationship among the micro services according to the service class file and writing the dependence calling relationship into a preset calling relationship configuration file among the services.
Optionally, the application may identify a Service class file (java file annotated by @ Service before class declaration is a microservice class file) by querying a specified microservice source code directory (which may contain one or more microservice codes), then read the Service class file to identify the dependent microservice (declared by using @ RpcReference mark for the dependent Service), record the dependent Service information (names microserviceName and schema id of the microserviceName), further continue reading the common method of the Service class file, identify which methods of the dependent microservice are called by each method of the Service, record the calling information of the dependent Service method, write the recorded microservicedependent information into an inter-Service calling relationship configuration file, and save to the specified directory for subsequent use, thereby enabling a development tester to focus more on the business logic aspect to be verified in the test code, and the aim of automatically and accurately realizing the dependence on the calling relation when writing the test code program is achieved without spending effort on simulating other service calls.
In order to prepare the required basic test code capable of implementing the dependent call function in advance before executing the software test according to the dependent call relationship between the micro services, in an embodiment of the software test method under the micro service architecture of the present application, referring to fig. 3, the step S102 may further include the following contents:
step S301: and determining the dependent call information of each service method under each service class in each micro service according to the dependent call relation in the call relation configuration file between services.
Step S302: and generating a basic test code according to the dependent call information.
Optionally, the application may read in the inter-service call relationship configuration file, traverse the inter-service call relationship configuration file, obtain the dependency information of each service method in each specific service class under each microservice, and generate the basic test code of the service method according to the dependency information.
In order to automatically and accurately refer to the dependency call relationship between the micro services and accurately execute the test work during the software test, in an embodiment of the software test method under the micro service architecture of the present application, referring to fig. 4, the step S103 may further specifically include the following steps:
step S401: receiving a unit test case sent by a user, introducing a basic test code corresponding to the unit test case, generating a test unit and executing the test unit.
Step S402: and monitoring whether variable values and branch circulation in the execution process of the test unit are abnormal, if not, judging that the micro-service test is passed, otherwise, judging that the micro-service test is not passed.
Optionally, the user writes the unit test case code, adds the service logic verification to be done in the unit test case code, and then automatically introduces the corresponding basic test code to realize the required dependent call relation when the unit test case runs.
Optionally, when the unit test case is run, whether the running processing is normal or not may be determined by observing whether variable values and branch flows in the running process are normal or not.
Optionally, the unit case is run locally, the variable values and branch flows in the running process are observed, and whether the running processing is normal or not is confirmed.
In order to automatically, conveniently and accurately complete software testing work under a micro-service architecture, the present application provides an embodiment of a software testing apparatus under a micro-service architecture for implementing all or part of contents of a software testing method under a micro-service architecture, and referring to fig. 5, the software testing apparatus under a micro-service architecture specifically includes the following contents:
the configuration file determining module 10 is configured to obtain a dependent call relationship between micro services under a preset micro service architecture, and obtain a configuration file of the call relationship between the services.
And a basic test code determining module 20, configured to determine the basic test code of each microservice according to the inter-service call relationship configuration file.
The micro-service test operation module 30 is configured to receive a target micro-service test case sent by a user, and execute a micro-service test operation according to the target micro-service test case and the basic test code corresponding to the target micro-service to obtain a micro-service test result.
As can be seen from the above description, the software testing apparatus under the micro service architecture provided in the embodiment of the present application can automatically obtain the dependent call relationship between the micro services under the preset micro service architecture, and generate the basic test codes corresponding to the micro services, so that a developer and a tester do not need to spend effort on simulating other service calls, and can concentrate more on the service logic to be verified in the test codes, and meanwhile, the test iteration speed is also improved, so that the software testing process is simple and intuitive.
In order to automatically and accurately obtain the dependent call relationship between the micro services, in an embodiment of the software testing apparatus under the micro service architecture of the present application, referring to fig. 6, the configuration file determining module 10 includes:
the service class file obtaining unit 11 is configured to obtain a service class file in each micro-service source code directory under a preset micro-service architecture.
And the dependent call relation determining unit 12 is configured to determine a dependent call relation between the micro services according to the service class file and write the dependent call relation into a preset inter-service call relation configuration file.
In order to prepare the required basic test code capable of implementing the dependent call function in advance before executing the software test according to the dependent call relationship between the micro services, in an embodiment of the software test apparatus under the micro service architecture of the present application, referring to fig. 7, the basic test code determining module 20 includes:
and a dependent call information determining unit 21, configured to determine, according to the dependent call relationship in the inter-service call relationship configuration file, the dependent call information of each service method in each service class in each microservice.
And a basic test code generating unit 22, configured to generate a basic test code according to the dependent call information.
In order to automatically and accurately refer to the dependency call relationship between the micro services and accurately execute the test task during the software test, in an embodiment of the software testing apparatus under the micro service architecture of the present application, referring to fig. 8, the micro service test operation module 30 includes:
the test unit executing unit 31 is configured to receive a unit test case sent by a user, introduce a basic test code corresponding to the unit test case, generate a test unit, and execute the test unit.
And the test unit monitoring unit 32 is configured to monitor whether variable values and branch flows in the execution process of the test unit are abnormal, if not, determine that the micro service test passes, and otherwise, determine that the micro service test does not pass.
To further explain the present solution, the present application further provides a specific application example of implementing a software testing method under a micro service architecture by using the software testing apparatus under the micro service architecture, which specifically includes: the system comprises an information acquisition module and a test code generation module.
The information acquisition module is specifically implemented as follows:
1. the program identifies the Service class file according to the specified micro-Service source code directory (which can contain one or more micro-Service codes) (the class declares that the java file annotated by @ Service is the micro-Service class file).
2. The program reads the service class file, identifies the dependent microservices (declared by the dependent service using the @ RpcReference flag), and records the dependent service information (its microserviceName and schema id).
3. The program continues to read the common methods of the service class file, identify which methods of the dependent microservice were called by each method of the service, and record the calling information of the dependent service methods (dependent service from the previous step).
4. The program writes the recorded micro-service dependence information into a configuration file and stores the configuration file into a specified directory;
an example of a profile fragment generated is as follows:
Figure BDA0002831531570000091
Figure BDA0002831531570000101
the test code generation module is specifically implemented as follows:
1. the program reads in a dependency configuration file.
2. The program traverses the configuration file, the dependency information of each service method under each specific service class under each micro-service.
3. And generating basic test codes of the service method by the program according to the information of the last step.
4. Generating a test class for a specific service class of each micro-service, wherein the test class comprises a reference statement of a dependent service and a dependent service method called by a test method of each common method;
an example of a test code fragment generated is as follows:
Figure BDA0002831531570000102
Figure BDA0002831531570000111
the specific working process is as follows:
1. and running an information acquisition module on a system storing all micro-service codes, wherein the module acquires all micro-service calls from the codes, and records and stores the calls in an automatically generated configuration file in a corresponding relationship mode.
2. The module can automatically generate a unit test code containing the information of the function called method, the called method initial parameter, the dependent simulation class of the calling method and the simulation return initial parameter.
As can be seen from the above, the present application can achieve at least the following technical effects:
1. a method and apparatus for automatically collecting dependent services used by a service method.
2. And automatically generating a dependency relationship recording file among services, wherein the dependency relationship recording file can be used by multiple people once.
3. And generating all or appointed basic test codes of the micro service for the user, so that the verification of the business function is more centralized, the verification is quick and accurate, and the manpower is saved.
In order to automatically, conveniently and accurately complete software testing under a micro-service architecture from a hardware level, the present application provides an embodiment of an electronic device for implementing all or part of contents in a software testing method under the micro-service architecture, where the electronic device specifically includes the following contents:
a processor (processor), a memory (memory), a communication Interface (Communications Interface), and a bus; the processor, the memory and the communication interface complete mutual communication through the bus; the communication interface is used for realizing information transmission between the software testing device under the micro-service architecture and relevant equipment such as a core service system, a user terminal, a relevant database and the like; the logic controller may be a desktop computer, a tablet computer, a mobile terminal, and the like, but the embodiment is not limited thereto. In this embodiment, the logic controller may be implemented with reference to the embodiment of the software testing method under the micro service architecture and the embodiment of the software testing apparatus under the micro service architecture in the embodiment, and the contents thereof are incorporated herein, and repeated details are not repeated.
It is understood that the user terminal may include a smart phone, a tablet electronic device, a network set-top box, a portable computer, a desktop computer, a Personal Digital Assistant (PDA), an in-vehicle device, a smart wearable device, and the like. Wherein, intelligence wearing equipment can include intelligent glasses, intelligent wrist-watch, intelligent bracelet etc..
In practical applications, part of the software testing method under the microservice architecture may be executed on the electronic device side as described above, or all operations may be completed in the client device. The selection may be specifically performed according to the processing capability of the client device, the limitation of the user usage scenario, and the like. This is not a limitation of the present application. The client device may further include a processor if all operations are performed in the client device.
The client device may have a communication module (i.e., a communication unit), and may be communicatively connected to a remote server to implement data transmission with the server. The server may include a server on the task scheduling center side, and in other implementation scenarios, the server may also include a server on an intermediate platform, for example, a server on a third-party server platform that is communicatively linked to the task scheduling center server. The server may include a single computer device, or may include a server cluster formed by a plurality of servers, or a server structure of a distributed apparatus.
Fig. 12 is a schematic block diagram of a system configuration of an electronic device 9600 according to an embodiment of the present application. As shown in fig. 12, the electronic device 9600 can include a central processor 9100 and a memory 9140; the memory 9140 is coupled to the central processor 9100. Notably, this fig. 12 is exemplary; other types of structures may also be used in addition to or in place of the structure to implement telecommunications or other functions.
In one embodiment, the software testing method function under the micro service architecture may be integrated into the central processor 9100. The central processor 9100 may be configured to control as follows:
step S101: and acquiring a dependent calling relationship between micro services under a preset micro service architecture to obtain a calling relationship configuration file between services.
Step S102: and determining the basic test code of each micro service according to the calling relation configuration file among the services.
Step S103: and receiving a target micro-service test case sent by a user, and executing micro-service test operation according to the target micro-service test case and the basic test code corresponding to the target micro-service to obtain a micro-service test result.
As can be seen from the above description, according to the electronic device provided in the embodiment of the present application, by automatically obtaining the dependency call relationship between the micro services under the preset micro service architecture and generating the basic test code corresponding to each micro service, development and test personnel do not need to spend effort in simulating other service calls, and can more concentrate on the service logic to be verified in the test code, and at the same time, the test iteration speed is also increased, so that the software test process is simple and intuitive.
In another embodiment, the software testing apparatus under the micro service architecture may be configured separately from the central processing unit 9100, for example, the software testing apparatus under the micro service architecture may be configured as a chip connected to the central processing unit 9100, and the function of the software testing method under the micro service architecture is realized by the control of the central processing unit.
As shown in fig. 12, the electronic device 9600 may further include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is noted that the electronic device 9600 also does not necessarily include all of the components shown in fig. 12; further, the electronic device 9600 may further include components not shown in fig. 12, which can be referred to in the related art.
As shown in fig. 12, a central processor 9100, sometimes referred to as a controller or operational control, can include a microprocessor or other processor device and/or logic device, which central processor 9100 receives input and controls the operation of the various components of the electronic device 9600.
The memory 9140 can be, for example, one or more of a buffer, a flash memory, a hard drive, a removable media, a volatile memory, a non-volatile memory, or other suitable device. The information relating to the failure may be stored, and a program for executing the information may be stored. And the central processing unit 9100 can execute the program stored in the memory 9140 to realize information storage or processing, or the like.
The input unit 9120 provides input to the central processor 9100. The input unit 9120 is, for example, a key or a touch input device. Power supply 9170 is used to provide power to electronic device 9600. The display 9160 is used for displaying display objects such as images and characters. The display may be, for example, an LCD display, but is not limited thereto.
The memory 9140 can be a solid state memory, e.g., Read Only Memory (ROM), Random Access Memory (RAM), a SIM card, or the like. There may also be a memory that holds information even when power is off, can be selectively erased, and is provided with more data, an example of which is sometimes called an EPROM or the like. The memory 9140 could also be some other type of device. Memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application/function storage portion 9142, the application/function storage portion 9142 being used for storing application programs and function programs or for executing a flow of operations of the electronic device 9600 by the central processor 9100.
The memory 9140 can also include a data store 9143, the data store 9143 being used to store data, such as contacts, digital data, pictures, sounds, and/or any other data used by an electronic device. The driver storage portion 9144 of the memory 9140 may include various drivers for the electronic device for communication functions and/or for performing other functions of the electronic device (e.g., messaging applications, contact book applications, etc.).
The communication module 9110 is a transmitter/receiver 9110 that transmits and receives signals via an antenna 9111. The communication module (transmitter/receiver) 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as in the case of a conventional mobile communication terminal.
Based on different communication technologies, a plurality of communication modules 9110, such as a cellular network module, a bluetooth module, and/or a wireless local area network module, may be provided in the same electronic device. The communication module (transmitter/receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide audio output via the speaker 9131 and receive audio input from the microphone 9132, thereby implementing ordinary telecommunications functions. The audio processor 9130 may include any suitable buffers, decoders, amplifiers and so forth. In addition, the audio processor 9130 is also coupled to the central processor 9100, thereby enabling recording locally through the microphone 9132 and enabling locally stored sounds to be played through the speaker 9131.
An embodiment of the present application further provides a computer-readable storage medium capable of implementing all steps in the software testing method under the micro service architecture of which the execution subject is the server or the client in the foregoing embodiments, 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 steps of the software testing method under the micro service architecture of which the execution subject is the server or the client in the foregoing embodiments, for example, when the processor executes the computer program, the processor implements the following steps:
step S101: and acquiring a dependent calling relationship between micro services under a preset micro service architecture to obtain a calling relationship configuration file between services.
Step S102: and determining the basic test code of each micro service according to the calling relation configuration file among the services.
Step S103: and receiving a target micro-service test case sent by a user, and executing micro-service test operation according to the target micro-service test case and the basic test code corresponding to the target micro-service to obtain a micro-service test result.
As can be seen from the above description, according to the computer-readable storage medium provided in the embodiment of the present application, by automatically obtaining the dependency call relationship between the micro services under the preset micro service architecture and generating the basic test code corresponding to each micro service, development and test personnel do not need to spend effort in simulating other service calls, and can focus on the service logic to be verified in the test code more, and meanwhile, the test iteration speed is also increased, so that the software test process is simple and intuitive.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention 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 (devices), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams 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.
The principle and the implementation mode of the invention are explained by applying specific embodiments in the invention, and the description of the embodiments is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A software testing method under a micro service architecture is characterized by comprising the following steps:
acquiring a dependency calling relationship among micro services under a preset micro service architecture to obtain a calling relationship configuration file among the services;
determining the basic test code of each micro service according to the calling relation configuration file among the services;
and receiving a target micro-service test case sent by a user, and executing micro-service test operation according to the target micro-service test case and the basic test code corresponding to the target micro-service to obtain a micro-service test result.
2. The method for testing software under the micro-service architecture according to claim 1, wherein the obtaining of the dependent call relationship between the micro-services under the preset micro-service architecture to obtain the configuration file of the call relationship between the services comprises:
acquiring service class files under each micro-service source code directory under a preset micro-service architecture;
and determining the dependence calling relationship among the micro services according to the service class file and writing the dependence calling relationship into a preset calling relationship configuration file among the services.
3. The method for testing software under the microservice architecture according to claim 1, wherein the determining the basic test code of each microservice according to the inter-service call relationship configuration file comprises:
determining the dependent call information of each service method under each service class in each micro service according to the dependent call relation in the call relation configuration file between services;
and generating a basic test code according to the dependent call information.
4. The method for testing software under the micro-service architecture according to claim 1, wherein the receiving a target micro-service test case sent by a user, and performing a micro-service test operation according to the target micro-service test case and the basic test code corresponding to the target micro-service to obtain a micro-service test result comprises:
receiving a unit test case sent by a user, introducing a basic test code corresponding to the unit test case, generating a test unit and executing the test unit;
and monitoring whether variable values and branch circulation in the execution process of the test unit are abnormal, if not, judging that the micro-service test is passed, otherwise, judging that the micro-service test is not passed.
5. A software testing device under a micro-service architecture is characterized by comprising:
the configuration file determining module is used for acquiring a dependent calling relationship between micro services under a preset micro service architecture to obtain a calling relationship configuration file between the services;
a basic test code determining module, configured to determine a basic test code of each microservice according to the inter-service call relationship configuration file;
and the micro-service test operation module is used for receiving a target micro-service test case sent by a user, and executing micro-service test operation according to the target micro-service test case and the basic test code corresponding to the target micro-service to obtain a micro-service test result.
6. The apparatus for testing software under micro service architecture according to claim 5, wherein the configuration file determining module comprises:
the system comprises a service file acquisition unit, a service file storage unit and a service file processing unit, wherein the service file acquisition unit is used for acquiring service files under various micro-service source code directories under a preset micro-service architecture;
and the dependent call relation determining unit is used for determining the dependent call relation among the micro services according to the service class file and writing the dependent call relation into a preset inter-service call relation configuration file.
7. The apparatus for testing software under micro service architecture according to claim 5, wherein the basic test code determining module comprises:
the dependent call information determining unit is used for determining the dependent call information of each service method under each service class in each micro service according to the dependent call relation in the call relation configuration file between the services;
and the basic test code generating unit is used for generating a basic test code according to the dependent call information.
8. The apparatus for testing software under micro service architecture according to claim 5, wherein the micro service test operation module comprises:
the test unit execution unit is used for receiving a unit test case sent by a user, introducing a basic test code corresponding to the unit test case, generating a test unit and executing the test unit;
and the test unit monitoring unit is used for monitoring whether variable values and branch circulation in the execution process of the test unit are abnormal or not, if not, the micro-service test is judged to pass, and otherwise, the micro-service test is judged not to pass.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the steps of the method for testing software under the microservice architecture of any of claims 1 to 4 are implemented when the program is executed by the processor.
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 method for testing software under a microservice architecture according to any one of claims 1 to 4.
CN202011449518.5A 2020-12-11 2020-12-11 Software testing method and device under micro-service architecture Active CN112463634B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011449518.5A CN112463634B (en) 2020-12-11 2020-12-11 Software testing method and device under micro-service architecture

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011449518.5A CN112463634B (en) 2020-12-11 2020-12-11 Software testing method and device under micro-service architecture

Publications (2)

Publication Number Publication Date
CN112463634A true CN112463634A (en) 2021-03-09
CN112463634B CN112463634B (en) 2024-03-29

Family

ID=74802059

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011449518.5A Active CN112463634B (en) 2020-12-11 2020-12-11 Software testing method and device under micro-service architecture

Country Status (1)

Country Link
CN (1) CN112463634B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112905486A (en) * 2021-03-26 2021-06-04 建信金融科技有限责任公司 Service integration test method, device and system
CN113285849A (en) * 2021-04-06 2021-08-20 武汉虹信科技发展有限责任公司 Equipment testing method and device based on microservice
CN114064475A (en) * 2021-11-11 2022-02-18 中国联合网络通信集团有限公司 Cloud native application testing method, device, equipment and storage medium
CN114826899A (en) * 2022-03-16 2022-07-29 青岛海尔科技有限公司 Debugging method and device of equipment control service, storage medium and electronic device
CN115242880A (en) * 2022-07-14 2022-10-25 湖南三湘银行股份有限公司 Micro-service framework access method based on network request bridging

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110096437A (en) * 2019-04-12 2019-08-06 平安普惠企业管理有限公司 The test method and Related product of micro services framework
CN110413673A (en) * 2019-07-08 2019-11-05 中国人民银行清算总中心 The unified acquisition of database data and distribution method and system
CN110659206A (en) * 2019-08-30 2020-01-07 平安普惠企业管理有限公司 Simulation architecture establishing method, device, medium and electronic equipment based on microservice
CN110990262A (en) * 2019-11-08 2020-04-10 安徽继远检验检测技术有限公司 Test method and tool integration based on micro-service architecture
CN111209210A (en) * 2020-01-15 2020-05-29 北京明略软件系统有限公司 Method and device for generating test case, electronic equipment and storage medium
CN111382055A (en) * 2018-12-29 2020-07-07 贝壳技术有限公司 Automatic unit testing method and device based on unified description language
CN111506505A (en) * 2020-04-13 2020-08-07 北京奇艺世纪科技有限公司 Test case obtaining method and device
CN111897738A (en) * 2020-08-21 2020-11-06 中国工商银行股份有限公司 Automatic testing method and device based on atomic service

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111382055A (en) * 2018-12-29 2020-07-07 贝壳技术有限公司 Automatic unit testing method and device based on unified description language
CN110096437A (en) * 2019-04-12 2019-08-06 平安普惠企业管理有限公司 The test method and Related product of micro services framework
CN110413673A (en) * 2019-07-08 2019-11-05 中国人民银行清算总中心 The unified acquisition of database data and distribution method and system
CN110659206A (en) * 2019-08-30 2020-01-07 平安普惠企业管理有限公司 Simulation architecture establishing method, device, medium and electronic equipment based on microservice
CN110990262A (en) * 2019-11-08 2020-04-10 安徽继远检验检测技术有限公司 Test method and tool integration based on micro-service architecture
CN111209210A (en) * 2020-01-15 2020-05-29 北京明略软件系统有限公司 Method and device for generating test case, electronic equipment and storage medium
CN111506505A (en) * 2020-04-13 2020-08-07 北京奇艺世纪科技有限公司 Test case obtaining method and device
CN111897738A (en) * 2020-08-21 2020-11-06 中国工商银行股份有限公司 Automatic testing method and device based on atomic service

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
PABLO LAMELA SEIJAS等: "Model Extraction and Test Generation from JUnit Test Suites", 《2016 IEEE/ACM 11TH INTERNATIONAL WORKSHOP IN AUTOMATION OF SOFTWARE TEST (AST)》, pages 8 - 14 *
孟凡玥: "基于微服务的客户服务平台的设计与实现", 《CNKI优秀硕士学位论文全文库 工程科技Ⅱ辑》, no. 01, pages 042 - 55 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112905486A (en) * 2021-03-26 2021-06-04 建信金融科技有限责任公司 Service integration test method, device and system
CN113285849A (en) * 2021-04-06 2021-08-20 武汉虹信科技发展有限责任公司 Equipment testing method and device based on microservice
CN114064475A (en) * 2021-11-11 2022-02-18 中国联合网络通信集团有限公司 Cloud native application testing method, device, equipment and storage medium
CN114826899A (en) * 2022-03-16 2022-07-29 青岛海尔科技有限公司 Debugging method and device of equipment control service, storage medium and electronic device
CN114826899B (en) * 2022-03-16 2024-01-23 青岛海尔科技有限公司 Debugging method and device for equipment control service, storage medium and electronic device
CN115242880A (en) * 2022-07-14 2022-10-25 湖南三湘银行股份有限公司 Micro-service framework access method based on network request bridging

Also Published As

Publication number Publication date
CN112463634B (en) 2024-03-29

Similar Documents

Publication Publication Date Title
CN112463634B (en) Software testing method and device under micro-service architecture
CN111506579B (en) Method, program and equipment for generating intelligent contract code
CN111897738B (en) Automatic testing method and device based on atomic service
CN112394932A (en) Automatic browser webpage skin changing method and device
CN112306857A (en) Method and apparatus for testing applications
CN114153856A (en) Host data double-writing method and device
CN113791984B (en) Automatic interface testing method and device
CN113515447B (en) Automatic testing method and device for system
CN116150029A (en) Automatic overdue batch testing method and device for loan system
CN113297076B (en) Service change identification method and device based on call chain diagram
CN114328215A (en) Test data deployment method, device, equipment, readable storage medium and product
CN112905464B (en) Application running environment data processing method and device
CN113050985A (en) Front-end engineering dependence automatic registration method and device
CN114637531A (en) Method and device for dynamically generating application program interface
CN112882921B (en) Fault simulation method and device
CN113434423A (en) Interface test method and device
CN112241372A (en) Terminal testing method and device and electronic equipment
CN112988603B (en) Big data test case generation method and device
CN108628750B (en) Test code processing method and device
CN113609017A (en) Interface test case generation method and device
CN114968794A (en) Knowledge graph-based application program automatic testing method and device
CN111158744B (en) Cross-platform heterogeneous data integration method and device
CN113419953A (en) Test data processing method, device and system
CN114880229A (en) Batch file testing method and device
CN115237808A (en) Software online test method, device and system

Legal Events

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