Test Driven Development
Comp 645
Topics in Software Development
Presented by: Rashmi Srivastava
Franklin University, Summer 2018
Agenda
 What is TDD & TDD Cycle
 Advantages
 How to perform TDD Test
 Example Test Driven Development
 Summary
 References
What is TDD
 Test-driven development (TDD), is an new age
evolutionary approach to development which
emphasizes test-first development.
 It starts with designing and developing tests for every
small functionality of an application.
 Key Point: The test is written first, imagining the code
to be tested is written.
 TDD cycle
 Write a test
 Make it run
 Change code to make it right i.e. Refactor
 Repeat process
Advantages Includes
 The unit tests actually get written
 Programmer satisfaction leading to more consistent test writing
 Clarification of detailed interface and behavior
 Provable, repeatable, automated verification
 The confidence to change things
How to perform TDD Test
 see the rhythm of test-driven
development
 Add a test.
 Run all tests and see if any new
test fails.
 Write some code.
 Run tests and Refactor code.
 Repeat.
Example Test Driven
Development
 Requirements
 passwords meet the following
criteria
 Between 6 and 10 characters
long
 Contain at least one digit
 Contain at least one upper
case letter
Write the code
TDD Example: Refactoring #1
TDD Example: Refactoring #2
Final code
Final Test class
Summary  What is TDD & its Advantages
 Example Test Driven Development
References
 http://agiledata.org/essays/tdd.html
 Larman, C. (2004). Applying UML and patterns: An introduction to object-
oriented analysis and design and iterative development. (3rd).

Presentation Test Driven Development

  • 1.
    Test Driven Development Comp645 Topics in Software Development Presented by: Rashmi Srivastava Franklin University, Summer 2018
  • 2.
    Agenda  What isTDD & TDD Cycle  Advantages  How to perform TDD Test  Example Test Driven Development  Summary  References
  • 3.
    What is TDD Test-driven development (TDD), is an new age evolutionary approach to development which emphasizes test-first development.  It starts with designing and developing tests for every small functionality of an application.  Key Point: The test is written first, imagining the code to be tested is written.  TDD cycle  Write a test  Make it run  Change code to make it right i.e. Refactor  Repeat process
  • 4.
    Advantages Includes  Theunit tests actually get written  Programmer satisfaction leading to more consistent test writing  Clarification of detailed interface and behavior  Provable, repeatable, automated verification  The confidence to change things
  • 5.
    How to performTDD Test  see the rhythm of test-driven development  Add a test.  Run all tests and see if any new test fails.  Write some code.  Run tests and Refactor code.  Repeat.
  • 6.
    Example Test Driven Development Requirements  passwords meet the following criteria  Between 6 and 10 characters long  Contain at least one digit  Contain at least one upper case letter
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
    Summary  Whatis TDD & its Advantages  Example Test Driven Development
  • 13.
    References  http://agiledata.org/essays/tdd.html  Larman,C. (2004). Applying UML and patterns: An introduction to object- oriented analysis and design and iterative development. (3rd).