I answered a question on Twitter today from a guy who had problems running SpecFlow scenarios with MSTest. That shouldn’t be I thought to myself – in SpecFlow the test runner is only used for the auto-generated stuff (#2 in this pictures) and shouldn’t affect the code you write. Lets try it.
The default test runner is NUnit so first I simply create a new Specs-project and created the following scenario:
I then Nuget’d SpecFlow, Should and NUnit with these commands:
Install-Package SpecFlow Install-Package NUnit Install-Package ShouldFluent
And sure enough – when I compile some NUnit code is auto generated for me:
Kanbanboards V–creating new boards
OK – after the last post of refactoring I now feels great to turn my focus on some new functionality; I want to let the users create new Kanban boards. This involves some new views and controllers stuff, uploading pictures and also changes in the domain model.
I got some valuable feedback from my colleague Joakim Sunden on the real purpose of the Kanban board application / site. I actually never wrote it down. So I’ve updated the first post in the series with the following:
www.kanban-boards.com will be a site where users can upload their Kanban boards for other people to see, vote on and get inspired by. In this way we can share and learn from each other I think and hope.
The creation of this site is documented as my learning process.
On with the show!
New functionality – new scenario
Customize your SpecFlow templates and more
I got this tip from a non-developer. An intern actually. He’s brilliant though and figured this out by himself, about 3 months after I introduced him to SpecFlow. Thank you Dejen – you’re great!
The fact that this is not documented anywhere just adds to the coolness, but also make the solution a bit hackish. Sorry for that.
As it seems – SpecFlow is storing templates for the feature-files in this folder:
C:\Program Files (x86)\TechTalk\ SpecFlow\ItemTemplates\
I’m using a 64-bit system so your path may not contain the (x86)-part.
Here you’ll find a number of zip-archives that contains the templates. You can modify the EventDefinition- (Hooks) and the StepDefinition-templates and (maybe most common) the Feature-template. All the structure is the same so you can follow it in the same manner as below.
How to modify the Feature template
- Make a Copy of the...
Kanbanboards IV–shaping stuff up
I have now coded away for a while and it’s time to reflect a refactor a bit. I don’t like code lying around that I might not need. YAGNI you know…
So I thought I’d give it an hour to clean stuff up. And maybe put some better looks on the site. Hopefully I’ll end up in a better place. Here are the things I have planned:
- Remove all the Views and Controller methods that I’m not using
- Bring in a theme for the site
- Shape up the lists on the first page
- Create a page object to write my acceptance tests against
- Introduce a read service for the site – the start of my CQRS initiative
Man – that looked long! But most of them are small. Just imaging how much better the code will be afterwards.
Here we go.
Remove unused stuff