SlideShare une entreprise Scribd logo
1  sur  12
Télécharger pour lire hors ligne
Who is Lars Thorup?

●   Software developer
    ●   Web: C# and JavaScript
    ●   Embedded C++ for several
        devices using agile and
        automated testing

●   Coach: Teaching agile and
    automated testing

●   Advisor: Assesses software
    projects and companies

●   Founder and CEO of
    BestBrains and ZeaLake
Agenda
●   What is automated testing?

●   Unity, test framework for embedded C

●   Code example

●   Why should we write automated tests?

●   Questions
What is automated testing?
●   Developers write test   ●   Automated execution of all
    programs                    test programs
The Unity testing framework
●   Small memory footprint       ●   Many test functions
                                     ●   ASSERT_TRUE
●   Pure C                           ●   FAIL
                                     ●   ASSERT_EQUAL
●   Optional tools to generate       ●   ASSERT_WITHIN
    test runners automatically       ●   ASSERT_BITS
                                     ●   ASSERT_NOT_NULL
●   Alternatives in C++
                                     ●   ASSERT_MEMORY
    ●   CppUnit
    ●   Google Test
How do we handle dependencies?
●   The flow example
    ●   a flow sensor
    ●   generates pulse counts proportional to actual flow
    ●   calculate average flow rate with regular intervals

●   The dependencies in the flow example
    ●   the sensor creating the pulse interrupt
    ●   recurring timer event
    ●   thread safe counting

●   Decouple the dependencies
    ●   Pulse: provide a callback to the FlowSensor component
    ●   Timer and Counting: inject components into the Flow component

●   flow.c
Dependencies, on device
                       main.c

            Listen
                             GetRate

    flowSensor.c                    flow.c
                     Pulse



                        GetTime

              timerImpl.c



                                        Increment

                                counterImpl.c
Dependencies, in test
                                      flowTest.c
                        Pulse



                               GetRate

                      flow.c                 SetTime



                          GetTime

                                         timerStub.c



                          Increment

                  counterImpl.c
Strategy for testing embedded software
●   Continuous Integration
    ●   Automate build and test execution
    ●   On desktop, simulator and/or the device

●   Break dependencies
    ●   Hardware Abstraction Layer
    ●   Simulate time measurements and timer events
    ●   Standardize on frequently used stubs
    ●   Use mock objects for testing protocols

●   Dependency injection
    ●   Link time, where possible
    ●   Run time, using function pointers, where necessary
Why should we write unit tests?
●   Speed up development
    ●   Because of all the things we no longer have to waste time on
    ●   Test Driven Development vs Debug Later Programming
    ●   Avoid piling up technical dept (manual testing, bug fixing)
    ●   Typing code is not where the bottleneck is

●   Find bugs faster
    ●   Trivial bugs found immediately
    ●   QA can do exploratory testing earlier and more extensively

●   Prevent bugs from reappearing
    ●   Never fix a bug until we have a failing test

●   Improve the software design
    ●   Loose coupling is required to write tests
Links to further resources
●   List of testing tools for C and C++
    ●   http://www.opensourcetesting.org/unit_c.php

●   Book
    ●   http://pragprog.com/titles/jgade/test-driven-development-for-
        embedded-c

●   Experiement on the benefits of TDD
    ●   http://www.infoq.com/news/2009/03/TDD-Improves-Quality

●   Meetup groups
    ●   http://www.meetup.com/Test-Driven-Developers-Bay-Area/
Questions

Contenu connexe

Tendances

Test Automation - Keytorc Approach
Test Automation - Keytorc Approach Test Automation - Keytorc Approach
Test Automation - Keytorc Approach
Keytorc Software Testing Services
 

Tendances (20)

Test Automation
Test AutomationTest Automation
Test Automation
 
Tdd and bdd
Tdd and bddTdd and bdd
Tdd and bdd
 
Advanced C - Part 1
Advanced C - Part 1 Advanced C - Part 1
Advanced C - Part 1
 
The Test Pyramid
The Test PyramidThe Test Pyramid
The Test Pyramid
 
TDD in Python With Pytest
TDD in Python With PytestTDD in Python With Pytest
TDD in Python With Pytest
 
Robot Framework with Python | Edureka
Robot Framework with Python | EdurekaRobot Framework with Python | Edureka
Robot Framework with Python | Edureka
 
Test Driven Development With Python
Test Driven Development With PythonTest Driven Development With Python
Test Driven Development With Python
 
RESTful API Testing using Postman, Newman, and Jenkins
RESTful API Testing using Postman, Newman, and JenkinsRESTful API Testing using Postman, Newman, and Jenkins
RESTful API Testing using Postman, Newman, and Jenkins
 
Python in Test automation
Python in Test automationPython in Test automation
Python in Test automation
 
Unit testing on embedded target with C++Test
Unit testing on embedded  target with C++TestUnit testing on embedded  target with C++Test
Unit testing on embedded target with C++Test
 
Guide to Agile testing
Guide to Agile testingGuide to Agile testing
Guide to Agile testing
 
Agile QA Process
Agile QA ProcessAgile QA Process
Agile QA Process
 
QEMU - Binary Translation
QEMU - Binary Translation QEMU - Binary Translation
QEMU - Binary Translation
 
Robot Framework Dos And Don'ts
Robot Framework Dos And Don'tsRobot Framework Dos And Don'ts
Robot Framework Dos And Don'ts
 
Introduction to Software Test Automation
Introduction to Software Test AutomationIntroduction to Software Test Automation
Introduction to Software Test Automation
 
Introduction to Automation Testing
Introduction to Automation TestingIntroduction to Automation Testing
Introduction to Automation Testing
 
Profiling tools and Android Performance patterns
Profiling tools and Android Performance patternsProfiling tools and Android Performance patterns
Profiling tools and Android Performance patterns
 
Cypress Automation
Cypress  AutomationCypress  Automation
Cypress Automation
 
Test Automation
Test AutomationTest Automation
Test Automation
 
Test Automation - Keytorc Approach
Test Automation - Keytorc Approach Test Automation - Keytorc Approach
Test Automation - Keytorc Approach
 

Similaire à Automated Testing for Embedded Software in C or C++

OS-Final-Transform-Manual-Testing-Processes-to-incorporate-Automatio....pptx
OS-Final-Transform-Manual-Testing-Processes-to-incorporate-Automatio....pptxOS-Final-Transform-Manual-Testing-Processes-to-incorporate-Automatio....pptx
OS-Final-Transform-Manual-Testing-Processes-to-incorporate-Automatio....pptx
ShivareddyGangam
 
Gatling - Bordeaux JUG
Gatling - Bordeaux JUGGatling - Bordeaux JUG
Gatling - Bordeaux JUG
slandelle
 
Qtp training session I
Qtp training session IQtp training session I
Qtp training session I
Aisha Mazhar
 
Gabriel carabat a healthy approach for test automation
Gabriel carabat   a healthy approach for test automationGabriel carabat   a healthy approach for test automation
Gabriel carabat a healthy approach for test automation
Romania Testing
 
WSO2Con Asia 2014 - Effective Test Automation in an Agile Environment
WSO2Con Asia 2014 - Effective Test Automation in an Agile EnvironmentWSO2Con Asia 2014 - Effective Test Automation in an Agile Environment
WSO2Con Asia 2014 - Effective Test Automation in an Agile Environment
WSO2
 

Similaire à Automated Testing for Embedded Software in C or C++ (20)

GCC Compiler as a Performance Testing tool for C programs
GCC Compiler as a Performance Testing tool for C programsGCC Compiler as a Performance Testing tool for C programs
GCC Compiler as a Performance Testing tool for C programs
 
OS-Final-Transform-Manual-Testing-Processes-to-incorporate-Automatio....pptx
OS-Final-Transform-Manual-Testing-Processes-to-incorporate-Automatio....pptxOS-Final-Transform-Manual-Testing-Processes-to-incorporate-Automatio....pptx
OS-Final-Transform-Manual-Testing-Processes-to-incorporate-Automatio....pptx
 
Continuous Performance Testing
Continuous Performance TestingContinuous Performance Testing
Continuous Performance Testing
 
Unit testing (eng)
Unit testing (eng)Unit testing (eng)
Unit testing (eng)
 
Test Automation: How to Succeed When Moving Beyond Manual Testing
Test Automation: How to Succeed When Moving Beyond Manual TestingTest Automation: How to Succeed When Moving Beyond Manual Testing
Test Automation: How to Succeed When Moving Beyond Manual Testing
 
Test automation - Building effective solutions
Test automation - Building effective solutionsTest automation - Building effective solutions
Test automation - Building effective solutions
 
What is Automation Testing?
What is Automation Testing?What is Automation Testing?
What is Automation Testing?
 
TEST EXECUTION.ppt
TEST EXECUTION.pptTEST EXECUTION.ppt
TEST EXECUTION.ppt
 
Gatling - Bordeaux JUG
Gatling - Bordeaux JUGGatling - Bordeaux JUG
Gatling - Bordeaux JUG
 
How To Transform the Manual Testing Process to Incorporate Test Automation
How To Transform the Manual Testing Process to Incorporate Test AutomationHow To Transform the Manual Testing Process to Incorporate Test Automation
How To Transform the Manual Testing Process to Incorporate Test Automation
 
Ensuring Performance in a Fast-Paced Environment (CMG 2014)
Ensuring Performance in a Fast-Paced Environment (CMG 2014)Ensuring Performance in a Fast-Paced Environment (CMG 2014)
Ensuring Performance in a Fast-Paced Environment (CMG 2014)
 
Dhanasekaran 2008-2009 Quick Test Pro Presentation
Dhanasekaran 2008-2009 Quick Test Pro PresentationDhanasekaran 2008-2009 Quick Test Pro Presentation
Dhanasekaran 2008-2009 Quick Test Pro Presentation
 
First QTP Tutorial
First QTP TutorialFirst QTP Tutorial
First QTP Tutorial
 
QTP Tutorial Slides Presentation.
QTP Tutorial Slides Presentation.QTP Tutorial Slides Presentation.
QTP Tutorial Slides Presentation.
 
Qtp training session I
Qtp training session IQtp training session I
Qtp training session I
 
Testing Tools Online Training.pdf
Testing Tools Online Training.pdfTesting Tools Online Training.pdf
Testing Tools Online Training.pdf
 
Gabriel carabat a healthy approach for test automation
Gabriel carabat   a healthy approach for test automationGabriel carabat   a healthy approach for test automation
Gabriel carabat a healthy approach for test automation
 
Production profiling what, why and how technical audience (3)
Production profiling  what, why and how   technical audience (3)Production profiling  what, why and how   technical audience (3)
Production profiling what, why and how technical audience (3)
 
PAC 2019 virtual Bruno Audoux
PAC 2019 virtual Bruno Audoux PAC 2019 virtual Bruno Audoux
PAC 2019 virtual Bruno Audoux
 
WSO2Con Asia 2014 - Effective Test Automation in an Agile Environment
WSO2Con Asia 2014 - Effective Test Automation in an Agile EnvironmentWSO2Con Asia 2014 - Effective Test Automation in an Agile Environment
WSO2Con Asia 2014 - Effective Test Automation in an Agile Environment
 

Plus de Lars Thorup

Javascript unit testing with QUnit and Sinon
Javascript unit testing with QUnit and SinonJavascript unit testing with QUnit and Sinon
Javascript unit testing with QUnit and Sinon
Lars Thorup
 

Plus de Lars Thorup (19)

100 tests per second - 40 releases per week
100 tests per second - 40 releases per week100 tests per second - 40 releases per week
100 tests per second - 40 releases per week
 
SQL or NoSQL - how to choose
SQL or NoSQL - how to chooseSQL or NoSQL - how to choose
SQL or NoSQL - how to choose
 
Super fast end-to-end-tests
Super fast end-to-end-testsSuper fast end-to-end-tests
Super fast end-to-end-tests
 
Extreme Programming - to the next-level
Extreme Programming - to the next-levelExtreme Programming - to the next-level
Extreme Programming - to the next-level
 
Advanced Javascript Unit Testing
Advanced Javascript Unit TestingAdvanced Javascript Unit Testing
Advanced Javascript Unit Testing
 
Unit testing legacy code
Unit testing legacy codeUnit testing legacy code
Unit testing legacy code
 
Advanced QUnit - Front-End JavaScript Unit Testing
Advanced QUnit - Front-End JavaScript Unit TestingAdvanced QUnit - Front-End JavaScript Unit Testing
Advanced QUnit - Front-End JavaScript Unit Testing
 
Put "fast" back in "fast feedback"
Put "fast" back in "fast feedback"Put "fast" back in "fast feedback"
Put "fast" back in "fast feedback"
 
Database Schema Evolution
Database Schema EvolutionDatabase Schema Evolution
Database Schema Evolution
 
Advanced Jasmine - Front-End JavaScript Unit Testing
Advanced Jasmine - Front-End JavaScript Unit TestingAdvanced Jasmine - Front-End JavaScript Unit Testing
Advanced Jasmine - Front-End JavaScript Unit Testing
 
Javascript unit testing with QUnit and Sinon
Javascript unit testing with QUnit and SinonJavascript unit testing with QUnit and Sinon
Javascript unit testing with QUnit and Sinon
 
Continuous Integration for front-end JavaScript
Continuous Integration for front-end JavaScriptContinuous Integration for front-end JavaScript
Continuous Integration for front-end JavaScript
 
Automated Performance Testing
Automated Performance TestingAutomated Performance Testing
Automated Performance Testing
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)
 
Agile Contracts
Agile ContractsAgile Contracts
Agile Contracts
 
High Performance Software Engineering Teams
High Performance Software Engineering TeamsHigh Performance Software Engineering Teams
High Performance Software Engineering Teams
 
Elephant Carpaccio
Elephant CarpaccioElephant Carpaccio
Elephant Carpaccio
 
Unit Testing in JavaScript with MVC and QUnit
Unit Testing in JavaScript with MVC and QUnitUnit Testing in JavaScript with MVC and QUnit
Unit Testing in JavaScript with MVC and QUnit
 
Introduction to Automated Testing
Introduction to Automated TestingIntroduction to Automated Testing
Introduction to Automated Testing
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Dernier (20)

Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
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
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
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
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 

Automated Testing for Embedded Software in C or C++

  • 1.
  • 2. Who is Lars Thorup? ● Software developer ● Web: C# and JavaScript ● Embedded C++ for several devices using agile and automated testing ● Coach: Teaching agile and automated testing ● Advisor: Assesses software projects and companies ● Founder and CEO of BestBrains and ZeaLake
  • 3. Agenda ● What is automated testing? ● Unity, test framework for embedded C ● Code example ● Why should we write automated tests? ● Questions
  • 4. What is automated testing? ● Developers write test ● Automated execution of all programs test programs
  • 5. The Unity testing framework ● Small memory footprint ● Many test functions ● ASSERT_TRUE ● Pure C ● FAIL ● ASSERT_EQUAL ● Optional tools to generate ● ASSERT_WITHIN test runners automatically ● ASSERT_BITS ● ASSERT_NOT_NULL ● Alternatives in C++ ● ASSERT_MEMORY ● CppUnit ● Google Test
  • 6. How do we handle dependencies? ● The flow example ● a flow sensor ● generates pulse counts proportional to actual flow ● calculate average flow rate with regular intervals ● The dependencies in the flow example ● the sensor creating the pulse interrupt ● recurring timer event ● thread safe counting ● Decouple the dependencies ● Pulse: provide a callback to the FlowSensor component ● Timer and Counting: inject components into the Flow component ● flow.c
  • 7. Dependencies, on device main.c Listen GetRate flowSensor.c flow.c Pulse GetTime timerImpl.c Increment counterImpl.c
  • 8. Dependencies, in test flowTest.c Pulse GetRate flow.c SetTime GetTime timerStub.c Increment counterImpl.c
  • 9. Strategy for testing embedded software ● Continuous Integration ● Automate build and test execution ● On desktop, simulator and/or the device ● Break dependencies ● Hardware Abstraction Layer ● Simulate time measurements and timer events ● Standardize on frequently used stubs ● Use mock objects for testing protocols ● Dependency injection ● Link time, where possible ● Run time, using function pointers, where necessary
  • 10. Why should we write unit tests? ● Speed up development ● Because of all the things we no longer have to waste time on ● Test Driven Development vs Debug Later Programming ● Avoid piling up technical dept (manual testing, bug fixing) ● Typing code is not where the bottleneck is ● Find bugs faster ● Trivial bugs found immediately ● QA can do exploratory testing earlier and more extensively ● Prevent bugs from reappearing ● Never fix a bug until we have a failing test ● Improve the software design ● Loose coupling is required to write tests
  • 11. Links to further resources ● List of testing tools for C and C++ ● http://www.opensourcetesting.org/unit_c.php ● Book ● http://pragprog.com/titles/jgade/test-driven-development-for- embedded-c ● Experiement on the benefits of TDD ● http://www.infoq.com/news/2009/03/TDD-Improves-Quality ● Meetup groups ● http://www.meetup.com/Test-Driven-Developers-Bay-Area/