10
Test-Driven Development Building Better Software Contents What is TDD? Origins. Characteristics. Life Cycle. Benefits. What can be tested? Framework. References. Code Example.

Test-Driven Development

Embed Size (px)

DESCRIPTION

Test-Driven Development. Building Better Software Contents What is TDD? Origins. Characteristics. Life Cycle. Benefits. What can be tested? Framework. References. Code Example. What is Test Driven Development?. - PowerPoint PPT Presentation

Citation preview

Page 1: Test-Driven Development

Test-Driven Development Building Better Software

Contents

What is TDD?

Origins.

Characteristics.

Life Cycle.

Benefits.

What can be tested?

Framework.

References.

Code Example.

Page 2: Test-Driven Development

What is Test Driven Development?

An iterative technique to develop software.

Test-driven development (TDD) is an advanced technique of using automated unit tests to drive the design of software and force decoupling of dependencies.

Page 3: Test-Driven Development

Origin Test-Driven Development is a core part of the

agile process formalized by Kent Beck called eXtreme Programming (XP).

XP originally had the rule to test everything that could possibly break. Now, however, the

practice of testing in XP has evolved into Test-Driven Development."

Do not need to adopt XP in order to practice TDD and gain the benefit from it.

Page 4: Test-Driven Development

Characteristics

Maintain an exhaustive suite of Programmer Tests.

No code goes into production unless it has associated tests.

write the tests first.

Tests determine what code you need to write.

Page 5: Test-Driven Development

Life Cycle

Write Test

Compile

Run & See the Fail

Refactor As Needed

Page 6: Test-Driven Development

TDD Benefits

Better Code No defects. Meet requirement. Remove Duplication. Less Debug Time. Tests become an asset. Tests are documentation. De-couple.

Page 7: Test-Driven Development

What Can be Tested?

Valid Input

In-valid Input

Exceptions

Boundary Conditions

Everything that should be possible break.

Page 8: Test-Driven Development

Testing Framewrok

Test Must be Automated. A Simple Tool collect, organizes and

automatically call test code. Most OO Language has testing

framework. Nunit for .Net, Junit for Java, JSUnit for Javascript, VBUnit for Visual Basic, CppUnit for C++.

Graphical Test Runner. Could be added to build Environment.

Page 9: Test-Driven Development

References

http://msdn.microsoft.com/en-us/library/aa730844(VS.80).aspx

TestDrivenDevelopmentByExample

By Kenth Beck

Test Driven Development-A practical Guide By David Astels

Test-Driven Development in Microsoft .NET by James W. Newkirk and Alexei A. Vorontsov 

http://blog.daveastels.com/files/BDD_Intro.pdf

Page 10: Test-Driven Development

See Demo Project

Thanks.

Habib MMODC