CN115061928A - Micro-service automatic testing method and device, electronic equipment and storage medium - Google Patents

Micro-service automatic testing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115061928A
CN115061928A CN202210739728.0A CN202210739728A CN115061928A CN 115061928 A CN115061928 A CN 115061928A CN 202210739728 A CN202210739728 A CN 202210739728A CN 115061928 A CN115061928 A CN 115061928A
Authority
CN
China
Prior art keywords
micro
service
verification
test
database
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
CN202210739728.0A
Other languages
Chinese (zh)
Inventor
万光平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Life Insurance Company of China Ltd
Original Assignee
Ping An Life Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Life Insurance Company of China Ltd filed Critical Ping An Life Insurance Company of China Ltd
Priority to CN202210739728.0A priority Critical patent/CN115061928A/en
Publication of CN115061928A publication Critical patent/CN115061928A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/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

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 application relates to the field of system development, and provides a micro-service automatic testing method, a device, electronic equipment and a computer readable storage medium, wherein the method comprises the following steps: building a micro-service test architecture in a preset database system, wherein the micro-service test architecture comprises a plurality of micro-service test modules; acquiring a micro service to be tested; performing first analysis on the micro service to be tested to obtain corresponding database attribution information, and determining a verification database according to the database attribution information; acquiring micro-service verification information corresponding to each micro-service test module from a preset micro-service test table; executing the micro service to be tested based on the micro service verification information and the verification database to obtain verification difference data; and sorting the verification difference data to obtain a micro-service test result. By the technical scheme, the efficiency of the micro-service test can be improved.

Description

Micro-service automatic testing method and device, electronic equipment and storage medium
Technical Field
The embodiment of the application relates to but not limited to the field of system development, in particular to a method and a device for automatically testing micro-services, electronic equipment and a computer-readable storage medium.
Background
At present, in the process of system development, the technology of microservices is increasingly utilized; micro-services, also called micro-service architecture, is a software architecture mode, which constructs applications into a series of modular autonomous services divided according to business fields, and in the micro-service architecture, each service can realize a single business function; for larger projects, more micro services are set in the system, so that the workload of testing the micro services in the system is larger, and the efficiency of system development is influenced.
Disclosure of Invention
The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.
In order to solve the problems mentioned in the background art, embodiments of the present application provide a method and an apparatus for automatically testing a micro service, an electronic device, and a computer-readable storage medium, which can improve efficiency of testing a micro service.
In a first aspect, an embodiment of the present application provides a method for automatically testing a microservice, where the method includes:
the method comprises the steps that a micro-service test architecture is built in a preset database system, and the micro-service test architecture comprises a plurality of micro-service test modules;
acquiring a micro service to be tested;
performing first analysis on the micro service to be tested to obtain corresponding database attribution information, and determining a verification database according to the database attribution information;
acquiring micro-service verification information corresponding to each micro-service test module from a preset micro-service test table;
executing the micro service to be tested based on the micro service verification information and the verification database to obtain verification difference data;
and sorting the verification difference data to obtain a micro-service test result.
According to the micro-service automatic testing method provided by the embodiment of the application, at least the following beneficial effects are achieved: firstly, building a micro-service test architecture in a preset database system, wherein the micro-service test architecture comprises a plurality of micro-service test modules; then acquiring a micro service to be tested; then, performing first analysis on the micro service to be tested to obtain corresponding database attribution information, and determining a verification database according to the database attribution information; acquiring micro-service verification information corresponding to each micro-service test module from a preset micro-service test table; then, executing the micro service to be tested based on the micro service verification information and the verification database to obtain verification difference data; finally, the micro-service test result can be obtained by sorting the verification difference data; by the technical scheme, each micro-service test module is controlled and processed by the micro-service test meter, and the micro-service test result can be obtained by sorting and analyzing the verification difference data, so that the micro-service test process is simpler, more convenient and faster, and the micro-service test efficiency is improved.
According to some embodiments of the present application, the microservice verification information includes a microservice verification script and an on-off state, and the performing processing on the microservice to be tested based on the microservice verification information and the verification database to obtain verification difference data includes:
determining a target micro-service test module from a plurality of micro-service test modules according to the switch state;
calling the target micro-service testing module to test the micro-service to be tested to obtain first testing data;
calling the verification database to test the micro service to be tested to obtain second test data;
and comparing the first test data with the second test data to obtain the verification difference data.
According to some embodiments of the present application, the sorting the verification difference data to obtain a micro service test result includes:
storing the verification difference data to a preset verification difference table to obtain a verification difference result table;
and carrying out second analysis on the check difference result table to obtain the micro-service test result.
According to some embodiments of the present application, the invoking the target microservice testing module to test the microservice to be tested to obtain first test data includes:
and testing the micro service to be tested based on the micro service verification script corresponding to the target micro service testing module to obtain the first test data.
According to some embodiments of the present application, the performing a second analysis on the check difference result table to obtain the micro service test result includes:
performing third analysis processing on the verification difference result table to obtain verification difference attribution information;
and combining the verification difference attribution information with the corresponding verification difference data to obtain the micro-service test result.
According to some embodiments of the present application, the determining a target micro service test module from a plurality of micro service test modules according to the switch status being on or off comprises:
acquiring the on-off state of each micro-service test module;
and determining the micro-service test module with the switch state of on as the target micro-service test module.
According to some embodiments of the present application, after the collating the check difference data to obtain the micro service test result, the method further includes:
carrying out format conversion processing on the micro-service test result to obtain micro-service test text information;
and forwarding the micro-service test text information according to a preset network address.
In a second aspect, an embodiment of the present application further provides a micro service automation test apparatus, where the apparatus includes:
the system comprises a first processing module, a second processing module and a third processing module, wherein the first processing module is used for building a micro-service test architecture in a preset database system, and the micro-service test architecture comprises a plurality of micro-service test modules;
the second processing module is used for acquiring micro services to be tested;
the third processing module is used for performing first analysis on the micro service to be tested to obtain corresponding database attribution information and determining a verification database according to the database attribution information;
the fourth processing module is used for acquiring micro-service verification information corresponding to each micro-service testing module from a preset micro-service testing table;
the fifth processing module is used for executing the micro service to be tested based on the micro service verification information and the verification database to obtain verification difference data;
and the sixth processing module is used for sorting the verification difference data to obtain a micro-service test result.
In a third aspect, an embodiment of the present application further provides an electronic device, including: a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the microservice automated testing method as described above in the first aspect when executing the computer program.
In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium storing computer-executable instructions for executing the micro-service automation testing method according to the first aspect.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
The accompanying drawings are included to provide a further understanding of the claimed subject matter and are incorporated in and constitute a part of this specification, illustrate embodiments of the subject matter and together with the description serve to explain the principles of the subject matter and not to limit the subject matter.
Fig. 1 is a flowchart of a method for testing microservice automation provided by an embodiment of the present application;
fig. 2 is a flowchart of executing a micro service to be tested in the method for automatically testing a micro service according to an embodiment of the present application;
fig. 3 is a flowchart illustrating sorting of check difference data in the method for testing micro-service automation according to an embodiment of the present application;
fig. 4 is a flowchart of obtaining first test data in the method for testing microservice automation according to an embodiment of the present application;
fig. 5 is a flowchart illustrating analyzing a check difference result table in the method for testing micro service automation according to an embodiment of the present application;
fig. 6 is a flowchart of determining a target micro service test module in the micro service automation test method according to an embodiment of the present application;
FIG. 7 is a flowchart of a method for automatically testing microservice provided by another embodiment of the present application;
FIG. 8 is a schematic diagram of a microservice automated testing apparatus provided in accordance with one embodiment of the present application;
fig. 9 is a schematic diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
It should be noted that although functional block divisions are performed in apparatus diagrams and logical orders are illustrated in flowcharts, in some cases, steps shown or described may be performed in orders different from block divisions in apparatus diagrams or flowcharts. The terms first, second and the like in the description and in the claims, and the drawings described above, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
It is to be noted that, unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of the present application only and is not intended to be limiting of the application.
The application provides a micro-service automatic test method, a device, electronic equipment and a computer readable storage medium, firstly, a micro-service test architecture is built in a preset database system, wherein the micro-service test architecture comprises a plurality of micro-service test modules; then acquiring a micro service to be tested; then, performing first analysis on the micro service to be tested to obtain corresponding database attribution information, and determining a verification database according to the database attribution information; acquiring micro-service verification information corresponding to each micro-service test module from a preset micro-service test table; then, executing the micro service to be tested based on the micro service verification information and the verification database to obtain verification difference data; finally, the micro-service test result can be obtained by sorting the verification difference data; by the technical scheme, each micro-service test module is controlled and processed by the micro-service test meter, and the micro-service test result can be obtained by sorting and analyzing the verification difference data, so that the micro-service test process is simpler, more convenient and faster, and the micro-service test efficiency is improved.
The embodiment of the application provides an automatic micro-service testing method, and relates to the technical field of system development. The method for automatically testing the micro-service can be applied to a terminal, a server side and software running in the terminal or the server side. In some embodiments, the terminal may be a smartphone, tablet, laptop, desktop computer, or the like; the server side can be configured into an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, and cloud servers for providing basic cloud computing services such as cloud service, a cloud database, cloud computing, cloud functions, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN (content delivery network) and big data and artificial intelligence platforms; the software may be an application or the like that implements the microservice automated testing method, but is not limited to the above form.
The application is operational with numerous general purpose or special purpose computing system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like. The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
In each embodiment of the present application, when data related to the user identity or characteristic, such as user information, user behavior data, user history data, and user location information, is processed, permission or consent of the user is obtained, and the data collection, use, and processing comply with relevant laws and regulations and standards of relevant countries and regions. In addition, when the embodiment of the present application needs to acquire sensitive personal information of a user, individual permission or individual consent of the user is obtained through a pop-up window or a jump to a confirmation page, and after the individual permission or individual consent of the user is definitely obtained, necessary user-related data for enabling the embodiment of the present application to operate normally is acquired.
The embodiments of the present application will be further explained with reference to the drawings.
As shown in fig. 1, fig. 1 is a flowchart of a micro service automation test method provided in an embodiment of the present application, where the micro service automation test method includes, but is not limited to, steps S100 to S600.
Step S100, a micro-service test architecture is built in a preset database system, and the micro-service test architecture comprises a plurality of micro-service test modules;
step S200, acquiring a micro service to be tested;
step S300, carrying out first analysis on the micro service to be tested to obtain corresponding database attribution information, and determining a verification database according to the database attribution information;
step S400, acquiring micro-service verification information corresponding to each micro-service test module from a preset micro-service test table;
step S500, executing the micro service to be tested based on the micro service verification information and the verification database to obtain verification difference data;
and step S600, sorting the verification difference data to obtain a micro-service test result.
The method includes the steps that firstly, a micro-service test architecture is built in a preset database system, wherein the micro-service test architecture comprises a plurality of micro-service test modules; then acquiring a micro service to be tested; then, performing first analysis on the micro service to be tested to obtain corresponding database attribution information, and determining a verification database according to the database attribution information; acquiring micro-service verification information corresponding to each micro-service test module from a preset micro-service test table; then, executing the micro service to be tested based on the micro service verification information and the verification database to obtain verification difference data; finally, the micro-service test result can be obtained by sorting the verification difference data; according to the technical scheme, each micro-service test module is controlled and processed by the micro-service test meter, and the micro-service test result can be obtained by sorting and analyzing the verification difference data, so that the micro-service test process is simpler, more convenient and faster, and the micro-service test efficiency is improved.
It should be noted that the database system may include a relational database system and a non-relational database system; the database system is an ideal data processing system developed for adapting to the needs of data processing, is also a software system for providing data for a storage, maintenance and application system which can be actually operated, and is an aggregate of a storage medium, a processing object and a management system; database systems are typically comprised of software, databases, and data administrators. The software mainly comprises an operating system, various host languages, a utility program and a database management system. The database is uniformly managed by a database management system, and the insertion, modification and retrieval of data are all performed by the database management system. The data administrator is responsible for creating, monitoring and maintaining the entire database, enabling the efficient use of data by anyone with access rights. The database system is an ideal core mechanism for data processing, which is developed to meet the needs of data processing. The high speed processing power and mass storage of computers provide the conditions for implementing data management automation.
It should be noted that micro-service is an architecture model, and is a variant of a service-oriented architecture, and it is advocated to gradually restore and divide a single application into small services, and the services are coordinated and matched with each other, so as to provide final value for users. The microservice architecture style is a system in which small, autonomous services work together to form a loose coupling. In addition, it is necessary to avoid a uniform and centralized service management mechanism as much as possible, and for a specific service, a suitable language tool should be selected and constructed according to the context. The micro-service has the characteristics of concentration, autonomy, independent process, independent deployment and technology heterogeneity, namely, each service is only limited to specific services and is concentrated on doing one thing, each service bears a single responsibility, but the micro-service also needs to reach a certain scale to completely process specific domain services.
It should be noted that the micro service test architecture includes a plurality of micro service test modules, and the micro service test modules can perform test processing on the micro service to be tested, and can be used for testing the working condition of the micro service and detecting whether the micro service can work normally.
It can be understood that, the first analysis is performed on the micro service to be tested to obtain corresponding database attribution information, and the database attribution information is used for representing which database the micro service to be tested specifically has a calling relationship with; the design of the database is a key point of the design of the micro-services, and the basic principle is that each micro-service has a separate database and only the micro-service itself can access the database. Data sharing between the microservices can be realized by means of service calls or master and slave tables. When sharing data, a proper synchronization mode is to be found. In the microservice architecture, the database modification is widely effected and it is necessary to ensure that such modifications are backward compatible.
It can be understood that the micro service test table stores micro service check information corresponding to each micro service test module; the micro-service check information is used for controlling whether the corresponding micro-service test module tests the micro-service to be detected, so that the control process of the micro-service test is simpler, more convenient and faster, and the testing personnel can control the test process of the micro-service only by modifying the micro-service check information in the micro-service test table. Wherein, the micro service test table can be arranged in the database test system.
In some embodiments, as shown in fig. 2, the microservice checking information includes a microservice checking script and a switch status, and the step S500 may include, but is not limited to, the steps S510 to S540.
Step S510, determining a target micro-service test module from a plurality of micro-service test modules according to the switch state;
step S520, calling a target micro-service test module to test the micro-service to be tested to obtain first test data;
step S530, calling a verification database to test the micro service to be tested to obtain second test data;
step S540, comparing the first test data with the second test data to obtain verification difference data.
It should be noted that the microservice verification information includes a microservice verification script and an on-off state; in the process of testing the micro service to be tested, firstly, determining a target micro service test module from a plurality of micro service test modules according to the switch state; then, calling a target micro-service test module to test the micro-service to be tested to obtain first test data; then, calling a verification database to test the micro service to be tested to obtain second test data; and finally, comparing the first test data with the second test data to obtain verification difference data.
Notably, a target micro-service test module is determined from the plurality of micro-service test modules according to the switch state; for example, when the switch state is in the on state, the corresponding micro service test module is selected as the target micro service test module; the switch state is in the off state, and the corresponding micro service test module is not selected as the target micro service test module.
It is worth noting that first test data can be obtained by calling a target micro-service test module to test the micro-service to be tested; the target micro-service test module selected from the plurality of micro-service test modules tests the micro-service to be tested to obtain first test data.
It is worth noting that second test data can be obtained by calling the verification database to test the micro service to be tested; namely, the second test data can be obtained by calling the verification database in the process of testing the micro service to be tested. The verification database is a database which has a calling relation with the micro service to be tested, and second test data can be obtained by calling the verification database in the process of testing the micro service to be tested.
It can be appreciated that the verification difference data can be obtained by comparing the first test data with the second test data; and taking the second test data as reference data, comparing the first test data with the reference data, and taking data different from the reference data in the first test data as verification difference data.
It is understood that a script is an executable file written according to a certain format using a particular descriptive language; a scripting language, also called extension language, or dynamic language, is a programming language used to control software applications, and scripts are usually saved as text and are only interpreted or compiled when called; scripts are executable files written according to a certain format, also called macro or batch files, using a specific descriptive language. Scripts can typically be temporarily called and executed by an application. Various scripts are widely used in web page design at present, because the scripts can not only reduce the scale of the web page and improve the browsing speed of the web page, but also enrich the representation of the web page, such as animation, sound, etc.
In some embodiments, as shown in fig. 3, the step S600 may include, but is not limited to, the steps S610 to S620.
Step S610, storing the verification difference data to a preset verification difference table to obtain a verification difference result table;
and step S620, carrying out second analysis on the verification difference result table to obtain a micro-service test result.
It should be noted that, in the process of sorting the verification difference data, the verification difference result table can be obtained by storing the verification difference data in a preset verification difference table; and then, carrying out second analysis on the verification difference result table to obtain a micro-service test result.
It should be noted that the check difference table may be disposed in the database system for collecting and processing the check difference data; and subsequently, carrying out second analysis on the verification difference result table to obtain a micro-service test result. And storing the verification difference data into the verification difference table, so that the micro-service test result can be conveniently and quickly obtained by analyzing the verification difference result table subsequently.
In some embodiments, as shown in fig. 4, the step S520 may include, but is not limited to, the step S521.
Step S521, testing the micro service to be tested based on the micro service verification script corresponding to the target micro service testing module to obtain first test data.
It should be noted that each target micro-service test module corresponds to a micro-service verification script, and the first test data can be obtained by performing test processing on the micro-service to be tested based on the set micro-service verification script; the micro-service verification script can be a set execution program to be executed, and the first test data can be obtained by testing the micro-service to be tested according to the micro-service verification script.
It should be noted that the target micro-service test module is a micro-service test module selected from the plurality of micro-service test modules according to the on-off state; in the process of testing the micro service to be tested according to the micro service verification script, the data obtained in the testing process is the first test data, the first test data and the second test data are compared to obtain verification difference data, and the subsequent analysis of the verification difference data can obtain a micro service testing result, so that the testing process of the micro service is simpler, more convenient and faster.
In some embodiments, as shown in fig. 5, the step S620 may include, but is not limited to, steps S621 to S622.
Step S621, performing third analysis processing on the verification difference result table to obtain verification difference attribution information;
and step S622, combining the verification difference attribution information with the corresponding verification difference data to obtain a micro-service test result.
It should be noted that, the verification difference attribution information can be obtained by performing the third analysis processing on the verification difference result table; and then combining the verification difference attribution information with the corresponding verification difference data to obtain a micro-service test result.
Notably, the check difference attribution information obtained by performing the third analysis on the check difference result table is used for representing that the check difference data is obtained by specifically testing which micro-service test module; for example, before testing the micro service to be tested, a plurality of micro service test modules in the database system may be numbered to distinguish different micro service test modules in the database system, and the check difference attribution information obtained by performing the third analysis on the check difference result table is the number information, where the number information is used to identify the uniqueness of the micro service test module in the database system.
It can be understood that the microservice test result can be obtained by combining the verification difference attribution information and the corresponding verification difference data. The verification difference attribution information is used for representing that the verification difference data is obtained by specifically testing through which micro service test module; and combining the verification difference attribution information and the corresponding verification difference data to obtain a micro-service test result; the micro-service test result reveals which micro-service test module passes the test to obtain the corresponding verification difference data. By checking the test result of the micro-service, the tester can know the test condition of the micro-service to be tested.
In some embodiments, as shown in fig. 6, the switch status is on or off, and the step S510 may include, but is not limited to, the steps S511 and S512.
Step S511, acquiring the on-off state of each micro-service test module;
step S512, the micro-service test module with the switch state of on is determined as the target micro-service test module.
It should be noted that, in the process of selecting the micro-service test module, the on-off state of each micro-service test module is firstly obtained, and the micro-service test module with the on-off state being turned on is determined as the target micro-service test module; if the switch state is closed, the selected micro-service test module is not determined as the target micro-service test module; the micro-service test module can be selected by setting the on or off of the switch state, so that the selection process of the micro-service test module is simpler, more convenient and faster.
It is worth noting that under the condition that the micro-service test module is in the on-off state, the micro-service test module can execute the corresponding micro-service check script to test the micro-service to be tested, so that the control process of the micro-service test module is simpler, more convenient and faster.
In some embodiments, as shown in fig. 7, step S710 and step S720 may be included, but not limited to, after step S600 is performed.
Step S710, carrying out format conversion processing on the micro service test result to obtain micro service test text information;
and step S720, forwarding the micro-service test text information according to the preset network address.
It should be noted that after the micro-service test result is obtained, format conversion can be performed on the micro-service test result, so as to obtain micro-service test text information; and then forwarding the micro-service test text information according to the preset network address, and further informing a tester of the micro-service test result, so that the micro-service test process is more intelligent.
It is worth noting that format conversion is performed on the micro-service test result to convert the micro-service test result into a form of micro-service test text information, and a precondition is prepared for subsequent result forwarding. The network address may be a mailbox address or a terminal device address with a real-time communication function, for example, in the case that the network address is the mailbox address, the micro-service test text information obtained through format conversion may be sent to a preset mailbox, and a tester may quickly and conveniently know the test result of the micro-service by checking the mailbox. The terminal device with the real-time communication function may be a mobile phone, a tablet, or a computer, which is not limited herein.
According to the technical scheme, firstly, a micro-service test architecture is built in a preset database system, wherein the micro-service test architecture comprises a plurality of micro-service test modules; then acquiring a micro service to be tested; then, performing first analysis on the micro service to be tested to obtain corresponding database attribution information, and determining a verification database according to the database attribution information; acquiring micro-service verification information corresponding to each micro-service test module from a preset micro-service test table; then, executing the micro service to be tested based on the micro service verification information and the verification database to obtain verification difference data; finally, the micro-service test result can be obtained by sorting the verification difference data; by the technical scheme, each micro-service test module is controlled and processed by the micro-service test meter, and the micro-service test result can be obtained by sorting and analyzing the verification difference data, so that the micro-service test process is simpler, more convenient and faster, and the micro-service test efficiency is improved.
In addition, as shown in fig. 8, an embodiment of the present application further provides a micro service automation test apparatus 10, including:
the system comprises a first processing module 100, a second processing module and a third processing module, wherein the first processing module is used for building a micro-service test architecture in a preset database system, and the micro-service test architecture comprises a plurality of micro-service test modules;
the second processing module 200 is configured to obtain a microservice to be tested;
the third processing module 300 is configured to perform a first analysis on the micro service to be tested to obtain corresponding database attribution information, and determine a verification database according to the database attribution information;
the fourth processing module 400 is configured to obtain micro-service verification information corresponding to each micro-service testing module from a preset micro-service testing table;
a fifth processing module 500, configured to perform execution processing on the micro service to be tested based on the micro service verification information and the verification database, to obtain verification difference data;
and a sixth processing module 600, configured to sort the verification difference data to obtain a micro service test result.
In some embodiments, a micro-service test architecture is firstly established in a preset database system, wherein the micro-service test architecture comprises a plurality of micro-service test modules; then acquiring a micro service to be tested; then, performing first analysis on the micro service to be tested to obtain corresponding database attribution information, and determining a verification database according to the database attribution information; acquiring micro-service verification information corresponding to each micro-service test module from a preset micro-service test table; then, executing the micro service to be tested based on the micro service verification information and the verification database to obtain verification difference data; finally, the micro-service test result can be obtained by sorting the verification difference data; by the technical scheme, each micro-service test module is controlled and processed by the micro-service test meter, and the micro-service test result can be obtained by sorting and analyzing the verification difference data, so that the micro-service test process is simpler, more convenient and faster, and the micro-service test efficiency is improved.
It should be noted that the database system may include a relational database system and a non-relational database system; the database system is an ideal data processing system developed for adapting to the needs of data processing, is also a software system for providing data for a storage, maintenance and application system which can be actually operated, and is an aggregate of a storage medium, a processing object and a management system; database systems are typically comprised of software, databases, and data administrators. The software mainly comprises an operating system, various host languages, a utility program and a database management system. The database is uniformly managed by a database management system, and the insertion, modification and retrieval of data are all performed by the database management system. The data administrator is responsible for creating, monitoring and maintaining the entire database, enabling the efficient use of data by anyone with access rights. The database system is an ideal core mechanism for data processing, which is developed to meet the needs of data processing. The high speed processing power and mass storage of computers provide the conditions for implementing data management automation.
It should be noted that the micro service test architecture includes a plurality of micro service test modules, and the micro service test modules can perform test processing on the micro service to be tested, and can be used for testing the working condition of the micro service and detecting whether the micro service can work normally.
It can be understood that, the first analysis is performed on the micro service to be tested to obtain corresponding database attribution information, and the database attribution information is used for representing which database the micro service to be tested specifically has a calling relationship with; the design of the database is a key point of the design of the micro-services, and the basic principle is that each micro-service has a separate database and only the micro-service itself can access the database. Data sharing between the microservices can be realized by means of service calls or master and slave tables. When sharing data, a proper synchronization mode is to be found. In the microservice architecture, the modification of the database is of a wide variety of impacts, and it is necessary to ensure that such modifications are backwards compatible.
It can be understood that the micro service test table stores the micro service check information corresponding to each micro service test module; the micro-service check information is used for controlling whether the corresponding micro-service test module tests the micro-service to be detected, so that the control process of the micro-service test is simpler, more convenient and faster, and the testing personnel can control the test process of the micro-service only by modifying the micro-service check information in the micro-service test table. Wherein, the micro service test table can be arranged in the database test system.
The specific implementation of the apparatus for testing microservice automation is substantially the same as the specific implementation of the method for testing microservice automation, and is not described herein again.
In addition, as shown in fig. 9, an embodiment of the present application also provides an electronic device 700, including: memory 710, processor 720, and computer programs stored on memory 710 and executable on processor 720.
The processor 720 and the memory 710 may be connected by a bus or other means.
The non-transitory software programs and instructions required to implement the micro service automation test method of the above embodiments are stored in the memory 710, and when executed by the processor 720, the micro service automation test method of the above embodiments is performed, for example, the method steps S100 to S600 in fig. 1, the method steps S510 to S540 in fig. 2, the method steps S610 to S620 in fig. 3, the method step S521 in fig. 4, the method steps S621 to S622 in fig. 5, the method steps S511 to S512 in fig. 6, and the method steps S710 to S720 in fig. 7 described above are performed.
The above-described embodiments of the apparatus are merely illustrative, wherein the units illustrated as separate components may or may not be physically separate, i.e. may be located in one place, or may also be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
Furthermore, an embodiment of the present application further provides a computer-readable storage medium, which stores computer-executable instructions, which are executed by a processor 720 or a controller, for example, by a processor 720 in the above device embodiment, and can make the processor 720 execute the micro service automation test method in the above embodiment, for example, execute the above-described method steps S100 to S600 in fig. 1, method steps S510 to S540 in fig. 2, method steps S610 to S620 in fig. 3, method step S521 in fig. 4, method steps S621 to S622 in fig. 5, method steps S511 to S512 in fig. 6, and method steps S710 to S720 in fig. 7.
The above embodiments may be combined, and the modules with the same name may be the same or different between different embodiments.
While certain embodiments of the present application have been described above, other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily have to be in the particular order shown or in sequential order to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The embodiments in the present application are described in a progressive manner, and the same and similar parts among the embodiments can be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus, device, and computer-readable storage medium embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and in relation to the description, reference may be made to some portions of the description of the method embodiments.
The apparatus, the device, the computer-readable storage medium, and the method provided in the embodiments of the present application correspond to each other, and therefore, the apparatus, the device, and the nonvolatile computer storage medium also have advantageous technical effects similar to those of the corresponding method.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical blocks. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually making an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Hardware Description Language), traffic, pl (core universal Programming Language), HDCal (jhdware Description Language), lang, Lola, HDL, laspam, hardward Description Language (vhr Description Language), vhal (Hardware Description Language), and vhigh-Language, which are currently used in most common. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be regarded as a hardware component and the means for performing the various functions included therein may also be regarded as structures within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functions of the units may be implemented in the same software and/or hardware or in multiple software and/or hardware when implementing the embodiments of the present application.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, embodiments of the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present specification has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. 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.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or Flash memory (Flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium which can be used to store information that can be accessed by a computing device. As defined herein, computer readable Media does not include Transitory computer readable Media such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In the embodiments of the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" describes the association relationship of the associated objects, and means that there may be three relationships, for example, a and/or B, and may mean that a exists alone, a and B exist simultaneously, and B exists alone. Wherein A and B can be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" and similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one of a, b, and c may represent: a, b, c, a and b, a and c, b and c or a and b and c, wherein a, b and c can be single or multiple.
Embodiments of the application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. Embodiments of the application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present application are described in a progressive manner, and the same and similar parts among the embodiments can be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A method for automatically testing microservice, the method comprising:
the method comprises the steps that a micro-service test architecture is built in a preset database system, and the micro-service test architecture comprises a plurality of micro-service test modules;
acquiring a micro service to be tested;
performing first analysis on the micro service to be tested to obtain corresponding database attribution information, and determining a verification database according to the database attribution information;
acquiring micro-service verification information corresponding to each micro-service test module from a preset micro-service test table;
executing the micro service to be tested based on the micro service verification information and the verification database to obtain verification difference data;
and sorting the verification difference data to obtain a micro-service test result.
2. The method according to claim 1, wherein the microservice verification information includes a microservice verification script and an on-off state, and the performing the processing on the microservice to be tested based on the microservice verification information and the verification database to obtain verification difference data includes:
determining a target micro-service test module from a plurality of micro-service test modules according to the switch state;
calling the target micro-service testing module to test the micro-service to be tested to obtain first testing data;
calling the verification database to test the micro service to be tested to obtain second test data;
and comparing the first test data with the second test data to obtain the verification difference data.
3. The method for automatically testing the micro-service according to claim 1, wherein the collating the verification difference data to obtain the micro-service test result comprises:
storing the verification difference data to a preset verification difference table to obtain a verification difference result table;
and carrying out second analysis on the check difference result table to obtain the micro-service test result.
4. The method of claim 2, wherein the invoking the target microservice testing module to test the microservice to be tested to obtain first test data comprises:
and testing the micro service to be tested based on the micro service verification script corresponding to the target micro service testing module to obtain the first test data.
5. The method according to claim 3, wherein the second analyzing the check difference result table to obtain the micro service test result comprises:
performing third analysis processing on the verification difference result table to obtain verification difference attribution information;
and combining the verification difference attribution information with the corresponding verification difference data to obtain the micro-service test result.
6. The method of claim 2, wherein the switch state is on or off, and the determining a target microservice test module from the plurality of microservice test modules according to the switch state comprises:
acquiring the on-off state of each micro-service test module;
and determining the micro-service test module with the switch state of on as the target micro-service test module.
7. The method for testing the micro service automation according to claim 1, wherein after the collating the check difference data to obtain the micro service test result, the method further comprises:
carrying out format conversion processing on the micro-service test result to obtain micro-service test text information;
and forwarding the micro-service test text information according to a preset network address.
8. An apparatus for automated testing of microservice, the apparatus comprising:
the system comprises a first processing module, a second processing module and a third processing module, wherein the first processing module is used for building a micro-service test architecture in a preset database system, and the micro-service test architecture comprises a plurality of micro-service test modules;
the second processing module is used for acquiring the micro-service to be tested;
the third processing module is used for performing first analysis on the micro service to be tested to obtain corresponding database attribution information and determining a verification database according to the database attribution information;
the fourth processing module is used for acquiring micro-service verification information corresponding to each micro-service testing module from a preset micro-service testing table;
the fifth processing module is used for executing the micro service to be tested based on the micro service verification information and the verification database to obtain verification difference data;
and the sixth processing module is used for sorting the verification difference data to obtain a micro-service test result.
9. An electronic device, comprising: memory, processor and computer program stored on the memory and executable on the processor, characterized in that the processor implements the microservice automated testing method according to any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing computer-executable instructions for performing the microservice automated testing method of any of claims 1-7.
CN202210739728.0A 2022-06-28 2022-06-28 Micro-service automatic testing method and device, electronic equipment and storage medium Pending CN115061928A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210739728.0A CN115061928A (en) 2022-06-28 2022-06-28 Micro-service automatic testing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210739728.0A CN115061928A (en) 2022-06-28 2022-06-28 Micro-service automatic testing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115061928A true CN115061928A (en) 2022-09-16

Family

ID=83202036

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210739728.0A Pending CN115061928A (en) 2022-06-28 2022-06-28 Micro-service automatic testing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115061928A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117076336A (en) * 2023-10-17 2023-11-17 之江实验室 Testing method and device of cloud edge cooperative system, storage medium and equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117076336A (en) * 2023-10-17 2023-11-17 之江实验室 Testing method and device of cloud edge cooperative system, storage medium and equipment
CN117076336B (en) * 2023-10-17 2024-01-09 之江实验室 Testing method and device of cloud edge cooperative system, storage medium and equipment

Similar Documents

Publication Publication Date Title
CN107193750B (en) Script recording method and device
CN107391101B (en) Information processing method and device
US9612946B2 (en) Using linked data to determine package quality
CN109241026B (en) Data management method, device and system
CN112162915A (en) Test data generation method, device, equipment and storage medium
CN102760096A (en) Test data generation method, unit testing method and unit testing system
EP2951680B1 (en) Acquiring identification of an application lifecycle management entity associated with similar code
CN115774552A (en) Configurated algorithm design method and device, electronic equipment and readable storage medium
US10803091B2 (en) Method and device for determining a category directory, and an automatic classification method and device
CN115061928A (en) Micro-service automatic testing method and device, electronic equipment and storage medium
CN117033249A (en) Test case generation method and device, computer equipment and storage medium
CN112231531A (en) Data display method, equipment and medium based on openstb
CN107562533B (en) Data loading processing method and device
CN115543428A (en) Simulated data generation method and device based on strategy template
CN111967769B (en) Risk identification method, apparatus, device and medium
CN115292196A (en) User interface testing method and device, electronic equipment and readable storage medium
CN110245136B (en) Data retrieval method, device, equipment and storage equipment
US9471569B1 (en) Integrating information sources to create context-specific documents
CN109697141B (en) Method and device for visual testing
CN111967767A (en) Business risk identification method, device, equipment and medium
CN116911973A (en) Automatic account checking analysis method and device, electronic equipment and readable storage medium
CN113220801B (en) Structured data classification method, device, equipment and medium
CN116483735B (en) Method, device, storage medium and equipment for analyzing influence of code change
CN117421214A (en) Batch counting method, device, electronic equipment and computer readable storage medium
CN113704020B (en) Method and device for analyzing error field data of solid state disk

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