Clean Architecture and acceptance tests

139 views
Skip to first unread message

Michael Azerhad

unread,
Jun 23, 2016, 6:49:35 PM6/23/16
to Clean Code Discussion
Hi,

Imagine a use case : listing some items. 
Imagine another use case :   create an item. 

I want to start with acceptance tests against the interactors part of the clean architecture (as recommended by Uncle Bob).

I started with the first use case, since it provides a good business value to customer. 
Since the (second) use case for creating items didn't exist yet, I provide a fixture that populate the repository with some items; in order to be listed; so that I fulfill the acceptance test of the use case.  

I passed the first test for the first use case :  listing some items.

Then, I pass the test for the second use case : creating an item. 

Question :  Should I now replace the fixture (pre-populated items repository)  within the first acceptance test by a call to the "create an item" use case ? 
Meaning, should a use case depend on another use case in acceptance tests on interactor parts ?

Norbert Nemes

unread,
Jun 29, 2016, 9:06:53 AM6/29/16
to Clean Code Discussion
Personally I wouldn't. Simply because of the dependency. If you do it, and your create item use case ever breaks, your list items use case breaks too, despite having nothing to do with each other (conceptually).

Regards,

Norbert

Reply all
Reply to author
Forward
0 new messages