4
votes
Accepted
In testing is making asserts in cleanup bad?
I am less concerned about DRY code in unit tests, and more concerned about the test clearly stating the intended behavior. Doc Brown has sensible advice, but I would prefer the assert in each test.
If ...
3
votes
Mock a bean with 10 methods when I only use one?
A number of options come to mind:
Decompose ServiceTwo into an additional interface that ServiceTwo inherits from. This new parent interface would define the two methods that ServiceOne needs, or a ...
3
votes
Accepted
Is it worth testing simple details?
Does worth testing simple details?
Maybe?
I get paid for code that works, not for tests, so my philosophy is to test as little as possible to reach a given level of confidence -- Kent Beck, 2008
...
2
votes
In testing is making asserts in cleanup bad?
This is ok as long as
your test runner lets you still see easily which specific test caused the assertion to fail
the failing assertion does not prevent the cleanup of the resources up to the point ...
2
votes
Is it worth testing simple details?
Every unit of implementation code is an asset. Every unit test is a line in your insurance policy.
You get to decide which assets are protected and how exactly how they're fixed or replaced when they ...
1
vote
Accepted
What is a good way to call a unit-tested function provided by a library/package?
Encapsulating library functions makes most sense when your "own" interface main offers simplified access to the library, or at least provides a more precise or more readable name (assuming ...
1
vote
How to properly isolate tests for dataframes with grouping?
More generally what you are describing is a Data-Driven Test. To echo Kilian Foth's comment, each data frame is not a separate test case. Each data frame represents a different input to the same test ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
unit-testing × 1692testing × 447
tdd × 335
c# × 177
integration-tests × 137
mocking × 124
java × 111
design × 84
python × 62
c++ × 58
object-oriented × 48
javascript × 48
.net × 48
dependency-injection × 48
programming-practices × 47
php × 45
refactoring × 42
continuous-integration × 40
design-patterns × 37
bdd × 34
test-coverage × 32
architecture × 27
database × 26
integration-testing × 26
code-quality × 24