automated unit testing and tdd

Download Automated Unit Testing and TDD

Post on 30-Nov-2014




3 download

Embed Size (px)


Slides from a presentation I gave at CRineta ( at its April '10 meeting.


  • 1. Unit Testing and Test Driven Development Presented By Greg Sohl
  • 2. Agenda
    • Testing? Dude, I already test.
    • Unit testing and TDD Overview
    • Simple TDD example
      • Calculation Class
    • But I already have code
    • More complex example, with injection
      • File Copy Class
    • Tools
    • Q & A
  • 3. Testing? Dude, I Already Test Do you currently unit test your code? What types of unit tests do you create? CRineta Member Survey, 8/08
  • 4. Unit Testing and TDD The process of designing software by writing a validating client before the code. What is Test-Driven Development (TDD)? Programmatically and continuously validating the correctness the code. What is Automated Unit Testing?
  • 5. Unit Testing and TDD Automated Unit Testing != Test-Driven Development TDD is a way of thinking about your code, but it doesnt require automated unit testing. Agile processes adapt to change. Unit tests help to manage change in our code. Unit Testing is a key component of the Agile Methodology
  • 6. Unit Testing
  • 7. Writing Tests First
  • 8. Testing - Before and After
  • 9. TDD
  • 10. TDD Demo
  • 11. Test Parts
    • The 3 As
      • Arrange, Act, Assert
    • [Test]
    • Public void Send_SingleRecipient_Success
    • {
    • EmailManager emailManager = new EmailManager();
      • bool result = emailManager.Send(,, Hello, message);
      • Assert.AreEqual(true, result, The email was not successfully sent);
    • }