SlideShare une entreprise Scribd logo
1  sur  47
Télécharger pour lire hors ligne
Unit testing in embedded environments
         with Parasoft C++test
Agenda
 Introduction
    What are the embedded systems
    What is Unit Testing
 Unit Testing With C++test
    General flow
    Test cases generation
 Unit Testing in Embedded Environments
    General flow
    Runtime requirements
    Building test executable
    Pros, Cons, limitations
 Questions ....
Introduction
What is an embedded system ?



An embedded system is a combination of computer
hardware and the software, and perhaps additional
mechanical or other parts, designed to perform a
specific function.


                   (Michael Barr - Programming Embedded Systems)
A generic embedded system



                 Memory




                                       Functional devices
      Inputs     Processor   Outputs
Example 1 - VCR
                  VCR can be made of:
                   8 bit processor
                   ROM and RAM
                   Mechanical
                    components
                   Analog modules
                    for signal
                    processing
                   Platform targeted
                    operating system
Example 2 - Opportunity
                          Opportunity:
                           CPU RAD6000
                            (RISC)
                           128 MB DRAM
                           3 MB EEPROM
                           256 MB FLASH
                           Running on
                            VxWORKS
                            (WindRiver)
                            operating system
Example 3 - Pendolino
                        Composed of many
                        sub systems running
                        on different
                        hardware platforms
                        and different
                        operating systems
Development process




    Host Machine                     CPU
                       deployment
   Cross development
      environment                   Target Platform


                                     MEM
Unit Testing


In computer programming, a unit test is a
procedure used to validate that a particular module
of source code is working properly. The procedure is
to write test cases for all functions and methods so
that whenever a change causes a regression, it can
be quickly identified and fixed.

                                     (www.wikipedia.org)
Unit testing with C++test
-test flow
-test harness architecture
-test cases
-regression testing
Unit Testing with C++test


   Automatic test cases generation
   Test cases in a form of source code
   Coverage metrics
   Post-Conditions recording for regression testing
   Automatic Stubs configuration
   Automatic test flow management
   Command line mode
   Convenient reporting system
From source code to test results

                                test results

            C++test
                                instrumented
 source          Parser          user source
  code
             Instr Generator


               Test Cases        test cases      Test
               Generator           source      Executable

                                                runtime
                                                 library
libraries   Libraries Scanner       stub
                                   source
             Stub Manager
Tests architecture - example



  #include <header>

  int funcB();

  int funcA(int b)
  {
     int a = funcB();
     return a + b;
  }
Tests architecture - example
                                      Test Executable

   test runner
       main() {             instrumented code
           call_test_case   Int funcA(int a) {
      .....}                   instr_callback();
                               int b = funcB_stub();
                               instr_callback();
                               return a + b;
                            }
   test_case
   {
     pre_cond                    Stubs
     funcA()                     funcB_stub() {
     post_cond                      return 0;
   }                             }
Test cases
Test cases architecture
                                       Test case is composed of
TestSuite_MyClass::test_foo_0()          three sections:
{
  //PreCondition initialization
  int arg_1 = 0;
  MyClass testObject();                 Pre conditions setup
    //Tested function call
                                        Tested function call
    int ret = testObject.func(arg1);    Post conditions
    //PostConditions validation          validation
    CPPTEST_ASSERT(ret == 1)

}
Automatic test cases generation
C++test's test cases generator automatically
produces source elements for:

Initializing pre-conditions like: function arguments,
global variables, 'this' object for tested function

Calling the tested function or method

Validating post-conditions (achieved test result)
Initialization strategies
 Simple (built-in) types:
    Integers (-1,0,1, min, max value)
    Floating point (-1.0, 0.0, 1.0, max, min positive, max,
     min negative)
    Heuristic values



 Complex types (user defined types) C++test will
  use available constructors and generate code
  necessary to initialize constructors arguments.
Initialization strategies
 Pointer types:
    NULL pointer
    address of a local object created on stack
    address of an object created with “new” (on heap)
 Reference types:
    local object created on stack
    object created using operator “new”
 Heuristic values for simple types:
    int
    float
    char *
Post conditions
C++test provides macros and routines for controlling
how source code test results are collected and
validated:

Test case post-conditions are controlled via
assertion macros (similar to CppUnit)
    CPPTEST_ASSERT_INTEGER_EQUAL(expected,actual)


Assertions perform a condition validation and send
results back to C++test
Test case example with post-conditions


      /* CPPTEST_TEST_CASE_BEGIN test_bufLen_0 */
      void TestSuite_bufLen_0::test_bufLen_0()
      {
         /* Pre-condition initialization */

          /* Initializing argument 0 (this) */
              /* Initializing constructor argument 1 (fill) */
              char _fill_0 = '001';
          ::Data _cpptest_TestObject (_fill_0);

          /* Tested function call */
          int _return = _cpptest_TestObject.bufLen();

          /* Post-condition check */
          CPPTEST_ASSERT_INTEGER_EQUAL(4, ( _return ))
          CPPTEST_ASSERT(( _cpptest_TestObject._data ) != 0)
      }
Regression test cases generation

   subsequent test runs


               generation                      Test results


       Test cases                Validation              Testing
       generation

                                         First test execution
                            Test cases




                            Regression
                            test cases
Stubs
Stubs – handling missing definitions

                                    Instrumented
     Libraries                       source code
         &
    object files
                                   Auto generated
                                        stubs

                                  int func2()
                                  {
                                     return 0;
                                  }
extern int func2();

int func1(int b)                    User defined
{                                      stubs
   int a = func2();
   return a + b;
}
Stubs in C++test
 Stubs are used:
   when testing in separation from other modules
   when application module is not yet ready
   when hardware module is not yet ready
 C++test provides three modes for stubbed
  function:
   original
   user-defined
   auto-generated
 Stubs configuration is managed from C++test GUI
  and persisted in C++test project
Unit Testing in embedded environments
-test flow
-runtime library
-problems & limitations
-why to unit test on target ?
Unit testing in embedded environment
C++test
                                  runtime



           Cross Compiler
runtime




                                                          linker/locator
library                            library
 source
                                                                              Test
                                                                           executable
                                    Test
 Test                             harness
harness                           binaries
source




                                                                           deploy
 code



                            host - target communication

                                       results
Unit testing in embedded environment

   Host
    Development env                               Target


           C++test              deploy
                                                  Test executable

                                                 Runtime library
             Listening                           communication
               agent     communication channel      module
C++test runtime library
C++test runtime library


 Provided in form of source code
 Implemented in plain C
 Needs to be cross-compiled for specific target
  platform
 Contains definition of communication channel
  Provided implementations:
   file
   TCP/IP sockets
 Designed to be easily customizable
C++test runtime library
Communication module
Target-to-host communication module
 Custom implementation of communication channel
  can be plugged in
 Defining communication channel requires
  implementing four methods:
   cpptestInitializeCommunication(...);
   cpptestFinalizeCommunication(...);
   cpptestSendData(const char* data, unsigned size);
 All data transfer operations, performed inside C+
  +test runtime library are implemented in terms of
  above interface
Collecting results on target
  Host
                                       Target
           C++test

                                       Test executable

                     Manual results   Runtime library
                       transfer
   File                               communication
  System                                 module




                                           Local
                                          Storage
“On the fly” results transfer

  Host
                                                   Target
           C++test

                             TCP/IP Sockets        Test executable
                                RS 232
                                RS 485
                                   I2C
                                  ICE             Runtime library
   File       Listening                           communication
  System        agent     communication channel      module
C++test runtime library
Exceptions handling module
Exceptions handling
                                           C++test uses
  Test cases execution
        sequence                            exceptions handling
                                            facilities (try, catch,
                    Test                    setjmp, longjmp,
                   case 1                   signal) to recover if
                                            exception is thrown
                            exception
                                            during test sequence
handling enabled




                    Test
With exceptions




                   case 2
                            (e.g divide
                            by zero)       If target platform does
                                            not provide exceptions
                                            handling, test sequence
                    Test
                                            is broken on first
                   case n                   exception and needs to
                                            be restarted
Test flow automation
Test flow automation
 Test sequence can be automatically performed in
  C++test GUI as well as in command line mode
 Test sequence consists of test harness
  preparation, building test executable, deploying
  test executable, starting it, and collecting results
 Limitations in automation of testing process can be
  imposed be development environment
 C++test provides easy to use XML-based format
  for defining test framework operations
Problems & Limitations
Problems & limitations
 Not enough memory on the target device to store
  test harness and tested code may block or limit
  testing capabilities


                    Compilation without debug information

                Original file     Min Instr       Med Instr     Max Instr
 GNU GCC 3.2       22 KB         22 KB (0%)      29 KB (30%)   41 KB (80%)
 MSVC++ 7.1        33 KB         33 KB (0%)      41 KB (24%)   69 KB (100%)
Tornado simpc      23 KB         23 KB (0%)      30 KB (30%)   41 KB (78%)
Problems & limitations


 Lack of communication channel may effect in weak
  test automation

 Missing support for exceptions handling may
  increase the number of runs necessary to execute
  test cases scheduled for test session.

 Additional amount of work required during
  development process
Why to unit test on target ?
Pros of unit testing on target
 All well known positives from host-based unit
  testing (early bugs detection, increased code
  robustness, ...)
 Possibility of detecting hardware problems
 Possibility of detecting software/hardware
  interaction problems
 Easy stubbing of missing software (also hardware)
  modules
 Quick and automated generation of regression
  suites
Unit testing in embedded environment - example
static int iTemperatures[2];
                                            “Critical section”
void interrupt vReadTemperatures(void) {     related bugs are hard
    ITemperatures[0] = /*Read sensor 1*/     to detect during host-
    ITemperatures[1] = /*Read sensor 2*/     based unit testing
}
                                            Target-based unit
bool testSensors() {                         testing highly increases
    int iTemp0, iTemp1;                      probability of catching
    iTemp0 = ITemperatures[0];
                                             this kind of problems,
    iTemp1 = ITemperatures[1];
    if (iTemp0 != iTemp1) { // Alarm !!!
                                             however it does not
        return -1;                           provide 100% certainty
    }                                        of catching them.
    return 0;
}
Unit testing in embedded environment - example
                          Module for driving the position
                           of functional mechanical
                           equipment
 servo                    Hardware contains “stuck-at-
          encoder          zero” problem between the
                           encoder and board interface

                       int set_position(int angl)
                       {
                           if (angl < MIN || angl > MAX)
                           {
                               return INCORRECT_ANGL;
                           }
                           return run_servo(angl);
                       }
Epilog


 C++test offers a high level of automation for tasks
which are usually performed manually, especially in
embedded environments, therefore very often it lets
    us give the positive answer for a question:


          “to test ? or not to test ?”

Contenu connexe

Tendances

End-to-End Test Automation for Both Horizontal and Vertical Scale
End-to-End Test Automation for Both Horizontal and Vertical ScaleEnd-to-End Test Automation for Both Horizontal and Vertical Scale
End-to-End Test Automation for Both Horizontal and Vertical ScaleErdem YILDIRIM
 
XPDS13: Xen in OSS based In–Vehicle Infotainment Systems - Artem Mygaiev, Glo...
XPDS13: Xen in OSS based In–Vehicle Infotainment Systems - Artem Mygaiev, Glo...XPDS13: Xen in OSS based In–Vehicle Infotainment Systems - Artem Mygaiev, Glo...
XPDS13: Xen in OSS based In–Vehicle Infotainment Systems - Artem Mygaiev, Glo...The Linux Foundation
 
BKK16-315 Graphics Stack Update
BKK16-315 Graphics Stack UpdateBKK16-315 Graphics Stack Update
BKK16-315 Graphics Stack UpdateLinaro
 
Building a Test Automation Strategy for Success
Building a Test Automation Strategy for SuccessBuilding a Test Automation Strategy for Success
Building a Test Automation Strategy for SuccessLee Barnes
 
System Device Tree and Lopper: Concrete Examples - ELC NA 2022
System Device Tree and Lopper: Concrete Examples - ELC NA 2022System Device Tree and Lopper: Concrete Examples - ELC NA 2022
System Device Tree and Lopper: Concrete Examples - ELC NA 2022Stefano Stabellini
 
Scanning with nmap
Scanning with nmapScanning with nmap
Scanning with nmapcommiebstrd
 
The Top Ten things that have been proven to effect software reliability
The Top Ten things that have been proven to effect software reliabilityThe Top Ten things that have been proven to effect software reliability
The Top Ten things that have been proven to effect software reliabilityAnn Marie Neufelder
 
Test Management introduction
Test Management introductionTest Management introduction
Test Management introductionOana Feidi
 
Linux kernel Architecture and Properties
Linux kernel Architecture and PropertiesLinux kernel Architecture and Properties
Linux kernel Architecture and PropertiesSaadi Rahman
 
Xray for Jira - How to automate your QA process
Xray for Jira - How to automate your QA processXray for Jira - How to automate your QA process
Xray for Jira - How to automate your QA processXpand IT
 
2018 Genivi Xen Overview Nov Update
2018 Genivi Xen Overview Nov Update2018 Genivi Xen Overview Nov Update
2018 Genivi Xen Overview Nov UpdateThe Linux Foundation
 
Hardware accelerated Virtualization in the ARM Cortex™ Processors
Hardware accelerated Virtualization in the ARM Cortex™ ProcessorsHardware accelerated Virtualization in the ARM Cortex™ Processors
Hardware accelerated Virtualization in the ARM Cortex™ ProcessorsThe Linux Foundation
 
Xen and the art of embedded virtualization (ELC 2017)
Xen and the art of embedded virtualization (ELC 2017)Xen and the art of embedded virtualization (ELC 2017)
Xen and the art of embedded virtualization (ELC 2017)Stefano Stabellini
 
Nagios An Open Source Network Management System Powerpoint Presentation Slides
Nagios An Open Source Network Management System Powerpoint Presentation SlidesNagios An Open Source Network Management System Powerpoint Presentation Slides
Nagios An Open Source Network Management System Powerpoint Presentation SlidesSlideTeam
 
ELC21: VM-to-VM Communication Mechanisms for Embedded
ELC21: VM-to-VM Communication Mechanisms for EmbeddedELC21: VM-to-VM Communication Mechanisms for Embedded
ELC21: VM-to-VM Communication Mechanisms for EmbeddedStefano Stabellini
 
Xen in Safety-Critical Systems - Critical Summit 2022
Xen in Safety-Critical Systems - Critical Summit 2022Xen in Safety-Critical Systems - Critical Summit 2022
Xen in Safety-Critical Systems - Critical Summit 2022Stefano Stabellini
 
Understanding .Net Standards, .Net Core & .Net Framework
Understanding .Net Standards, .Net Core & .Net FrameworkUnderstanding .Net Standards, .Net Core & .Net Framework
Understanding .Net Standards, .Net Core & .Net Frameworkpunedevscom
 

Tendances (20)

End-to-End Test Automation for Both Horizontal and Vertical Scale
End-to-End Test Automation for Both Horizontal and Vertical ScaleEnd-to-End Test Automation for Both Horizontal and Vertical Scale
End-to-End Test Automation for Both Horizontal and Vertical Scale
 
XPDS13: Xen in OSS based In–Vehicle Infotainment Systems - Artem Mygaiev, Glo...
XPDS13: Xen in OSS based In–Vehicle Infotainment Systems - Artem Mygaiev, Glo...XPDS13: Xen in OSS based In–Vehicle Infotainment Systems - Artem Mygaiev, Glo...
XPDS13: Xen in OSS based In–Vehicle Infotainment Systems - Artem Mygaiev, Glo...
 
BKK16-315 Graphics Stack Update
BKK16-315 Graphics Stack UpdateBKK16-315 Graphics Stack Update
BKK16-315 Graphics Stack Update
 
Building a Test Automation Strategy for Success
Building a Test Automation Strategy for SuccessBuilding a Test Automation Strategy for Success
Building a Test Automation Strategy for Success
 
System Device Tree and Lopper: Concrete Examples - ELC NA 2022
System Device Tree and Lopper: Concrete Examples - ELC NA 2022System Device Tree and Lopper: Concrete Examples - ELC NA 2022
System Device Tree and Lopper: Concrete Examples - ELC NA 2022
 
Scanning with nmap
Scanning with nmapScanning with nmap
Scanning with nmap
 
The Top Ten things that have been proven to effect software reliability
The Top Ten things that have been proven to effect software reliabilityThe Top Ten things that have been proven to effect software reliability
The Top Ten things that have been proven to effect software reliability
 
Ariane 5 launcher failure
Ariane 5 launcher failure Ariane 5 launcher failure
Ariane 5 launcher failure
 
Borland C++Builder 進階課程
Borland C++Builder 進階課程Borland C++Builder 進階課程
Borland C++Builder 進階課程
 
Test Management introduction
Test Management introductionTest Management introduction
Test Management introduction
 
Linux kernel Architecture and Properties
Linux kernel Architecture and PropertiesLinux kernel Architecture and Properties
Linux kernel Architecture and Properties
 
Xray for Jira - How to automate your QA process
Xray for Jira - How to automate your QA processXray for Jira - How to automate your QA process
Xray for Jira - How to automate your QA process
 
2018 Genivi Xen Overview Nov Update
2018 Genivi Xen Overview Nov Update2018 Genivi Xen Overview Nov Update
2018 Genivi Xen Overview Nov Update
 
Hardware accelerated Virtualization in the ARM Cortex™ Processors
Hardware accelerated Virtualization in the ARM Cortex™ ProcessorsHardware accelerated Virtualization in the ARM Cortex™ Processors
Hardware accelerated Virtualization in the ARM Cortex™ Processors
 
Xen and the art of embedded virtualization (ELC 2017)
Xen and the art of embedded virtualization (ELC 2017)Xen and the art of embedded virtualization (ELC 2017)
Xen and the art of embedded virtualization (ELC 2017)
 
Nagios An Open Source Network Management System Powerpoint Presentation Slides
Nagios An Open Source Network Management System Powerpoint Presentation SlidesNagios An Open Source Network Management System Powerpoint Presentation Slides
Nagios An Open Source Network Management System Powerpoint Presentation Slides
 
ELC21: VM-to-VM Communication Mechanisms for Embedded
ELC21: VM-to-VM Communication Mechanisms for EmbeddedELC21: VM-to-VM Communication Mechanisms for Embedded
ELC21: VM-to-VM Communication Mechanisms for Embedded
 
Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore Android Internals
 
Xen in Safety-Critical Systems - Critical Summit 2022
Xen in Safety-Critical Systems - Critical Summit 2022Xen in Safety-Critical Systems - Critical Summit 2022
Xen in Safety-Critical Systems - Critical Summit 2022
 
Understanding .Net Standards, .Net Core & .Net Framework
Understanding .Net Standards, .Net Core & .Net FrameworkUnderstanding .Net Standards, .Net Core & .Net Framework
Understanding .Net Standards, .Net Core & .Net Framework
 

Similaire à Unit testing on embedded target with C++Test

Infrastructure testing with Molecule and TestInfra
Infrastructure testing with Molecule and TestInfraInfrastructure testing with Molecule and TestInfra
Infrastructure testing with Molecule and TestInfraTomislav Plavcic
 
In search of JavaScript code quality: unit testing
In search of JavaScript code quality: unit testingIn search of JavaScript code quality: unit testing
In search of JavaScript code quality: unit testingAnna Khabibullina
 
Comparative Development Methodologies
Comparative Development MethodologiesComparative Development Methodologies
Comparative Development Methodologieselliando dias
 
Automation Using Marvin Framework by Sowmya Krishnan
Automation Using Marvin Framework by Sowmya KrishnanAutomation Using Marvin Framework by Sowmya Krishnan
Automation Using Marvin Framework by Sowmya KrishnanRadhika Puthiyetath
 
Unit testingandcontinousintegrationfreenest1dot4
Unit testingandcontinousintegrationfreenest1dot4Unit testingandcontinousintegrationfreenest1dot4
Unit testingandcontinousintegrationfreenest1dot4JAMK
 
Performance and Scalability Testing with Python and Multi-Mechanize
Performance and Scalability Testing with Python and Multi-MechanizePerformance and Scalability Testing with Python and Multi-Mechanize
Performance and Scalability Testing with Python and Multi-Mechanizecoreygoldberg
 
QTP Training
QTP TrainingQTP Training
QTP TrainingG.C Reddy
 
Measurement .Net Performance with BenchmarkDotNet
Measurement .Net Performance with BenchmarkDotNetMeasurement .Net Performance with BenchmarkDotNet
Measurement .Net Performance with BenchmarkDotNetVasyl Senko
 
Unmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/InvokeUnmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/InvokeDmitri Nesteruk
 
Tdd with python unittest for embedded c
Tdd with python unittest for embedded cTdd with python unittest for embedded c
Tdd with python unittest for embedded cBenux Wei
 
Static code analysis: what? how? why?
Static code analysis: what? how? why?Static code analysis: what? how? why?
Static code analysis: what? how? why?Andrey Karpov
 
Node.js behind: V8 and its optimizations
Node.js behind: V8 and its optimizationsNode.js behind: V8 and its optimizations
Node.js behind: V8 and its optimizationsDawid Rusnak
 
JavaScript Robotics
JavaScript RoboticsJavaScript Robotics
JavaScript RoboticsAnna Gerber
 
Hadoop: Code Injection, Distributed Fault Injection
Hadoop: Code Injection, Distributed Fault InjectionHadoop: Code Injection, Distributed Fault Injection
Hadoop: Code Injection, Distributed Fault InjectionCloudera, Inc.
 
Property Based Testing in PHP
Property Based Testing in PHPProperty Based Testing in PHP
Property Based Testing in PHPvinaikopp
 

Similaire à Unit testing on embedded target with C++Test (20)

Full Stack Unit Testing
Full Stack Unit TestingFull Stack Unit Testing
Full Stack Unit Testing
 
How to fake_properly
How to fake_properlyHow to fake_properly
How to fake_properly
 
Infrastructure testing with Molecule and TestInfra
Infrastructure testing with Molecule and TestInfraInfrastructure testing with Molecule and TestInfra
Infrastructure testing with Molecule and TestInfra
 
In search of JavaScript code quality: unit testing
In search of JavaScript code quality: unit testingIn search of JavaScript code quality: unit testing
In search of JavaScript code quality: unit testing
 
Comparative Development Methodologies
Comparative Development MethodologiesComparative Development Methodologies
Comparative Development Methodologies
 
Automation Using Marvin Framework by Sowmya Krishnan
Automation Using Marvin Framework by Sowmya KrishnanAutomation Using Marvin Framework by Sowmya Krishnan
Automation Using Marvin Framework by Sowmya Krishnan
 
Unit testingandcontinousintegrationfreenest1dot4
Unit testingandcontinousintegrationfreenest1dot4Unit testingandcontinousintegrationfreenest1dot4
Unit testingandcontinousintegrationfreenest1dot4
 
Performance and Scalability Testing with Python and Multi-Mechanize
Performance and Scalability Testing with Python and Multi-MechanizePerformance and Scalability Testing with Python and Multi-Mechanize
Performance and Scalability Testing with Python and Multi-Mechanize
 
QTP Online Training
QTP Online Training QTP Online Training
QTP Online Training
 
QTP Training
QTP TrainingQTP Training
QTP Training
 
Measurement .Net Performance with BenchmarkDotNet
Measurement .Net Performance with BenchmarkDotNetMeasurement .Net Performance with BenchmarkDotNet
Measurement .Net Performance with BenchmarkDotNet
 
Unmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/InvokeUnmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/Invoke
 
Tdd with python unittest for embedded c
Tdd with python unittest for embedded cTdd with python unittest for embedded c
Tdd with python unittest for embedded c
 
Matlab isim link
Matlab isim linkMatlab isim link
Matlab isim link
 
Static code analysis: what? how? why?
Static code analysis: what? how? why?Static code analysis: what? how? why?
Static code analysis: what? how? why?
 
Node.js behind: V8 and its optimizations
Node.js behind: V8 and its optimizationsNode.js behind: V8 and its optimizations
Node.js behind: V8 and its optimizations
 
JavaScript Robotics
JavaScript RoboticsJavaScript Robotics
JavaScript Robotics
 
Hadoop: Code Injection, Distributed Fault Injection
Hadoop: Code Injection, Distributed Fault InjectionHadoop: Code Injection, Distributed Fault Injection
Hadoop: Code Injection, Distributed Fault Injection
 
Beyond Unit Testing
Beyond Unit TestingBeyond Unit Testing
Beyond Unit Testing
 
Property Based Testing in PHP
Property Based Testing in PHPProperty Based Testing in PHP
Property Based Testing in PHP
 

Plus de Engineering Software Lab

המדריך לכוון חיישן מצב מצערת באופנועי קטמ דגמי הזרקת דלק
המדריך לכוון חיישן מצב מצערת באופנועי קטמ דגמי הזרקת דלקהמדריך לכוון חיישן מצב מצערת באופנועי קטמ דגמי הזרקת דלק
המדריך לכוון חיישן מצב מצערת באופנועי קטמ דגמי הזרקת דלקEngineering Software Lab
 
Amran Tuberi - the damage of cycling to the desert ecosystem
Amran Tuberi - the damage of cycling to the desert ecosystemAmran Tuberi - the damage of cycling to the desert ecosystem
Amran Tuberi - the damage of cycling to the desert ecosystemEngineering Software Lab
 
Parasoft Concerto A complete ALM platform that ensures quality software can b...
Parasoft Concerto A complete ALM platform that ensures quality software can b...Parasoft Concerto A complete ALM platform that ensures quality software can b...
Parasoft Concerto A complete ALM platform that ensures quality software can b...Engineering Software Lab
 
Code coverage in theory and in practice form the do178 b perspective
Code coverage in theory and in practice form the do178 b perspectiveCode coverage in theory and in practice form the do178 b perspective
Code coverage in theory and in practice form the do178 b perspectiveEngineering Software Lab
 
Code Coverage in Theory and in practice form the DO178B perspective
Code Coverage in Theory and in practice form the DO178B perspective   Code Coverage in Theory and in practice form the DO178B perspective
Code Coverage in Theory and in practice form the DO178B perspective Engineering Software Lab
 
WPF/ XamDataGrid Performance, Infragistics Seminar, Israel , November 2011
WPF/ XamDataGrid Performance, Infragistics Seminar, Israel , November 2011WPF/ XamDataGrid Performance, Infragistics Seminar, Israel , November 2011
WPF/ XamDataGrid Performance, Infragistics Seminar, Israel , November 2011Engineering Software Lab
 
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
Parasoft .TEST, Write better C# Code Using  Data Flow Analysis Parasoft .TEST, Write better C# Code Using  Data Flow Analysis
Parasoft .TEST, Write better C# Code Using Data Flow Analysis Engineering Software Lab
 
Nunit C# source code defects report by Parasoft dotTEST
Nunit  C# source code  defects report by Parasoft dotTEST Nunit  C# source code  defects report by Parasoft dotTEST
Nunit C# source code defects report by Parasoft dotTEST Engineering Software Lab
 
Perforce עשרת היתרונות המובילים של מערכת ניהול התצורה
Perforce עשרת היתרונות המובילים של מערכת ניהול התצורהPerforce עשרת היתרונות המובילים של מערכת ניהול התצורה
Perforce עשרת היתרונות המובילים של מערכת ניהול התצורהEngineering Software Lab
 

Plus de Engineering Software Lab (17)

FDA software compliance 2016
FDA software compliance 2016FDA software compliance 2016
FDA software compliance 2016
 
המדריך לכוון חיישן מצב מצערת באופנועי קטמ דגמי הזרקת דלק
המדריך לכוון חיישן מצב מצערת באופנועי קטמ דגמי הזרקת דלקהמדריך לכוון חיישן מצב מצערת באופנועי קטמ דגמי הזרקת דלק
המדריך לכוון חיישן מצב מצערת באופנועי קטמ דגמי הזרקת דלק
 
ועד בית דב כרמי 1
ועד בית דב כרמי 1ועד בית דב כרמי 1
ועד בית דב כרמי 1
 
המסדרת הפכה למגוהצת
המסדרת הפכה למגוהצתהמסדרת הפכה למגוהצת
המסדרת הפכה למגוהצת
 
Amran Tuberi - the damage of cycling to the desert ecosystem
Amran Tuberi - the damage of cycling to the desert ecosystemAmran Tuberi - the damage of cycling to the desert ecosystem
Amran Tuberi - the damage of cycling to the desert ecosystem
 
Parasoft Concerto A complete ALM platform that ensures quality software can b...
Parasoft Concerto A complete ALM platform that ensures quality software can b...Parasoft Concerto A complete ALM platform that ensures quality software can b...
Parasoft Concerto A complete ALM platform that ensures quality software can b...
 
Palamida Open Source Compliance Solution
Palamida Open Source Compliance Solution Palamida Open Source Compliance Solution
Palamida Open Source Compliance Solution
 
Code coverage in theory and in practice form the do178 b perspective
Code coverage in theory and in practice form the do178 b perspectiveCode coverage in theory and in practice form the do178 b perspective
Code coverage in theory and in practice form the do178 b perspective
 
Code Coverage in Theory and in practice form the DO178B perspective
Code Coverage in Theory and in practice form the DO178B perspective   Code Coverage in Theory and in practice form the DO178B perspective
Code Coverage in Theory and in practice form the DO178B perspective
 
WPF/ XamDataGrid Performance, Infragistics Seminar, Israel , November 2011
WPF/ XamDataGrid Performance, Infragistics Seminar, Israel , November 2011WPF/ XamDataGrid Performance, Infragistics Seminar, Israel , November 2011
WPF/ XamDataGrid Performance, Infragistics Seminar, Israel , November 2011
 
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
Parasoft .TEST, Write better C# Code Using  Data Flow Analysis Parasoft .TEST, Write better C# Code Using  Data Flow Analysis
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
 
Nunit C# source code defects report by Parasoft dotTEST
Nunit  C# source code  defects report by Parasoft dotTEST Nunit  C# source code  defects report by Parasoft dotTEST
Nunit C# source code defects report by Parasoft dotTEST
 
A Scalable Software Build Accelerator
A Scalable Software Build AcceleratorA Scalable Software Build Accelerator
A Scalable Software Build Accelerator
 
Parasoft fda software compliance part2
Parasoft fda software compliance   part2Parasoft fda software compliance   part2
Parasoft fda software compliance part2
 
Parasoft fda software compliance part1
Parasoft fda software compliance   part1Parasoft fda software compliance   part1
Parasoft fda software compliance part1
 
Introduction to Parasoft C++TEST
Introduction to Parasoft C++TEST Introduction to Parasoft C++TEST
Introduction to Parasoft C++TEST
 
Perforce עשרת היתרונות המובילים של מערכת ניהול התצורה
Perforce עשרת היתרונות המובילים של מערכת ניהול התצורהPerforce עשרת היתרונות המובילים של מערכת ניהול התצורה
Perforce עשרת היתרונות המובילים של מערכת ניהול התצורה
 

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 

Dernier (20)

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 

Unit testing on embedded target with C++Test

  • 1. Unit testing in embedded environments with Parasoft C++test
  • 2. Agenda  Introduction  What are the embedded systems  What is Unit Testing  Unit Testing With C++test  General flow  Test cases generation  Unit Testing in Embedded Environments  General flow  Runtime requirements  Building test executable  Pros, Cons, limitations  Questions ....
  • 4. What is an embedded system ? An embedded system is a combination of computer hardware and the software, and perhaps additional mechanical or other parts, designed to perform a specific function. (Michael Barr - Programming Embedded Systems)
  • 5. A generic embedded system Memory Functional devices Inputs Processor Outputs
  • 6. Example 1 - VCR VCR can be made of:  8 bit processor  ROM and RAM  Mechanical components  Analog modules for signal processing  Platform targeted operating system
  • 7. Example 2 - Opportunity Opportunity:  CPU RAD6000 (RISC)  128 MB DRAM  3 MB EEPROM  256 MB FLASH  Running on VxWORKS (WindRiver) operating system
  • 8. Example 3 - Pendolino Composed of many sub systems running on different hardware platforms and different operating systems
  • 9. Development process Host Machine CPU deployment Cross development environment Target Platform MEM
  • 10. Unit Testing In computer programming, a unit test is a procedure used to validate that a particular module of source code is working properly. The procedure is to write test cases for all functions and methods so that whenever a change causes a regression, it can be quickly identified and fixed. (www.wikipedia.org)
  • 11. Unit testing with C++test -test flow -test harness architecture -test cases -regression testing
  • 12. Unit Testing with C++test  Automatic test cases generation  Test cases in a form of source code  Coverage metrics  Post-Conditions recording for regression testing  Automatic Stubs configuration  Automatic test flow management  Command line mode  Convenient reporting system
  • 13. From source code to test results test results C++test instrumented source Parser user source code Instr Generator Test Cases test cases Test Generator source Executable runtime library libraries Libraries Scanner stub source Stub Manager
  • 14. Tests architecture - example #include <header> int funcB(); int funcA(int b) { int a = funcB(); return a + b; }
  • 15. Tests architecture - example Test Executable test runner main() { instrumented code call_test_case Int funcA(int a) { .....} instr_callback(); int b = funcB_stub(); instr_callback(); return a + b; } test_case { pre_cond Stubs funcA() funcB_stub() { post_cond return 0; } }
  • 17. Test cases architecture Test case is composed of TestSuite_MyClass::test_foo_0() three sections: { //PreCondition initialization int arg_1 = 0; MyClass testObject();  Pre conditions setup //Tested function call  Tested function call int ret = testObject.func(arg1);  Post conditions //PostConditions validation validation CPPTEST_ASSERT(ret == 1) }
  • 18. Automatic test cases generation C++test's test cases generator automatically produces source elements for: Initializing pre-conditions like: function arguments, global variables, 'this' object for tested function Calling the tested function or method Validating post-conditions (achieved test result)
  • 19. Initialization strategies  Simple (built-in) types:  Integers (-1,0,1, min, max value)  Floating point (-1.0, 0.0, 1.0, max, min positive, max, min negative)  Heuristic values  Complex types (user defined types) C++test will use available constructors and generate code necessary to initialize constructors arguments.
  • 20. Initialization strategies  Pointer types:  NULL pointer  address of a local object created on stack  address of an object created with “new” (on heap)  Reference types:  local object created on stack  object created using operator “new”  Heuristic values for simple types:  int  float  char *
  • 21. Post conditions C++test provides macros and routines for controlling how source code test results are collected and validated: Test case post-conditions are controlled via assertion macros (similar to CppUnit)  CPPTEST_ASSERT_INTEGER_EQUAL(expected,actual) Assertions perform a condition validation and send results back to C++test
  • 22. Test case example with post-conditions /* CPPTEST_TEST_CASE_BEGIN test_bufLen_0 */ void TestSuite_bufLen_0::test_bufLen_0() { /* Pre-condition initialization */ /* Initializing argument 0 (this) */ /* Initializing constructor argument 1 (fill) */ char _fill_0 = '001'; ::Data _cpptest_TestObject (_fill_0); /* Tested function call */ int _return = _cpptest_TestObject.bufLen(); /* Post-condition check */ CPPTEST_ASSERT_INTEGER_EQUAL(4, ( _return )) CPPTEST_ASSERT(( _cpptest_TestObject._data ) != 0) }
  • 23. Regression test cases generation subsequent test runs generation Test results Test cases Validation Testing generation First test execution Test cases Regression test cases
  • 24. Stubs
  • 25. Stubs – handling missing definitions Instrumented Libraries source code & object files Auto generated stubs int func2() { return 0; } extern int func2(); int func1(int b) User defined { stubs int a = func2(); return a + b; }
  • 26. Stubs in C++test  Stubs are used:  when testing in separation from other modules  when application module is not yet ready  when hardware module is not yet ready  C++test provides three modes for stubbed function:  original  user-defined  auto-generated  Stubs configuration is managed from C++test GUI and persisted in C++test project
  • 27. Unit Testing in embedded environments -test flow -runtime library -problems & limitations -why to unit test on target ?
  • 28. Unit testing in embedded environment C++test runtime Cross Compiler runtime linker/locator library library source Test executable Test Test harness harness binaries source deploy code host - target communication results
  • 29. Unit testing in embedded environment Host Development env Target C++test deploy Test executable Runtime library Listening communication agent communication channel module
  • 31. C++test runtime library  Provided in form of source code  Implemented in plain C  Needs to be cross-compiled for specific target platform  Contains definition of communication channel Provided implementations:  file  TCP/IP sockets  Designed to be easily customizable
  • 33. Target-to-host communication module  Custom implementation of communication channel can be plugged in  Defining communication channel requires implementing four methods:  cpptestInitializeCommunication(...);  cpptestFinalizeCommunication(...);  cpptestSendData(const char* data, unsigned size);  All data transfer operations, performed inside C+ +test runtime library are implemented in terms of above interface
  • 34. Collecting results on target Host Target C++test Test executable Manual results Runtime library transfer File communication System module Local Storage
  • 35. “On the fly” results transfer Host Target C++test TCP/IP Sockets Test executable RS 232 RS 485 I2C ICE Runtime library File Listening communication System agent communication channel module
  • 37. Exceptions handling  C++test uses Test cases execution sequence exceptions handling facilities (try, catch, Test setjmp, longjmp, case 1 signal) to recover if exception is thrown exception during test sequence handling enabled Test With exceptions case 2 (e.g divide by zero)  If target platform does not provide exceptions handling, test sequence Test is broken on first case n exception and needs to be restarted
  • 39. Test flow automation  Test sequence can be automatically performed in C++test GUI as well as in command line mode  Test sequence consists of test harness preparation, building test executable, deploying test executable, starting it, and collecting results  Limitations in automation of testing process can be imposed be development environment  C++test provides easy to use XML-based format for defining test framework operations
  • 41. Problems & limitations  Not enough memory on the target device to store test harness and tested code may block or limit testing capabilities Compilation without debug information Original file Min Instr Med Instr Max Instr GNU GCC 3.2 22 KB 22 KB (0%) 29 KB (30%) 41 KB (80%) MSVC++ 7.1 33 KB 33 KB (0%) 41 KB (24%) 69 KB (100%) Tornado simpc 23 KB 23 KB (0%) 30 KB (30%) 41 KB (78%)
  • 42. Problems & limitations  Lack of communication channel may effect in weak test automation  Missing support for exceptions handling may increase the number of runs necessary to execute test cases scheduled for test session.  Additional amount of work required during development process
  • 43. Why to unit test on target ?
  • 44. Pros of unit testing on target  All well known positives from host-based unit testing (early bugs detection, increased code robustness, ...)  Possibility of detecting hardware problems  Possibility of detecting software/hardware interaction problems  Easy stubbing of missing software (also hardware) modules  Quick and automated generation of regression suites
  • 45. Unit testing in embedded environment - example static int iTemperatures[2];  “Critical section” void interrupt vReadTemperatures(void) { related bugs are hard ITemperatures[0] = /*Read sensor 1*/ to detect during host- ITemperatures[1] = /*Read sensor 2*/ based unit testing }  Target-based unit bool testSensors() { testing highly increases int iTemp0, iTemp1; probability of catching iTemp0 = ITemperatures[0]; this kind of problems, iTemp1 = ITemperatures[1]; if (iTemp0 != iTemp1) { // Alarm !!! however it does not return -1; provide 100% certainty } of catching them. return 0; }
  • 46. Unit testing in embedded environment - example  Module for driving the position of functional mechanical equipment servo  Hardware contains “stuck-at- encoder zero” problem between the encoder and board interface int set_position(int angl) { if (angl < MIN || angl > MAX) { return INCORRECT_ANGL; } return run_servo(angl); }
  • 47. Epilog C++test offers a high level of automation for tasks which are usually performed manually, especially in embedded environments, therefore very often it lets us give the positive answer for a question: “to test ? or not to test ?”