Your SlideShare is downloading. ×
Introduction to Automated Testing
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Introduction to Automated Testing


Published on

Learn about the benefits of writing unit tests. You will spend less time fixing bugs and you will get a better design for your software. Some of the questions answered are: …

Learn about the benefits of writing unit tests. You will spend less time fixing bugs and you will get a better design for your software. Some of the questions answered are:

Why should I, as a developer, write tests?

How can I improve the software design by writing tests?

How can I save time, by spending time writing tests?

When should I write unit tests and when should I write system tests?

Published in: Technology, Education
  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Introduction to Automated Testing by Lars Thorup, ZeaLake May 26th 2011
  • 2. Who is Lars Thorup?
    • Software developer
    • 3. Coach: Teaching TDD and automated testing
    • 4. Advisor: Assesses software projects and companies
    • 5. Founder and CEO of BestBrains and ZeaLake
  • 6. Why are we here today?
    • How do we do automated testing?
      • Write test programs
      • 7. Run the tests automatically
    • Why should we write tests?
      • Enjoy more efficient and predictable course of development
      • 8. Find and fix bugs fast
      • 9. Prevent bugs from reappearing
      • 10. Improve the design of our software
  • 11. Different kinds of automated tests
    • Unit tests
      • Tests individual pieces of code and the interaction between code blocks
    • System tests
      • Tests the entire system against the requirements
    • Performance tests
      • Tests non functional requirements
  • 12. Unit tests or system tests?
    • Unit tests are efficient
      • Fast to run (a few seconds)
      • 13. Robust and predictable
      • 14. Easy to write
      • 15. Is written together with the code it is testing
    • System tests are thorough
      • Tests all layers together
      • 16. Most efficient way to create a set of tests for existing code
  • 17. Can we automate performance tests?
    • Performance tests are brittle
      • Tip: create performance trend curves instead
  • 18. So, how do we actually do this?
    • IsNumeric
    • TransferFunds
      • C++
  • 20. How do we run the tests automatically?
    • From our programming environment (IDE)
      • Command line: make test
      • 21. Right click | Run Tests
    • On every commit
      • Setup a build server
        • Hudson / Jenkins
        • 22. TeamCity
      • Let the build server run all tests
      • 23. Get build notifications
      • 24. Keep the build green
        • Fixing a broken build has priority over any other development task
  • 25. How can tests help improve our design?
    • The software design needs to evolve over time
    • 26. A refactoring modifies the design without changing behavior
    • 27. Tests ensure that behavior is not accidentally changed
    • 28. Without tests, refactoring is scary
      • and with no refactoring, the design decays over time
    • With tests, we have the courage to refactor
      • so we continually keep our design healthy
  • 29. What is good design?
    • One element of good design is loose dependencies
      • Use interfaces (for static languages)
      • 30. Inject dependencies
    • Avoid this
    • 31. Do this instead
  • 32. Are we wasting valuable developer time writing tests?
    • No
    • 33. The time spent writing tests is not taken from the time spent coding
      • It is taken from the time otherwise spent on manual testing and debugging
    • The cost of a bug keeps increasing until we fix it
    • 34. Find bugs fast
      • Avoid losing customer confidence
      • 35. Free QA to do exploratory testing so they find the hard-to-find bugs
      • 36. Spend less time trying to figure out what is causing the bug and how to fix it
    • Avoid spending time testing again
  • 37. How do we get started?
    • When we have a lot of existing code without tests
      • Create a set of system tests to get a safety net
    • When we are writing new code
      • Write unit tests in conjunction with the new code
    • Set up a standard test environment for our specific application
      • Test data
        • Automate the creation of standard testdata in a local database
      • External dependencies
        • Write stubs to use in the tests
  • 38. What does a real-world project look like?
      • Web application: C# and JavaScript
      • 39. 3 years of production
      • 40. 2-4 developers
    • 40% test code, 60% production code (in lines of code)
    • 41. 71% code coverage of unit tests
    • 42. 614 unit tests – run in 1 minute
    • 43. 54 system tests – run in 20 minutes
    • 44. No functional errors seen by end users in production (yet)
  • 45. Where can I read more?
    • 46.
    • 47.
  • 48. Which tools do we use? Environment Tool C# NUnit JavaScript qUnit HTML-based UI WatiN, Selenium C++ CppUnit, googletest Python unittest Ruby Test::Unit C check, cunit Java JUnit ... ...