How to Use Different app.config for Each Developer

UPDATED: See this post for a different way to do this.

In our current team, we’re doing a lot of integration testing, which means we need a well-known state in the database before each test run. We have solved this with a simple restore of a known backup before each test run (using the handy BeforeTestRun attribute of SpecFlow). But we have run into some issues…

This approach means we end up destroying the database for each other all the time during development. So we created a small database for each developer and restored that before each test run. But again, it came back to bite us.

The database name and backup name we’re restoring is stored in app.config, which means you need to change that on your local machine. A simple slip on check-in might have you distribute your app.config to the whole team, putting us...

Read More

Marcus Hammarberg's Journey with Outside-In Development Using SpecFlow

Marcus Hammarberg embarks on an exploration of outside-in development with SpecFlow and ASP.NET MVC. In this narrative, he shares his journey from initial project setup to the implementation of specifications-driven code.

Setting the Stage

Excited about the opportunity to apply outside-in development practices to a real project, Marcus enters the office, ready to tackle the challenge. His project manager, Tobias, assigns him a task to extract tasks from the database to kickstart their learning journey.

Crafting Specifications

Together with Tobias, Marcus refines the project’s specifications, ensuring clarity and alignment with their goals. They define scenarios using Gherkin syntax to articulate the expected behavior of the application.

Implementation Begins

Marcus sets up his development environment in Visual Studio, configuring SpecFlow for executable specifications. He encounters initial challenges but perseveres, leveraging tools like Watin for browser automation to drive the development process forward.

Building the Web Application

With...

Read More

Supported Step Exporter – watch your language

After working intensively with SpecFlow for a while now I have experienced something that I think is common. After a while you have all the steps you need… Or rather, if you write your step regular expressions carefully you’ll end up with a little language that automates the running of your application. So if you stay within the supported language you can simply write Gherkin. In Swedish for example.

It’s really cool to write Swedish that tells what the application should do. And it does it. I wrote about that experience before. The extension of this is that non-developers soon can start to write the specs and run them without any steps needed to be developed. But to do that you’ll need to have communicate which steps are supported.

Also after a while the supported regular expressions steps can be...

Read More

WhiteStepHelper – a small step toward smaller steps

I have been using White in our project for a couple of days now and it’s looking good I must say. I use White in conjunction with SpecFlow to get our specifications in an executable format (that still makes me smile everything I think of it…)

What I soon realized was that much of the White-automating could be pushed to a base class… That is much of the stuff that we’re using and the way we’ll like to do stuff can be pushed downwards.

However – I think that the result is pretty generic and can be used outside our project. So if you need it you can have it.

Well known names

The first thing that we’ve thought about was the fact that most user doesn’t refer to the items in the GUI by the programming name (“So I clicked the btnSearch2-button”, doesn’t sound...

Read More

Snippet for creating testmethod in VB.NET

I’ve already posted this snippet in C#, but as I from time to time need it in VB.NET I’ll post that too. Here you go:

<?xml version=”1.0” encoding=”utf-8” ?> <CodeSnippets xmlns=”http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet”>     <CodeSnippet Format=”1.0.0”>         <Header>             <Title>TestMethod</Title>             <Shortcut>tm</Shortcut>             <Description>Code snippet for creating a testmethod</Description>             <Author>Marcusoft (www.marcusoft.net)</Author>             <SnippetTypes>                 <SnippetType>Expansion</SnippetType>                 <SnippetType>SurroundsWith</SnippetType>             </SnippetTypes>         </Header>         <Snippet>             <Declarations>                 <Literal>                     <ID>methodName</ID>                     <ToolTip>The name of the test</ToolTip>                     <Default>methodName</Default>                 </Literal>             </Declarations>             <Code Language=”VB”>               <![CDATA[<TestMethod()> _               Public Sub should_$methodName$()         ‘ Arrange

        ‘ Act

        ‘ Assert         Assert.Fail(“Implement test!”)     End Sub]]>             </Code>         </Snippet>     </CodeSnippet> </CodeSnippets>

Read More

Virtual PC performance tip Multi-core support

I often get to work with brilliant people. That’s one of the real benefits of being a consultant, I would argue. Last week I got to know Thomas Gyllencreutz, who came onboard my project. He didn’t waste any time in getting the performance in our virtual development environments to new heights. This post is a condensation of his findings that really got our Virtual PC images flying.

A general performance tip is to put your virtual hard drive (.vhd-file) on a separate hard drive, as suggested by Mr. Hanselman.

OK, to get the multi-core support you’ll need to find out how many cores your system has. The easiest way to do that is to open Task Manager (CTRL+SHIFT+Esc) and check the number of CPU boxes under the performance tab:

taskmanagerwith2cores

This guide expects you to have an existing .VHD-file—the one with the performance you want to...

Read More

A story on specification by example in two projects

The last month I’ve read The Goal by Eliyahu M. Goldratt. Apart from being a great book, it was also written in a really interesting way. It’s a novel in which we follow Mr. Alex Rogo and how he learns about the Theory of Constraints. I thought that I might try to mimic that style a bit in this post.

The subject I’m getting back to again and again nowadays is agile for the whole project. In my opinion, agile thoughts often come from development and never get a good foothold in the analysis/requirements or testing departments. “Yes, by all means… Do this agile you like so much, but please let us write the specs and test cases as we always have done.” – is a common reasoning where I’ve been.

OK – on to the story. It comes in two flavors, set in two different companies;...

Read More

Using BDD with SpecFlow, WPF and White

It’s been a while since I blogged. Twitter is taking over. I compensate that with a major blog post.

Background

I written about the project I’m in right now a couple of times before and to make a long story short; we don’t have any requirements! We only have the existing application which we are to “convert” from VB6 to VB.NET. 1:1 is the mantra – which is to be understood as: functional the same.

I have suggested for the team that we work with BDD (or ATDD if you like) to create the requirements as we go. They liked it. A lot!

To not let this post grow totally out of control, I leave the description for that process to another post.

To put my money where my mouth is and show them how it should be accomplished. This blog post is that description.

Read More

Solution to closing the lid of my MacBook cause it to get VERY hot

OK – this might not be one of my ordinary subjects but this was soooo annoying. Sometimes when I closed the lid of my MacBook Pro there were something still running. This caused the battery to drain in about 20 minutes and the computer to go very, very hot. For the first time ever I actually burned myself on a computer.

I have checked around the net for a solution, and even went into a MacStore but as the error comes and goes there’s not much security in the tips.

As suspected one process doesn’t have time to close down and just keeps running. But which one?

In my case it was something called Safe Sleep (that prevents unsaved data from being lost if the power goes out). This is disabled by the following commands in a Terminal window:

sudo pmset -a hibernatemode 0 sudo...
      
Read More

Resovling policy enabled objects with Unity 2.0

I had the opportunity to use Unity and Enterprise Libarary in my current project. On of the really cool features of Enterprise Library (and most Dependency Injection frameworks) is the support for Aspect Oriented Programming. It’s a really neat way of handling the cross-cutting concerns in your application.

I was therefore very surprised when I had a really hard time to get, what I thought was simple, the following scenario to work:

I want the objects that I resolve to be “policy enabled” – i.e. configured in such a way that I can add policies in the configuration that can be picked up later and applied to the resolved objects.

That is, it was hard in Enterprise Library 4.1 and Unity 1.2. I had to scan the net and put together a solution of my own. It was a mix of extension...

Read More