Hey everybody what's going on is Caleb with Def slopes dot com and if you're anything like me when you
were in school or I guess if you are in school right now you hated taking tests.
Don't worry I hated them too.
And the research has actually shown that most testing done in schools is not totally accurate or complete
picture of student learning understanding or knowledge.
Ok but what makes a good test then what would accurately test something.
Well in layman's terms a good test is one that accurately examines what it's supposed to test.
OK one that you've actually carefully thought out and one that produces the intended result.
That's why it's really really important to write good clean unit tests.
Otherwise they might not end up testing what you intend for them to test or you might even be tricked
into thinking that they work because they might pass but not actually test what you want.
Causing all kinds of problems for yourself.
So how do you write a good unit test.
Well I have an acronym for you to remember and it's a trip a trip.
What I mean is that A stands for automatic test should be automatic.
They should automatically run quickly and pass or fail quickly.
OK.
Automatic t in a trip stands for thorough.
You should make sure that you test as many different scenarios and situations as possible like the initialization
of data models network request et cetera et cetera.
Thorough K R is for repeatable.
This means that your test should be able to run the same way and produce the same result every single
time.
That's the point right.
They should be able to be very consistent.
I is for independent OK a good test should only test one thing at a time.
Multiple assertions are OK.
Right you're asserting that something is true or false or nil or equal to another thing.
Multiple assertions are fine as long as they're testing the same one feature or behavior test should
also not rely upon other tests in order to run P is for professional follow the same good standards
for writing tests that you would for writing production code.
Make sure your code is as readable clean and efficient as possible.
A trip automatic thorough repeatable independent professional.
That is how you ensure that you've written a good unit test.
This is Caleb with Debb slopes com.