4 ms·
Ah, my pet peeve. I also prefer AAA tests, but I can't stand it when people leave those comments in as some kind of region markers. IMO, they're useful when te
by moogly 5y ago
Ah, my pet peeve.
I also prefer AAA tests, but I can't stand it when people leave those comments in as some kind of region markers. IMO, they're useful when teaching AAA tests, but it seems, in my experience, most developers actually have those comments in every. single. test. That's some hardcore cargo culting.
I just use a blank line to separate the different stages, and if you have problems making that readable, you probably need to refactor the Arrange or Assert parts to use some helper methods.
I realize I'm probably overreacting, but I feel the anger rising whenever I see this in the wild (and have to suppress it).
- hvidgaard 5y agoIt's to ensure that it's actually adhered to. Unfortunately experience have shown that it's unreasonable to expect all developers to remember this on their own accord. I generally also advise the leads to make sure there is a reasonable limit to the length of a test method. As you say if it's too long it probably needs some work before it's allowed in the main branch.
- pc86 5y agoYou can always just overwrite the comments with the first line of code. If this actually makes you angry and you're not just hyperbolizing for literary flair you need to see a therapist.
- moogly 5y ago> You can always just overwrite the comments with the first line of code. I of course mean leaving the comments in the final test. I don't care about the comments in the actual snippet.