Gáspár Nagy on software

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

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

Detailed Report for PartCover in TeamCity 5.1

by Gáspár on September 20, 2010

I was configuring a build with TeamCity (for SpecFlow that is hosted on github). After the initial success, I thought I would also enable code coverage in the build. I don’t really believe in code coverage numbers, but if it is easy (and free) to configure, than why not?

TeamCity supports NCover and PartCover out of the box. As I wanted to go for a free solution (SpecFlow is a free, open-source product), I used PartCover (v4.0.10801). PartCover seems to be a great tool, but it is not so easy to set it up with TeamCity. (You can find a lot of questions and discussions about it.) As I can see, there are some improvements in the later versions of PartCover and TeamCity, but still there are some problems.

If you just start with the build server configuration, you should read first Jeremy Skinner’s post. (On TeamCity 5.1, you don’t have to worry with the assembly renaming.) The rest comes here:

Problem: Sometimes you see no results at all

Maybe there are many reasons that can cause this, but for me the problem was an x86/x64 issue. On an x64 build controller, you have to make sure that the test execution and the coverage are all running with the same processor architecture. I’ve achieved success with x86 compilation only, with x64 I always encountered a “…\tmpE1BE.tmp exited with code -1” error. But I did not play with this so much. These are my working settings:

teamcity_partcover_settings

Problem: The reports provided with PartCover don’t work with TeamCity

You can find fixes for the reports in stackoverflow and also on Jeremy’s post, but altogether these reports are not too detailed, e.g. they don’t go into method level. Without knowing which method causes the low class coverage, the numbers are not too helpful (except for your boss). So this leads me to the third problem…

Problem: There is no detailed HTML report available

As I have mentioned above, this was quite a pain for me. So I  refreshed my old XSLT skills (again) and tried to put together a report that shows what I need:

  • global & assembly-level summary
  • top 10 uncovered method
  • detailed method-level report with source code line numbers (it is not possible to embed the source code file from XSLT unfortunately)
  • coverage values excluding the very simple members (simple property get/set, empty constructor, etc.)

The detailed report (for a small solution):

Class details with method-level numbers:

How to setup the detailed report
  1. download the XSLT from here: PartCoverFullReport.xslt
  2. copy the XSLT file in the “xslt” folder of PartCover on the build controller(s) (e.g.: C:\Program Files\PartCover\PartCover .NET 4.0\xslt)
  3. in the build configuration, specify the “Report XSLT” field as:C:\Program Files\PartCover\PartCover .NET 4.0\xslt\PartCoverFullReport.xslt=>index.html

SpecFlow Workshop at Skills Matter / Progressive.NET Tutorials

by Gáspár on May 17, 2010

Luckily escaping the BA strike and the newest volcano ash cloud, on Friday I safely arrived home from the Skills Matter Progressive.NET Tutorials in London.

This was the first time I visited this event and it was a great honor that Jonas and me had been invited to do two workshops about behavior-driven development (BDD) and SpecFlow.

I enjoyed the event very much. I also visited a lot of interesting tracks, but maybe the best was to meet so many enthusiastic and “progressive” developers. It helped me a lot to charge my batteries – to keep on thinking about new ideas and improvements in the development process and technologies.

Chris has written a short summary on our sessions, I don’t want to repeat him. I was very pleased that we got so much interest and positive feedback after the sessions. It was a pleasure to work with Jonas and thanks also for TechTalk’s support.

Let me highlight only two things about the BDD session.

The best part in it (again) was the acceptance criteria writing task, where the attendees had to write 2-3 (the most important) acceptance criteria about the shopping cart feature of a book shop application. The goal of the exercise was to discuss good/bad practices and patterns in formulating scenarios. We thought that the best way to learn these was to learn them on the basis of personal experience. But as we can never guarantee that the attendees will really make those mistakes that we would like to highlight, this is always risky. But it worked again! We didn’t have to show any prepared solution (to be honest we didn’t prepare any), we could explain and discuss a lot of interesting things through the samples the attendees came up with. It was amazing!

In the beginning of the workshop where we wanted to collect possible hopes and fears about BDD to be addresses during the sessions, we had another task as well. Usually we do this with yellow stickers but this time we made a last minute adaption to our process – making the session “progressive”… Instead of stickers, now we used a twitter – everyone could post comments with the term #prognetbdd that we displayed on the projector and discussed. It was a fun!

SpecFlow: Pragmatic BDD for .NET

by Gáspár on October 19, 2009

SpecFlow icon Last year I worked a lot on finding better techniques for automated functional testing.

I was investigating topics like how to solve problems of automated web UI testing (especially ASP.NET), how to structure automated functional tests or how to ensure the preconditions of functional tests. We even created small tools to support this, but altogether it was not a big success.

Finally, we started to use cucumber and this was the first tool where I felt that it supported the concept we need. However, we had some issues with cucumber, too:

  • Using it with .NET projects (through IronRuby) was quite slow, and since the IronRuby documentation is not too detailed, we continually encountered ruby/.net conversion issues that were hard to debug and solve.
  • We had our continuous build infrastructure, but it was not prepared for running cucumber tests.
  • The development team did not have sufficient ruby knowledge.

Considering these problems, we finally decided to move forward: to implement a small .NET running environment for cucumber, where the step definitions are written in .NET. Since I’ve gathered quite a lot of experience with Visual Studio SDK, I came to the idea to implement this tool as a single-file generator that generates NUnit test fixture files from the cucumber file, which can be executed by NUnit runner, also on the build server, without extra configuration.

We resolved to implement the bindings as .NET methods, having [Given], [When] or [Then] attributes.

[Given(“I have entered (.*) into the calculator”)]
public static void GivenIHaveEnteredANrIntoTheCalculator(int nr)
{
    //…
}

The tool contains a runtime part as well that finds the matching step definition method during the test executions and executes them. The first implementation used an Oslo parser, but finally we had to rewrite it to use ANTRL, because of performance issues.

The tool worked surprisingly well and we started to use it in a project where we had our cucumber tests already; we just had to rewrite the step definitions to .NET, since the cucumber files were compatible.

In the meanwhile, TechTalk decided to make an open-source project out of the in-house tool. But life is not easy, we have quickly realized that the names we have used so far (“NCucumber” or “Cucumber for .NET”) cannot really be used as a “trademark”. The cucumber team – somehow understandable – wanted to keep the name “cucumber” for products which are direct ports of cucumber. Although we are compatible in the cucumber file (gherkin) level, we don’t have an own execution environment (NUnit does it for us). So we have chosen the new name: SpecFlow.

The first version of SpecFlow is already available, so you can try it out (the source-code is also coming next week). To learn more, visit the website:

http://www.specflow.org

specflow test execution