Approval Tests at Agile 2012

Post on 19-Jun-2015

3.379 views 1 download

Tags:

description

slides from our talk on Approval Tests at Agile 2012

Transcript of Approval Tests at Agile 2012

An open source library for better Unit Testing

Woody Zuill & Lynn Langit

Agile 2012 – August 2012

Dan

Who wrote ApprovalTests?

Llewellyn

Approval Tests and Test Types

Integration Tests

Unit Tests Unit Tests

Function Tests

Performance Tests

Acceptance Tests

Installation Tests

DEMOGETTING STARTED

Building your Testing Toolkit

Test Runner Test CodeLibraries Manual testsAutomated tests & tools

TDD - Red, Green, Refactor

Approval Tests make it EASY…

For Woody…• … for human evaluation of

test results• … to set up Tests • … to modify test output for

readability• … to maintain tests

For Lynn…• … in multiple languages• … with visual results…

Golden Master

DEMOEXPRESSIVENESS

Approving the Reported Result• Contents are serialized to a file as binary (to compare)• Rename *.received to *.approved• Right click ‘Use whole file’ • Copy ‘Move’ statement from Test Results to command window.

More about

reporters…

A Little About Reporters

• Reporters provide a rich, expressive, human-friendly view of a failed test.

• Reporters usually hook into DiffTools (Text, Image, Sound…)• Support for many diff tools included in Reporters• Can add hooks to your favorite diff tool

Best test output has…?

Best test output has...?

Granularity• What is the result of a break• What is the specific cause of a break

Feedback• Frequent (or even constant) feedback

Specification• What is this code supposed to do?• How do we use it?

Regression-Proofing• Did what I just do break something?

Automatic Design Process• TDD can be thought of as Test Driven Design

DEMOARRAYS

Approval Tests in Java…

Code must be Testable

Code must be Testable

Code must include Tests

Code should be written so that it is easy to write its required tests

“Reduce to Functional”

Code Tests must be kept runnable

Unit Test Frameworks are Multi-Purpose

• Application code (components)New Code

• Functionality• Edge casesTesting APIs

• Locking tests• Characterization testsLegacy Code

• Scope• Functionality

Learning new APIs

Legacy Code

How much of your code base is dead code?

Locking Tests (Characterization Tests)

Test to enable

refactoring

Ensures system still works the

same

Most often used with

Legacy Code

Quickly results in high test coverage

DEMOLegacy Code – Chart Smart

For More Information

www.ApprovalTests.com

Pick your language & download

Pick your diff tool

Reference, Approve & Enjoy

Learn more – videos (.NET)

Podcast - HerdingCode

Q & A

@LynnLangit@WoodyZuill