Thoughts about unittest run order

Atila Neves atila.neves at gmail.com
Tue May 7 16:50:23 UTC 2019


On Tuesday, 7 May 2019 at 11:29:43 UTC, H. S. Teoh wrote:
> On Tue, May 07, 2019 at 09:40:27AM +0000, Atila Neves via 
> Digitalmars-d wrote: [...]
>> If the order tests run in is important, the tests are 
>> coupled... friends don't let friends couple their tests.
>
> How do you decouple the tests of two functions F and G in which 
> F calls G?

It depends. If F and G are both public functions that are part of 
the API, then one can't. Otherwise I'd just test F since G is an 
implementation detail.

I consider keeping tests around for implementation details an 
anti-pattern. Sometimes it's useful to write the tests if doing 
TDD or debugging, but afterwards I delete them.



More information about the Digitalmars-d mailing list