specflow and some things i've picked up

92
SpecFlow, Gherkin and some things I’ve picked up using them Marcus Hammarberg

Post on 17-Oct-2014

808 views

Category:

Technology


0 download

DESCRIPTION

These are the slides for my SpecFlow presentation. This particular version was given as part of my "I'm telling you for the last time"-series (see http://www.marcusoft.net/2013/11/ImTellingYou.html).

TRANSCRIPT

Page 1: SpecFlow and some things I've picked up

SpecFlow, Gherkin and some things

I’ve picked up using them

Marcus Hammarberg

Page 2: SpecFlow and some things I've picked up

Specification by example is not about the tools

!

it’s about communication

Page 3: SpecFlow and some things I've picked up

Whether we choose to call it BDD or ATDD or Specification by Example, we want the same

result – a shared common understanding of what is to be built

to try to build the ‘thing’ right the first time. !

We know it never will be, but the less rework, the better.

!Janet Gregory

Page 4: SpecFlow and some things I've picked up

Hence: Let’s talk tools!

http://boulderblimp.com/blimpwp/wp-content/uploads/2012/03/Craftsman-Toolbox.jpg

Page 5: SpecFlow and some things I've picked up
Page 6: SpecFlow and some things I've picked up
Page 7: SpecFlow and some things I've picked up
Page 8: SpecFlow and some things I've picked up
Page 9: SpecFlow and some things I've picked up
Page 10: SpecFlow and some things I've picked up
Page 11: SpecFlow and some things I've picked up
Page 12: SpecFlow and some things I've picked up
Page 13: SpecFlow and some things I've picked up
Page 14: SpecFlow and some things I've picked up
Page 15: SpecFlow and some things I've picked up
Page 16: SpecFlow and some things I've picked up

http://www.youtube.com/aptitudsthlm

Page 17: SpecFlow and some things I've picked up

Bandung

Page 18: SpecFlow and some things I've picked up

It’s not in the tool

http://www.barbellsandbacon.com/wp-content/uploads/2010/02/mlss_mario-hammer.jpg

Page 19: SpecFlow and some things I've picked up

Tools

Page 20: SpecFlow and some things I've picked up

How does this work?

Page 21: SpecFlow and some things I've picked up

How does this work?

[Given("I am on the Activity list")] public void ThisNameIsNotImportantToSpecFlow() ![When("I click the Create New link")] public void SpecFlowUsesTheAttirbutesPerDefault() ![Then("I should be on the Create Activity page")] public void SoItDoesntEvenCareWhatYouCallThese()

Page 22: SpecFlow and some things I've picked up

Gherkin

Page 23: SpecFlow and some things I've picked up
Page 24: SpecFlow and some things I've picked up
Page 25: SpecFlow and some things I've picked up
Page 26: SpecFlow and some things I've picked up
Page 27: SpecFlow and some things I've picked up
Page 28: SpecFlow and some things I've picked up
Page 29: SpecFlow and some things I've picked up
Page 30: SpecFlow and some things I've picked up
Page 31: SpecFlow and some things I've picked up

Feature

http://www.lushtshirts.co.uk/images/products/bug-feature.jpg

Page 32: SpecFlow and some things I've picked up

Feature

http://www.lushtshirts.co.uk/images/products/bug-feature.jpg

Page 33: SpecFlow and some things I've picked up

Feature

http://www.lushtshirts.co.uk/images/products/bug-feature.jpg

Page 34: SpecFlow and some things I've picked up

Scenario

http://images2.fanpop.com/images/photos/7000000/Friends-33-friends-7046166-1280-1024.jpg

Page 35: SpecFlow and some things I've picked up

Scenario

http://images2.fanpop.com/images/photos/7000000/Friends-33-friends-7046166-1280-1024.jpg

Page 36: SpecFlow and some things I've picked up

Scenario

http://images2.fanpop.com/images/photos/7000000/Friends-33-friends-7046166-1280-1024.jpg

Page 37: SpecFlow and some things I've picked up

Step in time!

Page 38: SpecFlow and some things I've picked up

Step in time!

Page 39: SpecFlow and some things I've picked up

Expressions

Page 40: SpecFlow and some things I've picked up

Expressions

When I withdraw $20

Page 41: SpecFlow and some things I've picked up

Expressions

When I withdraw $20

[When(@“I withdraw $(\d+)“)] public void Withdraw(int amount)

Page 42: SpecFlow and some things I've picked up

Expressions

When I withdraw $20

[When(@“I withdraw $(\d+)“)] public void Withdraw(int amount)

(.*) => string (\d+) => integer

Page 43: SpecFlow and some things I've picked up

Background

Page 44: SpecFlow and some things I've picked up

Hooks

Page 45: SpecFlow and some things I've picked up

Hooks

Page 46: SpecFlow and some things I've picked up

Tags

Page 47: SpecFlow and some things I've picked up

Tags

Page 48: SpecFlow and some things I've picked up

@ignore

Page 49: SpecFlow and some things I've picked up
Page 50: SpecFlow and some things I've picked up
Page 51: SpecFlow and some things I've picked up
Page 52: SpecFlow and some things I've picked up

[Given("I have the following persons")] public void IHaveTheFollowingPersons (Table personsTable)

Page 53: SpecFlow and some things I've picked up

SpecFlow.Assist

Page 54: SpecFlow and some things I've picked up

SpecFlow.Assist

Page 55: SpecFlow and some things I've picked up
Page 56: SpecFlow and some things I've picked up

Scenario outline

Page 57: SpecFlow and some things I've picked up

Scenario outline

Page 58: SpecFlow and some things I've picked up

Language

Page 59: SpecFlow and some things I've picked up

ScenarioContext.Current

Page 60: SpecFlow and some things I've picked up

Do I have time for more?

http://appyourmac.com/wp-content/uploads/2009/06/Awaken.png

Page 61: SpecFlow and some things I've picked up

Code here: http://bit.ly/SpecFlowDemos

Page 62: SpecFlow and some things I've picked up
Page 63: SpecFlow and some things I've picked up

Cuke Envy

Page 64: SpecFlow and some things I've picked up
Page 65: SpecFlow and some things I've picked up

Gherkin

Page 66: SpecFlow and some things I've picked up

Gherkin

Step definition

Page 67: SpecFlow and some things I've picked up

Gherkin

Step definition

DSL

Page 68: SpecFlow and some things I've picked up

Gherkin

Step definition

DSL

Automation code

Page 69: SpecFlow and some things I've picked up

Gherkin

Step definition

DSL

Automation code

SUT

Page 70: SpecFlow and some things I've picked up
Page 71: SpecFlow and some things I've picked up

Here’s one I’ve prepare earlier

Page 72: SpecFlow and some things I've picked up

Here’s one I’ve prepare earlier

http://media.kansascity.com/smedia/2013/02/13/13/33/meBc3.St.81.jpeg

Page 73: SpecFlow and some things I've picked up
Page 74: SpecFlow and some things I've picked up

Structure

Page 75: SpecFlow and some things I've picked up

Structure

Coding by intention

Page 76: SpecFlow and some things I've picked up

Structure

Coding by intention

Pushing the HOW down

Page 77: SpecFlow and some things I've picked up

Structure

Coding by intention

DSL Swap

Pushing the HOW down

Page 78: SpecFlow and some things I've picked up

A special thank you to my friends:

• SpecFlow - Cucumber on .NET, great Visual Studio integration (specflow.org)

• NancyFx - Minimalistic web framework, with great testing capabilities (nancyfx.org)

• Simple.Data - simple data access, that’s all (github.com/markrendle/Simple.Data)

• FluentAutomation - UI Automation, wraps Selenium/Watin/etc (fluent.stirno.com)

Page 79: SpecFlow and some things I've picked up

Code here: http://bit.ly/CukeEnvy

Page 80: SpecFlow and some things I've picked up

Learn more

Page 85: SpecFlow and some things I've picked up

Learn more• http://blog.dannorth.net/introducing-bdd/

• http://www.specflow.org/

• http://cukes.info

• https://github.com/marcusoftnet/SpecFlowDemos

• http://skillsmatter.com/podcast/agile-testing/refuctoring-your-cukes

Page 86: SpecFlow and some things I've picked up

Learn more• http://blog.dannorth.net/introducing-bdd/

• http://www.specflow.org/

• http://cukes.info

• https://github.com/marcusoftnet/SpecFlowDemos

• http://skillsmatter.com/podcast/agile-testing/refuctoring-your-cukes

• http://skillsmatter.com/podcast/agile-testing/bdd-as-its-meant-to-be-done

Page 87: SpecFlow and some things I've picked up

Learn more• http://blog.dannorth.net/introducing-bdd/

• http://www.specflow.org/

• http://cukes.info

• https://github.com/marcusoftnet/SpecFlowDemos

• http://skillsmatter.com/podcast/agile-testing/refuctoring-your-cukes

• http://skillsmatter.com/podcast/agile-testing/bdd-as-its-meant-to-be-done

• http://skillsmatter.com/podcast/agile-testing/cuke-envy-a-dot-net-programmers-attempt-to-catch-up

Page 88: SpecFlow and some things I've picked up
Page 89: SpecFlow and some things I've picked up

www.marcusoft.net @marcusoftnet

[email protected]

Page 90: SpecFlow and some things I've picked up

www.marcusoft.net @marcusoftnet

[email protected]

Page 91: SpecFlow and some things I've picked up

Recording of this talk http://www.youtube.com/

aptitudsthlm

Page 92: SpecFlow and some things I've picked up