Loading
Current section: Principles 4 exercises
lesson

Overview of Testing Principles

Transcript

00:00 All right, so we're starting off with the testing principles. Whenever you write any code, you have some intention behind it. You want it to do something. So we have a button that should re-render the UI when you click on it. We have a function that should print a greeting message for the user. That's what you want the code to do. So then you grab all the tools you have, your programming language,

00:18 your third-party libraries, to make that intention a reality. But how do you make sure that what you've written, your code, actually fulfills that intention? More so that it keeps fulfilling that intention over time as more people work on it and things change around. Well, this is where the testing comes in. And the most straightforward way to check that intention

00:37 is just to manually test your code. So supply it with the right input and observe the output. This is a great strategy in certain situations. But the thing is, it's not scalable. You will be writing a lot of code, different code, and manually checking it every time is extremely time-consuming. Not to mention that we're humans and we make mistakes.

00:55 Why not delegate this check to the machines? And this is where the concept of automated testing comes in. So in this exercise, you will see what role intention plays when writing tests, and you will also write your very first minimal test. So I hope you have a fantastic time.