Skip to content

@pdelre /SpecFlowFeature1.feature secret
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
SpecFlow Hello World
Feature: SpecFlowFeature1
I want to be able to go to google.com
Scenario: Go to google.com
When I navigate to google.com
Then I should go to google.com
using System;
using TechTalk.SpecFlow;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
namespace SpecFlow
{
[Binding]
public class SpecFlowFeature1Steps
{
[When(@"I navigate to google\.com")]
public void WhenINavigateToGoogle_Com()
{
WebBrowser.Current.Navigate().GoToUrl("http://google.com");
}
[Then(@"I should go to google\.com")]
public void ThenIShouldGoToGoogle_Com()
{
Assert.That(WebBrowser.Current.Url, Is.SamePath("http://www.google.com"));
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TechTalk.SpecFlow;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
namespace SpecFlow
{
[Binding]
class WebBrowser
{
public static IWebDriver Current
{
get
{
if (!ScenarioContext.Current.ContainsKey("browser"))
{
ScenarioContext.Current["browser"] = new FirefoxDriver();
}
return ScenarioContext.Current.Get<IWebDriver>("browser");
}
}
[AfterScenario]
public static void Quit()
{
if (ScenarioContext.Current.ContainsKey("browser"))
{
Current.Quit();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.