Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can do unit test without TDD? [closed]

I'm in a project where we don't do TDD, because our bosses and the cliente are very "old styled" people. Because I can't do design through TDD but I feel fear to changes, I would like to write unit tests for my own safety. But, how those unit test would be? Do I have to write a test for each method specification for test that they do what it's supposed they do? Do I have to test for each new functionality like TDD but without design? I have a mess in my mind.

Thanks in advance.

like image 820
Alex Text Avatar asked Jan 18 '23 10:01

Alex Text


1 Answers

You probably can't hurt anything by doing unit tests - regardless of how well they're done - except for one possible side-effect, and that is false confidence.

We tend not to do hardcore TDD, nevertheless the unit test coverage ranges from non-existent to moderate depending on project, and is becoming increasingly valuable as the idea settles in.

For general pointers, I'd say the following are key priorities for you right now:

  • Test what you know to be important
  • Test what you know to be fragile
  • Write tests to expose any new bugs, then solve the bug by making modifications that pass the test
  • Apply TDD where possible to any new features
  • Acknowledge that you can't TDD an existing project. By its nature, TDD only applies to new ground, whether that's a new product, or a new feature for a legacy product. Don't let this fact dishearten you.
like image 116
Tom W Avatar answered Jan 25 '23 21:01

Tom W