Intro to Testing in Javascript

I am frontend developer from India.
Introduction
Testing in javascript or rather testing is the topic which most developers run away or shy away from. Knowing about it will give you an extra edge over other developers.
It may look tough at first but with modern tools, testing is not so tough. In this article, we will see what is testing, why do we need it, and some types of testing.

What is Testing
A few days back before knowing about testing I used to wonder what exactly is it. Didn't I test my web app by clicking across the web app?
Well, that is also testing. This type of testing is called manual testing. We test links, buttons, and other parts of our web app by clicking across it.
To some extent, it is a good thing to do testing of the web apps on our own. We will always be doing this type of testing as we want to experience the app on our own.
Why Testing
Imagine yourself working on a food delivery app. You made some changes and without testing pushed it into production. What if it contains errors!! The app will crash down and you need to see all parts of the codebase where the error is coming. Frustrating task right.

That's why testing is important before pushing the changes into production. Additionally, it is less error-prone you don't need to test everything manually every time and it speeds up your development.
Unit Testing-What's that?
We saw what is manual testing above. A unit test is simply the code snippets that the developer writes and see if the result of that code meets a certain expectation(expected result). Unit testing makes development fast and less error-prone and helps in identifying the issues, breaking changes, and side effects in a quick manner.

If we have some unit tests then one can easily spot problems/errors in code when some of our automated test cases start failing.

Manual testing has its own flaws like one can easily overlook a certain scenario. In automated testing even if you forget an important scenario you can always add respective tests later on.
And that's all. Thank you for reading.






