O'Reilly logo

TypeScript Microservices by Parth Ghiya

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hands-on testing

It's now time to get our hands dirty with microservice testing frameworks. In this section, we will look at testing basics and then carry on to write some unit tests, contract tests, and service-level tests. Writing tests has great advantages. We are forced to think through breaking the code into sub-functions and writing code based on the principle of single responsibility. Comprehensive test coverage with good tests makes us understand how the application works. In this section, we will be using some famous toolsets: Mocha, Chai, Sinon, and Ava. Ava will be our test runner, Chai will be our assertion library, and Sinon will be our mocking library.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required