Why you should use a testing framework

Embed Size (px)

DESCRIPTION

The case for using a testing framework to make your software robust, with a simple example in MATLAB.

Citation preview

  • 1.
    • Why you should use a testing framework
  • by Richard Cotton

2. Our goal: write a function to calculate the length of the hypotenuse of a right-angled triangle from the other two sides 3. 4. 5. 6.

  • ( nargin returns the number of arguments passed into the function)

7. 8.

  • In MATLAB,[]represents an empty matrix.

9. 10. 11.

  • Uh-oh.The answers should be1.414e300and1.414e-300respectively.

12. 13. 14.

  • The story so far
  • We need to do lots of tests.

15. We need to do each test lots of times.

  • This means that ...
  • It would be a good idea to have a suite of tests that can be easily created/run/maintained.

16. 17.

  • Lots of short functions/methods representing individual tests

18.

  • Lots of short functions/methods representing individual tests

19. A suite function that runs some or all of the tests. 20.

  • Lots of short functions/methods representing individual tests

21. A suite function that runs some or all of the tests. 22. Some utility functions for handling errors and displaying results. 23. 24. 25. 26.

  • Thorough testing is necessary.

27.

  • Thorough testing is necessary.

28. If we use a testing framework, then thorough testing neednt be onerous. 29.

  • Thorough testing is necessary.

30. If we use a testing framework, then thorough testing neednt be onerous.

  • 1 & 2 => Testing frameworks are a great idea.

31.

  • Resources
  • Lists of testing frameworks
  • http://c2.com/cgi/wiki?TestingFramework http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks
  • Testing Strategies
  • " Testing Computer Software " by Kaner et al, especially Ch. 3 http://en.wikipedia.org/wiki/Software_testing http://software-carpentry.org/4_0/test/