Linked Questions
30 questions linked to/from Where is the line between unit testing application logic and distrusting language constructs?
2 votes
3 answers
335 views
Unit testing code which does not establish correlation between input and output
In most descriptions of unit testing as a methodology there's an idea of unit tests being as independent of implementation as possible. This is easy to understand and implement in cases when code does ...
9 votes
1 answer
2k views
To what extent should I test what should not happen
In the case of unit testing, I'm testing as many cases as I can that when I do X, Y happens. I'm also concerned in some cases that when I do X, Z does not happen. But for the sake of protection, I ...
1 vote
1 answer
5k views
Is it worth writing a unit test for a DTO with the most basic getter/setters? [duplicate]
The advantage is it protects your DTO against future "enhancements" ?
1 vote
4 answers
671 views
Little value in unit-testing the database component
Having a component that represents the database is wonderful! You can use it from the business logic to read and write data. But should that component be unit-tested? I would argue that it should ...
0 votes
1 answer
2k views
Do I need to unit test a generic method with all accepted types?
For a method whose signature looks like this: public T Add<T>(T first, T second) where T : struct, IEquatable<T>, IComparable<T> which can work with all of the integral types, do I ...
4 votes
1 answer
651 views
Should I unit test "trivial" functions that are thing wrappers around the Pandas API?
I'm working on a codebase with very little testing. The code is 90% an ETL pipeline with functions like def sort_data(df: pd.DataFrame, column: str = 'date') -> pd.DataFrame: return df....
0 votes
2 answers
940 views
Should I test the aspects that type checking covers?
For example, should I test like this: // it shouldn't even compile since I'm using a static type-checking expect(addTen('string')).toThrowError() when it is already type-checked like this: function ...
2 votes
1 answer
886 views
When is interaction testing (invocation verification) while unit testing considered excessive?
I am under the impression that interaction testing (verifying mock invocations) in general should be avoided. When unit testing method postconditions should be asserted instead. However there are ...
1 vote
1 answer
236 views
Should I cover code that should not be able to fail with tests?
I'm asking myself above question since I implemented an API that accesses a third-party API and currently write tests to increase my code coverage in the class that communicates with the third-party ...
0 votes
4 answers
534 views
How to test a service that only connects other services
I'm currently scratching my and my colleagues head about whether and how we could test SyncService::syncFoo in any meaningful way that does not involve basically recreating the whole call tree as ...
0 votes
3 answers
472 views
Would you test this piece of configuration code? How do I determine which code is worth testing?
We have a piece of code that decorates an interface to transparently add retry logic. Inversion of Control configuration service.AddOurRestApiClient() .AddResilienceHandler("Retry", ...
1 vote
2 answers
1k views
Test a wrapper to external static/singleton
I am integrating an external library that declares a singleton, like this: public class External : MonoBehaviour { public static External Instance { get {/*setup inner stuff*/} } public void ...
0 votes
2 answers
227 views
Is it worth testing simple details? [closed]
In front-end projects(made in frameworks like Angular or React), when we correctly encapsulate complex functionalities, the components that really have some relation to the business logic normally ...
0 votes
1 answer
506 views
Is this wrapper class too simple to test?
I have a following class in my PHP code: <?php declare(strict_types=1); use function Http\Response\send; use Psr\Http\Message\ResponseInterface; class ResponseSender implements ...
0 votes
1 answer
240 views
How to test this getRandom() method? [duplicate]
There are strings and each string has a weight in a data structure. The getRandom() method should return a string randomly with its weight/total weight probability. There is already a question on how ...