Monday, February 28, 2011

Running SpecFlow Tests

We are setting up SpecFlow tests, in a BDD approach, before generating the code to satisfy the user stories (features and scenarios). Data layer is generated with Sharp Architecture.

The first error that pops out when trying to run the tests is

 ----> NHibernate.HibernateException : Could not create the driver from NHibernate.Driver.SQLite20Driver.

  ----> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.

  ----> System.IO.FileLoadException : Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

   at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()

To sort this out, check this linked article. Adding those few lines to your nunit-console application configuration file does the trick.

After this, see here how to set up running SpecFlow tests from Visual Studio and automatically generating the report.

No comments: