SlideShare a Scribd company logo
1 of 29
Download to read offline
GTC-NL-FXD Rachid Kherazi
Behavior Driven Testing (BDT)
with MS VS2010 & SpecFlow
Confidential
GTC-NL for internal use
Goal of presentation
• Informative
• Share my knowledge w.r.t. Testing and Test tools
In the scope of “did you know?”
Gathered in my daily train trips
Amstelveen Best
Confidential
GTC-NL for internal use
Qeustion 1: what are the following two vegetables?
Subject of today is related to some vegetables
Answer 1: Cucumber Gherkin
Question 2: What is the difference between the two?
Answer 2:
Cucumber: Tool, behavior driven development, …
Gherkin: Language, Business Readable, Domain Specific Language,..
Let start with a Quiz
Confidential
GTC-NL for internal use
Content
• Behavior Driven Development (Development view)
– Agile Iteration and Test Driven Development (TDD)
– What’s all these DD’s? (TFD, TDD, BDD, ATDD and SDD)
– Scenario/Story and Gherkin-syntax
– Executable Specification
– Behavior Driven Development tools
– Live demo with SpecFlow
• Behavior Driven Testing (Test view)
– DDB vs BDT
Confidential
GTC-NL for internal use
http://www.synerzip.com/agile-method.htm
Introduction: Agile iterations and TTD
Confidential
GTC-NL for internal use
ATDD
- Acceptance Test Driven
- Different than BDD?
- Start with the acceptance test
- Examples,
(2) Write the
implementation code to
make the test pass. Keep
it simple
(3) Change the code to
remove duplication in code
and to improve the design
while ensuring that all tests
still pass.
(1) Imagine how the new
code should be called and
write the test as if the code
already existed
Confidential
GTC-NL for internal use
What are the advantages of TDD?
• TDD shortens the programming feedback loop
• TDD provides detailed specification (tests)
• TDD promotes the development of high-quality code
• TDD provides concrete evidence that your software works
• TDD supports evolutionary development
• TDD encourages developers to write code that is easily tested
TDD is used in
Agile development
eXtreme programming
Confidential
GTC-NL for internal use
ATDD
- Acceptance Test Driven
- Different than BDD?
- Start with the acceptance test
- Examples,
Test First
Development
Refactor
TDD
Start from acceptation test
Focus on behavior of feature
S/BDD
Confidential
GTC-NL for internal use
What’s all these DD’s?
TFD Test First Development
TDD Test Driven Development
ATDD Acceptance Test Driven Development
BDD Behavior Driven Development
STDD Story Test Driven Development
TTD = Test First Development + Refactor (remove duplicate, improve design)
Micro view
ATDD start for end user acceptance test
Macro view
BDD focus on the behavior of the feature
Based on user story: a couple of examples on how SUT could be used
Story written in a standard syntax: e.g. Given / When / Then
The [Given, When, Then] syntax is called Gherkin
First create test (Failing test) than create implementation (Test passed)
Given [initial context]
When [event]
Then [an outcome]
Subsequent steps of the same kind can also be specified with the “And “ and “But” keyword
Variations on a Theme
Context
Specification
AAA
User Story
Structure
Establish
Initial Context
Given
Arrange
SetContext
Interact with
SUT
When
Act
BecauseOf
Check the
results
Then
Assert
ItShould
Confidential
GTC-NL for internal use
Example: Application Under Test
(3) Application displays “Hello Best Tester: Password is Correct”
(If password = “Rachid”)
(1) type password “Rachid”
(2) press Login button
(0) start application
“Say Hello Best Tester” a simple application for demo purpose.
According req. of this tool: “Rachid”, “Ali” and ‘Pieter” are correct passwords for login.
Confidential
GTC-NL for internal use
Example: Feature file (Scenario’s: Given When Then)
Feature: Log-In in “Best Tester Application”, check correctness of
password
Scenario: Check Login with correct password
Given Application is started
When correct password is typed
And Login button is pressed
Then Login should be successful
And Messagebox should display "Hello Best Tester: Password Correct"
Describe some piece of functionality of the system
Plain readable text
Features contain one or more scenarios
A scenario describes a single acceptance test for a feature
Most features are composed of multiple scenarios
Tool generates a test for each scenario
The name of the test is generated from the scenario title
Confidential
GTC-NL for internal use
When scenario/story is in place it would be wonderful if there is a
tool that can run this scenario’s to verify that the implementation
actually behaves as specified.
Executable specification that verifies that the implementation behaves as expected, readable by all in the team, and around it
Requirements
/Behavior
In well known
format
e.g.
Given/When/Then
Tool
Implementation
(SUT)
Main benefit
Main benefit is not in the tool!
The benefit is that team get together and write down a common,
shared knowledge in a well known format. In one place.
Confidential
GTC-NL for internal use
Tools
This was the idea of Cucumber tool that first was created in the Ruby-community.
Cucumber can execute scenarios written in the Given/When/Then-syntax.
For .Net framework SpecFlow is known good tool.
Both tools used Gherkin syntax and are free (open source).
Cucumber
Ruby
SpecFlow
.Net
Confidential
GTC-NL for internal use
Behavior Driven Development in one slide
Feature file
(Scenario’s: Given When Then)
Test class (for Nunit)
Generated by SpecFow tool (.cs)
Stepper class
binding with implementation (.cs)
Implementation
(.dll, .exe)
Nunit dll
Nunit
Test
report
Code of Implementation (.cs)
Visual Studio 2010 + SpecFlow
SW developer
Requirements
User
feedback1
2
3
4
5
6
7
8
Confidential
GTC-NL for internal use
Some handy Attributes
Background
With the keyword background you can run some steps before each scenario in the
feature.
Hooks
Hooks are events that is fired in the following order.
And you can “hook in” code here to do useful things:
- Restore a database
- Dump a log on error
- Init variables before steps
Scenario outlines
Data-driven scenarios or scenario templates
Consists of Scenario template specification with data placeholders
Tool generates parameterized test logic for the scenario outline and individual test
method for each example set (using pairwise testing)
Confidential
GTC-NL for internal use
Some handy Attributes
Tag
Can be used to specify “categories” for Nunit or other test runners
e.g. @RegressionTestSet
@ignore tag is a special tag “ignore test”
# is reserved for comment
#language
The language of the feature files can be either specified globally in the
configuration file or in the header of the feature file using “#language” keyword
different ISO languages are supported
Debugging Tests
SpecFlow Visual Studio integration also supports debugging the execution of the
tests. Just like in the source code files of your project, you can also place
breakpoints in the SpecFlow feature files. Whenever you execute the generated
tests in debug mode, the execution will stop at the specified breakpoints and you
can execute the steps one-by-one using the standard “Step Over” (F10)
command or you can go to the detailed execution of the bindings using the “Step
Into” (F11) command.
Confidential
GTC-NL for internal use
SpecFlow configuration file
language
Test runner
Stop at error
Confidential
GTC-NL for internal use
Live demo “SayHello Application”
VS 2010 and SpecFlow Link Nunitdll
Confidential
GTC-NL for internal use
SpecFlow and generated Test Results
SpecFlow tool generates clear and concise report
Report
Confidential
GTC-NL for internal use
Behavior Driven Development in one slide
Feature file
(Scenario’s: Given When Then)
Test class (for Nunit)
Generated by SpecFow tool (.cs)
Stepper class
binding with implementation (.cs)
Implementation
(.dll, .exe)
Nunit dll
Nunit
Test
report
Code of Implementation (.cs)
Visual Studio 2010 + SpecFlow
SW developer
Requirements
User
feedback1
2
3
4
5
6
7
8
Confidential
GTC-NL for internal use
Behavior Driven Testing in one slide
Feature file
(Scenario’s: Given When Then)
Test class (for Nunit)
Generated by SpecFow tool (.cs)
Stepper class
binding with implementation (.cs)
SUT (FlashLite)
Nunit dll
Bello/Nunit
Test
report
Visual Studio 2010 + SpecFlow
Requirements
Tester SW/FW developer
implementation
code
Development
environment
User
SW/FW Implementation
feedback
4
2
3
1
5
Confidential
GTC-NL for internal use
http://www.synerzip.com/agile-method.htm
Behavior driven testing
Development domain
Test domain
Confidential
GTC-NL for internal use
BDD vs BDT
• Behavior Driven Development (BDD)
– Development domain
– White box
– Micro view
– Input = specification (Behavior)
– Output = Implementation
• Behavior Driven Testing (BDT)
– Test domain
– Black box (interface)
– Macro view
– Input = Specification (Behavior)
– Output = Test
Confidential
GTC-NL for internal use
Requirement Based Testing in one slide
Feature file
(Scenario’s: Given When Then)
Test class (for Nunit)
Generated by SpecFow tool (.cs)
Stepper class
binding with implementation (.cs)
SUT (FlashLite)
Nunit dll
Bello/Nunit
Test
report
Visual Studio 2010 + SpecFlow
Requirements
doc
SW/FW developer
implementation
code
Development
environment
User
SW/FW Implementation
feedback
4
3
2
1
5
Spec.doc to Feature file
convertor
(2) = refactor= clean up and improveTester
To be
developed
Confidential
GTC-NL for internal use
Learn more about SpecFlow and BDD
http://blog.dannorth.net/introducing-bdd/
http://www.specflow.org/
https://github.com/techtalk/SpecFlow
http://github.com/techtalk/SpecFlow-Examples
http://github.com/aslakhellesoy/cucumber/wiki
http://www.marcusoft.net/search/label/SpecFlow
https://github.com/marcushammarberg/
https://www.marcusoft.net
Free downloadable book
Confidential
GTC-NL for internal use
1, 2, 3
Given
When
Then
[TestMethod]
public void
Total_Should_Be_1_When_1_Product_Added()
{
var cart = new ShoppingCart("TEST");
cart.AddItem(new Product("SKU"));
Assert.AreEqual(1, cart.TotalItems);
}

More Related Content

What's hot

Robot Framework Introduction
Robot Framework IntroductionRobot Framework Introduction
Robot Framework IntroductionPekka Klärck
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumLiraz Shay
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using SeleniumNaresh Chintalcheru
 
Test Automation
Test AutomationTest Automation
Test Automationrockoder
 
An introduction to Behavior-Driven Development (BDD)
An introduction to Behavior-Driven Development (BDD)An introduction to Behavior-Driven Development (BDD)
An introduction to Behavior-Driven Development (BDD)Suman Guha
 
Setting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation FrameworkSetting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation Frameworkvaluebound
 
Web automation using selenium.ppt
Web automation using selenium.pptWeb automation using selenium.ppt
Web automation using selenium.pptAna Sarbescu
 
Automation Testing with Test Complete
Automation Testing with Test CompleteAutomation Testing with Test Complete
Automation Testing with Test CompleteVartika Saxena
 
Test Case Creation in Katalon Studio
Test Case Creation in Katalon StudioTest Case Creation in Katalon Studio
Test Case Creation in Katalon StudioRapidValue
 
An Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnitAn Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnitweili_at_slideshare
 
TestNG Session presented in PB
TestNG Session presented in PBTestNG Session presented in PB
TestNG Session presented in PBAbhishek Yadav
 
Test Automation Framework Development Introduction
Test Automation Framework Development IntroductionTest Automation Framework Development Introduction
Test Automation Framework Development IntroductionGanuka Yashantha
 
05 junit
05 junit05 junit
05 junitmha4
 

What's hot (20)

Robot Framework Introduction
Robot Framework IntroductionRobot Framework Introduction
Robot Framework Introduction
 
JUNit Presentation
JUNit PresentationJUNit Presentation
JUNit Presentation
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and Selenium
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
 
Automated Test Framework with Cucumber
Automated Test Framework with CucumberAutomated Test Framework with Cucumber
Automated Test Framework with Cucumber
 
Pytest KT.pptx
Pytest KT.pptxPytest KT.pptx
Pytest KT.pptx
 
BDD with Cucumber
BDD with CucumberBDD with Cucumber
BDD with Cucumber
 
Test Automation
Test AutomationTest Automation
Test Automation
 
An introduction to Behavior-Driven Development (BDD)
An introduction to Behavior-Driven Development (BDD)An introduction to Behavior-Driven Development (BDD)
An introduction to Behavior-Driven Development (BDD)
 
N Unit Presentation
N Unit PresentationN Unit Presentation
N Unit Presentation
 
Setting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation FrameworkSetting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation Framework
 
Web automation using selenium.ppt
Web automation using selenium.pptWeb automation using selenium.ppt
Web automation using selenium.ppt
 
Automation Testing with Test Complete
Automation Testing with Test CompleteAutomation Testing with Test Complete
Automation Testing with Test Complete
 
Test Automation Framework with BDD and Cucumber
Test Automation Framework with BDD and CucumberTest Automation Framework with BDD and Cucumber
Test Automation Framework with BDD and Cucumber
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Test Case Creation in Katalon Studio
Test Case Creation in Katalon StudioTest Case Creation in Katalon Studio
Test Case Creation in Katalon Studio
 
An Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnitAn Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnit
 
TestNG Session presented in PB
TestNG Session presented in PBTestNG Session presented in PB
TestNG Session presented in PB
 
Test Automation Framework Development Introduction
Test Automation Framework Development IntroductionTest Automation Framework Development Introduction
Test Automation Framework Development Introduction
 
05 junit
05 junit05 junit
05 junit
 

Viewers also liked

Selenium + Specflow
Selenium + SpecflowSelenium + Specflow
Selenium + Specflowcromwellryan
 
Bdd – with cucumber and gherkin
Bdd – with cucumber and gherkinBdd – with cucumber and gherkin
Bdd – with cucumber and gherkinArati Joshi
 
Behaviour Driven Development with SpecFlow
Behaviour Driven Development with SpecFlowBehaviour Driven Development with SpecFlow
Behaviour Driven Development with SpecFlowPascal Laurin
 
Behavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile TestingBehavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile Testingdversaci
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)Lars Thorup
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven DevelopmentLiz Keogh
 
Brand mangement main
Brand mangement mainBrand mangement main
Brand mangement mainprashhh
 
Abductionexperience
AbductionexperienceAbductionexperience
Abductionexperiencegorin2008
 
Aliens syllabus-2010aliens-syllabus-2010
Aliens syllabus-2010aliens-syllabus-2010Aliens syllabus-2010aliens-syllabus-2010
Aliens syllabus-2010aliens-syllabus-2010gorin2008
 
Delilah Panio - 2012 Un-Resume
Delilah Panio - 2012 Un-ResumeDelilah Panio - 2012 Un-Resume
Delilah Panio - 2012 Un-ResumeDelilahPanio
 
Ad Libitum 07
Ad Libitum 07Ad Libitum 07
Ad Libitum 07soumitroy
 
PeopleZone
PeopleZonePeopleZone
PeopleZoneCodeZone
 
By carolina and julia
By carolina and juliaBy carolina and julia
By carolina and julialola caravaca
 
Presentación david human reproduction
Presentación david human reproductionPresentación david human reproduction
Presentación david human reproductionlola caravaca
 

Viewers also liked (20)

Selenium + Specflow
Selenium + SpecflowSelenium + Specflow
Selenium + Specflow
 
Bdd – with cucumber and gherkin
Bdd – with cucumber and gherkinBdd – with cucumber and gherkin
Bdd – with cucumber and gherkin
 
Behaviour Driven Development with SpecFlow
Behaviour Driven Development with SpecFlowBehaviour Driven Development with SpecFlow
Behaviour Driven Development with SpecFlow
 
Behavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile TestingBehavior Driven Development (BDD) and Agile Testing
Behavior Driven Development (BDD) and Agile Testing
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven Development
 
Ecosystems gimena
Ecosystems gimenaEcosystems gimena
Ecosystems gimena
 
Brand mangement main
Brand mangement mainBrand mangement main
Brand mangement main
 
Abductionexperience
AbductionexperienceAbductionexperience
Abductionexperience
 
Bader ufo3
Bader ufo3Bader ufo3
Bader ufo3
 
Crime
CrimeCrime
Crime
 
Aliens syllabus-2010aliens-syllabus-2010
Aliens syllabus-2010aliens-syllabus-2010Aliens syllabus-2010aliens-syllabus-2010
Aliens syllabus-2010aliens-syllabus-2010
 
Delilah Panio - 2012 Un-Resume
Delilah Panio - 2012 Un-ResumeDelilah Panio - 2012 Un-Resume
Delilah Panio - 2012 Un-Resume
 
465
465465
465
 
Ad Libitum 07
Ad Libitum 07Ad Libitum 07
Ad Libitum 07
 
PeopleZone
PeopleZonePeopleZone
PeopleZone
 
Bader ufo3
Bader ufo3Bader ufo3
Bader ufo3
 
By carolina and julia
By carolina and juliaBy carolina and julia
By carolina and julia
 
Presentación david human reproduction
Presentación david human reproductionPresentación david human reproduction
Presentación david human reproduction
 
Nazi
NaziNazi
Nazi
 

Similar to Behavior Driven Development with SpecFlow

TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012Tieturi Oy
 
CucumberSeleniumWD
CucumberSeleniumWDCucumberSeleniumWD
CucumberSeleniumWDVikas Sarin
 
Behavior Driven Development by Example
Behavior Driven Development by ExampleBehavior Driven Development by Example
Behavior Driven Development by ExampleNalin Goonawardana
 
PHPConf.asia 2016 - BDD with Behat for Beginners
PHPConf.asia 2016 - BDD with Behat for BeginnersPHPConf.asia 2016 - BDD with Behat for Beginners
PHPConf.asia 2016 - BDD with Behat for BeginnersAdam Englander
 
Tdd is not about testing (C++ version)
Tdd is not about testing (C++ version)Tdd is not about testing (C++ version)
Tdd is not about testing (C++ version)Gianluca Padovani
 
Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010guest5639fa9
 
Test Driven Development (TDD) with FlexUnit 4 - 360|Flex San Jose preso
Test Driven Development (TDD) with FlexUnit 4 - 360|Flex San Jose presoTest Driven Development (TDD) with FlexUnit 4 - 360|Flex San Jose preso
Test Driven Development (TDD) with FlexUnit 4 - 360|Flex San Jose presoElad Elrom
 
Automated Developer Testing: Achievements and Challenges
Automated Developer Testing: Achievements and ChallengesAutomated Developer Testing: Achievements and Challenges
Automated Developer Testing: Achievements and ChallengesTao Xie
 
Zend con 2016 bdd with behat for beginners
Zend con 2016   bdd with behat for beginnersZend con 2016   bdd with behat for beginners
Zend con 2016 bdd with behat for beginnersAdam Englander
 
Manual testing visonia
Manual testing   visoniaManual testing   visonia
Manual testing visoniaVisoniaTechlab
 
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Ukraine
 
Susan windsor soft test 16th november 2005
Susan windsor soft test   16th november 2005Susan windsor soft test   16th november 2005
Susan windsor soft test 16th november 2005David O'Dowd
 
Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Gianluca Padovani
 
Katalon Studio - Successful Test Automation for both Testers and Developers
Katalon Studio - Successful Test Automation for both Testers and DevelopersKatalon Studio - Successful Test Automation for both Testers and Developers
Katalon Studio - Successful Test Automation for both Testers and DevelopersKatalon Studio
 
Testing apps with MTM and Tea Foundation Service
Testing apps with MTM and Tea Foundation ServiceTesting apps with MTM and Tea Foundation Service
Testing apps with MTM and Tea Foundation ServiceKevin DeRudder
 

Similar to Behavior Driven Development with SpecFlow (20)

TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
 
CucumberSeleniumWD
CucumberSeleniumWDCucumberSeleniumWD
CucumberSeleniumWD
 
Gherkin /BDD intro
Gherkin /BDD introGherkin /BDD intro
Gherkin /BDD intro
 
Behavior Driven Development by Example
Behavior Driven Development by ExampleBehavior Driven Development by Example
Behavior Driven Development by Example
 
PHPConf.asia 2016 - BDD with Behat for Beginners
PHPConf.asia 2016 - BDD with Behat for BeginnersPHPConf.asia 2016 - BDD with Behat for Beginners
PHPConf.asia 2016 - BDD with Behat for Beginners
 
Tdd is not about testing (C++ version)
Tdd is not about testing (C++ version)Tdd is not about testing (C++ version)
Tdd is not about testing (C++ version)
 
BDD using Cucumber JVM
BDD using Cucumber JVMBDD using Cucumber JVM
BDD using Cucumber JVM
 
Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010
 
Test Driven Development (TDD) with FlexUnit 4 - 360|Flex San Jose preso
Test Driven Development (TDD) with FlexUnit 4 - 360|Flex San Jose presoTest Driven Development (TDD) with FlexUnit 4 - 360|Flex San Jose preso
Test Driven Development (TDD) with FlexUnit 4 - 360|Flex San Jose preso
 
Automated Developer Testing: Achievements and Challenges
Automated Developer Testing: Achievements and ChallengesAutomated Developer Testing: Achievements and Challenges
Automated Developer Testing: Achievements and Challenges
 
Zend con 2016 bdd with behat for beginners
Zend con 2016   bdd with behat for beginnersZend con 2016   bdd with behat for beginners
Zend con 2016 bdd with behat for beginners
 
Manual testing visonia
Manual testing   visoniaManual testing   visonia
Manual testing visonia
 
Resume_shai.docx
Resume_shai.docxResume_shai.docx
Resume_shai.docx
 
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
 
TDD - Agile
TDD - Agile TDD - Agile
TDD - Agile
 
Susan windsor soft test 16th november 2005
Susan windsor soft test   16th november 2005Susan windsor soft test   16th november 2005
Susan windsor soft test 16th november 2005
 
Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Tdd is not about testing (OOP)
Tdd is not about testing (OOP)
 
Katalon Studio - Successful Test Automation for both Testers and Developers
Katalon Studio - Successful Test Automation for both Testers and DevelopersKatalon Studio - Successful Test Automation for both Testers and Developers
Katalon Studio - Successful Test Automation for both Testers and Developers
 
Testing apps with MTM and Tea Foundation Service
Testing apps with MTM and Tea Foundation ServiceTesting apps with MTM and Tea Foundation Service
Testing apps with MTM and Tea Foundation Service
 
Resume
ResumeResume
Resume
 

More from Rachid Kherrazi

Quest to the best test automation for low code development platform kherrazi ...
Quest to the best test automation for low code development platform kherrazi ...Quest to the best test automation for low code development platform kherrazi ...
Quest to the best test automation for low code development platform kherrazi ...Rachid Kherrazi
 
Behavior Driven Testing with SpecFlow
Behavior Driven Testing with SpecFlowBehavior Driven Testing with SpecFlow
Behavior Driven Testing with SpecFlowRachid Kherrazi
 
Hands-on Experience Model based testing with spec explorer
Hands-on Experience Model based testing with spec explorer Hands-on Experience Model based testing with spec explorer
Hands-on Experience Model based testing with spec explorer Rachid Kherrazi
 
Using task models in model-based testing
Using task models in model-based testingUsing task models in model-based testing
Using task models in model-based testingRachid Kherrazi
 
ASDSpec, Model Based Testing
ASDSpec, Model Based TestingASDSpec, Model Based Testing
ASDSpec, Model Based TestingRachid Kherrazi
 
Rachid kherrazi-testing-asd-interface-compliance-with-asd spec
Rachid kherrazi-testing-asd-interface-compliance-with-asd specRachid kherrazi-testing-asd-interface-compliance-with-asd spec
Rachid kherrazi-testing-asd-interface-compliance-with-asd specRachid Kherrazi
 

More from Rachid Kherrazi (7)

Quest to the best test automation for low code development platform kherrazi ...
Quest to the best test automation for low code development platform kherrazi ...Quest to the best test automation for low code development platform kherrazi ...
Quest to the best test automation for low code development platform kherrazi ...
 
Behavior Driven Testing with SpecFlow
Behavior Driven Testing with SpecFlowBehavior Driven Testing with SpecFlow
Behavior Driven Testing with SpecFlow
 
Hands-on Experience Model based testing with spec explorer
Hands-on Experience Model based testing with spec explorer Hands-on Experience Model based testing with spec explorer
Hands-on Experience Model based testing with spec explorer
 
Using task models in model-based testing
Using task models in model-based testingUsing task models in model-based testing
Using task models in model-based testing
 
Model Based Testing
Model Based TestingModel Based Testing
Model Based Testing
 
ASDSpec, Model Based Testing
ASDSpec, Model Based TestingASDSpec, Model Based Testing
ASDSpec, Model Based Testing
 
Rachid kherrazi-testing-asd-interface-compliance-with-asd spec
Rachid kherrazi-testing-asd-interface-compliance-with-asd specRachid kherrazi-testing-asd-interface-compliance-with-asd spec
Rachid kherrazi-testing-asd-interface-compliance-with-asd spec
 

Recently uploaded

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noidabntitsolutionsrishis
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 

Recently uploaded (20)

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 

Behavior Driven Development with SpecFlow

  • 1. GTC-NL-FXD Rachid Kherazi Behavior Driven Testing (BDT) with MS VS2010 & SpecFlow
  • 2. Confidential GTC-NL for internal use Goal of presentation • Informative • Share my knowledge w.r.t. Testing and Test tools In the scope of “did you know?” Gathered in my daily train trips Amstelveen Best
  • 3. Confidential GTC-NL for internal use Qeustion 1: what are the following two vegetables? Subject of today is related to some vegetables Answer 1: Cucumber Gherkin Question 2: What is the difference between the two? Answer 2: Cucumber: Tool, behavior driven development, … Gherkin: Language, Business Readable, Domain Specific Language,.. Let start with a Quiz
  • 4. Confidential GTC-NL for internal use Content • Behavior Driven Development (Development view) – Agile Iteration and Test Driven Development (TDD) – What’s all these DD’s? (TFD, TDD, BDD, ATDD and SDD) – Scenario/Story and Gherkin-syntax – Executable Specification – Behavior Driven Development tools – Live demo with SpecFlow • Behavior Driven Testing (Test view) – DDB vs BDT
  • 5. Confidential GTC-NL for internal use http://www.synerzip.com/agile-method.htm Introduction: Agile iterations and TTD
  • 6. Confidential GTC-NL for internal use ATDD - Acceptance Test Driven - Different than BDD? - Start with the acceptance test - Examples, (2) Write the implementation code to make the test pass. Keep it simple (3) Change the code to remove duplication in code and to improve the design while ensuring that all tests still pass. (1) Imagine how the new code should be called and write the test as if the code already existed
  • 7. Confidential GTC-NL for internal use What are the advantages of TDD? • TDD shortens the programming feedback loop • TDD provides detailed specification (tests) • TDD promotes the development of high-quality code • TDD provides concrete evidence that your software works • TDD supports evolutionary development • TDD encourages developers to write code that is easily tested TDD is used in Agile development eXtreme programming
  • 8. Confidential GTC-NL for internal use ATDD - Acceptance Test Driven - Different than BDD? - Start with the acceptance test - Examples, Test First Development Refactor TDD Start from acceptation test Focus on behavior of feature S/BDD
  • 9. Confidential GTC-NL for internal use What’s all these DD’s? TFD Test First Development TDD Test Driven Development ATDD Acceptance Test Driven Development BDD Behavior Driven Development STDD Story Test Driven Development TTD = Test First Development + Refactor (remove duplicate, improve design) Micro view ATDD start for end user acceptance test Macro view BDD focus on the behavior of the feature Based on user story: a couple of examples on how SUT could be used Story written in a standard syntax: e.g. Given / When / Then The [Given, When, Then] syntax is called Gherkin First create test (Failing test) than create implementation (Test passed)
  • 10. Given [initial context] When [event] Then [an outcome] Subsequent steps of the same kind can also be specified with the “And “ and “But” keyword
  • 11. Variations on a Theme Context Specification AAA User Story Structure Establish Initial Context Given Arrange SetContext Interact with SUT When Act BecauseOf Check the results Then Assert ItShould
  • 12. Confidential GTC-NL for internal use Example: Application Under Test (3) Application displays “Hello Best Tester: Password is Correct” (If password = “Rachid”) (1) type password “Rachid” (2) press Login button (0) start application “Say Hello Best Tester” a simple application for demo purpose. According req. of this tool: “Rachid”, “Ali” and ‘Pieter” are correct passwords for login.
  • 13. Confidential GTC-NL for internal use Example: Feature file (Scenario’s: Given When Then) Feature: Log-In in “Best Tester Application”, check correctness of password Scenario: Check Login with correct password Given Application is started When correct password is typed And Login button is pressed Then Login should be successful And Messagebox should display "Hello Best Tester: Password Correct" Describe some piece of functionality of the system Plain readable text Features contain one or more scenarios A scenario describes a single acceptance test for a feature Most features are composed of multiple scenarios Tool generates a test for each scenario The name of the test is generated from the scenario title
  • 14. Confidential GTC-NL for internal use When scenario/story is in place it would be wonderful if there is a tool that can run this scenario’s to verify that the implementation actually behaves as specified. Executable specification that verifies that the implementation behaves as expected, readable by all in the team, and around it Requirements /Behavior In well known format e.g. Given/When/Then Tool Implementation (SUT) Main benefit Main benefit is not in the tool! The benefit is that team get together and write down a common, shared knowledge in a well known format. In one place.
  • 15. Confidential GTC-NL for internal use Tools This was the idea of Cucumber tool that first was created in the Ruby-community. Cucumber can execute scenarios written in the Given/When/Then-syntax. For .Net framework SpecFlow is known good tool. Both tools used Gherkin syntax and are free (open source). Cucumber Ruby SpecFlow .Net
  • 16. Confidential GTC-NL for internal use Behavior Driven Development in one slide Feature file (Scenario’s: Given When Then) Test class (for Nunit) Generated by SpecFow tool (.cs) Stepper class binding with implementation (.cs) Implementation (.dll, .exe) Nunit dll Nunit Test report Code of Implementation (.cs) Visual Studio 2010 + SpecFlow SW developer Requirements User feedback1 2 3 4 5 6 7 8
  • 17. Confidential GTC-NL for internal use Some handy Attributes Background With the keyword background you can run some steps before each scenario in the feature. Hooks Hooks are events that is fired in the following order. And you can “hook in” code here to do useful things: - Restore a database - Dump a log on error - Init variables before steps Scenario outlines Data-driven scenarios or scenario templates Consists of Scenario template specification with data placeholders Tool generates parameterized test logic for the scenario outline and individual test method for each example set (using pairwise testing)
  • 18. Confidential GTC-NL for internal use Some handy Attributes Tag Can be used to specify “categories” for Nunit or other test runners e.g. @RegressionTestSet @ignore tag is a special tag “ignore test” # is reserved for comment #language The language of the feature files can be either specified globally in the configuration file or in the header of the feature file using “#language” keyword different ISO languages are supported Debugging Tests SpecFlow Visual Studio integration also supports debugging the execution of the tests. Just like in the source code files of your project, you can also place breakpoints in the SpecFlow feature files. Whenever you execute the generated tests in debug mode, the execution will stop at the specified breakpoints and you can execute the steps one-by-one using the standard “Step Over” (F10) command or you can go to the detailed execution of the bindings using the “Step Into” (F11) command.
  • 19. Confidential GTC-NL for internal use SpecFlow configuration file language Test runner Stop at error
  • 20. Confidential GTC-NL for internal use Live demo “SayHello Application” VS 2010 and SpecFlow Link Nunitdll
  • 21. Confidential GTC-NL for internal use SpecFlow and generated Test Results SpecFlow tool generates clear and concise report Report
  • 22. Confidential GTC-NL for internal use Behavior Driven Development in one slide Feature file (Scenario’s: Given When Then) Test class (for Nunit) Generated by SpecFow tool (.cs) Stepper class binding with implementation (.cs) Implementation (.dll, .exe) Nunit dll Nunit Test report Code of Implementation (.cs) Visual Studio 2010 + SpecFlow SW developer Requirements User feedback1 2 3 4 5 6 7 8
  • 23. Confidential GTC-NL for internal use Behavior Driven Testing in one slide Feature file (Scenario’s: Given When Then) Test class (for Nunit) Generated by SpecFow tool (.cs) Stepper class binding with implementation (.cs) SUT (FlashLite) Nunit dll Bello/Nunit Test report Visual Studio 2010 + SpecFlow Requirements Tester SW/FW developer implementation code Development environment User SW/FW Implementation feedback 4 2 3 1 5
  • 24. Confidential GTC-NL for internal use http://www.synerzip.com/agile-method.htm Behavior driven testing Development domain Test domain
  • 25. Confidential GTC-NL for internal use BDD vs BDT • Behavior Driven Development (BDD) – Development domain – White box – Micro view – Input = specification (Behavior) – Output = Implementation • Behavior Driven Testing (BDT) – Test domain – Black box (interface) – Macro view – Input = Specification (Behavior) – Output = Test
  • 26. Confidential GTC-NL for internal use Requirement Based Testing in one slide Feature file (Scenario’s: Given When Then) Test class (for Nunit) Generated by SpecFow tool (.cs) Stepper class binding with implementation (.cs) SUT (FlashLite) Nunit dll Bello/Nunit Test report Visual Studio 2010 + SpecFlow Requirements doc SW/FW developer implementation code Development environment User SW/FW Implementation feedback 4 3 2 1 5 Spec.doc to Feature file convertor (2) = refactor= clean up and improveTester To be developed
  • 27. Confidential GTC-NL for internal use Learn more about SpecFlow and BDD http://blog.dannorth.net/introducing-bdd/ http://www.specflow.org/ https://github.com/techtalk/SpecFlow http://github.com/techtalk/SpecFlow-Examples http://github.com/aslakhellesoy/cucumber/wiki http://www.marcusoft.net/search/label/SpecFlow https://github.com/marcushammarberg/ https://www.marcusoft.net Free downloadable book
  • 29. 1, 2, 3 Given When Then [TestMethod] public void Total_Should_Be_1_When_1_Product_Added() { var cart = new ShoppingCart("TEST"); cart.AddItem(new Product("SKU")); Assert.AreEqual(1, cart.TotalItems); }