Component testing in Vue.js 3
In Vue.js, components are the main building block of the UI and refer to a single unit of the application that is shareable, testable, and reusable. Therefore, component testing sits between unit testing and end-to-end testing. It can also be referred to as integration testing.
In the previous chapters, where we integrated atomic patterns using Storybook, we discussed creating component stories and how to create them. If you created stories for all your components and configured them to work properly as demonstrated, then you will have already implemented component testing using Storybook stories.
However, Chapter 10, Integrating Testing in Vue.js 3 is dedicated to exploring component testing. Nevertheless, we will briefly illustrate in this chapter how to implement simple component-based testing to aid our understanding of the next chapters.
Writing a basic component test
We will start by installing the new testing library for Vue.js 3. Since...