EDAs 3.0 microservice testing best practices

Time:2022-6-25

This article is based on the microservice practice of Alibaba cloud’s commercial product EDAs 3.0. If your team has strong microservice testing ability, we hope that our practice and thinking behind microservice testing can provide you with some reference.

preface

With the arrival of the cloud native era, more and more applications are born and grow in the cloud. As more and more enterprises start to go to the cloud, cloud native is also the best partner for enterprises to implement micro services. However, the testability of cloud applications has been greatly challenged. How to improve the testability of cloud applications and enhance the capabilities of Devops is the core problem to be solved in microservice testing.
Before describing microservice testing in detail, let’s talk about a scenario.

EDAs 3.0 microservice testing best practices

The figure above is a typical enterprise microservice application architecture. In order to consider security, cloud applications are usually deployed in cloud virtual LANs, and services are exposed through gateways. For the student in charge of the product service application, I just want to test whether the corresponding service of the application is available. What will he do?

  • Scheme 1: enter the machine (ECS) or container (POD) where the application is deployed, and verify whether the service is available through the curl command.
  • Scheme 2: expose the application to public network access, and verify whether the service is available through local command line tools or postman tools.
  • Scheme 3: pull a network dedicated line to connect the VPC on cloud and the office network, and verify whether the service is available through the local command line tool or postman tool.

From the above scenarios, we can summarize several problems in cloud based microservice testing:

  • Complex cloud network topology
  • If the public network access is exposed, hackers will attack and cause security risks
  • Pulling a special network line wastes resource costs

Obviously, I only want a simple test capability, and the cost is so high. The above scenario is just a simple debugging function. If it is pressure testing, automated regression, patrol inspection and other testing and stability assurance means, we not only need to solve the problems encountered in the above scenario, but also need self built tools to make up for them. We all feel that the cost is too high. Therefore, we need microservice testing to help us solve these problems and further accelerate the efficiency of software delivery.

Why do we need microservice testing

Product capability

Provide testing, pressure testing, automated regression, patrol inspection and other capabilities to form a microservice testing solution:

EDAs 3.0 microservice testing best practices

Imagine that R & D students submit code and deploy it. They can use testing tools to verify the correctness of service logic; You can use pressure measurement tools to verify service performance indicators; After the verification is passed, smoke test shall be carried out, and automatic regression tools can be used to write smoke cases; After the smoke passes, start the historical function regression. You can use the automated regression tool to write regression use cases; After the regression passes, submit the test for acceptance. The test only needs to verify the new function. After the new function passes the verification, submit it for release. After release, online environment verification needs to return to the main process of historical functions. You can use automated regression tools to write main process regression use cases and manually verify new functions; If the main process regression passes and the new function verification passes, the release is completed; R & D students can use patrol tools to configure online patrol; Once the patrol inspection alarm is given, the problem can be found and solved before the user. We are exporting the test solutions precipitated by Alibaba into products to help cloud businesses achieve high-quality and rapid delivery.

Easy to use and safe

Out of the box, no need to pay attention to the network topology under VPC; Safe and reliable, with testing experience under the office network.
Imagine that an enterprise deploys its R & D environment, test environment, pre launch environment and production environment in different VPCs for security isolation. If users build their own test tools, they need to solve the problem of network interworking between the test tools and different environments. Enterprise IT personnel obviously only want a simple test tool, but it is far from over to solve the complex cloud network topology after they go to the cloud, In order to use the test tool in the office network, it is also necessary to ensure that the test tool can be accessed by the office network. At this time, it is facing the test of network security. We hope to have a safe and reliable solution that can be used out of the box, so that enterprise IT personnel on the cloud can have a test tool for testing experience on the office network.

EDAs 3.0 microservice testing best practices

low cost

By flexibly pulling up the testing machine / pressure machine and destroying it after use, the machine resources and labor costs required to build the testing tools can be greatly reduced.

Just imagine that enterprises go to the cloud to reduce costs. Application hosting has greatly reduced resource costs and operation and maintenance costs, but the test costs have not been reduced. Enterprise IT personnel need to prepare test machines / pressure machines for self built test tools. These machines are occupied for a long time and are idle. The cost of resources is high, especially in the performance pressure test scenario. In addition to resource costs, enterprise IT personnel also need to develop test tools. The labor cost and time cost are very high. Basically, every enterprise needs a set of test tools. We hope to have a low-cost solution, which will not only improve the resource utilization of the enterprise, but also reduce the cost of IT personnel developing and maintaining test tools.

EDAs 3.0 microservice testing best practices

Micro service ecology

A large number of microservice products have been provided on the cloud to solve the hosting, governance and diagnosis of microservice applications, and microservice testing complements the microservice capabilities.

Imagine how to test a microservice interface. You need to understand the input and output of the interface. If you are a R & D student – service provider, you may be familiar with the interface. If you are a test student, or even other R & D students, you may need documents, or even oral communication. Microservice governance has visualized the service contract information of the application. Combined with the service contract information, you just need to follow the test needs, Select application – > framework – > Service – > method, and configure test parameters to test, which reduces the cost of service contract synchronization.

In combination with the above four points, test students only need to be responsible for case writing + test acceptance. Interface debugging, interface performance level and case automation can be enabled to R & D students. Just like early Devops, it reduces the feedback loop between R & D, operation and maintenance, improves software delivery efficiency. Devotest reduces the feedback loop between R & D and testing, and further improves software delivery efficiency on the premise of ensuring delivery quality, At the same time, actively create patrol inspection tasks, regularly monitor the availability of online services, and identify and solve problems before users.

Edas3.0 microservice testing practice

Prerequisite: the microservice application has been connected to edas3.0
Let’s experience how to use the ability of microservice testing on EDAs.

Service test

  1. Log in to the EDAs console and select the region in the upper left corner of the page;
  2. Select from the left navigation bar: Micro service governance – > spring cloud – > service test – > query service;
  3. Click Details of a service – > display metadata list;
  4. Click test of a method – > enter the test page (the user has been helped to fill in the parameter template);
  5. Click execute.

EDAs 3.0 microservice testing best practices
EDAs 3.0 microservice testing best practices
EDAs 3.0 microservice testing best practices

Service pressure test

  1. Log in to the EDAs console and select the region in the upper left corner of the page;
  2. Select from the left navigation bar: Micro service governance – > spring cloud – > service pressure test – > create scenario;
  3. Select the application to be pressure tested – > select the framework – > select the service – > select the method;
  4. Fill in the pressure measurement parameters and click OK;
  5. Enter the pressure test scenario list page and click Details;
  6. Enter the pressure test details page, click start, and wait for the pressure machine to be ready;
  7. Click Details to enter the pressure test performance data report page to view the performance data in real time;

EDAs 3.0 microservice testing best practices
EDAs 3.0 microservice testing best practices
EDAs 3.0 microservice testing best practices

Automated regression

  1. Log in to the EDAs console and select the region in the upper left corner of the page;
  2. Select from the left navigation bar: Micro service governance – > spring cloud – > automated regression – > create use case;
  3. Add step
  • Select application – > select framework – > select service – > select method;
  • Fill in parameters;
  • Assertion / parameter extraction;
  1. You can add multiple steps;
  2. Save the use case;
  3. Click execute;
  4. Check whether the use case passes through the execution history;

EDAs 3.0 microservice testing best practices
EDAs 3.0 microservice testing best practices
EDAs 3.0 microservice testing best practices

Service Patrol Inspection

  1. Log in to the EDAs console and select the region in the upper left corner of the page;
  2. Select from the left navigation bar: Micro service governance – > spring cloud – > Service Patrol – > create patrol task;
  3. Select the application to patrol – > select the framework – > select the service – > select the method;
  4. Fill in the patrol parameters and assertions, and click OK;
  5. Enter the patrol inspection task list page and click start to start patrol inspection;
  6. When the patrol inspection fails, you can view the failure records, or add an alarm by nailing, SMS, or e-mail;

EDAs 3.0 microservice testing best practices
EDAs 3.0 microservice testing best practices

Microservice test implementation details

Tool capability

The testing tools practiced in Alibaba Group will be output as products, including pressure testing, automatic regression and patrol inspection, so as to reduce the cost of user research and development tools.

Inter-switch communication

Using Alibaba cloud’s existing network connectivity technology solution (Eni mount), the VPC of cloud products and VPC of users can be accessed. When installing the microservice agent, the application actively reports the network information (VPC, vswitch, and SecurityGroup) to the server. According to the network information of the application, the VPC of cloud products and VPC of users can be accessed, The cloud product service can directly access the VPC deployment service of the user’s VPC.

Elastic resources

Cloud products use their own resource accounts to purchase elastic machines and install testing tools.

Service contract

The microservice governance has visualized the service contract information, and the microservice test can directly query the service contract information

Not just microservice testing

This article introduces several capabilities of micro service testing, complements the capabilities of micro service ecological testing, and will soon launch intelligent traffic testing: providing traffic production recording, production playback, production recording offline playback, automatic generation of test cases, automatic coverage of regression test scenarios, etc. under the micro service architecture to help your application easily complete test verification at a lower cost. Welcome to experience.

In addition to EDAs (enterprise level distributed application service), the microservice testing capability has been integrated by MSE (microservice engine), and will also be integrated by AHAs, CSB, SAE and other cloud products. The microservice testing capability will be integrated by more cloud products as a basic capability. In addition, it will form a linkage with more microservice products, such as arms (application real-time monitoring service) and ACM (application configuration management), to help ensure the stability of cloud business and keep the business online forever.

>>Original link

[Alibaba middleware] focuses on cloud native hot topics such as microservices, container services, serverless, etc,Follow the official account with the same name to get more exciting content and benefits
Tips: Official account backstage reply “lucky draw”, try your luck?

Recommended Today

Windows terminal uses nushell+oh-my-posh to beautify

First look at the renderings Please point out if the steps are wrong. Install nushell from github Download from github releaseRelease 0.66.2 · nushell/nushell (github.com) github release download speed may be slow, you can download it hereDownload (serctl.com) Install windows terminal in microsoft store Install oh-my-posh on Microsoft Store Winget can also be used, but […]