Vue.js Live 2024
21 min
No More Mocking! Write Better Tests For Your Nuxt Application With Contract Tests
Let's explore how to create more resilient software systems employing API-first techniques. By utilizing the contract testing tool Specmatic and the Playwright test runner, we can develop tests that ensure our Nuxt applications work perfectly and communicate correctly with Microservices they rely on to get data.
We will take a closer look at how to write OpenAPI specifications that aid us in documenting our APIs and enable us to ensure they work correctly. Furthermore, we can use those specifications to automatically spin up a stub server, which we can use to test our application in a controlled environment with Playwright.
The techniques I'll show you will help you write tests that enable you to rapidly iterate without fearing regressions.
Learning Outcomes:
1. You know about the basic principles of Contract Testing and how it also helps drive our E2E tests.
2. You know to opt for Contract Testing when working with Microservices and BFFs, database seeding when using Nuxt with a database, and mocking when dealing with SPAs.
3. You know the steps to create your first OpenAPI specification and integrate Specmatic with Playwright or Cypress, and you are keen to apply this technique to your projects.
We will take a closer look at how to write OpenAPI specifications that aid us in documenting our APIs and enable us to ensure they work correctly. Furthermore, we can use those specifications to automatically spin up a stub server, which we can use to test our application in a controlled environment with Playwright.
The techniques I'll show you will help you write tests that enable you to rapidly iterate without fearing regressions.
Learning Outcomes:
1. You know about the basic principles of Contract Testing and how it also helps drive our E2E tests.
2. You know to opt for Contract Testing when working with Microservices and BFFs, database seeding when using Nuxt with a database, and mocking when dealing with SPAs.
3. You know the steps to create your first OpenAPI specification and integrate Specmatic with Playwright or Cypress, and you are keen to apply this technique to your projects.