Selenium WebDriver +
C# + SpecFlow
Michał Ślęzak
About me
• Software Developer In Test (WhatClinic.com)
• PTaQ (ptaq.org)
• Blog –testingplus.me
• Blog posts series for testuj.pl about SpecFlow
• Mail– kontakt@testingplus.me
Agenda
• Selenium WebDriver &
NUnit
• Tasks 1-4
• SpecFlow
• Task 5 + more (?)
• Keywords in SpecFlow
• CI / DevOps
• Run on AppVeyor
• It’s flexible I’m for you 
Git
https://github.com/testingplusme/SpecFlowAndSeleniumWorkshops
Our test page
https://shopforautomation.wordpress.com
.NET
Selenium WebDriver
E2E Open source
Support main
browsers
Finds Elements
Id / Name
CSS Selector
/ XPath
Selector Gadget / XPath helper / F12
NUnit
• Test runner for .NET
Assertions Possible to check
something
Task 1
• Go to branch „Task 1”
If you have
solution
from github
• Install needed files
• Add project with type as
„Class Library”
• Add NuGet packages
• Nunit / Selenium WebDriver /
ChromeDriver / Selenium
Support
If you don’t
have
SourceTree:
Task 2
Test:
Go to contact page
Fill contact form by random data
Check message view of confirmation
message MESSAGE SENT (GO BACK)
Page
Object
Pattern
PageFactory – register
PageObject
• PageFactory register
IWebElements for Selenium
WebDriver
Task 3
Refactor previous test to Page
Object Pattern
Task 4
Move code to method
„ContactByContactForm()”
Add explicit waits
Explicit waits
ExpectedConditions
ElementIsClickable
it’s enought for 90%
BDD
BDD framework for .NET
Gáspár Nagy
Gherkin
Feature
Keywords
Given
When
Then
Steps
Scenario
Feature.cs
Table
Install SpecFlow to VS
+ NuGet package
Task 5
CI
DevOps
AppVeyor
Run our tests
on AppVeyor
Addtional Tips & Trics
Shoudldy
R#
How to
receive free
R#? If
you’re
student
http://testingplus.me/2017/03/10/r-za-darmo/
Testing trends 2018
Source – „https://az184419.vo.msecnd.net/sauce-labs/white-papers/sauce-labs-state-of-
testing-2018.pdf
Q&A
Source to photos
• https://i.stack.imgur.com/GQVQJ.png graphic about .NET
• https://testuj.pl/wp-content/uploads/2018/04/page-object-pattern-testuj.pl_.png -
graphic about page object pattern
• http://specflow.org/wp-content/uploads/2015/02/Header_Icon_Startpage_05.png -
graphic about living documentation
• https://www.specflow.org/wp-content/uploads/2016/07/SF_Logo.png -Specflow logo
• https://twitter.com/gasparnagy - Gaspar Nagy photo
• https://wac-cdn.atlassian.com/dam/jcr:325fff80-6aa7-4d46-a3f9-4db402f17a8d/devops-
loop-illustrations.png?cdnVersion=kq – DevOps graphic
• https://testuj.pl/wp-content/uploads/2018/02/3.10..png - Table graphic
• https://images.unsplash.com/photo-1449182325215-d517de72c42d?ixlib=rb-
0.3.5&s=46c51f306d535048e7a2528dcf9ef254&auto=format&fit=crop&w=1017&q=80
• Nunit.org –logo nunit

Workshops from konferencjabeit.pl