Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
Welcome to unit testing lol
When some smartass starts asking "but who tests the test code?" then answer "only God can Tell"
As a teacher you can take the obvious teacher action, which is:
1) Answer "Yes"
2) Answer the why and how
One of the reasons why I love the show SciShow on Youtube is because they explain the origins and resaons of something, which is crucial if you want to learn something.
Provide him a full rationale on why you write tests to verify your code. At my uni they used the example of several mission-critical applications (an aeroplane, probe to Mars gone wrong, hospital equipment, etc) and the consequences if you don't test.
The goal is no to test the code you wrote now but to test the changes that you could potentially make after.
Foobarbaz278dFirst learn TDD the right way:
1. Write small test.
2. Write small chunk of code satisfying that test.
3. Go to 1. until it's finished.
* You write better designed code unit (you have to use it before you even implement it).
* You will more likely think about boundary cases. If you test afterwards you will test just only what you implemented.
* Being ready for refactoring is additional benefit.
@Clueless the ceo at my previous Job Had a great mentality on that. Basically "When you ask an engineer to create something it's part of the engineers job to make sure that the thing gets tested as he's the expert who should know when to test what and how. Testing is part of the product, it's part of the job. That's true for car manufacturing, aeroplane engineering and should be true for our domain. Just because our errors won't lead to killing people doesn't mean we should ship brittle products. Don't fucking ask me if it's okay to spend time testing. Write tests whenever necessary. Of course there are times when quick fixes and rushed development are necessary but it's management's job to keep those times to a minimum."