BDD and Testing. User requirements and testing are tightly coupled

Similar documents
Gathering Requirements. We even iterate on the requirements

MACtivity Test Cases Team 6 CSE 5324: Spring 2012 Khandaker Moinur Rahman Shwetha Narayan Hardik Shah Yu Xuan Zhang Sanjay Vasudeva Iyer

Making ecards Can Be Fun!

No Source Code. EEC 521: Software Engineering. Specification-Based Testing. Advantages

A few more things about Agile and SE. Could help in interviews, but don t try to bluff your way through

The two bullets below provide instructions that will guide you through the process of setting up and connecting to the ILG VPN:

CS3205: Task Analysis and Techniques

S A M P L E C H A P T E R

Black Box Testing. EEC 521: Software Engineering. Specification-Based Testing. No Source Code. Software Testing

Google Docs Tipsheet. ABEL Summer Institute 2009

Time and Attendance is the system we use to keep track of the hours that our employees work. It also allows us to keep track of the number of hours

ASTQB Advance Test Analyst Sample Exam Answer Key and Rationale

Unit Testing as Hypothesis Testing

Testing. Topics. Types of Testing. Types of Testing

Drupal Basics. for COS and CLASS site maintainers

Guide to Completing Your Senior English and Government Portfolios

Filter and PivotTables in Excel

Chapter 2 The SAS Environment

EXCEL + POWERPOINT. Analyzing, Visualizing, and Presenting Data-Rich Insights to Any Audience KNACK TRAINING

Part 1: Understanding Windows XP Basics

Using your Participant Center A Step by Step Guide

Technology Policy! Tools, Tips, Apps

Click here for a PDF version of this tutorial. Start. MSTI 260 l HOME

Usability Test Report: Requesting Library Material 1

Team : Let s Do This CS147 Assignment 7 (Low-fi Prototype) Report

Food Festival Network

Post Experiment Interview Questions

So, why not start making some recommendations that will earn you some cash?

Midterm Exam, October 24th, 2000 Tuesday, October 24th, Human-Computer Interaction IT 113, 2 credits First trimester, both modules 2000/2001

Canon Image Browser EX: A Novice Tutorial for Creating a Vacation Slideshow. Eric Morlang

MISGUIDED GUIDE SPECS What Specifiers Want and Need

Lesson 2. Introducing Apps. In this lesson, you ll unlock the true power of your computer by learning to use apps!

Foundations, Reasoning About Algorithms, and Design By Contract CMPSC 122

Frequently Asked Questions Contents

User Guide Android App. Get the most out of the MapItFast app on your Android device with this user guide.

Quick Start Guide. Microsoft OneNote 2013 looks different from previous versions, so we created this guide to help you minimize the learning curve.

Abstraction and Specification

TKL Mobile User Guide v1.0 Cisco Public. Cisco Technical Knowledge Library Mobile User Guide v1.0

NCMail: Microsoft Outlook User s Guide

PRODUCT PAGE PHASES and EXPERIENCE DESCRIPTION

Project Demo. Ubiquitous and Mobile Computing /17

Kentico Lead Scoring. A Practical Guide to Setting Up Scoring and Its Rules in Kentico.

Scenarios, Storyboards, Wireframes, Critique. Jon Kolko Professor, Austin Center for Design

facebook a guide to social networking for massage therapists

Gradient Descent - Problem of Hiking Down a Mountain

Lecture 3: Recursion; Structural Induction

PhotoGeoDWG. Users Guide and Administration Notes, Version 1.0.0

CS2112 Fall Assignment 4 Parsing and Fault Injection. Due: March 18, 2014 Overview draft due: March 14, 2014

RECORD. Published : License : None

MFA (Multi-Factor Authentication) Enrollment Guide

Microsoft PowerPoint 2016 Part 2: Notes, Links, & Graphics. Choosing a Design. Format Background

PowerPoint Basics: Create a Photo Slide Show

ONLINE REGISTRATION: A STEP-BY-STEP GUIDE

CS Equalizing Society - Assignment 8. Interactive Hi-fi Prototype

Heuristic Evaluation of [ Quest ]

For Volunteers An Elvanto Guide

When you first start OneNote, it creates a sample notebook for you. You can use this notebook or quickly create your own.

User Stories. Wednesday, January 23, 13

I.

NCMail: Microsoft Outlook User s Guide

Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller

Microsoft Office Publisher


User Guide. esign Emcee is a trademark of esign Emcee. All other trademarks are the property of their respective owners.

How to Open a Free Yahoo! Account & Basics

WINDOWS 8.X SIG SEPTEMBER 22, 2014

Prezi - online presentation editor

Section 508 Compliance Review Report. Attachment A - Access Florida Detailed Forms Review

GEOG 487 Lesson 2: Step-by-Step Activity

Lecture 1: Overview

The ICT4me Curriculum

The ICT4me Curriculum

HOUR 12. Adding a Chart

CLIENT ONBOARDING PLAN & SCRIPT

Strategic Series-7001 Introduction to Custom Screens Version 9.0

Mastering the Actuarial Tool Kit

** Pre-Sell Page Secrets **

CLIENT ONBOARDING PLAN & SCRIPT

Technical Knowledge Library

Problem and Solution Overview: An elegant task management solution, that saves busy people time.

Welcome to Computers for ESL Students, 4th Edition

How to git with proper etiquette

Getting Started. Excerpted from Hello World! Computer Programming for Kids and Other Beginners

Hello World! Computer Programming for Kids and Other Beginners. Chapter 1. by Warren Sande and Carter Sande. Copyright 2009 Manning Publications

TABLE OF CONTENTS CREATE AN ACCOUNT...3. TO LOG IN AproPLAN HOMEPAGE...5 ADMINISTRATION CONSOLE...6 PROJECT...7

PRINCIPLES OF SOFTWARE BIM209DESIGN AND DEVELOPMENT 00. WELCOME TO OBJECTVILLE. Speaking the Language of OO

In this chapter we will be going over the technology that help you get through the sale successfully!

Analysis of the Test Driven Development by Example

Wimba Pronto. Version 3.1. User Guide

An introduction to plotting data

MindView Online - Quick Start Guide

The 10 step communication plan

Interactive PDFs Start

Have the students look at the editor on their computers. Refer to overhead projector as necessary.

Instructions for Casual and Relief Staff

USER GUIDE MYMAZDA MOBILE APP. The MyMazda mobile app makes your Mazda ownership experience simpler and more convenient than ever.

Behavior Driven Development (BDD) By Nabeel Ibrahim

Impossible Solutions, Inc. JDF Ticket Creator & DP2 to Indigo scripts Reference Manual Rev

CS 147 Let s Do This! Assignment 6 Report

EDI Web Portal Quick Start Guide

Transcription:

BDD and Testing User requirements and testing are tightly coupled 1

New Concept: Acceptance Tests Customer criteria for accepting a milestone Get paid if pass! Black-box tests specified with the customer Agreed upon features: User Stories! Performance requirements (speed, scalability) (System tests are like acceptance tests, but are spec d by the developers for own use) Customer may have no idea how to write good acceptance tests We have to collaborate to do it well 2

Writing Good Tests is Hard How many tests do we need to write to test the add method? // perform arithmetic + of x and y public int add(int x, int y) { return x + y; black box } A. One B. About four C. About 20 D. About 2 32 * 2 32 3

You can t test all combinations Simply too many tests (2 64 for measly add!) If there is one bug in add: Most tests will pass Another set of tests will fail, all the same way Most tests, then, are unnecessary (whew!) Ideally, have only: 1 test that succeeds (shows most of it works) 1 test that exposes the bug But doing that well requires knowing what the bug is (and that there s only one!) Or does it? 4

New Concept: Cluster tests into similar classes: one (or a few) tests per class public int add(int x, int y) { return x + y; } add(-5, -100) -105 two negatives add(5, 100) 105 two positives add(100, -5) 95 positive, negative add(-100, 5) -95 negative, positive add(0, 5) 5 special value: 0 add(-1, 1) 0 special values: near 0 add(integer.max_int, -1) 2 32-2 max int boundary val: These are really classes of coding errors, not just classes of values Handling neg s, handling pos s, handling mixed neg/pos, handling 0 ) Each is a hypothesis (guess) about how add might be coded wrong Classes can also be based on outputs, not just inputs 5

What are the classes for mycity acceptance tests? Not so simple add is stateless mycity is all about state To test send message to friend on map : Have to be logged in to retrieve friends User has to have a location Friend has to have a location Need to be close to each other (friend on the map) Also, not natural for customer to talk in terms of value classes or even classes of coding errors Different kinds of buddies (logged in, logged out, near, far) Different kinds of locations (San Diego, LA, huh?) 6

The Answer: Scenarios (new concept) The customer naturally thinks in terms of situations that users encounter when using app New user, returning user, forgot password, Can t acquire GPS location No buddies close by Each situation is the beginning of a story Not a User Story (describes a feature) User Story is a misnomer A personal story called a scenario Progresses step-by-step, driven by state of the world, state of the app, and motivations of the user 7

mycity scenario that exercises message friend on map Bob was looking for a lunch partner, so he decided to login to mycity. Clicking its icon, he was taken directly to the map; it had remembered his login and password. After a few moments, the map changed to his current location. Good. However, no buddies were shown in the city block shown. He didn t mind walking a little, so he clicked the - on the map to zoom out. Now he could see Alice on the map. Key elements: Bob s thoughts: motivations, preferences, etc. State of the app: remembered login info Progression: determines location, updates map State of the world: no one nearby Their combination drive the scenario forward 8

Scenarios are a Powerful Tool In non-technical language for customer Structure of a story good match for our brains Help uncover requirements Need to support zoom! Implicitly highlight benefit of app s features Exhibit common real-world progressions Omit trillions of unlikely progressions (i.e., tests) Identifies testing classes! Buddy-to-message distance: on map, off map 9

Behavior-Driven Development (BDD) Powered by scenarios Two parts, the User Story and its Scenarios Both use templates to ensure consistency User Story template: As a role I want feature So that benefit As a user I want to message a friend on the map So that we can spontaneously meet up Novel parts of BDD User Story are: Template syntax Explicit statement of benefit (relieves scenario of job) 10

Practice: Write your own BDD Story 4. User tracking: Map continues to track user s changing location, with option to not track As a user I want the map to update with my changing location unless I ve unclicked the track box so that I can continue to see friends who are closeby (for a spontaneous meet up) or who will be closeby soon Note: took a few tries to come to agreement; customer and devs made different assumptions as to benefit of requirement, which really meant different requirements. 11

BDD II: Scenarios More important are BDD scenarios Expose/reduce ambiguity/assumptions Tilted toward use in testing Leaves out the rationale (U.S. benefit fills in here) Scenario template: Given context When event Then outcome Flexible Given I am logged in And a friend is shown on the map When I click the friend s name Then a text box pops up When I type a message Then the send button is enabled When I click send Then the message is sent to the friend When-Then clauses repeated for longer progression And is used for multiple Given, When, or Then s 12

BDD: Scenarios II There are multiple scenarios per user story, driven by: Number of unique progressions into the feature Number of unique progressions out of the feature Given I am logged in And a friend is shown on the map When I click the friend s name Then a text box pops up When I click the cancel button Then the text box disappears Large number of progressions in/out Temptation is to enumerate cross product of valid in/out s Use test classes concept to manage tradeoff Need a case for messaging Alice and another for messaging Joe??? detail (more scenarios) vs. conciseness (fewer scenarios) Also consider if already covered by other User Stories zooming out in the show friends User Story Scenario is covered by (at least one) matching acceptance test E.g., need tests for sending message and canceling message 13

Practice: Write your own BDD Scenarios As a user I want the map to update with my changing location unless I ve unclicked the track box so that I can continue to see friends who are closeby (for a spontaneous meet up) or who will be closeby soon Given that the map is updating When I click do-not-track Then stop updating the map Given that the map is updating When I move 100m to the left Then my icon on map uses 100m to the left Given the map is not updating When I move 100m to the left Then the map does not update Notes: left out dragging map for the show buddies U.S.; like the motion details here because it s testable 14

Testing: two kinds required for project BDD-style tests, written in JUnit (or BDD s JBehave) Written in code; Tasks under a User Story At least one for each BDD Scenario Ideally written before actual code (but not required) Run before Git push (e.g., like continuous integration) Run frequently as regression tests (to see if broke anything) System/acceptance tests Written in English Combine a long progression of BDD User Story Scenarios Finishing one scenario enables the next scenario Centering you on map enables showing buddies around you Still check if inputs produce expected outputs (input/output pairs) Performed by user (like a demo) or a UI testing tool (Robotium) Done at end of Iterations and Milestone (at least) 15

A. 2 B. 4 C. 8 D. 16 How many BBD JUnit Tests for Msg? Given I am logged in And a friend is shown on the map Given I am logged in When I click the friend s name And a friend is shown on the map Then a text box pops up When I click the friend s name When I type a message Then a text box pops up Then the send button is enabled When I click the cancel button When I click send Then the text box disappears Then the message is sent to the friend E. 2 8 + 2 6 Somewhere between 4 and 8: 1 each for the two scenarios (2) 1 each for their cross product (2) - no typing + send no send? - typing + cancel are you sure? Someone suggested as clicking the target (user name) as a case (2) - click target get text box - miss target don t get box Should we add matching scenarios for these? Clarify size of name target? Not clear (concise vs. detailed) 16

Interaction Design via Scenarios U.I. design is now called Interaction Design Goal is to design a useful, simple, fun user experience BDD scenarios are great interaction design tool One goal: minimize user clicks between steps Draw screen for each major step (by hand is best) Copy identical screens shown in other scenarios Can Demo to customer alice me joe alice me joe alice me Generates important design debates Should messaging be on separate tab? joe 17

For Project Do Stories and Scenarios just like in article I ve simplified here due to space Need the Name, for example You have to write (and run ;) two kinds of tests Scenario-based system tests (planning phase) BDD scenario tests in JUnit (code & delivery phase) Draw screens for interaction design by hand Take pictures of them to put into digital form But PowerPoint OK (stunts experimentation) 18

Take-Aways from Class Today We can t test every input/output But can rigorously test most classes of input/output Complex, and involves tradeoffs BDD Scenarios define likely, testable progressions BDD Scenarios & User Story benefit clause sharpen actual requirements BDD s templates ensure compliance & consistency Testing is considered from the earliest stages Interaction design removes another layer of customer-developer assumptions Aided by BDD Scenarios 19