New answers tagged unit-testing
2
votes
Is integration-testing all services the best approach?
This is a "should" question, which necessarily is going to be answered by "It depends" - especially when it comes to testing. Despite what some zeaolots advocate, there really is ...
5
votes
Is integration-testing all services the best approach?
each class should have a unit test
This is not strictly true. There is little value in assertions such as “each method should be covered” or “we should have 95% branch coverage.”
If you have parts of ...
0
votes
Is it good practice to check exception messages in unit tests?
If it is necessary for a function to fail in some case, it is a good idea to test that. However, since the specific text should not affect the behavior of the caller of the function, it is not a good ...
0
votes
Is it good practice to check exception messages in unit tests?
In your case, the dynamic and important part of the message is a parameter name:
Assertions.assertContains("last", exception.getMessage());
This does not require the extremes Arseni ...
10
votes
Is it good practice to check exception messages in unit tests?
From my own personal experience, you should only be building unit tests for things that you do not want anyone to change without also modifying the unit tests. That might seem tautological so I'll ...
3
votes
Is it good practice to check exception messages in unit tests?
There is a hierarchy of value in testing.
Do the cases you expect to work, work correctly
Do the cases you expect to fail, fail without mucking stuff up
When you throw an exception for a failed case, ...
5
votes
Is it good practice to check exception messages in unit tests?
A string is equal to itself
A developer could later make a trivial change to the message, such as “last name must not be null” and this would break the unit tests, even though the message's meaning ...
Top 50 recent answers are included
Related Tags
unit-testing × 1810testing × 483
tdd × 356
c# × 190
integration-tests × 186
mocking × 140
java × 117
design × 89
python × 67
c++ × 60
.net × 55
dependency-injection × 55
object-oriented × 54
javascript × 49
programming-practices × 47
php × 46
refactoring × 43
continuous-integration × 42
design-patterns × 40
test-coverage × 36
bdd × 35
database × 28
architecture × 27
code-quality × 24
junit × 24