Tuesday, February 9, 2016

SpecFlow v2 finally arrived

We had to wait for it a long time, but now it’s finally there, a new release of SpecFlow; my favorite  Behaviour-Driven Development (BDD) tool.

So what’s new?

Important changes in SpecFlow V2 include:

  • All components upgraded to .NET 4.5.
  • Upgraded to the new Gherkin 3 parser
  • Support for parallel SpecFlow tests within the same AppDomain
  • Visual Studio integration has been separated to a separate project
  • Support for xUnit 2.0 and NUnit 3.0, including parallel test execution. The older providers have been retained and renamed (to xunit.1 and nunit.2 respectively).
  • Ability to determine the execution order of hooks (e.g. [BeforeScenario])
  • Extensible table conversions and comparisons for CreateSet, CreateInstance, CompareToSet and CompareToInstance.
  • Access the details of the currently executed step with ScenarioContext.StepContext
  • Display tags in NUnit test adapter in Visual Studio
  • Better regular expression suggestions generated for missing steps with quoted parameters
  • Steps base class provides properties for thread-safe access to feature, scenario and step contexts
  • Scenario and feature context can be injected to the binding class, avoiding static ScenarioContext.Current and FeatureContext.Current accessors
  • Better matching of column names to property names by removing characters that are invalid in property names
  • Small improvements in the DI framework
  • Easily configure SpecFlow to work with MSTest using the SpecFlow.MsTest NuGet package
  • Test execution report now includes “tags” in the NUnit report, which can be displayed using a custom XSLT
  • Removed .NET runtime version from generated file headers to avoid unwanted changes

If you never used SpecFlow before, now is a good time to try it out. Writing tests will never be the same again…

Remark: If you are already using SpecFlow today, don’t forget to check the upgrade guide: http://www.specflow.org/updating-to-specflow-2/

Monday, February 8, 2016

Shrink your environmental footprint: IFIXIT

With a small boy in the house, our pile of broken things kept growing and growing, not only toys but also electronic devices(think remote controls and XBOX controllers Smile) and other household stuff ended on the pile after he tried to use it in a kind of destructive fashion.

Instead of throwing everything away, it was time to dust off my soldering and electronic skills and try to repair some of these things. This was easier said than done as most electronic devices(including toys) seems to not be created with repairability in mind.

Luckily I discoved IFIXIT, an amazing site with lots of great (free!) step-by-step repair manuals. If you want to stop throwing things away and start with shrinking your environmental footprint, this site is a great help.

image

And if you need some tools to get your repair work going, they sell repair kits, spare parts and tools. I’m a fan!

Friday, February 5, 2016

F# Beginner Tip: File order matters!

One thing that you should be aware of when you build your first ‘real’ F# application, is that in F# file order matters. F# requires files (and code within) to be in dependency order. This means that you have to rethink how to organize your code. Have a look at the following post on http://fsharpforfunandprofit.com/(great site btw for every F# developer out there):

http://fsharpforfunandprofit.com/posts/recipe-part3/

Luckily Visual Studio provides some context menu options that allow you to re-order the files inside your F# projects:

image

Thursday, February 4, 2016

SonarQube: Error when running it as a Windows Service

After installing SonarQube, you can run it as a Windows Service by executing the InstallNTService.bat file inside the %SONARQUBE_HOME%/bin/windows-x86-32/InstallNTService.bat folder.

However when I tried to do this, it failed silently and I only saw the following on the command line:

--> Wrapper Started as Service

Launching a JVM...

Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org

Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

<—Wrapper Stopped

Luckily the documentation brought the answer.By default the SonarQube windows service is installed under a local account but you need administrative permissions to be able to run SonarQube.

Here are the steps to fix it:

  • Open the list of installed services on your system(search for services.msc)
  • Right click on the SonarQube service in the list
  • Click on Properties
  • Go to the LogOn tab
  • Change the LogOn from a Local System Account to another account with administrative permissions

Wednesday, February 3, 2016

SonarQube configuration error: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path

While configuring a SonarQube server to use SQL Server, I encountered the following error after enabling Integrated Security in the JDBC connection string. After adding “integratedSecurity=true” I got the following error message when I tried to start SonarQube:

WARNING: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path

Let’s fix this:

That should do the trick…

Tuesday, February 2, 2016

ASP.NET 5 & ServiceFabric: Unable to locate Dependency Microsoft.AspNet.Server.WebListener >= 1.0.0-rc1-final

When adding an ASP.NET 5 Web API to my ServiceFabric solution, restoring the NuGet packages failed with the following error message:

Errors in Projects\MyActor\Web1\project.json
    Unable to locate Dependency Microsoft.AspNet.Server.WebListener >= 1.0.0-rc1-final
Restore complete, 73193ms elapsed


image

This is an issue in the current version of the SDK. You can fix it by executing the following steps:

  • Go to your ASP.NET 5 web project
  • Open the project.json file
  • Add a space to the file and save it
    • This will trigger a NuGet Package restore and the missing dependency will be downloaded

Monday, February 1, 2016

ASP.MVC: Async/Await in action filters

A colleague was having some trouble with his ASP.NET MVC 4 application. Whe he started his application, the process “hanged” and he had to kill the w3wp process to be able to restart.

We were able to pinpoint the problem to a call to an async method inside an Action Filter:

It seems that there is no support for async filters in ASP.NET MVC 4. The call to .Result in the action filter resulted in a blocking operation making the whole application pool unavailable. We solved it by switching to a non async version of the api.

Remark: Note that ASP.NET Web API does have support for async action filters.