SlideShare a Scribd company logo
1 of 36
Improving the
Embedded
Development
Process
Matt Fletcher, Developer
William Bereza, Co-founder
Atomic Object, LLC
{fletcher, bereza}@atomicobject.com
OSCON 2007 Room D137-138
About this presentation
   - Test-driven development of embedded systems

   - Target audience is developers

   - Audience is familiar with test-driven
        development (TDD)

Matt Fletcher and William Bereza   OSCON 2007   2
Atomic and Savant Automation
   -    Atomic Object develops custom software




   -    Savant Automation produces automated-guided vehicles
Matt Fletcher and William Bereza   OSCON 2007            3
Battery monitor board
   -    Monitors the onboard battery’s overall state of
        charge




   -    Vehicle’s main computer decides when to charge or
        get back to work
Matt Fletcher and William Bereza   OSCON 2007             4
Feature development


                    Choose a new feature



Matt Fletcher and William Bereza   OSCON 2007   5
Feature development


           Develop a system test for it



Matt Fletcher and William Bereza   OSCON 2007   6
Feature development


                   See the system test fail



Matt Fletcher and William Bereza   OSCON 2007   7
Feature development


      Create unit tests for a module



Matt Fletcher and William Bereza   OSCON 2007   8
Feature development


                       See the unit tests fail



Matt Fletcher and William Bereza   OSCON 2007    9
Feature development


                       Make the tests pass



Matt Fletcher and William Bereza   OSCON 2007   10
Feature development


           Develop modules as needed



Matt Fletcher and William Bereza   OSCON 2007   11
Feature development


                       See system test pass



Matt Fletcher and William Bereza   OSCON 2007   12
Feature development


              Choose the next feature...



Matt Fletcher and William Bereza   OSCON 2007   13
Example system tests
   - Battery level output based on input voltages

   - Battery level mode vs. diagnostic data mode

   - Calibration commands adjust battery level values


Matt Fletcher and William Bereza   OSCON 2007      14
Matt Fletcher and William Bereza   OSCON 2007   15
Battery voltage test
  proves quot;the battery voltage reported via
          CAN is correct.quot;

  set_battery_voltage 51.0
  verify_can_reports_battery_voltage 51.0

  set_battery_voltage 2.0
  verify_can_reports_battery_voltage 2.0



Matt Fletcher and William Bereza   OSCON 2007   16
Under the covers
 set_battery_voltage 51.0
 verify_can_reports_battery_voltage 51.0




def set_battery_voltage(voltage)
  @minilab.write_analog(VOLTAGE_OUTPUT_PIN,
                        voltage / BATTERY_VOLTAGE_DIVIDER)
  sleep 0.1
end

 Matt Fletcher and William Bereza   OSCON 2007   17
Under the covers
set_battery_voltage 51.0
verify_can_reports_battery_voltage 51.0




def verify_can_reports_battery_voltage(voltage)
  last_message = @pcan.receive_message
  assert_in_delta(voltage / CAN_VOLTAGE_BIT_WEIGHT,
                   last_message.BatteryVoltage,
                   CAN_VOLTAGE_DELTA)
end

Matt Fletcher and William Bereza   OSCON 2007   18
Keys to system testing
   - Test automation

   - Choosing support hardware with command line
        and programmatic interfaces


   - Diligence. System test-first!
Matt Fletcher and William Bereza   OSCON 2007   19
Develop code unit test-first
   - Interaction-based testing
   - Modules are composed with delegates
   - Tests compose the target module with mocks
   - Composition is done at link time



Matt Fletcher and William Bereza   OSCON 2007   20
Rake
   - Ruby make
   - Automates building units and executables
   - Easy injection of Ruby scripts into the build
        system




Matt Fletcher and William Bereza   OSCON 2007        21
Argent
   - Ruby inline code generation
   - Finds and sets up tests
   - Invoked against files by the build system




Matt Fletcher and William Bereza   OSCON 2007   22
Generated mocks
   - Mocks created automatically
    - Ruby script scans header file
    - Creates mock header and source




Matt Fletcher and William Bereza   OSCON 2007   23
Generated mocks
   - Regular expression used to parse functions
  FUNC_MAGIC =/(w*s+)*(w+)s+(w+)s*(([^)]*))/


   - Naming conventions dictate how to declare
        functions and how to call mock functions




Matt Fletcher and William Bereza   OSCON 2007      24
Code to be mocked
MessageCreator.h
CANMessage MessageCreator_GetNextMessage(void)



MessageSender.h
void MessageSender_SendMessage(CANMessage message)



StatusOutputter.c
Needs to send the latest messages!

Matt Fletcher and William Bereza   OSCON 2007   25
Mock with return
MessageCreator.h
CANMessage MessageCreator_GetNextMessage(void)




MockMessageCreator.h
CANMessage MessageCreator_GetNextMessage(void)
void MessageCreator_GetNextMessage_Return(CANMessage toReturn)



Matt Fletcher and William Bereza   OSCON 2007      26
Mock expecting a value
MessageSender.h
void MessageSender_SendMessage(CANMessage message)




MockMessageSender.h
void MessageSender_SendMessage(CANMessage message)
void MessageSender_SendMessage_Expect(CANMessage message)



Matt Fletcher and William Bereza   OSCON 2007    27
The test!
 static void testShouldSendTheNewestMessage(void)
 {
   CANMessage someMessage = {0x0b, 0x0e, 0x0e, 0x0f};
   MessageCreator_GetNextMessage_Return(someMessage);
   MessageSender_SendMessage_Expect(someMessage);

     StatusOutputter_SendNewestMessage();
 }

   Mocks are automatically verified during tearDown


Matt Fletcher and William Bereza   OSCON 2007        28
The code!
void StatusOutputter_SendNewestMessage(void)
{
  CANMessage newestMessage;
  newestMessage = MessageCreator_GetNextMessage();
  MessageSender_SendMessage(newestMessage);
}




Matt Fletcher and William Bereza   OSCON 2007   29
Continuous integration
   - Automatically builds the system and runs tests on
        check-in




   - Build status is published to monitors throughout
        the office

Matt Fletcher and William Bereza   OSCON 2007   30
Summary
   - Automated system testing
   - Automated unit testing
   - Automated build system
   - Continuous integration
   - Ruby scripts and extensions played a key role!

Matt Fletcher and William Bereza   OSCON 2007   31
Embedded development - fun


    Imagine frustated engineer vs. a productive pair




Matt Fletcher and William Bereza   OSCON 2007   32
Build your own tools
   - Solve specific problems with custom tools

   - Automate tedious processes

   - Generate repetitive code

Matt Fletcher and William Bereza   OSCON 2007   33
Resources
   -   Rake
       - rake.rubyforge.org

   -   Argent
       - rubyforge.org/project/argent

   -   Minilab Ruby gem
       - minilab.rubyforge.org
Matt Fletcher and William Bereza   OSCON 2007   34
Resources
   -   Atomic Object embedded
       - www.atomicobject.com/pages/Embedded+Software
       - papers
       - Embedded System Conference 2007 demo project

   -   Agile Embedded Yahoo! group:
       - tech.groups.yahoo.com/group/AgileEmbedded

Matt Fletcher and William Bereza   OSCON 2007    35
Questions?



Matt Fletcher and William Bereza     OSCON 2007   36

More Related Content

Similar to Os Fletcher Bereza

Simple tools to fight bigger quality battle
Simple tools to fight bigger quality battleSimple tools to fight bigger quality battle
Simple tools to fight bigger quality battleAnand Ramdeo
 
Clean Architecture Essentials - Stockholm Software Craftsmanship
Clean Architecture Essentials - Stockholm Software CraftsmanshipClean Architecture Essentials - Stockholm Software Craftsmanship
Clean Architecture Essentials - Stockholm Software CraftsmanshipIvan Paulovich
 
PostMan and Jenkins RestApi Automation.pptx
PostMan and Jenkins RestApi Automation.pptxPostMan and Jenkins RestApi Automation.pptx
PostMan and Jenkins RestApi Automation.pptxEveryThing68
 
BenchFlow: A Platform for End-to-end Automation of Performance Testing and An...
BenchFlow: A Platform for End-to-end Automation of Performance Testing and An...BenchFlow: A Platform for End-to-end Automation of Performance Testing and An...
BenchFlow: A Platform for End-to-end Automation of Performance Testing and An...Vincenzo Ferme
 
Background And An Architecture Example
Background And An Architecture ExampleBackground And An Architecture Example
Background And An Architecture ExampleGlen Wilson
 
Mining Co-Change Information to Understand when Build Changes are Necessary
Mining Co-Change Information to Understand when Build Changes are NecessaryMining Co-Change Information to Understand when Build Changes are Necessary
Mining Co-Change Information to Understand when Build Changes are NecessaryShane McIntosh
 
Introduction to Apache Cassandra™ + What’s New in 4.0
Introduction to Apache Cassandra™ + What’s New in 4.0Introduction to Apache Cassandra™ + What’s New in 4.0
Introduction to Apache Cassandra™ + What’s New in 4.0DataStax
 
Automatic deployment on .NET web stack (Minsk .NET meetup 12.02.14)
Automatic deployment on .NET web stack (Minsk .NET meetup 12.02.14)Automatic deployment on .NET web stack (Minsk .NET meetup 12.02.14)
Automatic deployment on .NET web stack (Minsk .NET meetup 12.02.14)Is Antipov
 
Advanced WebLogic Monitoring: JMX and WLSDM Automation
Advanced WebLogic Monitoring: JMX and WLSDM AutomationAdvanced WebLogic Monitoring: JMX and WLSDM Automation
Advanced WebLogic Monitoring: JMX and WLSDM AutomationM. Fevzi Korkutata
 
Chef arista devops days a'dam 2015
Chef arista devops days a'dam 2015Chef arista devops days a'dam 2015
Chef arista devops days a'dam 2015Edwin Beekman
 
Basic Cmake for Qt Users
Basic Cmake for Qt UsersBasic Cmake for Qt Users
Basic Cmake for Qt UsersICS
 
Spectre meltdown performance_tests - v0.3
Spectre meltdown performance_tests - v0.3Spectre meltdown performance_tests - v0.3
Spectre meltdown performance_tests - v0.3David Pasek
 
Database automated build and test - SQL In The City Cambridge
Database automated build and test - SQL In The City CambridgeDatabase automated build and test - SQL In The City Cambridge
Database automated build and test - SQL In The City CambridgeRed Gate Software
 
Verified CKAD Exam Questions and Answers
Verified CKAD Exam Questions and AnswersVerified CKAD Exam Questions and Answers
Verified CKAD Exam Questions and Answersdalebeck957
 
Python SQite3 database Tutorial | SQlite Database
Python SQite3 database Tutorial | SQlite DatabasePython SQite3 database Tutorial | SQlite Database
Python SQite3 database Tutorial | SQlite DatabaseElangovanTechNotesET
 
The Emergence of Choice in the .NET Ecosystem
The Emergence of Choice in the .NET EcosystemThe Emergence of Choice in the .NET Ecosystem
The Emergence of Choice in the .NET EcosystemJames Avery
 
Arquillian Constellation
Arquillian ConstellationArquillian Constellation
Arquillian ConstellationAlex Soto
 
Testing the frontend
Testing the frontendTesting the frontend
Testing the frontendHeiko Hardt
 
Extending LabVIEW to the Web Using the LabSocket System
Extending LabVIEW to the Web Using the LabSocket SystemExtending LabVIEW to the Web Using the LabSocket System
Extending LabVIEW to the Web Using the LabSocket SystemBergmans Mechatronics LLC
 
Traceability for Verification and Validation in Autonomous Driving
Traceability for Verification and Validation in Autonomous DrivingTraceability for Verification and Validation in Autonomous Driving
Traceability for Verification and Validation in Autonomous DrivingSteven Vettermann
 

Similar to Os Fletcher Bereza (20)

Simple tools to fight bigger quality battle
Simple tools to fight bigger quality battleSimple tools to fight bigger quality battle
Simple tools to fight bigger quality battle
 
Clean Architecture Essentials - Stockholm Software Craftsmanship
Clean Architecture Essentials - Stockholm Software CraftsmanshipClean Architecture Essentials - Stockholm Software Craftsmanship
Clean Architecture Essentials - Stockholm Software Craftsmanship
 
PostMan and Jenkins RestApi Automation.pptx
PostMan and Jenkins RestApi Automation.pptxPostMan and Jenkins RestApi Automation.pptx
PostMan and Jenkins RestApi Automation.pptx
 
BenchFlow: A Platform for End-to-end Automation of Performance Testing and An...
BenchFlow: A Platform for End-to-end Automation of Performance Testing and An...BenchFlow: A Platform for End-to-end Automation of Performance Testing and An...
BenchFlow: A Platform for End-to-end Automation of Performance Testing and An...
 
Background And An Architecture Example
Background And An Architecture ExampleBackground And An Architecture Example
Background And An Architecture Example
 
Mining Co-Change Information to Understand when Build Changes are Necessary
Mining Co-Change Information to Understand when Build Changes are NecessaryMining Co-Change Information to Understand when Build Changes are Necessary
Mining Co-Change Information to Understand when Build Changes are Necessary
 
Introduction to Apache Cassandra™ + What’s New in 4.0
Introduction to Apache Cassandra™ + What’s New in 4.0Introduction to Apache Cassandra™ + What’s New in 4.0
Introduction to Apache Cassandra™ + What’s New in 4.0
 
Automatic deployment on .NET web stack (Minsk .NET meetup 12.02.14)
Automatic deployment on .NET web stack (Minsk .NET meetup 12.02.14)Automatic deployment on .NET web stack (Minsk .NET meetup 12.02.14)
Automatic deployment on .NET web stack (Minsk .NET meetup 12.02.14)
 
Advanced WebLogic Monitoring: JMX and WLSDM Automation
Advanced WebLogic Monitoring: JMX and WLSDM AutomationAdvanced WebLogic Monitoring: JMX and WLSDM Automation
Advanced WebLogic Monitoring: JMX and WLSDM Automation
 
Chef arista devops days a'dam 2015
Chef arista devops days a'dam 2015Chef arista devops days a'dam 2015
Chef arista devops days a'dam 2015
 
Basic Cmake for Qt Users
Basic Cmake for Qt UsersBasic Cmake for Qt Users
Basic Cmake for Qt Users
 
Spectre meltdown performance_tests - v0.3
Spectre meltdown performance_tests - v0.3Spectre meltdown performance_tests - v0.3
Spectre meltdown performance_tests - v0.3
 
Database automated build and test - SQL In The City Cambridge
Database automated build and test - SQL In The City CambridgeDatabase automated build and test - SQL In The City Cambridge
Database automated build and test - SQL In The City Cambridge
 
Verified CKAD Exam Questions and Answers
Verified CKAD Exam Questions and AnswersVerified CKAD Exam Questions and Answers
Verified CKAD Exam Questions and Answers
 
Python SQite3 database Tutorial | SQlite Database
Python SQite3 database Tutorial | SQlite DatabasePython SQite3 database Tutorial | SQlite Database
Python SQite3 database Tutorial | SQlite Database
 
The Emergence of Choice in the .NET Ecosystem
The Emergence of Choice in the .NET EcosystemThe Emergence of Choice in the .NET Ecosystem
The Emergence of Choice in the .NET Ecosystem
 
Arquillian Constellation
Arquillian ConstellationArquillian Constellation
Arquillian Constellation
 
Testing the frontend
Testing the frontendTesting the frontend
Testing the frontend
 
Extending LabVIEW to the Web Using the LabSocket System
Extending LabVIEW to the Web Using the LabSocket SystemExtending LabVIEW to the Web Using the LabSocket System
Extending LabVIEW to the Web Using the LabSocket System
 
Traceability for Verification and Validation in Autonomous Driving
Traceability for Verification and Validation in Autonomous DrivingTraceability for Verification and Validation in Autonomous Driving
Traceability for Verification and Validation in Autonomous Driving
 

More from oscon2007

J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Touroscon2007
 
Solr Presentation5
Solr Presentation5Solr Presentation5
Solr Presentation5oscon2007
 
Os Fitzpatrick Sussman Wiifm
Os Fitzpatrick Sussman WiifmOs Fitzpatrick Sussman Wiifm
Os Fitzpatrick Sussman Wiifmoscon2007
 
Performance Whack A Mole
Performance Whack A MolePerformance Whack A Mole
Performance Whack A Moleoscon2007
 
Os Lanphier Brashears
Os Lanphier BrashearsOs Lanphier Brashears
Os Lanphier Brashearsoscon2007
 
Os Fitzpatrick Sussman Swp
Os Fitzpatrick Sussman SwpOs Fitzpatrick Sussman Swp
Os Fitzpatrick Sussman Swposcon2007
 
Os Berlin Dispelling Myths
Os Berlin Dispelling MythsOs Berlin Dispelling Myths
Os Berlin Dispelling Mythsoscon2007
 
Os Keysholistic
Os KeysholisticOs Keysholistic
Os Keysholisticoscon2007
 
Os Jonphillips
Os JonphillipsOs Jonphillips
Os Jonphillipsoscon2007
 
Os Urnerupdated
Os UrnerupdatedOs Urnerupdated
Os Urnerupdatedoscon2007
 

More from oscon2007 (20)

J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Tour
 
Solr Presentation5
Solr Presentation5Solr Presentation5
Solr Presentation5
 
Os Borger
Os BorgerOs Borger
Os Borger
 
Os Harkins
Os HarkinsOs Harkins
Os Harkins
 
Os Fitzpatrick Sussman Wiifm
Os Fitzpatrick Sussman WiifmOs Fitzpatrick Sussman Wiifm
Os Fitzpatrick Sussman Wiifm
 
Os Bunce
Os BunceOs Bunce
Os Bunce
 
Yuicss R7
Yuicss R7Yuicss R7
Yuicss R7
 
Performance Whack A Mole
Performance Whack A MolePerformance Whack A Mole
Performance Whack A Mole
 
Os Fogel
Os FogelOs Fogel
Os Fogel
 
Os Lanphier Brashears
Os Lanphier BrashearsOs Lanphier Brashears
Os Lanphier Brashears
 
Os Tucker
Os TuckerOs Tucker
Os Tucker
 
Os Fitzpatrick Sussman Swp
Os Fitzpatrick Sussman SwpOs Fitzpatrick Sussman Swp
Os Fitzpatrick Sussman Swp
 
Os Furlong
Os FurlongOs Furlong
Os Furlong
 
Os Berlin Dispelling Myths
Os Berlin Dispelling MythsOs Berlin Dispelling Myths
Os Berlin Dispelling Myths
 
Os Kimsal
Os KimsalOs Kimsal
Os Kimsal
 
Os Pruett
Os PruettOs Pruett
Os Pruett
 
Os Alrubaie
Os AlrubaieOs Alrubaie
Os Alrubaie
 
Os Keysholistic
Os KeysholisticOs Keysholistic
Os Keysholistic
 
Os Jonphillips
Os JonphillipsOs Jonphillips
Os Jonphillips
 
Os Urnerupdated
Os UrnerupdatedOs Urnerupdated
Os Urnerupdated
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
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 AmsterdamUiPathCommunity
 
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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
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 DiscoveryTrustArc
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
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 connectorsNanddeep Nachan
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
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 businesspanagenda
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
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, ...Angeliki Cooney
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 

Recently uploaded (20)

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
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
 
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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
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
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
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
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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, ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

Os Fletcher Bereza

  • 1. Improving the Embedded Development Process Matt Fletcher, Developer William Bereza, Co-founder Atomic Object, LLC {fletcher, bereza}@atomicobject.com OSCON 2007 Room D137-138
  • 2. About this presentation - Test-driven development of embedded systems - Target audience is developers - Audience is familiar with test-driven development (TDD) Matt Fletcher and William Bereza OSCON 2007 2
  • 3. Atomic and Savant Automation - Atomic Object develops custom software - Savant Automation produces automated-guided vehicles Matt Fletcher and William Bereza OSCON 2007 3
  • 4. Battery monitor board - Monitors the onboard battery’s overall state of charge - Vehicle’s main computer decides when to charge or get back to work Matt Fletcher and William Bereza OSCON 2007 4
  • 5. Feature development Choose a new feature Matt Fletcher and William Bereza OSCON 2007 5
  • 6. Feature development Develop a system test for it Matt Fletcher and William Bereza OSCON 2007 6
  • 7. Feature development See the system test fail Matt Fletcher and William Bereza OSCON 2007 7
  • 8. Feature development Create unit tests for a module Matt Fletcher and William Bereza OSCON 2007 8
  • 9. Feature development See the unit tests fail Matt Fletcher and William Bereza OSCON 2007 9
  • 10. Feature development Make the tests pass Matt Fletcher and William Bereza OSCON 2007 10
  • 11. Feature development Develop modules as needed Matt Fletcher and William Bereza OSCON 2007 11
  • 12. Feature development See system test pass Matt Fletcher and William Bereza OSCON 2007 12
  • 13. Feature development Choose the next feature... Matt Fletcher and William Bereza OSCON 2007 13
  • 14. Example system tests - Battery level output based on input voltages - Battery level mode vs. diagnostic data mode - Calibration commands adjust battery level values Matt Fletcher and William Bereza OSCON 2007 14
  • 15. Matt Fletcher and William Bereza OSCON 2007 15
  • 16. Battery voltage test proves quot;the battery voltage reported via CAN is correct.quot; set_battery_voltage 51.0 verify_can_reports_battery_voltage 51.0 set_battery_voltage 2.0 verify_can_reports_battery_voltage 2.0 Matt Fletcher and William Bereza OSCON 2007 16
  • 17. Under the covers set_battery_voltage 51.0 verify_can_reports_battery_voltage 51.0 def set_battery_voltage(voltage) @minilab.write_analog(VOLTAGE_OUTPUT_PIN, voltage / BATTERY_VOLTAGE_DIVIDER) sleep 0.1 end Matt Fletcher and William Bereza OSCON 2007 17
  • 18. Under the covers set_battery_voltage 51.0 verify_can_reports_battery_voltage 51.0 def verify_can_reports_battery_voltage(voltage) last_message = @pcan.receive_message assert_in_delta(voltage / CAN_VOLTAGE_BIT_WEIGHT, last_message.BatteryVoltage, CAN_VOLTAGE_DELTA) end Matt Fletcher and William Bereza OSCON 2007 18
  • 19. Keys to system testing - Test automation - Choosing support hardware with command line and programmatic interfaces - Diligence. System test-first! Matt Fletcher and William Bereza OSCON 2007 19
  • 20. Develop code unit test-first - Interaction-based testing - Modules are composed with delegates - Tests compose the target module with mocks - Composition is done at link time Matt Fletcher and William Bereza OSCON 2007 20
  • 21. Rake - Ruby make - Automates building units and executables - Easy injection of Ruby scripts into the build system Matt Fletcher and William Bereza OSCON 2007 21
  • 22. Argent - Ruby inline code generation - Finds and sets up tests - Invoked against files by the build system Matt Fletcher and William Bereza OSCON 2007 22
  • 23. Generated mocks - Mocks created automatically - Ruby script scans header file - Creates mock header and source Matt Fletcher and William Bereza OSCON 2007 23
  • 24. Generated mocks - Regular expression used to parse functions FUNC_MAGIC =/(w*s+)*(w+)s+(w+)s*(([^)]*))/ - Naming conventions dictate how to declare functions and how to call mock functions Matt Fletcher and William Bereza OSCON 2007 24
  • 25. Code to be mocked MessageCreator.h CANMessage MessageCreator_GetNextMessage(void) MessageSender.h void MessageSender_SendMessage(CANMessage message) StatusOutputter.c Needs to send the latest messages! Matt Fletcher and William Bereza OSCON 2007 25
  • 26. Mock with return MessageCreator.h CANMessage MessageCreator_GetNextMessage(void) MockMessageCreator.h CANMessage MessageCreator_GetNextMessage(void) void MessageCreator_GetNextMessage_Return(CANMessage toReturn) Matt Fletcher and William Bereza OSCON 2007 26
  • 27. Mock expecting a value MessageSender.h void MessageSender_SendMessage(CANMessage message) MockMessageSender.h void MessageSender_SendMessage(CANMessage message) void MessageSender_SendMessage_Expect(CANMessage message) Matt Fletcher and William Bereza OSCON 2007 27
  • 28. The test! static void testShouldSendTheNewestMessage(void) { CANMessage someMessage = {0x0b, 0x0e, 0x0e, 0x0f}; MessageCreator_GetNextMessage_Return(someMessage); MessageSender_SendMessage_Expect(someMessage); StatusOutputter_SendNewestMessage(); } Mocks are automatically verified during tearDown Matt Fletcher and William Bereza OSCON 2007 28
  • 29. The code! void StatusOutputter_SendNewestMessage(void) { CANMessage newestMessage; newestMessage = MessageCreator_GetNextMessage(); MessageSender_SendMessage(newestMessage); } Matt Fletcher and William Bereza OSCON 2007 29
  • 30. Continuous integration - Automatically builds the system and runs tests on check-in - Build status is published to monitors throughout the office Matt Fletcher and William Bereza OSCON 2007 30
  • 31. Summary - Automated system testing - Automated unit testing - Automated build system - Continuous integration - Ruby scripts and extensions played a key role! Matt Fletcher and William Bereza OSCON 2007 31
  • 32. Embedded development - fun Imagine frustated engineer vs. a productive pair Matt Fletcher and William Bereza OSCON 2007 32
  • 33. Build your own tools - Solve specific problems with custom tools - Automate tedious processes - Generate repetitive code Matt Fletcher and William Bereza OSCON 2007 33
  • 34. Resources - Rake - rake.rubyforge.org - Argent - rubyforge.org/project/argent - Minilab Ruby gem - minilab.rubyforge.org Matt Fletcher and William Bereza OSCON 2007 34
  • 35. Resources - Atomic Object embedded - www.atomicobject.com/pages/Embedded+Software - papers - Embedded System Conference 2007 demo project - Agile Embedded Yahoo! group: - tech.groups.yahoo.com/group/AgileEmbedded Matt Fletcher and William Bereza OSCON 2007 35
  • 36. Questions? Matt Fletcher and William Bereza OSCON 2007 36