7
votes
Accepted
Is it worth unit testing hardcoded values?
Worth is subjective
"Is it worth it" is generally not objectively answerable when talking about realistic testing expectations.
Generally speaking, we don't get as much time to write tests ...
4
votes
Should Acceptance Criteria be mapped to unit tests?
I feel that part of this is common, BDD/Gherkin/Cucumber style testing where you write tests as acceptance tests and have them print out whether they work or not in that human readable format.
Adding ...
4
votes
How do I mock API responses with security in mind?
Rather than sprinkle such conditionals throughout your program, refactor the code so that all communication goes through a single, minimal communications specialist. Then replace that specialist with ...
4
votes
Accepted
Where to put interface files for mocking aka what are best practices for organizing interfaces in a C#/.NET Core project with NSubstitute, Moq etc.?
Decisions like this are usually best guided by the Principle of Least Astonishment: What pattern will other developers recognize and understand quickly?
First, C# projects have a very common ...
3
votes
Best practices for unit testing when breaking down functions into smaller ones
I'm sure someone will provide you with a more detailed answer, but here are some things to consider:
Unit tests are used to verify that the behavior of a function is correct and to prevent regressions ...
3
votes
Accepted
Should Acceptance Criteria be mapped to unit tests?
I've said it before and I'll say it again:
the most important thing to consider is a test's audience
You're grating at this request precisely because this busy work could force the tests audience to ...
3
votes
Should Acceptance Criteria be mapped to unit tests?
People often abuse the term "unit test" for any kind of automated test which is executed by some unit testing tool. So first thing you should do here is make a clear distinction between
...
2
votes
Accepted
Best practices for unit testing when breaking down functions into smaller ones
Don't try make such decisions up-front - it is way easier to decide when growing your unit tests alongside with the development of your functions.
You wrote
let us act like each line is a long ...
1
vote
Where to put interface files for mocking aka what are best practices for organizing interfaces in a C#/.NET Core project with NSubstitute, Moq etc.?
Your first two disadvantages are odd and suggest to me that your whole approach to coding might be different from 'normal'
Disadvantage: Accessing the interface from the class may require tools
like ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
unit-testing × 1749testing × 463
tdd × 344
c# × 185
integration-tests × 144
mocking × 132
java × 112
design × 87
python × 66
c++ × 59
dependency-injection × 52
object-oriented × 50
.net × 50
javascript × 48
programming-practices × 47
php × 45
refactoring × 42
continuous-integration × 42
design-patterns × 38
test-coverage × 36
bdd × 35
database × 28
architecture × 27
integration-testing × 27
code-quality × 24