bkaestner / codewars-rules

Arbitrary rules by an arbitrary Codewars warrior. THIS REPOSITORY IS LOOKING FOR A NEW MAINTAINER
https://bkaestner.github.io/codewars-rules/
Other
12 stars 5 forks source link

One assertion per test #37

Closed bkaestner closed 8 years ago

bkaestner commented 8 years ago

Uncle Bob and several other sources strongly discourage multiple assertions per test. And after I've finally read some articles on the topic, I strongly concur. This means that most of my "should work for some examples" tests aren't really valid, since they test multiple inputs.

However, I don't think that katas on Codewars are actually written in TDD style. Many users probably write their solution first, and then the tests. Also, it really depends on the testing framework. Still, one assertion per single test case gives the most feedback to the user.

Therefore, this should be added in the testing section, as well as in the example tests. The random tests aren't affected by this, since every random value basically creates its own "test case", and most frameworks will report the random values on an error.