Value of Unit Testing

Preview:

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

Unit Testing

Ferose Khan J

What is Unit Testing?

User Acceptance Testing

Integration Testing

Unit Testing

Reality Check

Unit testing is HARD

Developers only write production code

Never attempt UT for my code

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

Steps

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

Testing Scope

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

Do’s

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

Don’ts

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

code

Questions?Questions?

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.

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

THANKSTHANKS

Recommended