15
Unit Testing Ferose Khan J

Value of Unit Testing

Embed Size (px)

DESCRIPTION

Unit testing is an essential part of software design and development. But somehow it is considered as testing and its value is not known to majority of the software teams. This presentation tries to show the value of unit testing.

Citation preview

Page 1: Value of Unit Testing

Unit Testing

Ferose Khan J

Page 2: Value of Unit Testing

What is Unit Testing?

User Acceptance Testing

Integration Testing

Unit Testing

Page 3: Value of Unit Testing

Reality Check

Page 4: Value of Unit Testing

Unit testing is HARD

Page 5: Value of Unit Testing

Developers only write production code

Page 6: Value of Unit Testing

Never attempt UT for my code

Page 7: Value of Unit Testing

Why do unit testing?

• Refactor with peace of mind• Know when coding is done• Understand the design• Living documentation of the code• Feel good on seeing those green dots

Page 8: Value of Unit Testing

Steps

• Setup• Create input • Call the method • Verify output• Teardown

Page 9: Value of Unit Testing

Testing Scope

• Test behavior instead of methods• Test one layer at a time

Page 10: Value of Unit Testing

Do’s

• Runs Fast• Fully automated • Can be executed in any order• Produce consistent result • Produce atomic result• Write informative message

Page 11: Value of Unit Testing

Don’ts

• Conditional coding in tests• Catch unexpected exceptions in tests• Loops inside tests• Testing related logic in production

code

Page 12: Value of Unit Testing

Questions?Questions?

Page 13: Value of Unit Testing

Conversation master programmer & pupil:

Pupil: “When can I stop writing tests?” Master:“When you stop writing code.” Pupil:“When do I stop writing code?” Master:“When you become a manager.” (The pupil trembled)Pupil: “When do I become a manager?” Master: “When you stop writing tests.” The pupil rushed to write some tests. He left skid marks.

Page 14: Value of Unit Testing

“Unit testing is part of the design process and not part of testing process”

Page 15: Value of Unit Testing

THANKSTHANKS