0
votes
3answers
81 views

Is it good style to check explicitly for null in unit tests?

Whether or not a value is null could be checked implicitly like this: assertThat(value).isEqualTo("something"); Or it could be checked explicitly: assertThat(value).isNotNull(); ...
2
votes
2answers
118 views

How to (or should I) have one assert per test with object comparisons? [duplicate]

I've recently read The Art of Unit Testing by Roy Osherove which I found very useful for helping me establish how to define a good unit test. One key aspect of the guidelines Roy puts forward are to ...
1
vote
1answer
71 views

Assert Message in Unit Tests

I've just begun reading "The Art Of Unit Testing" by Roy Osherove, and while I'm mostly finding the material very helpful, he makes a statement about not using messages in your Assert statements. ...
5
votes
2answers
255 views

Is it ok to use static (compile-time) assertions in unit tests?

Or more generally: to trigger compiler errors in test projects if something that can be checked at compile time is wrong?
5
votes
3answers
474 views

How much to test in TDD?

I am newbie to TDD (writing first project following TDD practices). I have fairly basic interface IProfiler and an implementation Profiler. interface IProfiler { bool IsBusy {get;} long Elapsed ...
15
votes
3answers
3k views

Should I still use Debug.Assert today?

I recently came across some newly written code that was interspersed with lots of Debug.Assert (C#). Should we still use this widely despite the usage of TDD, BDD and Unit Testing in general?
0
votes
3answers
360 views

Is Debug.Assert obsolete if you write unit tests?

Just like the question asks, is there a need to add Debug.Assert into your code if you are writing unit tests (which has its own assertions)? I could see that this might make the code more obvious ...
25
votes
3answers
2k views

Are asserts or unit tests more important?

Both asserts and unit tests serve as documentation for a codebase, and a means of discovering bugs. The main differences are that asserts function as sanity checks and see real inputs, whereas unit ...