Introduction to Test Driven Development

Slides:



Advertisements
Similar presentations
6/2/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 1 Automated Testing Environment Concepts.
Advertisements

Lab. 2 – More details – Tasks 4 to 6 1. What concepts are you expected to understand after the Lab. 2 is finished? 2. How do you demonstrate that you have.
Core Timer Code Development How you could have done the Take- Home Quiz using a test driven development (TDD) approach.
Lab. 2 Overview 1. What concepts are you expected to understand after the Lab. 2 is finished? 2. How do you demonstrate that you have that knowledge?
VisualDSP++ and Test Driven Development Prelaboratory assignment information.
Swami NatarajanJuly 14, 2015 RIT Software Engineering Reliability: Introduction.
Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 1 Introduction To Computers.
COMPUTER PROGRAMMING. Introduction to C++ History Merges notions from Smalltalk and notions from C The class concept was borrowed from Simular67 Developed.
For 3-G Systems Tara Larzelere EE 497A Semester Project.
1 “ Speech ” EMPOWERED COMPUTING Greenfield Business Centre, 20 th September, 2006.
Test Driven Development TDD. Testing ”Testing can never demonstrate the absence of errors in software, only their presence” Edsger W. Dijkstra (but it.
Averaging Filter Basic SHARC assembly and adding automated tests Example of project development on SHARC using C++ and assembly Planned for Tutorial Thursday.
Computer Programming I An Introduction to the art and science of programming with C++
Understanding the TigerSHARC ALU pipeline Determining the speed of one stage of IIR filter – Part 3 Understanding the memory pipeline issues.
Understanding the TigerSHARC ALU pipeline Determining the speed of one stage of IIR filter – Part 2 Understanding the pipeline.
Generating “Rectify( )” Test driven development approach to TigerSHARC assembly code production Assembly code examples Part 1 of 3.
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
Blackfin Array Handling Part 1 Making an array of Zeros void MakeZeroASM(int foo[ ], int N);
Mistakes, Errors and Defects. 12/7/2015Mistakes, Errors, Defects, Copyright M. Smith, ECE, University of Calgary, Canada 2 Basic Concepts  You are building.
12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 1 Automated Testing Environment Concepts.
“Lab. 5” – Updating Lab. 3 to use DMA Test we understand DMA by using some simple memory to memory DMA Make life more interesting, since hardware is involved,
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Generating a software loop with memory accesses TigerSHARC assembly syntax.
Coupling and Cohesion Rajni Bhalla.
Types for Programs and Proofs
Introduction to programming
Hands-On Microsoft Windows Server 2008
CS 326 Programming Languages, Concepts and Implementation
The Software Development Cycle
Using Visual Studio with C#
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
Lab. 2 Overview – Earlier Tasks Prelaboratory T1, T3, T4 and T5
CMSC 341 Prof. Michael Neary
Software and Hardware Circular Buffer Operations
TigerSHARC processor General Overview.
Generating the “Rectify” code (C++ and assembly code)
Generating “Rectify( )”
Design and Programming
Automated Testing Environment
Trying to avoid pipeline delays
Generating a software loop with memory accesses
Understanding the TigerSHARC ALU pipeline
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep track of these action items during.
TigerSHARC processor and evaluation board
Lab. 2 – More details – Later tasks
VisualDSP++ and Test Driven Development What happened last lecture?
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
Understanding the TigerSHARC ALU pipeline
Moving Arrays -- 2 Completion of ideas needed for a general and complete program Final concepts needed for Final DMA.
Thermal arm-wrestling
Using Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
What time is it?. What time is it? Major Concepts: a data structure model: basic representation of data, such as integers, logic values, and characters.
Moving Arrays -- 2 Completion of ideas needed for a general and complete program Final concepts needed for Final DMA.
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep track of these action items during.
Getting serious about “going fast” on the TigerSHARC
Concept of TDD Test Driven Development
Explaining issues with DCremoval( )
General Optimization Issues
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Thermal arm-wrestling
Understanding the TigerSHARC ALU pipeline
This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep track of these action items during.
Mistakes, Errors and Defects
Test Cases, Test Suites and Test Case management systems
Working with the Compute Block
A first attempt at learning about optimizing the TigerSHARC code
Building tests and code for a “software radio”
The Software Development Cycle
Presentation transcript:

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

Concepts of TDD, M. Smith, ECE, University of Calgary, Canada 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 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

Conventional “AM” radio RF STAGE Antenna Pickup AUDIO STAGE Low pass Filter + amplifier Low pass Filter Rectifier Mixer Local Oscillator IF STAGE Audio out 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

Software “AM” radio concept RF STAGE Antenna Pickup AUDIO STAGE Low pass Filter + amplifier Low pass Filter Rectifier Mixer Local Oscillator IF STAGE Audio out Most stages handled with high speed software 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

Software “FM” radio concept RF STAGE AUDIO STAGE Antenna Pickup Low pass Filter + amplifier What ever is needed Rectifier Audio out Most stages handled with high speed software 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

Concepts of TDD, M. Smith, ECE, University of Calgary, Canada 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) 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

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); 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

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

Standard testing practice Heavy on documentation TLD Test Last Development 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

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 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

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 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

Concepts of TDD, M. Smith, ECE, University of Calgary, Canada 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 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

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 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

Concepts of TDD, M. Smith, ECE, University of Calgary, Canada 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 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

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

Running the customer product code 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

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

Test code – test level control 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

Result of “link test” Disassembler window Source or “Mixed mode” window Project window Editor tabs selected Twin processors can be controlled Results in VisualDSP CONSOLE WINDOW 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

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

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

Concepts of TDD, M. Smith, ECE, University of Calgary, Canada 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 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

Concepts of TDD, M. Smith, ECE, University of Calgary, Canada Zero-length test Modify the integer test case 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

Float rectification test 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

Take notes from the screen 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

Speed tests – integer code versions 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

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 Run all available tests to make sure nothing “broke” Bring third test in – write the code to satisfy that test 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada

Concepts of TDD, M. Smith, ECE, University of Calgary, Canada 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 11/20/2018 Concepts of TDD, M. Smith, ECE, University of Calgary, Canada