Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
<ul><li>Why you should use a testing framework </li></ul><ul>by Richard Cotton </ul>
Our goal: write a function to calculate the length of the hypotenuse of a right-angled triangle from the other two sides
 
 
 
<ul>( nargin   returns the number of arguments passed into the function) </ul>
 
<ul>In MATLAB,  []  represents an empty matrix. </ul>
 
 
<ul>Uh-oh.  The answers should be  1.414e300  and  1.414e-300  respectively. </ul>
 
 
<ul>The story so far </ul><ul><li>We need to do lots of tests.
We need to do each test lots of times. </li></ul><ul>This means that ... </ul><ul><li>It would be a good idea to have a su...
 
<ul><li>Lots of short functions/methods representing individual tests </li></ul>
<ul><li>Lots of short functions/methods representing individual tests
A suite function that runs some or all of the tests. </li></ul>
<ul><li>Lots of short functions/methods representing individual tests
A suite function that runs some or all of the tests.
Some utility functions for handling errors and displaying results. </li></ul>
 
 
 
Upcoming SlideShare
Loading in …5
×

Why you should use a testing framework

2,664 views

Published on

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

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Why you should use a testing framework

  1. 1. <ul><li>Why you should use a testing framework </li></ul><ul>by Richard Cotton </ul>
  2. 2. Our goal: write a function to calculate the length of the hypotenuse of a right-angled triangle from the other two sides
  3. 6. <ul>( nargin returns the number of arguments passed into the function) </ul>
  4. 8. <ul>In MATLAB, [] represents an empty matrix. </ul>
  5. 11. <ul>Uh-oh. The answers should be 1.414e300 and 1.414e-300 respectively. </ul>
  6. 14. <ul>The story so far </ul><ul><li>We need to do lots of tests.
  7. 15. We need to do each test lots of times. </li></ul><ul>This means that ... </ul><ul><li>It would be a good idea to have a suite of tests that can be easily created/run/maintained. </li></ul>
  8. 17. <ul><li>Lots of short functions/methods representing individual tests </li></ul>
  9. 18. <ul><li>Lots of short functions/methods representing individual tests
  10. 19. A suite function that runs some or all of the tests. </li></ul>
  11. 20. <ul><li>Lots of short functions/methods representing individual tests
  12. 21. A suite function that runs some or all of the tests.
  13. 22. Some utility functions for handling errors and displaying results. </li></ul>
  14. 26. <ul><li>Thorough testing is necessary. </li></ul>
  15. 27. <ul><li>Thorough testing is necessary.
  16. 28. If we use a testing framework, then thorough testing needn’t be onerous. </li></ul>
  17. 29. <ul><li>Thorough testing is necessary.
  18. 30. If we use a testing framework, then thorough testing needn’t be onerous. </li></ul><ul>1 & 2 => Testing frameworks are a great idea. </ul>
  19. 31. <ul>Resources </ul><ul>Lists of testing frameworks </ul><ul>http://c2.com/cgi/wiki?TestingFramework http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks </ul><ul>Testing Strategies </ul><ul>&quot; Testing Computer Software &quot; by Kaner et al, especially Ch. 3 http://en.wikipedia.org/wiki/Software_testing http://software-carpentry.org/4_0/test/ </ul>

×