SlideShare a Scribd company logo
1 of 44
INTRODUCTION TO
TEST DRIVEN DEVELOPMENT
Presented by Sarah Dutkiewicz
sarah@cletechconsulting.com
AGENDA
• Test Driven Development – What does this mean?
• Gathering Requirements
• Gherkin
• Tools for TDD in the Workplace
WHAT IS
TEST DRIVEN
DEVELOPMENT?
TEST DRIVEN DEVELOPMENT
• Define {something} first through a test
• Write the code to pass the test
• Verify that the test succeeds
• Improve upon the code and keep the test passing
Write the
test

Write the
code to
pass the test

Improve the
code while
keeping the
test passing

RED-GREENREFACTOR
EXAMPLE – RUBY KOANS
EXAMPLE – RUBY KOANS
TDD CONCEPT - ASSERTIONS
• Verify whether a certain condition has been met
• Asserts come in many forms:
•
•
•
•
•
•

(Not) Equal
Contains / Any
Is a Type
Is an Instance of a Type
Is (Not) Null
Is (True/False)

• Design Guideline – One assert per test
TDD CONCEPT –
ARRANGE/ACT/ASSERT
• Pattern for arranging a test
1. Arrange all preconditions and inputs.
2. Act on the object or method.

3. Assert that the results have occurred.
TEST-DRIVEN – TYPES OF TESTS
Tests, Tests, and More Tests… Oh My!
TYPES OF TESTS
• Unit Tests
• Integration Tests
• End-to-End Tests
• Exploratory Testing
UNIT TESTS
• Focus on a class or a method
• Tests the smallest unit possible
• Typically tests simple objects; does not
test things such as:
• Database communication
• Network communication
• File system manipulation
INTEGRATION TESTS
• Tests functions, “does things”
• Tests interactions with the outside world, include:
• Database communication
• Network communication
• File system manipulation

• Focused integration tests isolate the testing to
one interaction at a time
• Integration tests should run on their own, with a
little help from 2 fundamental units:
• Setup – run at the beginning of the test to set
up the test environment
• Tear-down – run at the end of the test or upon
error to clean up the test environment
END-TO-END TESTS
• The most brittle of tests –
dependent on the big picture
• Verifies that the unit tests and
integration tests are working like
they should
• Start at the beginning and go
through the whole process
• Includes:
• Acceptance testing
• Functional testing
EXPLORATORY TESTING
• Not an automated process; manual testing
• Sometimes better to go this route rather than end-to-end tests – depending
on the design and architecture of your application
• EXPLORE!
• Discovery
• Investigation
• Learning
MORE *-DRIVEN DEVELOPMENT
Related philosophies and methodologies
OTHER RELATED *-DRIVEN
DEVELOPMENT
• Behavior Driven Development
• Acceptance Test Driven Development
• Specification by Example
ACCEPTANCE TEST DRIVEN DEVELOPMENT CYCLE
Discuss the
requirements

Distill the tests in
a friendly
format

Demo the code

Develop the
code (and
hook the code
to the tests)
ATDD AND THE TDD CYCLE

REFACTOR

Discuss the
requirements

Distill the tests in
a friendly
format

Demo the code

GREEN

RED

Develop the
code (and
hook the code
to the tests)

GREEN
GATHERING
REQUIREMENTS
The Importance of TDD & ATDD for the UX Realm and an Intro to Gherkin
DISCUSS
• Conducted by all who are involved:
•
•
•
•

Product owners
Business analysts
Developers
QA

• Requirements are explicitly spelled out.
• Include use cases.
• Include required behaviors or designs.
GHERKIN
• Common language for gathering requirements
• Written in “plain English” following a particular cadence
• Can then be hooked up to various programming languages and testing
tools

• Serves as guidelines for automated tests as well as project documentation
GHERKIN COMPONENTS
• Features
• Scenarios & Scenario
Outlines
• Backgrounds

• Steps
• Multiline Arguments
• Tags
FEATURES
• Define a feature of an application
• Starts with the Feature keyword and contains a few lines to define the feature
Example:

Feature: Short, concise, descriptive text of the goal
In order to do something
As someone related to this system
I want to gain something out of this
* Features are stored in a *.feature file
FEATURE EXAMPLE
Feature: Checking out books
In order to read eBooks on my eBook reader,
As a library patron,
I want to check out eBooks.
SCENARIOS
• Possibilities of situations (scenarios) that apply to a feature
• Scenarios are included in *.feature files with their relevant feature
• Created with one or more steps
SCENARIO EXAMPLE
Scenario: Checking out a book
Given the library collection has the book I want to check out
When I check out the book
Then the library collection’s available count is reduced by 1
STEPS
• Given a certain given condition
• When a certain behavior happens
• Then a certain outcome is expected
• Additional keywords include But and And
•
•
•
•

Given a certain given condition
And another given condition
When a certain behavior happens
Then a certain outcome is expected
SCENARIO OUTLINES
• Scenario Outlines eliminate the need for copying and pasting like scenarios
and collapsing values into variables.
• Rather than starting with Scenario, it starts with Scenario Outline.
• Variables (placeholders) are denoted with names sandwiched in greaterthan and less-than symbols.
SCENARIO OUTLINE EXAMPLE
Scenario Outline: Checking book checkout expiration
Given a checkout period of <checkout_period> days
When I open the book at day <open>
Then the book should expire in <left> days

Examples:
| checkout_period | open

| left |

|7

|2

|5

|

| 14

| 10

|2

|

| 21

| 18

|3

|
MULTILINE ARGUMENTS
• Tables
Example:
Scenario:
Given the following accounts exist:
|name
|email
|account_type|
| Laura
|laura@domain.com | Admin
|
| Sarah
|sarah@domain.com | Admin
|
| Kevin
| kevin@domain.com | User
|
MULTILINE ARGUMENTS
• Large paragraph of text
Example:
Scenario:
Given a description search with:
"""
It was the best of times
It was the worst of times
"""
BACKGROUNDS
• Backgrounds setup the environment for all scenarios in a feature file.
• Starts with the Background keyword and is typically made up of Given, And,
and But clauses
• Runs before individual scenario setup routines
BACKGROUND EXAMPLE
Feature: Checkout eMaterials
Background:
Given a customer named “Sarah Dutkiewicz“
And a library card numbered “12345678901”
And a checkout queue of books:
| title

| author

|

| Hop on Pop

| Dr. Seuss

|

| Harold and the Purple Crayon

| Crockett Johnson |

| Shark Tales: How I Turned $1,000 into a Billion Dollar Business | Barbara Corcoran|
TAGS
• Used for grouping like tests, scenarios, and/or features together
• Starts with a @, followed by the tag name
Examples:

@UI @accounting @security
• Many test runners support tags and allow collections of tests to be run by tag
TOOLS FOR TDD IN THE
WORKPLACE
GHERKIN LANGUAGE RESOURCES
AND GENERAL TDD RESOURCES
• Behat – Writing Features – Gherkin Language
• The Art of Agile Development: Test-Driven Development
• Test first != TDD
• Driving Development with Tests: ATDD and TDD

• Let’s Explore – Exploratory Testing
.NET TDD RESOURCES
• SpecFlow – Behavior Driven Development,
Acceptance Test Driven Development,
Specification by Example; includes support for
Silverlight, Windows Phone, and Mono
• TestDriven.Net – Visual Studio integration for unit
tests
• WatiN – Web Application Testing in .NET
• TestStack.White – UI automation testing
• Telerik Test Studio
• Nunit
• MbUnit
• MSTest
• NCover
• TypeMock
JAVASCRIPT TDD RESOURCES
• QUnit
• Jasmine

• Zombie.js
• Mocha
• Tutti
• JSTestDriver
• jsUnity
• CasperJS
RUBY TDD RESOURCES
• Cucumber – behavior driven
development
• Watir – Web Application Testing in
Ruby
• Ruby Koans – learn Ruby via testing
• Rspec – primary Ruby testing tool
PHP TDD RESOURCES
• Behat – behavior driven development
• Mink – web acceptance testing
• PHPUnit
• SimpleTest

• Phpt
• Gouette – headless browser, web scraper
JAVA TDD RESOURCES
• JUnit
• Watij – Web Application
Testing in Java
• AppPerfect Java Unit Test
ADDITIONAL *DD RESOURCES
• Sahi – JavaScript browser controller
• Selenium – supports C#, Java, Perl,
PHP, Python, Ruby
• Fitnesse – supports multiple languages
• Windmill – supports Python, JavaScript,
Ruby
• Canoo WebTest – supports Python,
JavaScript
• TSQLUnit – TDD for Transact-SQL

• TST – the T-SQL Test Tool
CONTACT INFORMATION
Sarah Dutkiewicz
Cleveland Tech Consulting, LLC

sarah@cletechconsulting.com
Twitter: @sadukie
Blog: http://codinggeekette.com

More Related Content

What's hot

Writing better tests for your java script app
Writing better tests for your java script appWriting better tests for your java script app
Writing better tests for your java script appJakeGinnivan
 
Episode 20 - Trigger Frameworks in Salesforce
Episode 20 - Trigger Frameworks in SalesforceEpisode 20 - Trigger Frameworks in Salesforce
Episode 20 - Trigger Frameworks in SalesforceJitendra Zaa
 
Automated testing in javascript
Automated testing in javascriptAutomated testing in javascript
Automated testing in javascriptMichael Yagudaev
 
Visual Studio ALM 2013 - Edition Comparison
Visual Studio ALM 2013 - Edition ComparisonVisual Studio ALM 2013 - Edition Comparison
Visual Studio ALM 2013 - Edition ComparisonSteve Lange
 
Episode 5 - Writing unit tests in Salesforce
Episode 5 - Writing unit tests in SalesforceEpisode 5 - Writing unit tests in Salesforce
Episode 5 - Writing unit tests in SalesforceJitendra Zaa
 
Mobile User Experience: Auto Drive through Performance Metrics
Mobile User Experience:Auto Drive through Performance MetricsMobile User Experience:Auto Drive through Performance Metrics
Mobile User Experience: Auto Drive through Performance MetricsAndreas Grabner
 
The Jira How-To Guide
The Jira How-To GuideThe Jira How-To Guide
The Jira How-To GuideWilson Su
 
Testing regression
Testing regressionTesting regression
Testing regressionRichie Lee
 
The limits of unit testing by Craig Stuntz
The limits of unit testing by Craig StuntzThe limits of unit testing by Craig Stuntz
The limits of unit testing by Craig StuntzQA or the Highway
 
Manual, Visual, and Automated Testing For Web Apps
Manual, Visual, and Automated Testing For Web AppsManual, Visual, and Automated Testing For Web Apps
Manual, Visual, and Automated Testing For Web AppsSmartBear
 
Automated testing with Cypress
Automated testing with CypressAutomated testing with Cypress
Automated testing with CypressYong Shean Chong
 
Yelp Tech Talks: Mobile Testing 1, 2, 3
Yelp Tech Talks: Mobile Testing 1, 2, 3Yelp Tech Talks: Mobile Testing 1, 2, 3
Yelp Tech Talks: Mobile Testing 1, 2, 3Yelp Engineering
 
Architecture of automated test cases for legacy applications
Architecture of automated test cases for legacy applicationsArchitecture of automated test cases for legacy applications
Architecture of automated test cases for legacy applicationsMikhail Vasylchenko
 
Getting Started With Selenium
Getting Started With SeleniumGetting Started With Selenium
Getting Started With SeleniumSmartBear
 
Test Design + Environment Management: Scaling UI Automation for Agile
Test Design + Environment Management: Scaling UI Automation for AgileTest Design + Environment Management: Scaling UI Automation for Agile
Test Design + Environment Management: Scaling UI Automation for AgileSmartBear
 
How to build webapps with tools
How to build webapps with toolsHow to build webapps with tools
How to build webapps with toolsPasindu Perera
 
Why Your Selenium Tests are so Dang Brittle, and What to Do About It
Why Your Selenium Tests are so Dang Brittle, and What to Do About ItWhy Your Selenium Tests are so Dang Brittle, and What to Do About It
Why Your Selenium Tests are so Dang Brittle, and What to Do About ItJay Aho
 

What's hot (20)

Writing better tests for your java script app
Writing better tests for your java script appWriting better tests for your java script app
Writing better tests for your java script app
 
Drupal 7 ci and testing
Drupal 7 ci and testingDrupal 7 ci and testing
Drupal 7 ci and testing
 
ASP.NET & Unit Testing
ASP.NET & Unit TestingASP.NET & Unit Testing
ASP.NET & Unit Testing
 
Episode 20 - Trigger Frameworks in Salesforce
Episode 20 - Trigger Frameworks in SalesforceEpisode 20 - Trigger Frameworks in Salesforce
Episode 20 - Trigger Frameworks in Salesforce
 
Automated testing in javascript
Automated testing in javascriptAutomated testing in javascript
Automated testing in javascript
 
Visual Studio ALM 2013 - Edition Comparison
Visual Studio ALM 2013 - Edition ComparisonVisual Studio ALM 2013 - Edition Comparison
Visual Studio ALM 2013 - Edition Comparison
 
Episode 5 - Writing unit tests in Salesforce
Episode 5 - Writing unit tests in SalesforceEpisode 5 - Writing unit tests in Salesforce
Episode 5 - Writing unit tests in Salesforce
 
Mobile User Experience: Auto Drive through Performance Metrics
Mobile User Experience:Auto Drive through Performance MetricsMobile User Experience:Auto Drive through Performance Metrics
Mobile User Experience: Auto Drive through Performance Metrics
 
The Jira How-To Guide
The Jira How-To GuideThe Jira How-To Guide
The Jira How-To Guide
 
Testing regression
Testing regressionTesting regression
Testing regression
 
The limits of unit testing by Craig Stuntz
The limits of unit testing by Craig StuntzThe limits of unit testing by Craig Stuntz
The limits of unit testing by Craig Stuntz
 
React performance
React performanceReact performance
React performance
 
Manual, Visual, and Automated Testing For Web Apps
Manual, Visual, and Automated Testing For Web AppsManual, Visual, and Automated Testing For Web Apps
Manual, Visual, and Automated Testing For Web Apps
 
Automated testing with Cypress
Automated testing with CypressAutomated testing with Cypress
Automated testing with Cypress
 
Yelp Tech Talks: Mobile Testing 1, 2, 3
Yelp Tech Talks: Mobile Testing 1, 2, 3Yelp Tech Talks: Mobile Testing 1, 2, 3
Yelp Tech Talks: Mobile Testing 1, 2, 3
 
Architecture of automated test cases for legacy applications
Architecture of automated test cases for legacy applicationsArchitecture of automated test cases for legacy applications
Architecture of automated test cases for legacy applications
 
Getting Started With Selenium
Getting Started With SeleniumGetting Started With Selenium
Getting Started With Selenium
 
Test Design + Environment Management: Scaling UI Automation for Agile
Test Design + Environment Management: Scaling UI Automation for AgileTest Design + Environment Management: Scaling UI Automation for Agile
Test Design + Environment Management: Scaling UI Automation for Agile
 
How to build webapps with tools
How to build webapps with toolsHow to build webapps with tools
How to build webapps with tools
 
Why Your Selenium Tests are so Dang Brittle, and What to Do About It
Why Your Selenium Tests are so Dang Brittle, and What to Do About ItWhy Your Selenium Tests are so Dang Brittle, and What to Do About It
Why Your Selenium Tests are so Dang Brittle, and What to Do About It
 

Similar to Introduction to Test Driven Development (TDD

Introduction to Testing and TDD
Introduction to Testing and TDDIntroduction to Testing and TDD
Introduction to Testing and TDDSarah Dutkiewicz
 
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Adob...
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Adob...Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Adob...
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Adob...Uma Ghotikar
 
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Into...
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Into...Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Into...
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Into...Ortus Solutions, Corp
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfullyTEST Huddle
 
Testing Tools Online Training.pdf
Testing Tools Online Training.pdfTesting Tools Online Training.pdf
Testing Tools Online Training.pdfSpiritsoftsTraining
 
Testing-Tools-Magnitia-Content.pdf
Testing-Tools-Magnitia-Content.pdfTesting-Tools-Magnitia-Content.pdf
Testing-Tools-Magnitia-Content.pdfAnanthReddy38
 
Lean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill AyersLean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill AyersSPC Adriatics
 
Clean tests
Clean testsClean tests
Clean testsAgileee
 
Software testing course content,advanto software
Software testing course content,advanto softwareSoftware testing course content,advanto software
Software testing course content,advanto softwareAdvanto Software
 
Acceptance Test Driven Development
Acceptance Test Driven DevelopmentAcceptance Test Driven Development
Acceptance Test Driven DevelopmentMike Douglas
 
Driving application development through behavior driven development
Driving application development through behavior driven developmentDriving application development through behavior driven development
Driving application development through behavior driven developmentEinar Ingebrigtsen
 
Testing, a pragmatic approach
Testing, a pragmatic approachTesting, a pragmatic approach
Testing, a pragmatic approachEnrico Da Ros
 
CBDW2014 - Behavior Driven Development with TestBox
CBDW2014 - Behavior Driven Development with TestBoxCBDW2014 - Behavior Driven Development with TestBox
CBDW2014 - Behavior Driven Development with TestBoxOrtus Solutions, Corp
 
Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Applitools
 
Build, Test and Extend Integrated Workflows 3.7
Build, Test and Extend Integrated Workflows 3.7Build, Test and Extend Integrated Workflows 3.7
Build, Test and Extend Integrated Workflows 3.7StephenKardian
 
ISTQB CTAL - Test Analyst
ISTQB CTAL - Test AnalystISTQB CTAL - Test Analyst
ISTQB CTAL - Test AnalystSamer Desouky
 
QA / Testing Tools, Automation Testing, Online & Classroom Training
QA / Testing Tools, Automation Testing, Online & Classroom Training QA / Testing Tools, Automation Testing, Online & Classroom Training
QA / Testing Tools, Automation Testing, Online & Classroom Training AnanthReddy38
 

Similar to Introduction to Test Driven Development (TDD (20)

Introduction to Testing and TDD
Introduction to Testing and TDDIntroduction to Testing and TDD
Introduction to Testing and TDD
 
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Adob...
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Adob...Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Adob...
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Adob...
 
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Into...
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Into...Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Into...
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Into...
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfully
 
Testing Tools Online Training.pdf
Testing Tools Online Training.pdfTesting Tools Online Training.pdf
Testing Tools Online Training.pdf
 
Testing-Tools-Magnitia-Content.pdf
Testing-Tools-Magnitia-Content.pdfTesting-Tools-Magnitia-Content.pdf
Testing-Tools-Magnitia-Content.pdf
 
Lean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill AyersLean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill Ayers
 
Clean tests
Clean testsClean tests
Clean tests
 
Software testing course content,advanto software
Software testing course content,advanto softwareSoftware testing course content,advanto software
Software testing course content,advanto software
 
Acceptance Test Driven Development
Acceptance Test Driven DevelopmentAcceptance Test Driven Development
Acceptance Test Driven Development
 
UNIT IV.ppt
UNIT IV.pptUNIT IV.ppt
UNIT IV.ppt
 
Test box bdd
Test box bddTest box bdd
Test box bdd
 
Driving application development through behavior driven development
Driving application development through behavior driven developmentDriving application development through behavior driven development
Driving application development through behavior driven development
 
Testing, a pragmatic approach
Testing, a pragmatic approachTesting, a pragmatic approach
Testing, a pragmatic approach
 
CBDW2014 - Behavior Driven Development with TestBox
CBDW2014 - Behavior Driven Development with TestBoxCBDW2014 - Behavior Driven Development with TestBox
CBDW2014 - Behavior Driven Development with TestBox
 
Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully
 
Build, Test and Extend Integrated Workflows 3.7
Build, Test and Extend Integrated Workflows 3.7Build, Test and Extend Integrated Workflows 3.7
Build, Test and Extend Integrated Workflows 3.7
 
ISTQB CTAL - Test Analyst
ISTQB CTAL - Test AnalystISTQB CTAL - Test Analyst
ISTQB CTAL - Test Analyst
 
Specification by example
Specification by exampleSpecification by example
Specification by example
 
QA / Testing Tools, Automation Testing, Online & Classroom Training
QA / Testing Tools, Automation Testing, Online & Classroom Training QA / Testing Tools, Automation Testing, Online & Classroom Training
QA / Testing Tools, Automation Testing, Online & Classroom Training
 

More from Sarah Dutkiewicz

Passwordless Development using Azure Identity
Passwordless Development using Azure IdentityPasswordless Development using Azure Identity
Passwordless Development using Azure IdentitySarah Dutkiewicz
 
Predicting Flights with Azure Databricks
Predicting Flights with Azure DatabricksPredicting Flights with Azure Databricks
Predicting Flights with Azure DatabricksSarah Dutkiewicz
 
Azure DevOps for Developers
Azure DevOps for DevelopersAzure DevOps for Developers
Azure DevOps for DevelopersSarah Dutkiewicz
 
Azure DevOps for JavaScript Developers
Azure DevOps for JavaScript DevelopersAzure DevOps for JavaScript Developers
Azure DevOps for JavaScript DevelopersSarah Dutkiewicz
 
Azure DevOps for the Data Professional
Azure DevOps for the Data ProfessionalAzure DevOps for the Data Professional
Azure DevOps for the Data ProfessionalSarah Dutkiewicz
 
Noodling with Data in Jupyter Notebook
Noodling with Data in Jupyter NotebookNoodling with Data in Jupyter Notebook
Noodling with Data in Jupyter NotebookSarah Dutkiewicz
 
Intro to Python for C# Developers
Intro to Python for C# DevelopersIntro to Python for C# Developers
Intro to Python for C# DevelopersSarah Dutkiewicz
 
Becoming a Servant Leader, Leading from the Trenches
Becoming a Servant Leader, Leading from the TrenchesBecoming a Servant Leader, Leading from the Trenches
Becoming a Servant Leader, Leading from the TrenchesSarah Dutkiewicz
 
NEOISF - On Mentoring Future Techies
NEOISF - On Mentoring Future TechiesNEOISF - On Mentoring Future Techies
NEOISF - On Mentoring Future TechiesSarah Dutkiewicz
 
The Polyglot Data Scientist - Exploring R, Python, and SQL Server
The Polyglot Data Scientist - Exploring R, Python, and SQL ServerThe Polyglot Data Scientist - Exploring R, Python, and SQL Server
The Polyglot Data Scientist - Exploring R, Python, and SQL ServerSarah Dutkiewicz
 
The importance of UX for Developers
The importance of UX for DevelopersThe importance of UX for Developers
The importance of UX for DevelopersSarah Dutkiewicz
 
The Impact of Women Trailblazers in Tech
The Impact of Women Trailblazers in TechThe Impact of Women Trailblazers in Tech
The Impact of Women Trailblazers in TechSarah Dutkiewicz
 
Unstoppable Course Final Presentation
Unstoppable Course Final PresentationUnstoppable Course Final Presentation
Unstoppable Course Final PresentationSarah Dutkiewicz
 
Even More Tools for the Developer's UX Toolbelt
Even More Tools for the Developer's UX ToolbeltEven More Tools for the Developer's UX Toolbelt
Even More Tools for the Developer's UX ToolbeltSarah Dutkiewicz
 
History of Women in Tech - Trivia
History of Women in Tech - TriviaHistory of Women in Tech - Trivia
History of Women in Tech - TriviaSarah Dutkiewicz
 
The UX Toolbelt for Developers
The UX Toolbelt for DevelopersThe UX Toolbelt for Developers
The UX Toolbelt for DevelopersSarah Dutkiewicz
 
World Usability Day 2014 - UX Toolbelt for Developers
World Usability Day 2014 - UX Toolbelt for DevelopersWorld Usability Day 2014 - UX Toolbelt for Developers
World Usability Day 2014 - UX Toolbelt for DevelopersSarah Dutkiewicz
 

More from Sarah Dutkiewicz (20)

Passwordless Development using Azure Identity
Passwordless Development using Azure IdentityPasswordless Development using Azure Identity
Passwordless Development using Azure Identity
 
Predicting Flights with Azure Databricks
Predicting Flights with Azure DatabricksPredicting Flights with Azure Databricks
Predicting Flights with Azure Databricks
 
Azure DevOps for Developers
Azure DevOps for DevelopersAzure DevOps for Developers
Azure DevOps for Developers
 
Azure DevOps for JavaScript Developers
Azure DevOps for JavaScript DevelopersAzure DevOps for JavaScript Developers
Azure DevOps for JavaScript Developers
 
Azure DevOps for the Data Professional
Azure DevOps for the Data ProfessionalAzure DevOps for the Data Professional
Azure DevOps for the Data Professional
 
Noodling with Data in Jupyter Notebook
Noodling with Data in Jupyter NotebookNoodling with Data in Jupyter Notebook
Noodling with Data in Jupyter Notebook
 
Pairing and mobbing
Pairing and mobbingPairing and mobbing
Pairing and mobbing
 
Intro to Python for C# Developers
Intro to Python for C# DevelopersIntro to Python for C# Developers
Intro to Python for C# Developers
 
Becoming a Servant Leader, Leading from the Trenches
Becoming a Servant Leader, Leading from the TrenchesBecoming a Servant Leader, Leading from the Trenches
Becoming a Servant Leader, Leading from the Trenches
 
NEOISF - On Mentoring Future Techies
NEOISF - On Mentoring Future TechiesNEOISF - On Mentoring Future Techies
NEOISF - On Mentoring Future Techies
 
Becoming a Servant Leader
Becoming a Servant LeaderBecoming a Servant Leader
Becoming a Servant Leader
 
The Polyglot Data Scientist - Exploring R, Python, and SQL Server
The Polyglot Data Scientist - Exploring R, Python, and SQL ServerThe Polyglot Data Scientist - Exploring R, Python, and SQL Server
The Polyglot Data Scientist - Exploring R, Python, and SQL Server
 
The importance of UX for Developers
The importance of UX for DevelopersThe importance of UX for Developers
The importance of UX for Developers
 
The Impact of Women Trailblazers in Tech
The Impact of Women Trailblazers in TechThe Impact of Women Trailblazers in Tech
The Impact of Women Trailblazers in Tech
 
Unstoppable Course Final Presentation
Unstoppable Course Final PresentationUnstoppable Course Final Presentation
Unstoppable Course Final Presentation
 
Even More Tools for the Developer's UX Toolbelt
Even More Tools for the Developer's UX ToolbeltEven More Tools for the Developer's UX Toolbelt
Even More Tools for the Developer's UX Toolbelt
 
History of Women in Tech
History of Women in TechHistory of Women in Tech
History of Women in Tech
 
History of Women in Tech - Trivia
History of Women in Tech - TriviaHistory of Women in Tech - Trivia
History of Women in Tech - Trivia
 
The UX Toolbelt for Developers
The UX Toolbelt for DevelopersThe UX Toolbelt for Developers
The UX Toolbelt for Developers
 
World Usability Day 2014 - UX Toolbelt for Developers
World Usability Day 2014 - UX Toolbelt for DevelopersWorld Usability Day 2014 - UX Toolbelt for Developers
World Usability Day 2014 - UX Toolbelt for Developers
 

Recently uploaded

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 

Recently uploaded (20)

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 

Introduction to Test Driven Development (TDD

  • 1. INTRODUCTION TO TEST DRIVEN DEVELOPMENT Presented by Sarah Dutkiewicz sarah@cletechconsulting.com
  • 2. AGENDA • Test Driven Development – What does this mean? • Gathering Requirements • Gherkin • Tools for TDD in the Workplace
  • 4. TEST DRIVEN DEVELOPMENT • Define {something} first through a test • Write the code to pass the test • Verify that the test succeeds • Improve upon the code and keep the test passing
  • 5. Write the test Write the code to pass the test Improve the code while keeping the test passing RED-GREENREFACTOR
  • 8. TDD CONCEPT - ASSERTIONS • Verify whether a certain condition has been met • Asserts come in many forms: • • • • • • (Not) Equal Contains / Any Is a Type Is an Instance of a Type Is (Not) Null Is (True/False) • Design Guideline – One assert per test
  • 9. TDD CONCEPT – ARRANGE/ACT/ASSERT • Pattern for arranging a test 1. Arrange all preconditions and inputs. 2. Act on the object or method. 3. Assert that the results have occurred.
  • 10. TEST-DRIVEN – TYPES OF TESTS Tests, Tests, and More Tests… Oh My!
  • 11. TYPES OF TESTS • Unit Tests • Integration Tests • End-to-End Tests • Exploratory Testing
  • 12. UNIT TESTS • Focus on a class or a method • Tests the smallest unit possible • Typically tests simple objects; does not test things such as: • Database communication • Network communication • File system manipulation
  • 13. INTEGRATION TESTS • Tests functions, “does things” • Tests interactions with the outside world, include: • Database communication • Network communication • File system manipulation • Focused integration tests isolate the testing to one interaction at a time • Integration tests should run on their own, with a little help from 2 fundamental units: • Setup – run at the beginning of the test to set up the test environment • Tear-down – run at the end of the test or upon error to clean up the test environment
  • 14. END-TO-END TESTS • The most brittle of tests – dependent on the big picture • Verifies that the unit tests and integration tests are working like they should • Start at the beginning and go through the whole process • Includes: • Acceptance testing • Functional testing
  • 15. EXPLORATORY TESTING • Not an automated process; manual testing • Sometimes better to go this route rather than end-to-end tests – depending on the design and architecture of your application • EXPLORE! • Discovery • Investigation • Learning
  • 16. MORE *-DRIVEN DEVELOPMENT Related philosophies and methodologies
  • 17. OTHER RELATED *-DRIVEN DEVELOPMENT • Behavior Driven Development • Acceptance Test Driven Development • Specification by Example
  • 18. ACCEPTANCE TEST DRIVEN DEVELOPMENT CYCLE Discuss the requirements Distill the tests in a friendly format Demo the code Develop the code (and hook the code to the tests)
  • 19. ATDD AND THE TDD CYCLE REFACTOR Discuss the requirements Distill the tests in a friendly format Demo the code GREEN RED Develop the code (and hook the code to the tests) GREEN
  • 20. GATHERING REQUIREMENTS The Importance of TDD & ATDD for the UX Realm and an Intro to Gherkin
  • 21. DISCUSS • Conducted by all who are involved: • • • • Product owners Business analysts Developers QA • Requirements are explicitly spelled out. • Include use cases. • Include required behaviors or designs.
  • 22. GHERKIN • Common language for gathering requirements • Written in “plain English” following a particular cadence • Can then be hooked up to various programming languages and testing tools • Serves as guidelines for automated tests as well as project documentation
  • 23. GHERKIN COMPONENTS • Features • Scenarios & Scenario Outlines • Backgrounds • Steps • Multiline Arguments • Tags
  • 24. FEATURES • Define a feature of an application • Starts with the Feature keyword and contains a few lines to define the feature Example: Feature: Short, concise, descriptive text of the goal In order to do something As someone related to this system I want to gain something out of this * Features are stored in a *.feature file
  • 25. FEATURE EXAMPLE Feature: Checking out books In order to read eBooks on my eBook reader, As a library patron, I want to check out eBooks.
  • 26. SCENARIOS • Possibilities of situations (scenarios) that apply to a feature • Scenarios are included in *.feature files with their relevant feature • Created with one or more steps
  • 27. SCENARIO EXAMPLE Scenario: Checking out a book Given the library collection has the book I want to check out When I check out the book Then the library collection’s available count is reduced by 1
  • 28. STEPS • Given a certain given condition • When a certain behavior happens • Then a certain outcome is expected • Additional keywords include But and And • • • • Given a certain given condition And another given condition When a certain behavior happens Then a certain outcome is expected
  • 29. SCENARIO OUTLINES • Scenario Outlines eliminate the need for copying and pasting like scenarios and collapsing values into variables. • Rather than starting with Scenario, it starts with Scenario Outline. • Variables (placeholders) are denoted with names sandwiched in greaterthan and less-than symbols.
  • 30. SCENARIO OUTLINE EXAMPLE Scenario Outline: Checking book checkout expiration Given a checkout period of <checkout_period> days When I open the book at day <open> Then the book should expire in <left> days Examples: | checkout_period | open | left | |7 |2 |5 | | 14 | 10 |2 | | 21 | 18 |3 |
  • 31. MULTILINE ARGUMENTS • Tables Example: Scenario: Given the following accounts exist: |name |email |account_type| | Laura |laura@domain.com | Admin | | Sarah |sarah@domain.com | Admin | | Kevin | kevin@domain.com | User |
  • 32. MULTILINE ARGUMENTS • Large paragraph of text Example: Scenario: Given a description search with: """ It was the best of times It was the worst of times """
  • 33. BACKGROUNDS • Backgrounds setup the environment for all scenarios in a feature file. • Starts with the Background keyword and is typically made up of Given, And, and But clauses • Runs before individual scenario setup routines
  • 34. BACKGROUND EXAMPLE Feature: Checkout eMaterials Background: Given a customer named “Sarah Dutkiewicz“ And a library card numbered “12345678901” And a checkout queue of books: | title | author | | Hop on Pop | Dr. Seuss | | Harold and the Purple Crayon | Crockett Johnson | | Shark Tales: How I Turned $1,000 into a Billion Dollar Business | Barbara Corcoran|
  • 35. TAGS • Used for grouping like tests, scenarios, and/or features together • Starts with a @, followed by the tag name Examples: @UI @accounting @security • Many test runners support tags and allow collections of tests to be run by tag
  • 36. TOOLS FOR TDD IN THE WORKPLACE
  • 37. GHERKIN LANGUAGE RESOURCES AND GENERAL TDD RESOURCES • Behat – Writing Features – Gherkin Language • The Art of Agile Development: Test-Driven Development • Test first != TDD • Driving Development with Tests: ATDD and TDD • Let’s Explore – Exploratory Testing
  • 38. .NET TDD RESOURCES • SpecFlow – Behavior Driven Development, Acceptance Test Driven Development, Specification by Example; includes support for Silverlight, Windows Phone, and Mono • TestDriven.Net – Visual Studio integration for unit tests • WatiN – Web Application Testing in .NET • TestStack.White – UI automation testing • Telerik Test Studio • Nunit • MbUnit • MSTest • NCover • TypeMock
  • 39. JAVASCRIPT TDD RESOURCES • QUnit • Jasmine • Zombie.js • Mocha • Tutti • JSTestDriver • jsUnity • CasperJS
  • 40. RUBY TDD RESOURCES • Cucumber – behavior driven development • Watir – Web Application Testing in Ruby • Ruby Koans – learn Ruby via testing • Rspec – primary Ruby testing tool
  • 41. PHP TDD RESOURCES • Behat – behavior driven development • Mink – web acceptance testing • PHPUnit • SimpleTest • Phpt • Gouette – headless browser, web scraper
  • 42. JAVA TDD RESOURCES • JUnit • Watij – Web Application Testing in Java • AppPerfect Java Unit Test
  • 43. ADDITIONAL *DD RESOURCES • Sahi – JavaScript browser controller • Selenium – supports C#, Java, Perl, PHP, Python, Ruby • Fitnesse – supports multiple languages • Windmill – supports Python, JavaScript, Ruby • Canoo WebTest – supports Python, JavaScript • TSQLUnit – TDD for Transact-SQL • TST – the T-SQL Test Tool
  • 44. CONTACT INFORMATION Sarah Dutkiewicz Cleveland Tech Consulting, LLC sarah@cletechconsulting.com Twitter: @sadukie Blog: http://codinggeekette.com

Editor's Notes

  1. Introduction to Test Driven Development (For Both Developers and Non-Developers)Have you heard of Test Driven Development (TDD) and wondered exactly what it meant? In this talk, we&apos;ll explore the process of Test Driven Development and how it fits in with gathering user needs and requirements. If teams know how they fit together, it can be a beautiful thing. Using gherkin (written in plain English that follows a pattern) to express the user needs and app requirements, developers can then write tests that lead to code that eventually lead to improvement in the overall software development process. We will also explore some tools for various platforms that can be used in the TDD process.
  2. Image taken from: http://onproductmanagement.net/wp-content/uploads/2010/10/why-us.jpg
  3. This may also be known as Red-Green-Clean
  4. Image taken from: http://2.bp.blogspot.com/_1UIyN-eAGC8/SnoFcKZ9gtI/AAAAAAAABnQ/rLOduxwJKmo/s320/point+d%27interrogation.jpg
  5. Image taken from: http://upload.wikimedia.org/wikipedia/commons/f/fd/Light_Green_Lego_Brick.jpg
  6. Image taken from: http://pixelperfectdigital.com/samples/NDQ0YzczNWFhODVlMw==/MjJjNzM1YWE4NWUz/photo.jpg&amp;size=1024
  7. Related reading: http://janetgregory.blogspot.com/2010/08/atdd-vs-bdd-vs-specification-by-example.html
  8. This is the Discuss phase of the Discuss/Distill/Develop/Demo cycle.
  9. Image taken from: http://2.bp.blogspot.com/-Q8TsaBzcxxg/TchwA0vS_sI/AAAAAAAAAEY/dMbBux1SukI/s320/lego+pile.jpg