Gáspár Nagy on software

coach, trainer and bdd addict, creator of SpecFlow; owner of Spec Solutions

SpecFlow 1.6 and after…

by Gáspár on April 5, 2011

logoAfter a lot of work we have finally released SpecFlow 1.6. This was an important milestone of SpecFlow for several reasons:

  • Altogether 11 people have contributed (in compare to 1.5, where “only” 6)
  • Effective usage of the public build server, for the contribution and for preliminary results
  • NuGet package published together with the release

There are many smaller improvements and fixes, but the most important new features are these (see the announcement and the detailed change log for further details):

  • Visual Studio 2010 integration improvements (improved intellisense, go to binding, automatic table formatting)
  • Windows Phone 7 support
  • Assist improvements (dynamic getter for ScenarioContext,
    Table.FillInstance())
  • Step argument transformation for tables and multi-line text
    arguments
  • Integration with Gherkin parser v2.3.5

I have posted recently about the VS2010 improvements and automatic table formatting. If you experience any problems with this features, you can enable SpecFlow debug tracing or disable the problematic features in Tools / Options / SpecFlow. (The trace is emitted to the output window.)

And what will come after 1.6? We have of course several ideas how to improve SpecFlow. Here is a (probably incomplete) list of directions we want to go:

1. Using the generator from the project’s lib folder

The generator interface have been prepared now for running from a different AppDomain, so we want to change the VS2010 integration in a way, that it detects the generator in the project’s lib folder (that was placed there through NuGet for example) and perform the test generation with that. The benefit: the VS integration would be more independent of the runtime and the tools. You can then decide project-by-project when to upgrade to a newer SpecFlow release. Less problems with breaking changes – more frequent releases.

2. Share VS2010 improvements with MonoDevelop

The core infrastructure we use for intellisense and navigation is Visual Studio independent, so we want to reuse that also for the MonoDevelop integration. For that the implementation has to be restructured a bit and the VS-independent parts have to be extracted. We do this together with Dale Ragan, who is the master of the SpecFlow Mono/MonoDevelop integration.

On the CukeUp! I had a good discussion with Aslak Hellesøy about standardizing the data gathered for the autocomplete (e.g. in a json format). This data could be generated build-time and used for other tools in the Cucumber-family providing rich editing experiences. Interesting, isn’t it? Let’s see.

3. Remove duplicated binding-match logic

Currently the logic that decides whether a scenario step matches for a binding is duplicated in the runtime and in the VS integration. This should be cleaned up.

As a part of this, we will establish a dependency between the generator and the runtime (generator depends on runtime), so the file-based sharing can be eliminated.

4. Better dependency handling

I have started to setup a better DI solution for SpecFlow, for

  • better support for parallel scenarios (eliminate static stuff)
  • better extensibility – being able to set/override any dependencies from the config file
  • better support for unit testing

Currently I’m using a mini DI framework, that can be embedded as a single source file (called MiniDi). This is a huge refactoring, so I try to do it step-by-step.

5. Runtime platform improvements

We do want to further improve the support for alternative platform runtimes, like Silverlight or Windows Phone 7 with the help of the contributors. Currently Matt Ellis is working on the asynchronous Silverlight support.

6. Visual Studio 2010 integration improvements

There are a lot of ideas still to improve the editing and navigation experience, like showing the binding status of a step, commenting out scenario blocks or running the focused scenarios from context menu.

7. Documentation, documentation, documentation

Yes, I know. This is something to be improved. But I hope that by using the github wiki it will be easier to complete the docs and keep it up-to-date.

Like before, we are collecting feedback about SpecFlow also through a (new) survey – please fill it in (anonymously or with your name) to help our work.

Once again, thanks to the contributors for their great work in SpecFlow. Also thanks to TechTalk for sponsoring the development and the infrastructure of this open-source project.

imageAt TechTalk we are developing another product, SpecLog, that supports managing your requirements in agile projects. Please have a look at our website: http://www.speclog.net/.

Automatic Table Formatting in SpecFlow

by Gáspár on April 5, 2011

In the new SpecFlow v1.6 release, besides other Visual Studio 2010 integration improvements there is one more that I did not mention in my previous post: the automatic table formatting.

I have spent a lot of time by aligning the table columns in the Gherkin files. This new feature tries to address this problem: whenever you type a pipe (|) character in a table that has at least two rows, it realigns the table columns. Here are the rules for the aligning:

  • the column widths are calculated based on the cell texts (header and body) without starting/ending whitespaces
  • the cell values are aligned to the left with a single padding space
  • there is at least one padding space on the right
  • the indentation whitespaces of the header row are repeated for the subsequent rows
  • comment lines between table rows are handled

The formatting is applied only to the table (parts) before the typed pipe character, simply because of technical reasons: it was easier to preserve the current cursor position this way. Though this sounds a bit weird, this should be still natural if you type in the table row-by-row. If you want to reformat an existing table, just simply re-type the last pipe character.

If the automatic formatting is not something you like, you can either press “Undo” after you typed in the pipe, or you can disable this feature from Tools / Options / SpecFlow.

Building Windows Phone 7 Applications on build server without installing the SDK

by Gáspár on March 29, 2011

I don’t like installing SDKs on build servers, especially ones that are relative new and gets updated frequently. In the new SpecFlow release, we provide support for WP7. In order to build this on our build server, I had to solve this problem. Here are my findings.

I have based my work on the post of Jeff Wilcox. The solution for WP7 is almost the same as he describes, but there is a small trick.

So I have created the following folders in the project’s lib collection:

  • lib\Silverlight\v4.0\Reference Assemblies – with the content of “C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0”, except the Profile folder. This can be also reused for normal SL4 projects.
  • lib\Silverlight for Phone\v7.0\MSBuild – with the content of “C:\Program Files (x86)\MSBuild\Microsoft\Silverlight for Phone\v4.0”.
  • lib\Silverlight for Phone\v7.0\Libraries – with the content of “C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Libraries\Silverlight”.
  • lib\Silverlight for Phone\v7.0\Reference Assemblies – with the content of “C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone”.

Unfortunately there is a special step in the WP7 Microsoft.Silverlight.Common.targets file that sets the reference paths without any condition. Because of this, you cannot specify the paths explicitly. I have duplicated this target (GetFrameworkPaths) and decorated it with a condition. This I’ve saved to a separate targets file inside lib\Silverlight for Phone\v7.0\MSBuild called Microsoft.Silverlight.Common.OverridesForBuild.targets. You can download the entire file from here, but the actual change is really just a condition:

<PropertyGroup 
Condition="'$(UseCustomWindowsPhoneSDKFolder)'!='true'">
<_FullFrameworkReferenceAssemblyPaths>
<TargetFrameworkDirectory>
PropertyGroup>

After this preparation, you can change your project file to use the dependencies from the lib folder. For this you need to open the project file in an XML editor and change the Import sections to the following:

<PropertyGroup>
<WindowsPhoneBuildResources>..\lib\Silverlight for Phone\v7.0WindowsPhoneBuildResources>
<SilverlightBuildResources>..\lib\Silverlight\v4.0SilverlightBuildResources>
<TargetFrameworkDirectory>$(WindowsPhoneBuildResources)\Reference AssembliesTargetFrameworkDirectory>
<TargetFrameworkSDKDirectory>$(WindowsPhoneBuildResources)\LibrariesTargetFrameworkSDKDirectory>
<_FullFrameworkReferenceAssemblyPaths>$(SilverlightBuildResources)\Reference Assemblies_FullFrameworkReferenceAssemblyPaths>
<UseCustomWindowsPhoneSDKFolder>trueUseCustomWindowsPhoneSDKFolder>
<SilverlightRuntimeVersion>4.0SilverlightRuntimeVersion>
PropertyGroup>
<Import Project="$(WindowsPhoneBuildResources)\MSBuild\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
<Import Project="$(WindowsPhoneBuildResources)\MSBuild\Microsoft.Silverlight.CSharp.targets" />
<Import Project="$(WindowsPhoneBuildResources)\MSBuild\Microsoft.Silverlight.Common.OverridesForBuild.targets" />

You might need to change the lib folder reference in the first two properties according to your setup.

With these I was able to build our solution on the build server.

Highlights of SpecFlow’s new VS2010 integration features

by Gáspár on March 19, 2011

The new SpecFlow release will come with a few nice improvements for Visual Studio 2010 integration. I have made a few screenshots to show the most interesting ones.

image 
Intellisense for keywords

imageImproved intellisense for steps, including binding information and examples from the feature files in the project (you can also see if the step was used in a scenario outline)

image
Go to binding – We have been waiting for this for a long time…

image
Re-generating code-behind after changing the configuration

image
Re-generating code-behind after upgrading the project

SpecLog Comes!

by Gáspár on February 2, 2011

In November 2009 we have started with the SpecFlow project to support .NET community with a BDD tool that is nicely integrating to the development environment. Through SpecFlow and the projects we delivered, we have learned a lot about agile requirement analysis and BDD.image

And now, after 14 months we also have something new to share! At the BDD eXchange, we have already talked about the development process of our new product, SpecLog, and now we are really close to release the first beta. On the right hand side, you can see our iteration burndown from today morning.

SpecLog is a collaborative tool for agile requirement engineering with strong integration to SpecFlow and ALM tools (initially TFS 2010). Stay tuned to http://www.speclog.net, where we will publish detailed information and the beta download this week.

image