12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 1 Automated Testing Environment Concepts.

Slides:



Advertisements
Similar presentations
xUnit Test Patterns (Some) xUnit Test Patterns (in practice) by Adam Czepil.
Advertisements

Over-view of Lab. 1 For more details – see the Lab. 1 web-site There will be a 20 min prelab quiz (based on Assignment 1 and 2) at the start of the lab.
Blackfin BF533 EZ-KIT Control The O in I/O Activating a FLASH memory “output line” Part 2.
TigerSHARC processor and evaluation board Different capabilities Different functionality.
Blackfin BF533 EZ-KIT Control The O in I/O Activating a FLASH memory “output line” Part 2.
6/2/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 1 Automated Testing Environment Concepts.
Review of Blackfin Syntax Moves and Adds 1) What we already know and have to remember to apply 2) What we need to learn.
More Example Blackfin Code Using the E-UNITTest Framework.
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.
TigerSHARC Laboratory Setting up the HPP-ICE environment ICT 318 / 320 Running versions of the Audio-talk-through program.
A look at interrupts What are interrupts and why are they needed in an embedded system? Equally as important – how are these ideas handled on the Blackfin.
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.
Getting the O in I/O to work on a typical microcontroller Ideas of how to send output signals to the radio controlled car. The theory behind the LED controller.
Laboratory 1 – ENCM415 Familiarization with the Analog Devices’ VisualDSP++ Integrated Development Environment.
Blackfin BF533 EZ-KIT Control The O in I/O Activating a FLASH memory “output line” Part 2.
Just enough information to program a Blackfin Familiarization assignment for the Analog Devices’ VisualDSP++ Integrated Development Environment.
Friday’s lecture again. Using E-TDD environment Build the tests you want to pass Build the code Test the code.
Introduction To C++ Programming 1.0 Basic C++ Program Structure 2.0 Program Control 3.0 Array And Structures 4.0 Function 5.0 Pointer 6.0 Secure Programming.
G51FSE Version Control Naisan Benatar. Lecture 5 - Version Control 2 On today’s menu... The problems with lots of code and lots of people Version control.
1 ENG236: ENG236: C++ Programming Environment (2) Rocky K. C. Chang THE HONG KONG POLYTECHNIC UNIVERSITY.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering.
Using a Simple Python Script to Download Data Rob Letzler Goldman School of Public Policy July 2005.
Phoenix Software Projects Larry Beaty © 2007 Larry Beaty. Copying and distribution of this document is permitted in any medium, provided this notice is.
Design and Programming Chapter 7 Applied Software Project Management, Stellman & Greene See also:
Renesas Technology America Inc. 1 SKP8CMINI Tutorial 2 Creating A New Project Using HEW.
Just as there are many human languages, there are many computer programming languages that can be used to develop software. Some are named after people,
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
C Hints and Tips The preprocessor and other fun toys.
TigerSHARC Laboratory Setting up the HPP-ICE environment ICT 318 / 320 Running versions of the Audio-talk-through program.
A Play Core Timer Interrupts Acted by the Human Microcontroller Ensemble from ENCM511.
Generating “Rectify( )” Test driven development approach to TigerSHARC assembly code production Assembly code examples Part 1 of 3.
INFO1408 Database Design Concepts Week 15: Introduction to Database Management Systems.
Lab. 2 Overview Move the tasks you developed in Lab. 1 into the more controllable TTCOS operating system Manual control of RC car.
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.
Scalatest. 2 Test-Driven Development (TDD) TDD is a technique in which you write the tests before you write the code you want to test This seems backward,
Introduction Chapter 1 1/22/16. Check zyBooks Completion Click on the boxes for each section.
“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,
Google C++ Testing Framework Part 2: Assertion. Concepts A test case contains one or many tests. ◦ You should group your tests into test cases that reflect.
Announcements Assignment 2 Out Today Quiz today - so I need to shut up at 4:25 1.
CHAPTER 3 COMPLETING THE PROBLEM- SOLVING PROCESS AND GETTING STARTED WITH C++ An Introduction to Programming with C++ Fifth Edition.
Text2PTO: Modernizing Patent Application Filing A Proposal for Submitting Text Applications to the USPTO.
Generating a software loop with memory accesses TigerSHARC assembly syntax.
FOP: Multi-Screen Apps
Microsoft Access Illustrated
Lab. 2 Overview – Earlier Tasks Prelaboratory T1, T3, T4 and T5
Generating “Rectify( )”
A Play Core Timer Interrupts
Introduction to Test Driven Development
Automated Testing Environment
CSCE 315 – Programming Studio, Fall 2017 Tanzir Ahmed
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
TigerSHARC processor and evaluation board
Lab. 2 – More details – Later tasks
VisualDSP++ and Test Driven Development What happened last lecture?
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
* M. R. Smith 07/16/96 This presentation will probably involve audience discussion, which will create action items. Use PowerPoint.
Getting serious about “going fast” on the TigerSHARC
Concept of TDD Test Driven Development
Explaining issues with DCremoval( )
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
An Introduction to Debugging
Lab. 2 Overview Move the tasks you developed in Lab. 1 into the more controllable TTCOS operating system.
Mistakes, Errors and Defects
A first attempt at learning about optimizing the TigerSHARC code
An Overview of C.
Working with the Compute Block
Building tests and code for a “software radio”
Presentation transcript:

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 1 Automated Testing Environment Concepts required for testing embedded systems adopted in this course (quizzes, assignments and laboratories)

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 2 / 28 To be tackled today Why test, and what kinds of tests are there? Difference between TLD – Test Last Development TDD – Test Driven Development (Test First Development) How do you add tests? More details on the testing process E-TDD and the testing toll E-UNIT Other kinds of available tests – time and access Design of custom TESTs and ASSERTS

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 3 / 28 Why test? Unit test I AM CURRENTLY BUILDING A NEW FUNCTION – does it work the way I expect? Testing my and my partner’s understanding of the Design WE ARE DESIGNING A NEW PRODUCT -- If we can’t explain (to ourselves via a test) the product ideas – how do we know when product is working? Regression testing MY PARTNER ADDED A NEW FEATURE to a product – how do I know it did not “break something” I wrote? System testing How do I PROVE TO THE CUSTOMER that the product (Lab. or assignment) works the way that was requested?

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 4 / 28 What are the problems with this sort of “Human intervention” test? This code would be placed in Assignments1 directory with the rest of the customer code

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 5 / 28 VisualDSP development environment (IDDE) – Communication overhead Debugging Interface “JTAG” boundary scan operation Processor Peripherals BF533 Evaluation Board VisualDSP++ program Debugging Interface HPPCIce Lab. station (ICT318 / 320) Each time we want to send a message (via printf( ) or cout) we must “stop” the processor from doing what we want it to do, and then send messages over the interface – Slow, plus the testing can impact on peripheral performance. E.g. no sound while doing printing in Assignment 2 and Lab. 1 THIS PROBLEM IS COMMON TO ALL EMBEDDED SYSTEM DEVELOPMENT NOT JUST THE BLACKFIN USED IN THE LAB.

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 6 / 28 More issues with this sort of test! Tests are mixed up “with production code”, in many places Must remove tests before release to customer Unreliable – may result in test messages at wrong time in released code Difficult to “add” and “remove tests” from production code without introducing new errors Results can be checked automatically – therefore unlikely to have tests run often during development – leads to unreliable product

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 7 / 28 E-TDD Tool E-TDD – embedded test driven development Build-the-tests-first (during design) ideas for product development has been made popular by the “Agile” approach Requires an automated testing approach (test framework) In this class, we are going to use the E-Unit tool for its automated behaviour Will use in both “test last” development (what most people currently do) and in “test first” development (trying to encourage). I (the customer) will provide tests so that you can check that you have developed the “right” stuff at the “high” level You will build additional tests to check your own code at the “low level”

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 8 / 28 Test Environment Can download “LabTestEnvironment.zip” file from the web (Check the September webpages for exact name of file) LabX directory is where you keep your “project” code LabXcode_main.cpp LabX_start.cpp LabX_initializeASM.asm LabXTests is where you keep the tests for LabX LabXtests_main.cpp (built by GUI) Tests_for_LabX_start.cpp Tests_for_LabX_initializeASM.cpp written in C++) E_UnitConnect.cpp (built by GUI)

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 9 / 28 Build a new VDSP project “Assignment1Test” and place in “Assignment1Tests” directory Now add certain standard files to the project Same set of files for all assignments and laboratory Use the automated features of the GUI to “convert” VDSP project to test project

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 10 / 28 Now add your Assignment1 subroutines files to the Assignment1Test project Don’t move or copy the files into the test directory – just “add” them to the project Note the use of “Assignment1.h” which has the prototypes for all “C++” and “assembly code” functions used (from AssignmentX dir.) This files are “added” using VDSP to the “Test” project and NOT copied from the Assignment1 directory

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 11 / 28 The GUI has automatically added the “Tests_main.cpp”

The GUI has automatically added a “TestGroup” file for you 12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 12 / 28

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 13 / 28 Modify “Assignment1Tests.cpp” to perform the needed testing

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 14 / 28 Tests and Test Groups have a standard format TESTGROUP NAME TESTGROUP NAME, TEST NAME Add further tests at this location

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 15 / 28 Tests then need to be customized A lot of this can be automated by GUI

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 16 / 28 Test Components Remember format for “exams” and “quizzes” The ACTUAL Test (This is a TEST MACRO) CHECK(result1 == result2) – If an error occurred what was ‘result1’ being used for? Error result1 != result2 Would get better test error messages if we “self- documented the code” int resultCPPCode = ; int resultASMCode = CHECK(resultCPPCode == resultASMCode); Error resultCPPCode != resultASMCode Test CONTROL statements (ALL MACROS) TEST_CONTROL( testgroup_name) TEST_FILE_RUN_NOTIFICATION( testgroup_name)

Have added stub versions of functions 12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 17 / 28 Note “code DEFECT” There is NO return value placed in R0

Now build source files to make executable 12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 18 / 28 Note the format of the error messages with both C / C++ and name-mangled ASM name shown

Fix the code. Review the code for syntax errors and “logical” errors 12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 19 / 28 DON’T IGNORE WARNINGS FIX THE PROBLEM, e.g. add.extern or fix type

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 20 / 28 Now “build and run” the tests All the tests MUST fail (no code written) otherwise using bad tests Quick test failure visualization Detailed test failure information Something wrong – how did the test pass with no code?

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 21 / 28 Now “build and run” the tests All the tests should fail (no code present) Quick test failure visualization Detailed test failure information Clicking on the “detailed test info” automatically takes you to the “test” that failed

The test that failed 12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 22 / 28 Clicking on the “detailed test info” automatically takes you to the “test” that failed

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 23 / 28 Test information modes are controlled in “Test_main” Show Failures and Expected Failures only Show Failures and Successes

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 24 / 28 Add a separate test to show that result2 (from the ASM code) is equal to 42 Add further tests at this location

Gui automatically adds new test 12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 25 / 28

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 26 / 28 Write the tests for “self-documenting” messages (What does “result1 == result2” mean if 200 tests present?) HAVE – What is a ‘result1’ and a ‘result 2’ WANT

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 27 / 28 Write the “CPP” code to get to work but “Write the ASM for speed” FAIL SUCCESS “../E-UNITIncludes/E-UNIT_Tests1Sept07.h”

Get a “Volun-tell” to come to the front and write the “better” test 12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 28 / 28

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 29 / 28 Available ASSERTS More can be “customized” CHECK(expected == actual) – Success if passes XF_CHECK(expected == actual) – Success if “fails” CHECK_EQUAL(expected, actual) XF_CHECK_EQUAL(expected, actual) – Success if fails CHECK_CLOSE(expected, actual, tolerance) CHECK_ARRAY_EQUAL(expected, actual, length) CHECK_ARRAY_CLOSE(expected, actual, length, tolerance) REPORT(“character message”); Special changes to editor.ini file makes this ASSERTS into highlighted key-words

12/14/2015 Concept of Test Driven Development applied to Embedded Systems M. Smith University of Calgary, Canada 30 / 28 Handled today – some easy “non- programming” quiz and midterm questions Why test, and what kinds of tests are there? Difference between TLD – Test Last Development TDD – Test Driven Development (Test First Development) How do you add tests for Assignment 1? More details on the testing process E-TDD and the testing tool E-UNIT Other kinds of available tests – time and access Design of custom TESTs and ASSERTS