testing system qualities agile2012 by rebecca wirfs-brock and joseph yoder

35
Testing System Qualities Rebecca Wirfs-Brock Joseph Yoder Copyright 2012 Rebecca Wirfs-Brock, Joseph Yoder, Wirfs-Brock Associates and The Refactory, Inc.

Upload: joseph-yoder

Post on 10-May-2015

769 views

Category:

Technology


5 download

DESCRIPTION

Agile teams incrementally deliver functionality based on user stories. In the sprint to deliver features, frequently software qualities such as security, scalability, performance, and reliability are overlooked. Often these characteristics cut across many user stories. Trying to deal with certain system qualities late in the game can be difficult, causing major refactoring and upheaval of the system’s architecture. This churn isn’t inevitable. Especially if you adopt a practice of identifying those characteristics key to your system’s success, writing quality scenarios and tests, and delivering on these capabilities at the opportune time. We will show how to write Quality Scenarios that emphasize architecture capabilities such as usability, security, performance, scalability, internationalization, availability, accessibility and the like. This will be hands-on; we present some examples and follow with an exercise that illustrates how you can look at a system, identify, and then write and test quality scenarios.

TRANSCRIPT

Page 1: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Testing System Qualities

Rebecca Wirfs-Brock

Joseph Yoder

Copyright 2012 Rebecca Wirfs-Brock, Joseph Yoder, Wirfs-Brock Associates and The Refactory, Inc.

Page 2: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Introducing Rebecca President, Wirfs-Brock Associates

Agile enthusiast (involved with experience reports since 1st agile conference, board president Agile Open Northwest)

First engineering job in Quality Assurance

Pattern enthusiast, author, and Hillside Board Treasurer

Old design geek (author of two object design books, inventor of Responsibility-Driven Design, advocate of CRC cards, hot spot cards, & other low-tech design tools, IEEE

Software design columnist)

Consults and trains top companies on agile architecture, responsiblity-driven design, enterprise app design, agile use cases, design storytelling, pragmatic testing

Runs marathons!!!

Page 3: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Introducing Joseph Founder and Architect, The Refactory, Inc.

Pattern enthusiast, author and Hillside Board President

Author of the Big Ball of Mud Pattern

Adaptive systems expert (programs adaptive software, consults on adaptive architectures, author of adaptive architecture patterns, metatdata maven, website: adaptiveobjectmodel.com)

Agile enthusiast and practitioner

Business owner (leads a world class development company)

Consults and trains top companies on design, refactoring, pragmatic testing

Amateur photographer, motorcycle enthusiast, enjoys dancing samba!!!

Page 4: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Some Agile Myths

• System Qualities can be added at the last moment.

• We can easily adapt to changing requirements (new requirements).

• You can change the system fast!!!

• Don’t worry about the architecture.

Page 5: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

…BUT THERE’S A LOT MORE TO TEST THAT YOUR SOFTWARE WORKS AS ADVERTISED

Most testers spend the majority of their time writing functional tests

Page 6: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Pragmatic Testing Issues

• What kinds of testing should you focus on?

• Who writes them?

• Who runs them?

• When are they run?

• How are they run?

Page 7: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Testing System Qualities

• Usability

• Security

• Performance

• Scalability

• Internationalization

• Availability

• Flexibility

• Accessibility

• Location

• Regulation

Qualities we could consider…

Page 8: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Discussion

What are the important qualities in

your system?

Page 9: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Functional Tests vs. System Quality Tests

Functional:

– How do I …?

– Tests user stories work as advertised

• “As a reviewer I want to add a note to a chart”

• Compute the charge for an invoice

– Tests boundary conditions

• Can I add more than one note at the same place?

• Are excess charges computed correctly?

Page 10: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

System Quality Tests

• How does the system handle…? – system load …? number of add note

transactions/minute under normal load

– system support for…? simultaneously updating charts

– usability…? ease of locating and selecting notes

• Tests that emphasize architecture capabilities and tangible system characteristics

Page 11: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Structure for A System Quality Acceptance Test

Page 12: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Specify Measurable Results

• Scale: The values you expect

– Natural Scale:

• Response time in milliseconds

– Constructed:

• 1-10 ranking

– Proxy:

• Projecting throughput using sample data

• Meter: An appropriate way to measure

Page 13: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Example Performance Scenario

Source of

Stimulus

Stimulus Artifact

Environment

Response Response

Measure

“Users initiate 1,000 order transactions per

minute under normal operations; transactions

are processed with an average latency of 2

seconds.”

Users Initiate

order System

Normal

conditions

Transactions

processed Average

latency of 2

seconds

Page 14: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Possible Performance Scenario Values Portion of

Scenario

Possible Values

Source External systems, users, components, databases

Stimulus Periodic events, sporadic or random events (or a

combination)

Artifact The system’s services, data, or other resources

Environment The state the system can be in: normal, overloaded,

partial operation, emergency mode…

Response Process the event or event sequence and possibly change

the level of service

Response

Measure

Times it takes to process the arriving events (latency or

deadline by which event must be processed), the

variation in this time, the number of events that can be

processed within a particular time interval, or a

characterization of events that cannot be processed

(missed rate, data loss)

Page 15: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Example Security Scenario

Source of

Stimulus Stimulus Artifact

Environment

Response Response

Measure

“A known, authorized user transfers money between

accounts. The user is later identified as an embezzler

by the institution they belong to and the system then

restores funds to the original account.”

Correctly

identified

individual

Tries to

transfer

money

between

accounts

Data

within the

system

Normal

operation

System

maintains

audit trail

Correct data

is restored

within a day of

reported event

Page 16: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Possible Security Scenario Values

Portion of

Scenario

Possible Values

Source A human or another system. May be identified (correctly or not) or

be unknown.

Stimulus An attack or an attempt to break security by trying to display

information, change information, access system services, or reduce

system availability

Artifact The system’s services or data.

Environment The system might be online or offline, connected to or disconnected

from the network, behind a firewall or open to the network.

Response Authenticates user; hides identity of the user; blocks or allows access

to data and/or services; records access/modification attempts by

identity; stores data in encrypted format; recognizes unexplained high

demand and informs a user or other system, or restricts availability.

Response

Measure

Time/effort/resources required to circumvent security measures with

probability of success; probability of detecting attack; probability of

identifying individual responsible for attack or access/modification;

time/effort/resources to restore data/services; extent to which

data/services are damaged and/or legitimate access denied.

Page 17: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Example Modifiability Scenario

Source of

Stimulus

Stimulus Artifact

Environment

Response Response

Measure

“A developer adds support for a new service code to the system by adding the service code to the definitions table and modifying the UI to make it available to users. The modification is made with no data schema changes ”

Developer Add support

for new

service

code

UI, Source

code,

Service

Code

Table

Compile time, data definition

Modification made

with no schema

changes

2 days to

code and

test, 1 day

to deploy

Page 18: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Possible Modifiability Scenario Values Portion of

Scenario

Possible Values

Source End user, developer, system administrator

Stimulus Wishes to add/delete/modify/vary functionality.

Wishes to change some system quality such as

availability, responsiveness, increasing capacity. Artifact What is to be changed: system user interface,

platform, environment, or another system or API

with which it interoperates Environment When the change can be made: runtime, compile

time, build time, when deployed,… Response Locates places to be modified; makes

modification without affecting other

functionality; tests and deploys modification Response

Measure End user, developer, system administrator

Page 19: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Example Availability Scenario

Source of

Stimulus

Stimulus Artifact

Environment

Response Response

Measure

“An unknown sensor sends a report. The system stores the raw data in the unknown sensor database (to potentially be processed or purged later) and logs the event. ”

Unknown

Sensor

Unexpected

Report System

Normal

conditions

Record “raw”

report in database

and log event

No lost

data

Page 20: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Example Usability Scenario

Source of

Stimulus

Stimulus Artifact

Environment

Response Response

Measure

“A user can cancel a pending request within two seconds.”

End user

Cancel

request System

At runtime

System

backs out

pending

transaction

and releases

resources

Cancel takes

less than one

second

Page 21: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Copyright 2012 Wirfs-Brock Associates and The Refactory

Page 22: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

WRITE A QUALITY SCENARIO FOR A DATA COLLECTION AND ANALYSIS SYSTEM

EXERCISES

Page 23: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Write A Quality Scenario

• Using the template handout, write a quality scenario. Be specific.

• Options: – Response to data received from an unknown sensor. – Adding new analyzer plug-ins. – Relocating a sensor and being able to correlate data

from its previous location (if desired). – Detecting and troubleshooting equipment failures – Detecting unusual weather conditions and incidents

• What quality does your scenario address?

Page 24: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

TURN VAGUE STATEMENTS INTO CONCRETE MEASURABLE ACTIONS

You can’t test warm and fuzzy…

“It should be easy to place an online order”

Page 25: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Turning Warm Fuzzies into a Testable Usability Scenario

Source of

Stimulus

Stimulus Artifact

Environment

Response Response

Measure

“80% of novice users should be able to place an order in

under 3 minutes without assistance.”

or

Novice

user

Place

order

System

Web interface

with online help

Time to

complete order

entry task

Order

completed

“80% of novice users should be able to place an order in

under 3 minutes only using online help.”

Page 26: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Agreeing on scenarios and target values

Page 27: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Some options…

• Toss out a reasonable number, then discuss to come to a consensus

• Average informed individuals’ estimates

• Use an existing system as baseline

• Values for similar scenarios

• Benchmark working code

• …

Page 28: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

There is more than “pass” or “fail”

• Landing Zone: Lets you define a range of acceptable values

– Minimal: OK, we can live with that

– Target: Realistic goal, what we are aiming for

– Outstanding: This would be great, if everything goes well

Page 29: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Landing Zones

• Roll up product or project success to several key scenarios

• Easier to make sense of the bigger picture: – What happens when one

quality scenario edges below minimum? How do others trend?

– When will targets be achieved? At what cost?

Page 30: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Too many scenarios and you lose track of what’s really important

Define a core set, organize and group

Roll up into aggregate scenarios

Re-calibrate values as you implement more functionality…be agile

Managing Landing Zones

Minimum Target Outstanding

Throughput (txns per day)

50,000 70,000 90,000

Average txn time 2 seconds 1 second < 1 second

Intersystem data consistency (per cent critical data attributes consistent)

95% 97% 97%

Data accuracy 97% 99% >99%

Performance

Data Quality

Page 31: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Quality Testing Cycle for TDD

Identify and

Write Quality

Scenarios

Verify Quality

Scenarios

Check all Tests Succeed

all tests succeed

Write Code and Tests

Clean up Code (Refactor/revise

/rework)

Ready to Release?

Ship it!!!

Page 32: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Test Coverage Can Overlap…

Integration Tests

Acceptance Tests (Functional and qualities)

Quality Scenarios

Unit Tests

Smoke Tests

Page 33: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Pragmatic Test Driven Development Is…

• Practical. Testing system qualities can fit into and enhance your current testing.

• Thoughtful. What qualities need to be tested? Who should write tests? When should you test for qualities?

• Realistic. You only have so much time and energy. Test essential qualities.

Page 34: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Summary

• Quality Scenarios are easy to write and read.

• Writing quality test scenarios drives out important cross-cutting concerns.

• If you don’t pay attention to qualities they can be hard to achieve at the last moment.

• Measuring system qualities can require specialized testing/measurement tools.

Page 35: Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder

Resources • Agile Myths: agilemyths.com • Wirfs-Brock Associates: www.wirfs-brock.com • The Refactory: www.refactory.com • Joe’s website: joeyoder.com • Our Pragmatic TDD Course:

– refactory.com/training/test-driven-development – wirfs-brock.com/pragmatictestdrivendevelopment.html

• Landing Zone blogs: – wirfs-brock.com/blog/2011/07/20/introducing-landing-zones/ – wirfs-brock.com/blog/2011/08/16/who-defines-or-redefines-

landing-zone-criteria/ – wirfs-brock.com/blog/2011/08/05/landing-zone-targets-precision-

specificity-and-wiggle-room/

• Introducing Pragmatic TDD: – wirfs-brock.com/blog/2011/09/23/what-is-pragmatic-testing-all-about/ – http://adaptiveobjectmodel.com/2012/01/what-is-pragmatic-tdd/