Importance of automated testing

Why automated testing is important

Project Source Code

Get the project source code below, and follow along with the lesson material.

Download Project Source Code

To set up the project on your local machine, please follow the directions provided in the README.md file. If you run into any issues with running the project source code, then feel free to reach out to the author in the course's Discord channel.

Previous LessonPrerequisitesNext LessonThe testing pyramid

Lesson Transcript

  • [00:00 - 00:17] In this lesson, let's define what an automated test is and also discuss the importance of automated testing and why it should be a fundamental part of your development process. The last time it takes to get feedback once you have written code, the more predictable your development process will be.

  • [00:18 - 00:38] For example, to create a check password function in an authentication flow, a developer with manually testing the application will have to first create a route, then create a login controller, which then calls check password function. The controller will call the check password function with the password supplied by the user.

  • [00:39 - 00:49] The check password function then checks the supplied password against the hash password and returns true or false. The developer has to go through all these steps before getting feedback on whether the check password function works or not.

  • [00:50 - 01:11] In the case of automated testing, the test will execute the function, check the returned value and give feedback to the developer in a very short time. Automated tests are more predictable because it will run the same instructions as many times as the developer wants and produce the same results while the manual tests are not equally as predictable because it gives room for human errors.

  • [01:12 - 01:24] Each time the test run, automated tests can exercise the check password function using different arguments. Another advantage of automated tests is that it guarantees that the same steps will be followed every time eliminating human error.

  • [01:25 - 01:41] If the developer has to go through several steps before checking if a function works, it is possible to skip a step in the process. And then when we experience errors, we cannot guarantee that the error is from the check password function or form any of the manual steps we used to set up the testing scenario.

  • [01:42 - 01:50] Writing tests helps do so we will touch that part of the code base next. Automated tests are useful for developer collaboration and help reduce regression.

  • [01:51 - 01:59] Other tests also help improve developer productivity. With that said, getting started might be time consuming but the more you run the test, the more value you get from it.

  • [02:00 - 02:10] Writing tests have a cost which is adequate to write and maintain but the benefits far out where the added costs, especially in projects that need to be operated and maintained for many years.