1 / 28

Introduction to Test Driven Development

Introduction to Test Driven Development. Building tests and code for a “software radio”. Concepts. Stages in a conventional radio Stages in a software radio Goals for the “long term” project Concept of test driven development Digital rectification Tests for integer array rectification

Download Presentation

Introduction to Test Driven Development

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Test Driven Development Building tests and code for a“software radio”

  2. Concepts • Stages in a conventional radio • Stages in a software radio • Goals for the “long term” project • Concept of test driven development • Digital rectification • Tests for integer array rectification • Tests for float array rectification (C++ compiler) • Tests for rectification in assembly code • More details of test driven development Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  3. Conventional “AM” radio RF STAGE Antenna Pickup AUDIO STAGE Low passFilter+ amplifier Low passFilter Rectifier Mixer LocalOscillator IF STAGE Audio out Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  4. Software “AM” radio concept RF STAGE Antenna Pickup AUDIO STAGE Low passFilter+ amplifier Low passFilter Rectifier Mixer LocalOscillator IF STAGE Audio out Most stages handled with high speed software Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  5. Software “FM” radio concept RF STAGE AUDIO STAGE Antenna Pickup Low passFilter+ amplifier What everis needed Rectifier Audio out Most stages handled with high speed software Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  6. Real “software” radio • Looking at RF stage to bring in wireless signal • Software radio is the rest of it • Update communication protocols • Change noise suppression characteristics “on the fly” • Etc. • Excellent topic for individual presentation (8 minute talk – 10 slides max – at the end of term) or possible joint presentation (16 minute talk – 20 slides max) Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  7. Rectification algorithm Choices are • C++ compiler in DEBUG mode • int *RectifyDEBUG(int initial[ ], int final, int N); • float *RectifyDEBUG (float initial[ ], float final, int N); • C++ compiler in RELEASE mode • int *RectifyRELEASE(int initial[ ], int final, int N); • float *RectifyRELEASE(float initial[ ], float final, int N); • “US” in ASSEMBLY mode • int *RectifyASM(int initial[ ], int final, int N); • float *RectifyASM(float initial[ ], float final, int N); • “US” in OPTIMIZED ASSEMBLY mode • int *RectifyOPTASM (int initial[ ], int final, int N); • float *RectifyOPTASM (float initial[ ], float final, int N); Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  8. Expected relative advantages • Compiler debug mode • Compiler release (optimized) mode • “US” – assembly mode • “US” – optimized assembly mode Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  9. Standard testing practice • Heavy on documentation TLD TestLastDevelopment Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  10. Test Driven Development • Customer Tests – personally find these hard to do • Not clear if there is yet “a real process available” • Developer Tests – have found many advantages CUSTOMER DEVELOPER Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  11. Lets apply TDD to rectification issue • Overall technique • Decide on a particular test action • Write the test(s) • Write the simplest possible code to satisfy the test(s) • “Refactor” the code to improve “quality” • Definition of “quality” is unclear in the literature • Ease of “use” or “reuse” of code • Reliable to use – “robust” • My additional idea – meets speed requirements for the embedded situation • TDD in an embedded / ubiquitous computing environment is a major part of my current research with funding from NSERC and Analog Devices Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  12. First unit test • Can I link to a particular test file and activate the tests within that files? This include file provides all the macros needed for the TDD environment Simple test to indicate the test set being run.Also indicates that a link is possible Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  13. First unit test • Can I link to a particular test file and activate the tests within that files? Test control. Certain tests always need to be run (totally automated). Others are more difficult to automate This include file provides defines needed for the project Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  14. First unit test • Can I link to a particular test file and activate the tests within that files? NOTE: REQUIREMENT – CUSTOMER TEST CODE MUST BE AVAILABLE TO DEVELOPER(Does not mean customer might not have other test code Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  15. Running the tests • Need a fast – easy to use – way of switching between running the tests, and demonstrating the working customer product Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  16. Running the customer product code Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  17. Test code – Report Mode Report all tests.Success and failures Report successes only Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  18. Test code – test level control Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  19. Result of “link test” Disassemblerwindow Source or“Mixed mode”window Projectwindow Editor tabs selected Twinprocessorscan be controlled Results in VisualDSP CONSOLE WINDOW Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  20. Obvious test – actually contained a hidden bug Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  21. Integer array tests ZERO-LENGTH ARRAY • Unspecified requirement – shown as part of test functionality • Function return pointer = NULL if error condition present Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  22. Float tests • You write the required tests for testing rectification of floating point arrays • Test for correct zero-length error response • Test for correct rectification operation Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  23. Zero-length test • Modify the integer test case Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  24. Float rectification test Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  25. Take notes from the screen Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  26. Speed tests – integer code versions Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  27. Using the tests – practical approach • Just because all the tests are known, does not mean that you use all of them immediately • If you use all of them immediately, you get a lot of failure messages, which is very soul destroying • I bring first test in – write the code to satisfy that test • Keep track of “defects” and “errors” as QA • Bring second test in – write the code to satisfy that test • Keep track of “defects” and “errors” as QA • Run all available tests to make sure nothing “broke” • Keep track of “defects” and “errors” as QA • Bring third test in – write the code to satisfy that test • Keep track of “defects” and “errors” as QA • Run all available tests to make sure nothing “broke” • Keep track of “defects” and “errors” as QA Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

  28. Concepts covered • Stages in a conventional radio • Stages in a software radio • Goals for the “long term” project • Concept of test driven development • Digital rectification • Tests for integer array rectification • Tests for float array rectification (C++ compiler) • Tests for rectification in assembly code • More details of test driven development Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

More Related