Test Driven Development presentation delhi meetup

Preview:

DESCRIPTION

TDD is a scrum engineering practice that helps in writing quality code and has in-built regression testing to ensure good code quality.

Citation preview

© 2013 iZenBridge | CONFIDENTIAL

Introduction to Test

Driven Development

Naveen Singh, PMP, PMI-ACP, CSP, CSM

Agile Coach and Trainer

© 2013 iZenBridge | CONFIDENTIAL

Unit Testing

Test Driven Development

Unit testing Framework

Code Sample

© 2013 iZenBridge | CONFIDENTIAL

What is Unit Testing

© 2013 iZenBridge | CONFIDENTIAL

Unit Test

A unit test is to test one unit of work. Generally one unit

means of one requirement for one method.

© 2013 iZenBridge | CONFIDENTIAL

Unit Test Characteristics

© 2013 iZenBridge | CONFIDENTIAL

Test Driven Development

TDD was introduced long

back in 1999 as part of

eXtreme Programming

(XP) by a group of

developers.

Basic philosophy is

“Before you write code,

think about what it will

do”.

© 2013 iZenBridge | CONFIDENTIAL

Test Driven Development

Testing code once will not ensure future

changes will not impact to earlier tested code so

TDD is something you write once but run once,

twice, three times etc.

TDD is risk averse programming, investing work

in the near term to avoid failures later on.

© 2013 iZenBridge | CONFIDENTIAL

TDD Cycle

Write a test

Compile

Fix compilation error

Run Test

Write Code

Run test

Refactor code

© 2013 iZenBridge | CONFIDENTIAL

Benefits

© 2013 iZenBridge | CONFIDENTIAL

Benefits

© 2013 iZenBridge | CONFIDENTIAL

Misconceptions

© 2013 iZenBridge | CONFIDENTIAL

Unit Test Framwork

Before Unit Test Framework

developers were using message

box/new window to verify the

output of code.

Later on developers moved on

console based testing and it

was better than previous but still

there was no common way of

writing and executing test

cases.

© 2013 iZenBridge | CONFIDENTIAL

NUnit

NUnit is the most popular unit testing

framework for Microsoft .Net platform.

NUnit is based on JUnit a java-based

unit testing tool.

NUnit is stable, easy to use, and

executes quickly.

NUnit is easy to learn and has

become a standard tool in almost

every TDD practitioner’s toolbox.

© 2013 iZenBridge | CONFIDENTIAL

NUnit – Important links

http://www.nunit.org

http://nunit.org/download.html

http://sourceforge.net/projects/nunit/

© 2013 iZenBridge | CONFIDENTIAL

NUnit - Input & Output

NUnit

Dll, exe file XML file (Optional)

Processing details on the GUI or Command prompt

© 2013 iZenBridge | CONFIDENTIAL

NUnit - Input & Output

Time to write TDD based code

for given scenarios

1. Display largest value from an

array

2. UserBLL class should return

text in below at after login

Hello Mr. Joe, Age – 39

© 2013 iZenBridge | CONFIDENTIAL

Stay Connected

YouTube Channel

www.youtube.com/izenbridge

PMP® / PMI-ACP®

Discussion Forum

forum.izenbridge.com

Naveen Singh

naveenhome@gmail.com

Recommended