Test Driven Development
Improving .NET Application
 Performance & Scalability


                     Brendon Birdoes
     ...
Agenda
    Challenges we deal with today
•
    Be Agile - Test Driven Development
•
    Code coverage
•
    Database can b...
Challenges we deal with today
    Does our code do what we intended?
•
    Documentation – is it updated?
•
    Debug – ag...
Get Agile – Test Driven Development
Practices




Tools
        Tools For Agility, Kent Beck
Unit Test Defined
• Code programmers write to exercise each
  method in the design that run quickly
  and help localize er...
Unit Tests Defined
• Tests are NOT unit tests when they…
  – Talk to a database
  – Communicate across the network
  – Tou...
What is Test Driven Development?
• Despite the name, TDD focuses on
  “Design” first, “Test” second
• Basic tenants are:
 ...
Test Driven Development
The motto quot;Red, Green, Refactor.quot;
Developer Unit Test
Code Coverage Defined
• Also known as “test coverage”
• It measures how thoroughly the
  automated tests exercise the prod...
What degree of code coverage
      should you aim for?
• Answer: It depends
• Average code coverage is around 85%
• Bigges...
Code Coverage
Database can be Unit Tested!
      User Interface



      Application
      Code



                       Unit
         ...
Database Unit Test
TDD in Action: Active Bug
Bug: Expired Credit Cards are being Credited
Quality Indicators
                                                             91


                                     ...
Traditional testing
Test Driven Development
TDD - Application Lifecycle

                                              UAT
                 Testing & Bug Fixing
 Deve...
Unit testing is a learned skill
that can only be honed with
         experience.



          Mock Objects

         Inter...
Starting Test Driven Development
Creating a cultural change is hard…

                    ….. and it can be done.
Summary
• Development becomes more challenging.
• TDD is a great tool to overcome these
  challenges
• Database can be Uni...
PHX - Session #2 Test Driven Development: Improving .NET Application Performance & Scalability
PHX - Session #2 Test Driven Development: Improving .NET Application Performance & Scalability
Upcoming SlideShare
Loading in...5
×

PHX - Session #2 Test Driven Development: Improving .NET Application Performance & Scalability

619

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
619
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
12
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

PHX - Session #2 Test Driven Development: Improving .NET Application Performance & Scalability

  1. 1. Test Driven Development Improving .NET Application Performance & Scalability Brendon Birdoes (brendon.birdoes@neudesic.com)
  2. 2. Agenda Challenges we deal with today • Be Agile - Test Driven Development • Code coverage • Database can be Unit Tested! • Benefits of TDD • Summary • Q&A •
  3. 3. Challenges we deal with today Does our code do what we intended? • Documentation – is it updated? • Debug – again? • Change Request – What did I break? •
  4. 4. Get Agile – Test Driven Development Practices Tools Tools For Agility, Kent Beck
  5. 5. Unit Test Defined • Code programmers write to exercise each method in the design that run quickly and help localize errors – Isolates and tests a single operation – Run in any environment – Less time debugging – Side affect is documentation!
  6. 6. Unit Tests Defined • Tests are NOT unit tests when they… – Talk to a database – Communicate across the network – Touch the file system – Require human intervention (such as modifying a *.config file, starting a console app, etc.) to run
  7. 7. What is Test Driven Development? • Despite the name, TDD focuses on “Design” first, “Test” second • Basic tenants are: – Write a failing automated test before you write any code • Focus on interface and use case or problem • Tests get written • Just enough code to pass the test – Remove duplication (refactor)
  8. 8. Test Driven Development The motto quot;Red, Green, Refactor.quot;
  9. 9. Developer Unit Test
  10. 10. Code Coverage Defined • Also known as “test coverage” • It measures how thoroughly the automated tests exercise the production code, its source code statements, branches, and expressions
  11. 11. What degree of code coverage should you aim for? • Answer: It depends • Average code coverage is around 85% • Biggest blocker to attain 100% - existing code, auto generated code • Aim for 100% while learning – you’ll understand why 85% is nicer
  12. 12. Code Coverage
  13. 13. Database can be Unit Tested! User Interface Application Code Unit Tests Data Access Layer Stored Procedures
  14. 14. Database Unit Test
  15. 15. TDD in Action: Active Bug Bug: Expired Credit Cards are being Credited
  16. 16. Quality Indicators 91 80 76 71 60 56 51 40 32.5 20 19 18 12 9 8 Iteration 1 Iteration 2 Iteration 3 Iteration 4 Iteration 5
  17. 17. Traditional testing
  18. 18. Test Driven Development
  19. 19. TDD - Application Lifecycle UAT Testing & Bug Fixing Development Testing & UAT Development Bug Fixing  Development and testing/bug fixing take about the same amount of time  Development takes more time than testing, and testing time is reduced  Overall lifecycle is shortened
  20. 20. Unit testing is a learned skill that can only be honed with experience. Mock Objects Interfaces Better Factored Code
  21. 21. Starting Test Driven Development Creating a cultural change is hard… ….. and it can be done.
  22. 22. Summary • Development becomes more challenging. • TDD is a great tool to overcome these challenges • Database can be Unit Tested! • Development is Faster using TDD. • VSTS is a great tool for UT and TDD.
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×