language agnostic - Guidelines for better unit tests -


Jimmy Bogard, an article is written, where it gives four rules:

  • < Strong> Test names from the user's perspective
  • Tests are codes too, give them some love
  • don
  • One setup , execute and verify

in your opinion are these guidelines fulfilled? What are your guidelines for unit tests? Please avoid specific language idioms, try to keep the answer-language agnostic.

A complete, 850 page book is called this deal with this topic, so there is nothing like this Which can be easily boiled for some strict rules (although the rules of your mentions are good).

Another digestible book that covers this topic

If I can add rules I Most are important, then they will be:

  • Use test-induced development This is the most effective road towards good unit tests. It is most difficult to try to withdraw unit tests in the existing code.
  • Keep it simple: Ideally, a unit test should be less than 10 lines of code. If it grows for more than 20 lines, then you should seriously consider the test code or the refactoring API you are testing.
  • Keep It Fast It is meant to execute unit test suites very often, so aiming to keep the entire association under 10 S. It can easily mean that keeping each test under 10 ms needed.

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -