Acceptance Test Driven Development with SpecFlow and Friends

Slides:



Advertisements
Similar presentations
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Advertisements

HTML 5 and CSS 3, Illustrated Complete Unit L: Programming Web Pages with JavaScript.
CHAPTER 30 THE HTML 5 FORMS PROCESSING. LEARNING OBJECTIVES What the three form elements are How to use the HTML 5 tag to specify a list of words’ form.
Story-Based Test Automation Using Free Tools
Testing by Duncan Butler Sara Stephens. Too much to cover.
Web Page Behavior IS 373—Web Standards Todd Will.
Chapter 11 ASP.NET JavaScript, Third Edition. 2 Objectives Learn about client/server architecture Study server-side scripting Create ASP.NET applications.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
SpecFlow & Gherkin Behavior Driven Development. Definitions Behavior Driven Development SpecFlow Structure Gerkin Demo Agenda.
Desktop and Mobile Testing Miroslav Shtilianov QA Engineer Automated Testing Team Telerik QA Academy
By Bob Bunson  Simulation of software development project  Fictitious system from Concept to Code  Oriented around the.
Microsoft SharePoint 2010 Upgrade Preview FSU SharePoint Users Group Presents: Thursday, December 1 st, 2011.
QA Automation Solution. Solution Architecture Test Management tool CI Tool Automation framework Testing Project BDD Tool Text of test to Testing Project.
UNIT-V The MVC architecture and Struts Framework.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 13 Slide 1 Application architectures.
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
2012 National BDPA Technology Conference Creating Rich Data Visualizations using the Google API Yolanda M. Davis Senior Software Engineer AdvancED August.
LAYING OUT THE FOUNDATIONS. OUTLINE Analyze the project from a technical point of view Analyze and choose the architecture for your application Decide.
Three-tier Mobile Application Testing Framework:
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
May 16 – 18, 2007 Copyright 2007, Data Access Worldwide May 16 – 18, 2007 Copyright 2007, Data Access Worldwide Build Great Web Application 'Fast and Easy'
Microsoft Visual Basic 2005: Reloaded Second Edition
Robot Framework – Basic Level. Date: Version:1.0 Page 1.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
Silverlight Technology. Table of Contents 1.What is Silverlight Technology? 2.Silverlight Overview. 2.1 How it works 2.2 Silverlight development tools.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
A TEST FRAMEWORK USING PROTRACTOR, CUCUMBER & CUCUMBER SANDWICH
What’s New for Web Developers in ASP.NET and Visual Studio 2008 Kate Gregory Microsoft Regional Director
Selenium and Selenium on Rails. Agenda  Overview of Selenium Simple Selenium Tests Selenium IDE  Overview of Selenium on Rails  Problems with Selenium.
Web Automation Testing With Selenium By Rajesh Kanade.
Automated Acceptance Testing and Continuous Delivery Larry Apke Agile Expert
Microsoft Visual Studio 2010 Teacher: Ms. Olifer.
HTML Form Widgets. Review: HTML Forms HTML forms are used to create web pages that accept user input Forms allow the user to communicate information back.
Chapter 4: Working with ASP.NET Server Controls OUTLINE  What ASP.NET Server Controls are  How the ASP.NET run time processes the server controls on.
© Hive Studios 2011 Ivan Pavlović, Hive Studios Visual C# MVP, MCT, CSM
BlackBerry Applications using Microsoft Visual Studio and Database Handling.
Selenium January Selenium course content  Introduction (Session-1)Session-  Automation  What is automation testing  When to go for automation.
Introduction Selenium IDE is a Firefox extension that allows you to record, edit, and debug tests for HTML Easy record and playback Intelligent field selection.
1 Presentation Title Test-driven development (TDD) Overview David Wu.
HTML Overview Part 5 – JavaScript 1. Scripts 2  Scripts are used to add dynamic content to a web page.  Scripts consist of a list of commands that execute.
4.01B Authoring Languages and Web Authoring Software 4.01 Examine webpage development and design.
Chapter 3 JSP Overview. The Problem with Servlets processing the request and generating the response are both handled by a single servlet class Java programming.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
Robot Framework – Basic Level. Date: Version:1.0 Page 1.
We Behatin’. INTRODUCTION Behat background 3 Behat prep Getting started
How and why we should use Behat?. About me Bozhidar Boshnakov QA Department FFW Drupal.org – bboshnakov Linkedin.com/in/bboshnakov.
Introduction to ASP.NET development. Background ASP released in 1996 ASP supported for a minimum 10 years from Windows 8 release ASP.Net 1.0 released.
The New Face of ASP.NET ASP.NET MVC, Razor, and jQuery Ido Flatow | Senior Architect | Sela | This session is.
V7 Foundation Series Vignette Education Services.
Arklio Studija 2007 File: / / Page 1 Automated web application testing using Selenium
HPE ALM Octane.
BEHAVIOR DRIVEN DEVELOPMENT / TESTING (BDD)
TEST AUTOMATION IN BDD WAY
Selenium and Selenium on Rails
JRA2: Acceptance Testing senarious
Haritha Dasari Josue Balandrano Coronel -
Module 1: Getting Started
Advantages OF BDD Testing
Silverlight Technology
Automation with Gwen Introduction.
Modern web applications
Behat - Arguably the best tool to switch to Automated testing from Manual Shweta Sharma.
Teaching slides Chapter 6.
Open Source Tool Based Automation solution with Continuous Integration and end to end BDD Implementation Arun Krishnan - Automation Manager Maria Afzal-
ASP.NET Imran Rashid CTO at ManiWeber Technologies.
HTML and CSS Basics.
Web Client Side Technologies Raneem Qaddoura
Telerik Testing Framework
Automated browser testing with Selenium and C#
Presentation transcript:

Acceptance Test Driven Development with SpecFlow and Friends Christopher Bartling Joel Levandoski

Contact information Christopher Bartling chris.bartling@gmail.com Twitter: @cbartling Joel Levandoski joel.levandoski@gmail.com Twitter: @joellevandoski

Administrative stuff Presentation and demo are available on BitBucket.org https://bitbucket.org/cebartling/presentations

Topics Acceptance Test Driven Development (ATDD) SpecFlow for .NET Behavior Driven Development (BDD) tool WatiN and WebAii Live demonstration Questions

Acceptance Test Driven Development ATDD Acceptance tests are executable specifications of desired behavior and functionality of the system Expressed in language of the problem domain Automated Regression suite Development is driven from the outside-in

ATDD vs. TDD TDD is extremely valuable, but you need more Achieve great unit test coverage and still not deliver value to the customer ATDD focuses on complete features and functionality ATDD: macro view TDD: micro view

SpecFlow for .NET BDD testing framework Integrates nicely with Visual Studio Acceptance tests manifest themselves as features and scenarios SpecFlow generates automated test from features SpecFlow tests run as normal xUnit tests Visual Studio test runner, build server

Features Describe some piece of functionality of the system Maintained in a .feature file Plain readable text Understandable by all parties, including business Gherkin format, popularized by Cucumber Features contain one or more scenarios

Feature file example Feature: Calculate Net Present Value In order analyze the profitability of a project As a project manager I want to be able to calculate the project’s Net Present Value Scenario: A project is rejected Given a project to evaluate When data is entered reflecting a failing project ROI scenario Then the net present value calculator will reject the project

Scenarios A scenario describes a single acceptance test for a feature Most features are composed of multiple scenarios SpecFlow generates a test for each scenario The name of the test is generated from the scenario title

Scenario example Scenario: A project is rejected when its NPV is negative Given a project to evaluate When data is entered reflecting a failing ROI scenario Then the net present value calculator will reject the project

Scenario steps Used to compose a scenario Custom code to automate your application Describe preconditions, triggering action, and verification of outputs for the acceptance test Given: preconditions When: triggering action Then: behavior and state verifications

Scenario step example Given a project to evaluate is matched to the following step definition binding… [Given(@"a project to evaluate")] public void GivenAProjectToEvaluate() { . . . }

Set up and tear down Attributes for before and after events TestRun Feature Scenario, ScenarioBlock Step Specificity achieved when used with tags

Tags Markers that can be applied to features and scenarios Useful for selectively mixing in behavior Used to categorize scenarios Some unit test frameworks support this categorization tagging Custom tags you define

Tag example @WatiN Scenario: Save valid sample size mid range Given the user enters 10 as sample size When the user selects save Then the value is stored

Tag example used with BeforeScenario [BeforeScenario("WatiN”)] public void BeforeScenarioUsingWatiN() { ... }

Background Common preconditions for all scenarios in a feature Contains one or more scenario steps Executed before any other steps in the scenario SpecFlow generates a method from the background element in the feature file in the test class Invoked from each scenario test case in the test class

Background example Background: Given that the welcome page is displayed Scenario: Add a comment to a book being reviewed . . .

Scenario outlines Data-driven scenarios or scenario templates Consists of Scenario template specification with data placeholders Set of examples providing values for placeholders SpecFlow generates parameterized test logic for the scenario outline and individual test method for each example set

Scenario outline example Scenario Outline: Score calculation tables Given a new bowling game When I roll the following series: <rolls> Then my total score should be <total score> Examples: | game | rolls | total score | | beginners game | 2,7,3,4,1,1,5,1,1,1,1,1,1,1,1,1,1,1,5,1 | 40 | | one single spare | 2,8,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 | 29 |

ScenarioContext ScenarioContext.Current.Pending() Causes the step definition to return pending Used to signal a stubbed step definition ScenarioContext.Current dictionary Allows you to carry context/state across step definitions participating in scenario

WatiN Open source browser automation tool for IE and Firefox Similar to Selenium, WebDriver, Watir Browser abstraction Find elements using CSS selectors Interact with AJAX web elements Handle popup dialogs (native and HTML)

WebAii Browser automation tool from Telerik HTML element wrappers Automates both web 2.0 and Silverlight applications HTML element wrappers WaitForElement(s) support when using AJAX Identifying elements using LINQ Invoke JavaScript directly from test code

Best practices Write high-level specifications Specifications should remain stable over time Build a scripting interface for manipulating your system under test (SUT) Focus specifications on isolated behaviors Think of specifications in Given-When-Then format Use the Page Object pattern

Smells Specifications are constantly changing Specifications are composed of “sequential command executions” Specifications have a lot of instrumentation or fixture code Specification examples exhibit same structure

Net Present Value Calculator Demo Used in capital budgeting Measures the excess or shortfall of cash flows, in present value terms, once financing terms have been covered Demo has two implementations ASP.NET MVC Silverlight

Questions?

Literature cited http://www.concordion.org/Technique.html http://www.telerik.com/automated-testing- tools/webaii-framework-features.aspx http://watin.org/ http://www.specflow.org/ http://code.google.com/p/selenium/wiki/PageO bjects