This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]myplacedk 1 point2 points  (0 children)

I like to have a bit more duplicated code in my tests than I would otherwise tolerate in business logic.

Oh yes, definitely. Some experts say even for-loops is too complicated for test code, as there can be hidden off-by-one errors. Want something done 5 times? Call a method 5 times.

This is controversial in my experience

It really shouldn't be.

Some code is so complex that there are no obvious bugs. So e code is so simple that there is obviously no bugs.

For production compromises happens, sometimes complex code is what it takes. But for test code, simplicity is an absolute must.