Testing is one of the most important topics in software development, but a lot of developers still shy away from it.
Today I’m gonna
If you have no experience in testing don’t worry
Is Testing Important?
Of course, for the best software project, it’s important.
If you want to know why testing is important please search it in google you will get a lot of answer about it. I just talk some topics about why testing is important I don’t wanna make this post larger for readability
Confidence in Code, Minimal Code, Rid of regression bugs
Example: Suppose You want to add some functionality in your application and after adding this functionality some bugs you are getting but not getting a specific reason for that. For this thing, you need testing to get where the code is breaking. Hope so you get it
A variant of Testing:
There are many types of testing methods like
1. Unit Tests
— The reason for unit tests validate the functionality and small piece of software. Unit test is the testing method where you can test every part of your application. Like One function will give specific output and you can test it by that it is giving or not…
2. Integration Tests
-This testing basically uses to test multiple functions and components when working together and those things will give an output of this that’s multiple components or modules working or not that’s time integration testing get the error
3. End to End Tests
-Personally, I love e2e testing cause it is the automatic testing system you can see your application is working in front of yourself and give the specific output like you want to test one form and it will take some data and some data will send to the server everything you can watch by e2e testing- This thing runs in your real device
Note: You need a better PC configuration for that
-Imagine you have a function that calculates the result of a number. Testing the function can then be done using the expect() function and a simple matcher that checks if the result of the function matches the expected value.
-Those tests will clone the function or component or module then it will test. Mocks help your tests to avoid test unreliability (flakiness) and improve the speed of your tests.
first, need to make sure that your application’s architecture is testable. If it is not, you need to understand why not and what you can do about it. If your code is not structured properly, you are definitely going to find it difficult to write tests for it
Different testing tools:
Jest is an open-source testing framework created by Facebook with a focus on simplicity.
Cypress is an all-in-one testing tool that is focused on making End-to-End testing easy and modern.