BDD - Files/Folders/Namespaces (BDD)
Files/Folders
One thing that can be troublesome when moving from TDD to BDD is how to organize your files and folders, so far I've tried two approaches:
- One class in each file - So if you have When_associating_an_order_with_a_customer and When_associating_an_order_with_a_preferred_customer then they'd be in seperate files even though they are very closely related. If they share a base class, or a class they both compose, then that would be in yet another class (presumably).
- Multiple classes per file - As an example you might group the Order addition contexts into a file called OrderPlacementSpecifications, the file could also contain the shared base class (if you went down that road).
- Gives the reader extra information - By grouping the two order placement classes we tell the reader that they are quite closely related.
- Simplifies folder structure - If we go for the other approach, one class in each file, then we're probably going to have to have more folders. The addition of the extra files and folders definitely makes the solution file harder to structure.
In addition to files/folders I've tried a few approaches to structuring namespaces but the approach I'm trying now groups related artifacts. For example:
- Specifications.Users.Domain
- Specifications.Users.Domain.Contacts
- Specifications.Users.Services
- Specifications.Users.Domain.Repositories
- Specifications.Users.UI.Controllers
Folder wise however we're using a standard approach where your Repositories are in a completely seperate folder from your controllers, even though they might both relate to a particular entity. To me the lack of relationship between our folders and namespaces isn't a problem though, with R# its easy to find a file/type and in addition the folder/namespace tell you two different things about your codebase (one by "layer", one by "feature").
So I'm interested in peoples views? I'm guessing you'll all dislike it though because from what I've seen no matter what you do people will be unhappy with your file/folder/namespace scheme. Pluse we'll probably turn against this approach next week....
I have implemented an advanced Category attribute for NUnit:
ReplyDeletepublic class TagAttribute : CategoryAttribute
{
public TagAttribute(InScopeWith scope) : base(scope.ToString())
{
}
}
where InScopeWith is
public enum InScopeWith
{
Account /*etc*/
}
and I use it in this way:
[Test]
[Tag(InScopeWith.Account)]
public void Transfer_to_cash_account()
{ ...
This comment has been removed by the author.
ReplyDelete