C#

C#: VIsualStudio 2017 IISE Setup Considerations

Simple Answer

It looks like you are missing a binding information entry in applicationhost.config file.

  1. Open your applicationhost.config file. Possible locations are:

    • %userprofile%\Documents\IISExpress\config\applicationhost.config
    • $(solutionDir)\.vs\config\applicationhost.config (VS2015)
    • Failing that, inspect the output from iisexpress.exe to be sure.
  2. Locate your WebSite entry and add following binding with your machine name.

SpecFlow: 03 - Selenium POM PageObjects & PageActions

Test Definitions For Selenium POM

  • While Selenium3 has done away with the attribute-driven PageFactory, the PageObject Model is still applicable

POM - Page Objects

PageBaseClass

  • Create a BaseClass that will be used for the PageObject classes & their static methods
  • Settings that will be common to all page objects can also reside here, though this base class can simply consume & return the 'driver'
  • The PageObject clases will extend the BaseClass & provide static methods to be called from the PageActions classes

Home_Page

IWebElement = el;

public static void Login_Link(){

el = findElement(By.XPath("//a[@href='/login/']");

}

Login_Link()

Logout_Link()

Login_Page

TxtBox_Username()

TxtBox_Password()

Btn_LoginButton()

SpecFlow: 02 - Gherkin Wiring

SpecFlow Feature File

  • The Feature file uses common Gherkin language
  • In a given project, normally this would be placed in a dedicated Features folder
Feature: LogIn_Feature
    In order to access my account
    As a user of the website
    I want to log into the website

@mytag
Scenario: Successful Login with Valid Credentials
    Given User is at the Home Page
    And Navigate to LogIn Page
    When User enter 'UnityAdmin' and 'UnityAdmin@2017'
    And Click on the LogIn button
    Then Successful LogIN message should display

Scenario: Successful LogOut
    When User LogOut from the Application
    Then Successful LogOut message should display

SpecFlow Test Definitions Generation

  • Once Feature file is created, the SpeckFlow 'Generate Definitions' option will auto-generate the required methods & open a dialog to save the newly created class file.
  • In a given project, normall

SpecFlow: 01 - Stand up Selenium WebDriver Script

Create Feature Folder

 

Add LogIn_Feature.feature file

Feature: LogIn_Feature
    In order to access my account
    As a user of the website
    I want to log into the website

@mytag
Scenario: Successful Login with Valid Credentials
    Given User is at the Home Page
    And Navigate to LogIn Page
    When User enter UserName and Password
    And Click on the LogIn button
    Then Successful LogIN message should display

Scenario: Successful LogOut
    When User LogOut from the Application
    Then Successful LogOut message should display

NuGet Selenium.WebDriver ( 3.12.1 )

 

Create Steps Folder

 

Tags

SpecFlow: 00 - Quick Setup & Test

  • Getting started with SpecFlow begins with setting up the environment & getting proof of concept working
  • Install VS2017, SpecFlow IDE Extension
  • Add Project
  • Install NuGet Packages for SpecFlow, NUnit & NUnit3 Test Adapter
  • Add SpecFlow Feature File
  • Generate Test Definitions
  • Replace method statement stubs with Console.Writeln() statements
  • Build project & Run Test
  • Ensure Test Passed & produced output

VisualStudio Setup

Install Visual Studio 2017 & Dependencies

SpecFlow IDE Plugin

Tools > Extensions and Updates

Search for SpecFlow & Install

SpecFlow NuGet

References > Manage NuGet Packages

Search for SpecFlow & Install

NUnit NuGet

References > Manage NuGet Packages

Search for NUnit & Install

Tags

SpecFlow: C# BDD Framework Runner Example(SpecFlow.org)

SpecFlow+ Getting Started

This section guides you through the process of installing SpecFlow and SpecFlow+ Runner1 and setting up a simple project in Visual Studio. The getting started guide for SpecFlow+ Excel can be found here.

The sample project is intentionally kept very simple and consists of a basic “calculator” that adds two numbers and returns the result. You will define a test scenario to automate the testing of the calculator’s code.

This guide contains the following sections:

Subscribe to C#