Do you even unit test, bro ?

  • Unit test was the first answer, but it took me time before writing them correctly.
  • Mocking make writing test easy, but it's not a good practice.
  • Code is composed by public methods, yes, but also by private and protected ones.
  • But, unlike public methods, the are not worth a specific test.
  • I am used to write tests following the FIRST principles, but other methods exists, like AAC for example.
  • Yes. You can be a Time Lord and mock Time (unless it's a fix point in time, of course ;-) ) Remember, if a test failed, the only valid reason should be that the method is not working as expected.
  • Unit testing should take time to write, sometime even more than writing the method itself.
  • Keep your tests simple, limit them to a specific scope and focus on the output of the method.

save | report | share on


Top 200 comments