Hi Nick,
I created a C# Unit Test Project (.NET Framework) on Visual Studio 2017 community edition and added the latest versions (as of 3/10/2018) of these following .Nuget packages
- Autofac, Autofac.configuration, NUnit, MSTest, Specflow.Assist.Dynamic, TechTalk.Specflow and
Unickq.Specflow.Selenium.SpecFlowPlugin
In the App.config file , I set the test provider to NUnit and set the component name to ChromeDebug as shown below
.....
I then created a feature file called GoogleSearch
Feature: GoogleSearch
Feature to test Google search functionality
We will test auto-search as well as navigationg to search results
@browser:ChromeDebug
Scenario: Google search for Execute Automation term
Given I have navigated to Google page
And I see the Google page fully loaded
When I type the following Keyword
| Keyword |
| Execute Automation |
Then I should see the results for the keyword
| Keyword |
| Execute Automation |
There are some issues with the generated GoogleSearch.feature.cs file
- It does not like the parameter 'GoogleSearchFeature' as shown below
[NUnit.Framework.ParallelizableAttribute("GoogleSearchFeature")]
public partial class GoogleSearchFeature
{
It shows this error when you mouse over 'GoogleSearchFeature'
(Argument1: cannot convert from 'string' to type 'NUnit.Framework.ParallelScope' )
Why is this happening?
-
In your Unickq.SpecFlow.Selenium.Example project's F1.feature,cs file, you have the following code that is missing from my GoogleSearch.feature.cs
using Autofac; // missing from mine
using Autofac.Configuration; // missing from mine
private OpenQA.Selenium.IWebDriver driver; // missing from mine, and all the code referring to driver is missing
private IContainer container; // missing from mine and all the code referring to container is missing
Your file
[NUnit.Framework.TestCaseAttribute("ChromeDebug", etc..]
public virtual void CheckWebsiteTitle(string browser, etc..)
{
InitializeSeleniumBrowser(browser);
versus mine
[NUnit.Framework.CategoryAttribute("Browser:ChromeDebug")]
public virtual void GoogleSearchForExecuteAutomationTerm()
{
// string browser and InitializeSeleniumBrowser(browser); are missing from mine
// also, mine does not have an [NUnit.Framework.TestCaseAttribute it has an
[NUnit.Framework.CategoryAttribute( "Browser:ChromeDebug")
private void InitializeSeleniumBrowser(string browser) // this function is missing from mine
{
driver = container.ResolveNamed<OpenQA.Selenium.IWebDriver>(browser);
}
Because of all the missing code, the following code in the step file is giving errors
if (scenarioContext == null) throw new ArgumentNullException(nameof(scenarioContext));
ScenarioContext = scenarioContext;
Browser = scenarioContext.GetWebDriver();
How can we fix this issue?
Thanks. :)
Burak