New rule to organize unit test contents
@yanivefraim I've always used comments to help organize the contents of a particular unit test such as:
// arrange
// act
// assert
or
// given
// when
// then
What do you think about adding a new rule to require similar comments within the test patterns?
Sounds cool. Are those patterns always relevant?
No, not always, for example, on some unit tests there may be nothing to arrange. But I don't think it's detrimental/distracting to have the comments there even if there is nothing in that part of the test. I find it is a nice future extension point when you do need to add code to arrange the unit test context, it is clear where that code should go.
OK, I'm with you on this (:
Do you have a preference between "arrange, act, assert" and "given, when, then"?
I use "given, when, then", not sure what is better...
OK, thanks, I don't have a strong preference. I typically use AAA, but GWT may fit a little better with the Jasmine BDD style.