17
© 2013 iZenBridge | CONFIDENTIAL Introduction to Test Driven Development Naveen Singh, PMP, PMI-ACP, CSP, CSM Agile Coach and Trainer

Test Driven Development presentation delhi meetup

Embed Size (px)

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

Page 1: Test Driven Development presentation delhi meetup

© 2013 iZenBridge | CONFIDENTIAL

Introduction to Test

Driven Development

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

Agile Coach and Trainer

Page 2: Test Driven Development presentation delhi meetup

© 2013 iZenBridge | CONFIDENTIAL

Unit Testing

Test Driven Development

Unit testing Framework

Code Sample

Page 3: Test Driven Development presentation delhi meetup

© 2013 iZenBridge | CONFIDENTIAL

What is Unit Testing

Page 4: Test Driven Development presentation delhi meetup

© 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.

Page 5: Test Driven Development presentation delhi meetup

© 2013 iZenBridge | CONFIDENTIAL

Unit Test Characteristics

Page 6: Test Driven Development presentation delhi meetup

© 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”.

Page 7: Test Driven Development presentation delhi meetup

© 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.

Page 8: Test Driven Development presentation delhi meetup

© 2013 iZenBridge | CONFIDENTIAL

TDD Cycle

Write a test

Compile

Fix compilation error

Run Test

Write Code

Run test

Refactor code

Page 9: Test Driven Development presentation delhi meetup

© 2013 iZenBridge | CONFIDENTIAL

Benefits

Page 10: Test Driven Development presentation delhi meetup

© 2013 iZenBridge | CONFIDENTIAL

Benefits

Page 11: Test Driven Development presentation delhi meetup

© 2013 iZenBridge | CONFIDENTIAL

Misconceptions

Page 12: Test Driven Development presentation delhi meetup

© 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.

Page 13: Test Driven Development presentation delhi meetup

© 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.

Page 14: Test Driven Development presentation delhi meetup

© 2013 iZenBridge | CONFIDENTIAL

NUnit – Important links

http://www.nunit.org

http://nunit.org/download.html

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

Page 15: Test Driven Development presentation delhi meetup

© 2013 iZenBridge | CONFIDENTIAL

NUnit - Input & Output

NUnit

Dll, exe file XML file (Optional)

Processing details on the GUI or Command prompt

Page 16: Test Driven Development presentation delhi meetup

© 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

Page 17: Test Driven Development presentation delhi meetup

© 2013 iZenBridge | CONFIDENTIAL

Stay Connected

YouTube Channel

www.youtube.com/izenbridge

PMP® / PMI-ACP®

Discussion Forum

forum.izenbridge.com

Naveen Singh

[email protected]