Your SlideShare is downloading. ×
0
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Spec flow – functional testing made easy
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Spec flow – functional testing made easy

6,324

Published on

Published in: Technology, Education
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
6,324
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. SpecFlow ‘functional testing made easy’Twitter: @stack72Email: public@paulstack.co.ukBlog: http://paulstack.co.uk/blog <br />
  • 2. Agenda<br />A look at ‘traditional testing’<br />Introduction to BDD<br />‘Testing Pyramid’<br />BDD Tools<br />Introduction to WatiN<br />The Marriage of SpecFlow and WatiN<br />
  • 3. Traditional Testing Ethos<br />Kent Beck introduced us to what testing should be in late 1990’s<br />It was the first real indication that testing should be part of the software development lifecycle<br />Unit Tests<br />smallest testable part of an application - e.g. method or function<br />programmer writes as many tests as they can think of that might &quot;break&quot; the code every piece of code that is written will have tests for it<br />Acceptance Tests<br />can be broken down to smoke tests, user acceptance tests and integration tests<br />verify that requirements as understood by developers satisfy the customers requirements<br />This led to practices like TDD<br />
  • 4. What is TDD?<br />Write a test beforewriting the production code<br />Make a minimal change to the production code to make the test pass<br />Refactor the code to make it better <br />Advantages<br />Provides a form of documentation<br />Also provides a safety net when code changes<br />Questions?<br />Where do we start?<br />What is a good enough test?<br />How does this relate to the user stories?<br />
  • 5. Test Driven Development Cycle<br />
  • 6. How should these change?<br />March 2006 – Dan North (@Tastapod)<br />he discusses he had a problem with traditional TDD and that he ran into the same problems all other developers ran into - where to start, what to test and what not to test<br />he decided to represent TDD in a way to avoid the pitfalls and get straight to the good stuff<br />The article was called – “Introducing BDD”<br />
  • 7. BDD Key points<br />Test method names should be sentences<br />A simple sentence template keeps test methods focused<br />An expressive test name is helpful when a test fails<br />“Behaviour” is a more useful word than “test”<br />Requirements are behaviour<br />BDD provides a “ubiquitous language” for analysis (GWT)<br />Acceptance criteria should be executable<br />
  • 8. Behavioural Driven Development Cycle<br />
  • 9. How do acceptance tests and unit tests work with each other?<br />
  • 10.
  • 11.
  • 12. BDD Testing Tools<br />
  • 13. Different Tools<br />+ MSpec, Rspec, Cuke4Nuke etc…<br />
  • 14. What is SpecFlow?<br />SpecFlow is a .Net tool that lets you write specifications / user stories in plain readable Gherkin format<br />It integrates with Visual Studio, which means you get File-&gt;New templates for creating new feature files<br />Gives VS debugger support, so you can set breakpoints on Given/When/Then lines in your .feature files and step through their execution<br />When you compile a project containing SpecFlow feature files, the output is an NUnit test assembly, so you can use your favourite NUnit-compatible test runner or existing CI infrastructure to run the specifications with no additional configuration.<br />
  • 15. SpecFlow basically turns this type of business level detail:<br />General rules for entering leader boards<br />Usernames need to be checked for profanities before publication.<br />Users will always be asked to post their scores to the leader boards, they won&apos;t be done automatically.<br />A user has to complete at least one question correctly to be eligible to be added to the leader board.<br />Users who don&apos;t post their scores to the leader board will not appear in any of the leader board stats.<br />A user cannot post their score to the leader board without logging in or registering.<br />Even if  a user hasn&apos;t submitted their score to the leader board, show them where they would be positioned in the leader board, when they view it.<br />
  • 16. Into this level of breakdown:<br />Given a user wants to post their score to a leader board<br />When they have registered the nickname ‘knobhead’<br />Then that nickname fails the profanity test<br />Given a user wants to post their score to a leader board<br />When they have registered the nickname ‘QuizStar’<br />Then that nickname passes the profanity test<br />
  • 17. General rules for entering leader boards<br />Usernames need to be checked for profanities before publication.<br />Users will always be asked to post their scores to the leader boards, they won&apos;t be done automatically.<br />A user has to complete at least one question correctly to be eligible to be added to the leader board.<br />Users who don&apos;t post their scores to the leader board will not appear in any of the leader board stats.<br />A user cannot post their score to the leader board without logging in or registering.<br />Even if  a user hasn&apos;t submitted their score to the leader board, show them where they would be positioned in the leader board, when they view it.<br />
  • 18. Given a user finishes a quiz<br />When the user is not logged in<br />Then the user is offered the chance to enter the leader board<br />And the post to leader board button redirects to login page<br />Given a user finishes a quiz<br />When the user is logged in<br />Then the user is offered the chance to enter the leader board<br /> And the post to leader board button returns successful entry<br />
  • 19. BDD Testing Tools<br />
  • 20. WatiN <br />
  • 21. What is WatiN?<br />Open source API (watin.org) that actually uses the browser for testing NOT emulating it<br />Integrates with Visual Studio so tests can be debugged<br />The most impressive feature of WatiN is the level of access you have to the DOM. Web tests are able to find elements by id, index, name, text, CSS class, etc., iterate through collections of elements, and invoke any event.<br />
  • 22. Front End Testing – Good Practice?<br />Everything should be tested BUT we need to remember a few things when testing the UI<br />UI tests:<br />Can be brittle<br />Can take time<br />Should not replace unit and integration tests<br />Should not be taken as 100% gospel truth<br />
  • 23. Demo…..<br />
  • 24. Summary<br />We have looked at:<br />Traditional testing ethos<br />Emergence of BDD<br />SpecFlow as a BDD tool<br />WatiN as a testing tool<br />SpecFlow + WatiN – Marriage made in heaven<br />
  • 25. Questions…..??<br />
  • 26. Thanks! <br />Twitter: @stack72<br />Email: public@paulstack.co.uk<br />Blog: http://paulstack.co.uk/blog <br />

×