specrun


Running Specrun and using 'Baseclass.contrib.Specflow' for cross browser parameterized tests in VS2015


I would like to use SpecRunner along with the library 'Baseclass.Contrib.SpecFlow.Selenium.NUnit.' When I added SpecRunner for SpecFlow 2 from Manage Nuget Packages, the unit test provider was 'SpecRun' in app.config. Then when added to 'Baseclass.Contrib.SpecFlow.Selenium.NUnit' to the solution using Manage Nuget Package, it also added a unit test provider of 'SeleniumNUnit. When I created my feature files and step definitions and tried to run the tests with each feature annotated with a browser tag like '#Browser: Chrome' and use the 'Browser.Current' syntax as the webdriver in my binding methods, it gave me an error. The error was first that I had two unit test providers in the app.config, and that the app.config can only have one unit test provider. SO I commented out the first unit test provider, and received another set of errors:
*Error 2 #error: 'Generation error: Could not load file or assembly 'TechTalk.SpecFlow, Version=1.9.0.77, Culture=neutral, PublicKeyToken=0778194805d6db41' or one of its dependencies. The system cannot find the file specified.' C:\Users\amaddox\documents\visual studio 2013\Projects\SpecFlow\SpecFlow\SpecFlowFeature1.feature.cs 1 8 SpecFlow
*
*Error 33 Custom tool error: Generation error: Could not load file or assembly 'TechTalk.SpecFlow, Version=1.9.0.77, Culture=neutral, PublicKeyToken=0778194805d6db41' or one of its dependencies. The system cannot find the file specified. C:\Users\amaddox\documents\visual studio 2013\Projects\SpecFlow\SpecFlow\SpecFlowFeature1.feature 2 2 SpecFlow
*
So then I tried to uncomment the first and comment the second unit test provider. Same issue. How can I run SpecRun in visual Studio 2015 along with the flexibility of parameterized cross browser tests functionality that 'Baseclass.Contrib.SpecFlow.Selenium.NUnit.Bindings' has to offer? It appears that it wants me to go back to a previous version of Specflow (1.9) and I am using Specflow 2. Not sure how to do this. How do I solve this issue?
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
<section name="autofac" type="Autofac.Configuration.SectionHandler, Autofac.Configuration" /></configSections>
<specFlow>
<!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->
<!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config --><!-- use unit test provider SpecRun+NUnit or SpecRun+MsTest for being able to execute the tests with SpecRun and another provider --><unitTestProvider name="SpecRun" /><plugins>
<add name="SpecRun" />
<add name="Baseclass.Contrib.SpecFlow.Selenium.NUnit" path="..\packages\Baseclass.Contrib.SpecFlow.Selenium.NUnit.1.3.1\tools" /></plugins><unitTestProvider name="SeleniumNUnit" /><stepAssemblies>
<stepAssembly assembly="Baseclass.Contrib.SpecFlow.Selenium.NUnit.Bindings" />
</stepAssemblies></specFlow>
<appSettings>
<add key="seleniumBaseUrl" value="http://localhost:58909" />
</appSettings><autofac>
<components>
<component name="IE" type="OpenQA.Selenium.IE.InternetExplorerDriver, WebDriver" service="OpenQA.Selenium.IWebDriver, WebDriver" instance-scope="per-dependency">
</component>
<component name="Chrome" type="OpenQA.Selenium.Chrome.ChromeDriver, WebDriver" service="OpenQA.Selenium.IWebDriver, WebDriver" instance-scope="per-dependency">
</component>
<component name="Firefox" type="OpenQA.Selenium.Firefox.FirefoxDriver, WebDriver" service="OpenQA.Selenium.IWebDriver, WebDriver" instance-scope="per-dependency">
</component>
<!-- Example of using an injected RemoteDriver:
<component
name="IE"
type="Baseclass.Contrib.SpecFlow.Selenium.NUnit.RemoteWebDriver, Baseclass.Contrib.SpecFlow.Selenium.NUnit.SpecFlowPlugin"
service="OpenQA.Selenium.IWebDriver, WebDriver"
instance-scope="per-dependency">
<parameters>
<parameter name="url" value="http://127.0.0.1:4444/wd/hub" />
<parameter name="browser" value="InternetExplorer">
</parameter>
</parameters>
</component>-->
</components>
</autofac>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="TechTalk.SpecFlow" publicKeyToken="0778194805d6db41" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
*
After a short look at Baseclass.Contrib.SpecFlow.Selenium.NUnit it depends on SpecFlow 1.9. If you want to use it, you have to stick on SpecFlow 1.9.
Additionally it looks like they create their own GeneratorPlugin to generate custom code behind files.
That does not work together with SpecFlow+Runner as it has its own generator.
And two unitTestProviders in the config does not work.
But the SpecFlow+Runner has a feature called "Targets" see http://www.specflow.org/plus/documentation/SpecFlowPlus-Runner-Profiles and search for it there.
You can create a target for each of your browsers and use the ConfigFileTransformation Step to adjust your config for your different browsers.
Another way, but I am not sure if this work. SpecFlow+Runner has support for SpecFlow 1.9 and can execute NUnit tests.
Use the SpecRun.SpecFlow.1-9-0 nuget package and configure the unitTestProvider to the one of baseClass. If they generate the standard NUnit attributes, the SpecFlow+Runner should find the tests and can execute them. But be aware, that you are losing some features with that method.
Full disclosure: I am one of the developers of SpecFlow and SpecFlow+
I rewrote Baseclass.Contrib.SpecFlow.Selenium.NUnit for 2.1 support.
New codebase, #ignore tag support for nunit3 and several testing services like BrowserStack, SauceLabs, TestingBot.

Related Links

How to specify feature with feature's path in SpecRun?
Specrun Command Line Filter by name of feature
Running Specrun and using 'Baseclass.contrib.Specflow' for cross browser parameterized tests in VS2015
SpecRun not integrating tests in Visual Studio 2012

Categories

HOME
deployment
keycloak
dictionary
kde
homebrew
hp-exstream
razor
onelogin
mouse
gnupg
timeout
lombok
samoa
swingx
orleans
mps
kannel
pingfederate
linkerd
nouislider
key-value-observing
google-qpx-express-api
mmenu
wpf-controls
serverside-rendering
dynamics-crm-2013
abstract-class
occlusion
temporary-files
avro4s
no-www
mime
vao
netcdf4
checkboxlist
node-sass
btrace
chain-builder
react-scripts
clean-architecture
blogengine.net
aurelia-validation
smart-table
word-vba-mac
url-pattern
google-feed-api
heidisql
python-stackless
unity-networking
lemon
feedback
varargs
muse
splash
umbraco6
sorl-thumbnail
website-monitoring
tween
codeigniter-url
neolane
mechanize-ruby
srs
java.nio.file
eventual-consistency
sabredav
wsdl-2.0
simba
dmoz
jquery-knob
tridion-worldserver
wse3.0
nsmanagedobject
joyent
invite
createwindow
zend-translate
modelstate
asp.net-profiles
ncqrs
nintendo-ds
boost-smart-ptr
ugc

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App