Let's take a step back and recap about testing. So testing, the parameter of testing is the most essential parameter that we will use for building any testing system and any application, right? So for this parameter of testing, we have three layers, unit test, integration test, and end-to-end test.
Unit test is considered the most ground-based for all of our application testing, which includes all the independent testable logics that make up to our system, to our applications. And then integration test is to test the data flow between different testable logic modules together, when you connect it together, to make sure that nothing breaks in the middle. And finally, end-to-end test is the most expensive one, with very little test. You can see at the top of the parameter. It's expensive, but it's also very important to simulate the experience of users step-by-step on how they interact with the application before you do the deployment.
And so here comes the next question. Where should component testing belong to? We've been talking so much about component testing, about how we can do it with Playwright, how we do it with Cypress. But what is component testing and where does it belong to? Well, component testing in many aspects has many different meanings. In the back end, it just means a piece of code, a module, a code block in the system that you need to test independently. Meanwhile, in the front end, it becomes more complex. So in fact, component testing, we can divide it into two types. Component testing in small, which is the modular testing, or we can call it unit testing. Component testing in large is meaning you are validating a component with the help of other components, such as a gallery, which depends on gallery item components to render and display the whole list of items. Which means when we test this gallery item, we don't just test the isolated individual component gallery item, sorry, gallery. We have to test it together with gallery items to see if the input and output of one component will be required for testing. Another component will come smooth, and also we need to care about interaction of user, and so on and so forth. So for that, we can say that component testing comes in two types. Component testing in small, unit test. Component testing in large, integration test, or end-to-end test. In the end-to-end test, it really depends on how you define the flow of your individual component testing you're aiming for.
So, which means in the pyramid, come to the question we asked before, where does component testing belong to? So in the pyramid of testing, it's a gray area. In fact, it's a gray area between integration test and unit test. It really depends on what scenario and your goal of testing in order to decide whether the component testing you are trying to achieve is integration or unit test. And that comes to our next question. When are we going to write a unit test for component, and when are we going to write an integration test for each component better, or both? And which technology we should use to do for each scenario? So for that, let's go for our demo app. So in our demo app, we're going to have an application, very simple, a pizza store, which allows users to add to cart, and then update the cart, and also search and update the URL. For the demo app, we're going to perform the testing, comparison between two methods. The first one is VTest with VueTestUtil, and the second one is Playwright component testing.
Comments