Skip to content

Commit 3b5a5d1

Browse files
committed
Add note about single assertions per test
Fixes #37
1 parent 278d119 commit 3b5a5d1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

rules/0120-Tests.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,22 @@ Test.describe('foo', function(){
112112
});
113113
```
114114

115+
A final remark on test grouping: if you have a look into some TDD books,
116+
you'll notice that they encourage you to use a _single_ assertion in a
117+
test, not multiple as in this section's first example. This is also
118+
the subject [of a programmers SE question][programmers-tdd-assert].
119+
120+
However, some languages on Codewars don't provide the proper means to
121+
couple tests (label/text) with assertions, for example Python. It would
122+
be cumbersome to add a single `it("...")` for every assertion and clutters
123+
the test code. In those cases, you should write a helper that takes care
124+
of this.
125+
126+
Either way, you should always make sure that the user knows the reason for
127+
failing tests (see next section).
128+
129+
[programmers-tdd-assert]: http://programmers.stackexchange.com/q/7823/7515
130+
115131

116132
### Make errors obvious
117133

0 commit comments

Comments
 (0)