SlideShare una empresa de Scribd logo
1 de 42
Descargar para leer sin conexión
EMBEDDED SOFTWARE 
DEVELOPMENT USING BDD 
Itamar Hassin 
September 2014
THIS TALK COVERS 
•Embedded development challenges 
! 
•The case for BDD 
! 
•Simulating the target 
! 
•Accessing the target remotely/in-situ 
! 
•Orchestrating access to multiple targets
EMBEDDED DEVELOPMENT CHALLENGES 
•A simulator rarely available or not fully functional 
! 
•Remote device verification 
! 
•Complex state-machines 
! 
•Test coverage often limited to unit testing
THE CASE FOR CUCUMBER 
•Direct mapping from user story acceptance 
criteria 
! 
•Living documentation, unified view of the product 
! 
•Helps defines ‘done’: Code is tested and validated 
! 
•BDD promotes lean code & emergent design 
! 
•Authored by the team: BAs/QA/Devs
CLOSER TO THE SOURCE
PREMISE FOR AUTOMATION 
Programatically validate that code solves the 
problem by articulating behaviour in 
machine-readable form.
CUCUMBER FOR EMBEDDED!
WRITE ONCE, USE THRICE 
Feature: Alarm assured to appear in quiet mode 
! 
Scenario: Pressure alarm 
Given device is in quiet mode 
When pressure sensor is disconnected 
Then a silent alarm will appear
IMPLEMENT STEPS 
Given(/Given device is in quiet mode $/) do 
@device.set_quiet_mode(1) 
end
IMPLEMENT A SIMULATOR 
class Device 
def set_quiet_mode(flag) 
if (flag) 
mode |= QUIET_MODE 
else 
mode &= ~QUIET_MODE 
end 
update_driver(mode) 
end 
end
VALIDATE UNDER SIMULATOR 
Scenario: Pressure alarm 
Given device is in quiet mode 
When pressure sensor is disconnected 
Then a silent alarm will appear 
! 
5 scenarios (5 passed) 
26 steps (26 passed) 
0m0.052s
WHEN SIMULATION IS NOT 
ENOUGH
THE “WIRE” 
•When your system does not have native support 
•When you want a lean, portable implementation
SIMPLIFIED WIRE PROTOCOL
WIRE IMPLEMENTATION 
BLUEPRINT 
•TCP/IP loop managing Cucumber protocol 
•Function table for API invocation 
•API implementation returning status to Cucumber
HOOKING CUCUMBER TO 
LISTENER 
features/step_definitions/cucumber.wire 
host: device 
port: 3901
LISTENER TCP/IP LOOP 
while(fgets(buff, sizeof(buff), rStream)) 
{ 
respond_to_cucumber(wStream, buff); 
}
WIRE HANDLER 
void respond_to_cucumber(FILE* stream, char* msg) 
{ 
if (MSG_TYPE_IS(msg, "step_matches")) 
respond_to_step_matches(stream, msg); 
else if (MSG_TYPE_IS(msg, "invoke")) 
respond_to_invoke(stream, msg); 
else if (MSG_TYPE_IS(msg, "begin_scenario")) 
respond_to_begin(stream, msg); 
else if (MSG_TYPE_IS(msg, "end_scenario")) 
respond_to_end(stream, msg); 
else 
respond_success(stream); 
}
FUNCTION TABLE 
stepdef_t stepdefs[] = { 
{ "device is in quiet mode”, set_quiet_mode } 
};
INVOKING API FUNCTIONS 
void respond_to_invoke(…) 
{ 
int id = get_function_id(msg); 
! 
stepdefs[id].callback(arg_val) ? 
failure(stream) : success(stream); 
}
TARGET API 
int set_quiet_mode(const char *arg) 
{ 
context->requested_mode = atoi(arg); 
context->quiet_mode |= context->requested_mode; 
return(update_driver(context)); 
}
IMPLEMENTATION STACK
WORKING WITH CUCUMBER 
•Decide on a strategy (off-board, on-board) 
•Get appropriate toolchain (cross compiler, linker) 
•Implement and port Wire to target 
•Run the feature files 
•fail/implement/pass/refactor/repeat
USAGE PATTERNS 
Off-Board 
• Framework on PC 
• Listener on PC 
• Proxy API on PC 
• Network calls to Target API 
! 
In-Situ 
• Framework on PC 
• Listener on Target 
• API calls on Target Progression
WORKING AT A SAFE 
DISTANCE
OFF-BOARD 
Cucumber 
running on 
PC 
Wire running 
on PC 
Target API 
running on 
PC 
C-implementation Network 
Target 
• + Target untouched 
• - All API’s must be exposed; 
low-fidelity; many moving 
parts;
UP CLOSE AND PERSONAL
IN-SITU 
Framework 
running on 
PC 
Cucumber- 
Wire running 
on Target 
Target API 
Network C-implementation 
• + high-fidelity, API’s not exposed 
• - Server part of codebase
COLLABORATIVE 
ENVIRONMENT
GATEWAY 
! 
•Acts as an end-to-end test orchestrator 
! 
•Switchboard events across heterogeneous devices
COLLABORATIVE 
END-TO-END TESTING 
Framework 
running on 
PC 
Cucumber- 
Wire running 
on Target 
C-implementation 
Targets 
Native 
Wire 
Collaboration
GATEWAY ARCHITECTURE 
SpecFlow 
Target B 
Proxies 
A1 
B1 
Hardware 
Serial 
Wire 
Cucumber Target A 
Behave
END-TO-END FEATURES 
Feature: Alarm assured to appear in quiet mode 
! 
Scenario: Pressure alarm 
Given device is in quiet mode 
When pressure sensor is disconnected 
Then a silent alarm will appear
GATEWAY STEPS 
public class QuietModeSteps 
{ 
SignalSimulator signalSimulator = new SignalSimulator(); 
MedicalDevice medicalDevice = new MedicalDevice(“192.168.1.1”, 3901); 
! 
[Given(@"device is quiet mode")] 
public void GivenDeviceIsQuietMode() 
{ 
NUnit.Framework.Assert.IsTrue(medicalDevice.SetQuietMode()); 
} 
! 
[When(@“pressure sensor is disconnected")] 
public void GivenPressureSensorIsDisconnected() 
{ 
NUnit.Framework.Assert.IsTrue(signalSimulator.SetPressure(off)); 
} 
}
GATEWAY PROXIES 
class MedicalDevice 
{ 
protected Wire wire; 
! 
public MedicalDevice(string ipAddress, int port) 
{ 
myAddress = ipAddress; 
wire = new Wire(myAddress, port); 
wire.Open(); 
} 
! 
public bool SetQuietMode() 
{ 
wire.Send("["step_matches",{"name_to_match":"set quiet mode on"}]n"); 
wire.Send("["invoke",{"id":"7","args":["on"]}]n"); 
return(wire.Ack()); 
} 
}
EMULATING WIRE 
public class Wire 
{ 
public int Open() 
{ 
client = new TcpClient(myAddress, myPort); 
stream = client.GetStream(); 
return(Send(“[”begin_scenario"]n")); 
} 
! 
public int Close() 
{ 
stream = client.GetStream(); 
Send("["end_scenario"]n"); 
return(client.Close()); 
} 
}
SPECFLOW TO WIRE 
SpecFlow 
int SetQuietMode(“on”) {} 
Wire 
Proxies 
A1 
Target 
TCP 
Given … quiet mode 
Wire 
Match: 
“set quiet’(on|off)’” 
Invoke: 
idx:0, params: “on” 
A 
int set_quiet(char* state){}
MAINTENANCE 
CONSIDERATIONS 
Exists in proxy? Write wrappers 
Exists in Wire? 
No 
No 
Yes 
Function table entry 
Yes 
API Exists? No Implement API 
Yes 
Use in feature/step files
COMPLIANCE 
CONSIDERATIONS 
•Security - Anyone can connect to Wire! 
•Regulation may not allow non-application code on 
a production system 
Shut down the wire thread in production
LESSONS LEARNED 
Threads & Target Dual Vocabulary 
Architecture 
Threading
REFERENCES 
•Specification by example 
•The Cucumber Book 
•Cucumber Recipes 
Photo Credits: 
@history_pics/@historyinpics 
Jim Reese#Wikipedia 
National Library of Australia 
•SpecFlow
THANK YOU! 
@itababy 
www.in-context.com

Más contenido relacionado

La actualidad más candente

Cypress-vs-Playwright-Rematch-Applitools.pdf
Cypress-vs-Playwright-Rematch-Applitools.pdfCypress-vs-Playwright-Rematch-Applitools.pdf
Cypress-vs-Playwright-Rematch-Applitools.pdfApplitools
 
ISO 29119 -The new international software testing standards
ISO 29119 -The new international software testing standardsISO 29119 -The new international software testing standards
ISO 29119 -The new international software testing standardsFareha Nadeem
 
Mobile UI Testing using Appium and Docker
Mobile UI Testing using Appium and DockerMobile UI Testing using Appium and Docker
Mobile UI Testing using Appium and DockerMoataz Nabil
 
Using the test process improvement models. Case study based on TPI Next model...
Using the test process improvement models. Case study based on TPI Next model...Using the test process improvement models. Case study based on TPI Next model...
Using the test process improvement models. Case study based on TPI Next model...Sigma Software
 
Playwright Begginers Presentation
Playwright Begginers PresentationPlaywright Begginers Presentation
Playwright Begginers PresentationFranPerea6
 
OAuth and STUN, TURN in WebRTC context RFC7635
OAuth and STUN, TURN  in WebRTC context RFC7635OAuth and STUN, TURN  in WebRTC context RFC7635
OAuth and STUN, TURN in WebRTC context RFC7635Mihály Mészáros
 
Space Camp - API Contract Testing
Space Camp - API Contract TestingSpace Camp - API Contract Testing
Space Camp - API Contract TestingPostman
 
API Test Automation
API Test Automation API Test Automation
API Test Automation SQALab
 
Automação de Testes com Robot Framework - GUTS-SC
Automação de Testes com Robot Framework - GUTS-SCAutomação de Testes com Robot Framework - GUTS-SC
Automação de Testes com Robot Framework - GUTS-SCMayara Fernandes
 
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...Edureka!
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaAgile Testing Alliance
 
Postman Webinar: Postman 101
Postman Webinar: Postman 101Postman Webinar: Postman 101
Postman Webinar: Postman 101Nikita Sharma
 
Postman tests in jenkins
Postman tests in jenkinsPostman tests in jenkins
Postman tests in jenkinsAlex Galkin
 
Why Should we use Microsoft's Playwright
Why Should we use Microsoft's PlaywrightWhy Should we use Microsoft's Playwright
Why Should we use Microsoft's PlaywrightKnoldus Inc.
 
[GDSC-ADYPU] APIs 101 with Postman
[GDSC-ADYPU] APIs 101 with Postman[GDSC-ADYPU] APIs 101 with Postman
[GDSC-ADYPU] APIs 101 with PostmanPranayNarang1
 
LF_APIStrat17_Creating Communication Applications using the Asterisk RESTFul ...
LF_APIStrat17_Creating Communication Applications using the Asterisk RESTFul ...LF_APIStrat17_Creating Communication Applications using the Asterisk RESTFul ...
LF_APIStrat17_Creating Communication Applications using the Asterisk RESTFul ...LF_APIStrat
 
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...Simplilearn
 
Postman: An Introduction for Developers
Postman: An Introduction for DevelopersPostman: An Introduction for Developers
Postman: An Introduction for DevelopersPostman
 

La actualidad más candente (20)

Cypress-vs-Playwright-Rematch-Applitools.pdf
Cypress-vs-Playwright-Rematch-Applitools.pdfCypress-vs-Playwright-Rematch-Applitools.pdf
Cypress-vs-Playwright-Rematch-Applitools.pdf
 
ISO 29119 -The new international software testing standards
ISO 29119 -The new international software testing standardsISO 29119 -The new international software testing standards
ISO 29119 -The new international software testing standards
 
Mobile UI Testing using Appium and Docker
Mobile UI Testing using Appium and DockerMobile UI Testing using Appium and Docker
Mobile UI Testing using Appium and Docker
 
Using the test process improvement models. Case study based on TPI Next model...
Using the test process improvement models. Case study based on TPI Next model...Using the test process improvement models. Case study based on TPI Next model...
Using the test process improvement models. Case study based on TPI Next model...
 
Playwright Begginers Presentation
Playwright Begginers PresentationPlaywright Begginers Presentation
Playwright Begginers Presentation
 
OAuth and STUN, TURN in WebRTC context RFC7635
OAuth and STUN, TURN  in WebRTC context RFC7635OAuth and STUN, TURN  in WebRTC context RFC7635
OAuth and STUN, TURN in WebRTC context RFC7635
 
Space Camp - API Contract Testing
Space Camp - API Contract TestingSpace Camp - API Contract Testing
Space Camp - API Contract Testing
 
API Test Automation
API Test Automation API Test Automation
API Test Automation
 
Automação de Testes com Robot Framework - GUTS-SC
Automação de Testes com Robot Framework - GUTS-SCAutomação de Testes com Robot Framework - GUTS-SC
Automação de Testes com Robot Framework - GUTS-SC
 
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh Gundecha
 
Postman Webinar: Postman 101
Postman Webinar: Postman 101Postman Webinar: Postman 101
Postman Webinar: Postman 101
 
Postman tests in jenkins
Postman tests in jenkinsPostman tests in jenkins
Postman tests in jenkins
 
Why Should we use Microsoft's Playwright
Why Should we use Microsoft's PlaywrightWhy Should we use Microsoft's Playwright
Why Should we use Microsoft's Playwright
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
 
Qa management in big agile teams
Qa management in big agile teamsQa management in big agile teams
Qa management in big agile teams
 
[GDSC-ADYPU] APIs 101 with Postman
[GDSC-ADYPU] APIs 101 with Postman[GDSC-ADYPU] APIs 101 with Postman
[GDSC-ADYPU] APIs 101 with Postman
 
LF_APIStrat17_Creating Communication Applications using the Asterisk RESTFul ...
LF_APIStrat17_Creating Communication Applications using the Asterisk RESTFul ...LF_APIStrat17_Creating Communication Applications using the Asterisk RESTFul ...
LF_APIStrat17_Creating Communication Applications using the Asterisk RESTFul ...
 
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
 
Postman: An Introduction for Developers
Postman: An Introduction for DevelopersPostman: An Introduction for Developers
Postman: An Introduction for Developers
 

Destacado

Embedded Software Development
Embedded Software DevelopmentEmbedded Software Development
Embedded Software DevelopmentSanjay Kumar
 
Automated Acceptance Testing from Scratch
Automated Acceptance Testing from ScratchAutomated Acceptance Testing from Scratch
Automated Acceptance Testing from ScratchExcella
 
Mattias Ratert - Incremental Scenario Testing
Mattias Ratert - Incremental Scenario TestingMattias Ratert - Incremental Scenario Testing
Mattias Ratert - Incremental Scenario TestingTEST Huddle
 
Scenario Testing and Sensitivity Analysis for 3-D Kinematic Models and Geophy...
Scenario Testing and Sensitivity Analysis for 3-D Kinematic Models and Geophy...Scenario Testing and Sensitivity Analysis for 3-D Kinematic Models and Geophy...
Scenario Testing and Sensitivity Analysis for 3-D Kinematic Models and Geophy...The University of Western Australia
 
Writing good test plan and writing good tests
Writing good test plan and writing good testsWriting good test plan and writing good tests
Writing good test plan and writing good testsQingsong Yao
 
Role+Of+Testing+In+Sdlc
Role+Of+Testing+In+SdlcRole+Of+Testing+In+Sdlc
Role+Of+Testing+In+Sdlcmahendra singh
 
Acceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkAcceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkSteve Zhang
 
Real Time Operating Systems
Real Time Operating SystemsReal Time Operating Systems
Real Time Operating SystemsAshwani Garg
 
Test Case Design
Test Case DesignTest Case Design
Test Case Designacatalin
 
Embedded systems ppt
Embedded systems pptEmbedded systems ppt
Embedded systems pptShreya Thakur
 
Test Case, Use Case and Test Scenario
Test Case, Use Case and Test ScenarioTest Case, Use Case and Test Scenario
Test Case, Use Case and Test ScenarioLokesh Agrawal
 
Writing Test Cases 20110808
Writing Test Cases 20110808Writing Test Cases 20110808
Writing Test Cases 20110808slovejoy
 
Real-Time Scheduling Algorithms
Real-Time Scheduling AlgorithmsReal-Time Scheduling Algorithms
Real-Time Scheduling AlgorithmsAJAL A J
 
REAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEMREAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEMprakrutijsh
 
Real Time Operating System
Real Time Operating SystemReal Time Operating System
Real Time Operating Systemvivek223
 
Specification by Example
Specification by ExampleSpecification by Example
Specification by ExampleDeclan Whelan
 
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysisMahesh Bhalerao
 

Destacado (20)

Embedded Software Development
Embedded Software DevelopmentEmbedded Software Development
Embedded Software Development
 
Automated Acceptance Testing from Scratch
Automated Acceptance Testing from ScratchAutomated Acceptance Testing from Scratch
Automated Acceptance Testing from Scratch
 
Mattias Ratert - Incremental Scenario Testing
Mattias Ratert - Incremental Scenario TestingMattias Ratert - Incremental Scenario Testing
Mattias Ratert - Incremental Scenario Testing
 
Scenario Testing and Sensitivity Analysis for 3-D Kinematic Models and Geophy...
Scenario Testing and Sensitivity Analysis for 3-D Kinematic Models and Geophy...Scenario Testing and Sensitivity Analysis for 3-D Kinematic Models and Geophy...
Scenario Testing and Sensitivity Analysis for 3-D Kinematic Models and Geophy...
 
Writing good test plan and writing good tests
Writing good test plan and writing good testsWriting good test plan and writing good tests
Writing good test plan and writing good tests
 
Role+Of+Testing+In+Sdlc
Role+Of+Testing+In+SdlcRole+Of+Testing+In+Sdlc
Role+Of+Testing+In+Sdlc
 
Intoduction to uml
Intoduction to umlIntoduction to uml
Intoduction to uml
 
Acceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkAcceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot Framework
 
Real Time Operating Systems
Real Time Operating SystemsReal Time Operating Systems
Real Time Operating Systems
 
Test Case Design
Test Case DesignTest Case Design
Test Case Design
 
Embedded systems ppt
Embedded systems pptEmbedded systems ppt
Embedded systems ppt
 
Test Case, Use Case and Test Scenario
Test Case, Use Case and Test ScenarioTest Case, Use Case and Test Scenario
Test Case, Use Case and Test Scenario
 
Writing Test Cases 20110808
Writing Test Cases 20110808Writing Test Cases 20110808
Writing Test Cases 20110808
 
Real-Time Scheduling Algorithms
Real-Time Scheduling AlgorithmsReal-Time Scheduling Algorithms
Real-Time Scheduling Algorithms
 
REAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEMREAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEM
 
E.s unit 6
E.s unit 6E.s unit 6
E.s unit 6
 
Real Time Operating System
Real Time Operating SystemReal Time Operating System
Real Time Operating System
 
Rtos Concepts
Rtos ConceptsRtos Concepts
Rtos Concepts
 
Specification by Example
Specification by ExampleSpecification by Example
Specification by Example
 
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
 

Similar a Embedded software development using BDD

Android Things in action
Android Things in actionAndroid Things in action
Android Things in actionStefano Sanna
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerMujahid Hussain
 
Architectural Patterns in IoT Cloud Platforms
Architectural Patterns in IoT Cloud PlatformsArchitectural Patterns in IoT Cloud Platforms
Architectural Patterns in IoT Cloud PlatformsRoshan Kulkarni
 
Ntcip Device Tester
Ntcip Device TesterNtcip Device Tester
Ntcip Device TesterPeter Ashley
 
arduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfarduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfssusere5db05
 
Dolphin: Regression Test System for Latitude
Dolphin: Regression Test System for LatitudeDolphin: Regression Test System for Latitude
Dolphin: Regression Test System for LatitudeTao Jiang
 
Arduino and c programming
Arduino and c programmingArduino and c programming
Arduino and c programmingPunit Goswami
 
Introduction to Industrial Control Systems : Pentesting PLCs 101 (BlackHat Eu...
Introduction to Industrial Control Systems : Pentesting PLCs 101 (BlackHat Eu...Introduction to Industrial Control Systems : Pentesting PLCs 101 (BlackHat Eu...
Introduction to Industrial Control Systems : Pentesting PLCs 101 (BlackHat Eu...arnaudsoullie
 
Iot for smart agriculture
Iot for smart agricultureIot for smart agriculture
Iot for smart agricultureAtit Patumvan
 
Sensu and Sensibility - Puppetconf 2014
Sensu and Sensibility - Puppetconf 2014Sensu and Sensibility - Puppetconf 2014
Sensu and Sensibility - Puppetconf 2014Tomas Doran
 
Arduino Workshop @ MSA University
Arduino Workshop @ MSA UniversityArduino Workshop @ MSA University
Arduino Workshop @ MSA UniversityAhmed Magdy Farid
 
Android 4.2 Internals - Bluetooth and Network
Android 4.2 Internals - Bluetooth and NetworkAndroid 4.2 Internals - Bluetooth and Network
Android 4.2 Internals - Bluetooth and NetworkCaio Pereira
 
iOS Bluetooth Low Energy (BLE) Remote Robot Interface
iOS Bluetooth Low Energy (BLE) Remote Robot InterfaceiOS Bluetooth Low Energy (BLE) Remote Robot Interface
iOS Bluetooth Low Energy (BLE) Remote Robot InterfaceSteve Knodl
 
KazooCon 2014 - Playing Kazoo Dudka Style
KazooCon 2014 - Playing Kazoo Dudka StyleKazooCon 2014 - Playing Kazoo Dudka Style
KazooCon 2014 - Playing Kazoo Dudka Style2600Hz
 

Similar a Embedded software development using BDD (20)

Android Things in action
Android Things in actionAndroid Things in action
Android Things in action
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino Microcontroller
 
Architectural Patterns in IoT Cloud Platforms
Architectural Patterns in IoT Cloud PlatformsArchitectural Patterns in IoT Cloud Platforms
Architectural Patterns in IoT Cloud Platforms
 
Ntcip Device Tester
Ntcip Device TesterNtcip Device Tester
Ntcip Device Tester
 
Introduction to Node MCU
Introduction to Node MCUIntroduction to Node MCU
Introduction to Node MCU
 
Arduino course
Arduino courseArduino course
Arduino course
 
arduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfarduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdf
 
Dolphin: Regression Test System for Latitude
Dolphin: Regression Test System for LatitudeDolphin: Regression Test System for Latitude
Dolphin: Regression Test System for Latitude
 
Arduino and c programming
Arduino and c programmingArduino and c programming
Arduino and c programming
 
Introduction to Industrial Control Systems : Pentesting PLCs 101 (BlackHat Eu...
Introduction to Industrial Control Systems : Pentesting PLCs 101 (BlackHat Eu...Introduction to Industrial Control Systems : Pentesting PLCs 101 (BlackHat Eu...
Introduction to Industrial Control Systems : Pentesting PLCs 101 (BlackHat Eu...
 
Iot for smart agriculture
Iot for smart agricultureIot for smart agriculture
Iot for smart agriculture
 
Sensu and Sensibility - Puppetconf 2014
Sensu and Sensibility - Puppetconf 2014Sensu and Sensibility - Puppetconf 2014
Sensu and Sensibility - Puppetconf 2014
 
IOT beginnners
IOT beginnnersIOT beginnners
IOT beginnners
 
IOT beginnners
IOT beginnnersIOT beginnners
IOT beginnners
 
Arduino Workshop @ MSA University
Arduino Workshop @ MSA UniversityArduino Workshop @ MSA University
Arduino Workshop @ MSA University
 
Android 4.2 Internals - Bluetooth and Network
Android 4.2 Internals - Bluetooth and NetworkAndroid 4.2 Internals - Bluetooth and Network
Android 4.2 Internals - Bluetooth and Network
 
ADCSS 2022
ADCSS 2022ADCSS 2022
ADCSS 2022
 
iOS Bluetooth Low Energy (BLE) Remote Robot Interface
iOS Bluetooth Low Energy (BLE) Remote Robot InterfaceiOS Bluetooth Low Energy (BLE) Remote Robot Interface
iOS Bluetooth Low Energy (BLE) Remote Robot Interface
 
KazooCon 2014 - Playing Kazoo Dudka Style
KazooCon 2014 - Playing Kazoo Dudka StyleKazooCon 2014 - Playing Kazoo Dudka Style
KazooCon 2014 - Playing Kazoo Dudka Style
 
Cafè Terminal
Cafè TerminalCafè Terminal
Cafè Terminal
 

Último

The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Intelisync
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 

Último (20)

The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 

Embedded software development using BDD

  • 1. EMBEDDED SOFTWARE DEVELOPMENT USING BDD Itamar Hassin September 2014
  • 2. THIS TALK COVERS •Embedded development challenges ! •The case for BDD ! •Simulating the target ! •Accessing the target remotely/in-situ ! •Orchestrating access to multiple targets
  • 3. EMBEDDED DEVELOPMENT CHALLENGES •A simulator rarely available or not fully functional ! •Remote device verification ! •Complex state-machines ! •Test coverage often limited to unit testing
  • 4. THE CASE FOR CUCUMBER •Direct mapping from user story acceptance criteria ! •Living documentation, unified view of the product ! •Helps defines ‘done’: Code is tested and validated ! •BDD promotes lean code & emergent design ! •Authored by the team: BAs/QA/Devs
  • 5. CLOSER TO THE SOURCE
  • 6. PREMISE FOR AUTOMATION Programatically validate that code solves the problem by articulating behaviour in machine-readable form.
  • 8. WRITE ONCE, USE THRICE Feature: Alarm assured to appear in quiet mode ! Scenario: Pressure alarm Given device is in quiet mode When pressure sensor is disconnected Then a silent alarm will appear
  • 9. IMPLEMENT STEPS Given(/Given device is in quiet mode $/) do @device.set_quiet_mode(1) end
  • 10. IMPLEMENT A SIMULATOR class Device def set_quiet_mode(flag) if (flag) mode |= QUIET_MODE else mode &= ~QUIET_MODE end update_driver(mode) end end
  • 11. VALIDATE UNDER SIMULATOR Scenario: Pressure alarm Given device is in quiet mode When pressure sensor is disconnected Then a silent alarm will appear ! 5 scenarios (5 passed) 26 steps (26 passed) 0m0.052s
  • 12. WHEN SIMULATION IS NOT ENOUGH
  • 13. THE “WIRE” •When your system does not have native support •When you want a lean, portable implementation
  • 15. WIRE IMPLEMENTATION BLUEPRINT •TCP/IP loop managing Cucumber protocol •Function table for API invocation •API implementation returning status to Cucumber
  • 16. HOOKING CUCUMBER TO LISTENER features/step_definitions/cucumber.wire host: device port: 3901
  • 17. LISTENER TCP/IP LOOP while(fgets(buff, sizeof(buff), rStream)) { respond_to_cucumber(wStream, buff); }
  • 18. WIRE HANDLER void respond_to_cucumber(FILE* stream, char* msg) { if (MSG_TYPE_IS(msg, "step_matches")) respond_to_step_matches(stream, msg); else if (MSG_TYPE_IS(msg, "invoke")) respond_to_invoke(stream, msg); else if (MSG_TYPE_IS(msg, "begin_scenario")) respond_to_begin(stream, msg); else if (MSG_TYPE_IS(msg, "end_scenario")) respond_to_end(stream, msg); else respond_success(stream); }
  • 19. FUNCTION TABLE stepdef_t stepdefs[] = { { "device is in quiet mode”, set_quiet_mode } };
  • 20. INVOKING API FUNCTIONS void respond_to_invoke(…) { int id = get_function_id(msg); ! stepdefs[id].callback(arg_val) ? failure(stream) : success(stream); }
  • 21. TARGET API int set_quiet_mode(const char *arg) { context->requested_mode = atoi(arg); context->quiet_mode |= context->requested_mode; return(update_driver(context)); }
  • 23. WORKING WITH CUCUMBER •Decide on a strategy (off-board, on-board) •Get appropriate toolchain (cross compiler, linker) •Implement and port Wire to target •Run the feature files •fail/implement/pass/refactor/repeat
  • 24. USAGE PATTERNS Off-Board • Framework on PC • Listener on PC • Proxy API on PC • Network calls to Target API ! In-Situ • Framework on PC • Listener on Target • API calls on Target Progression
  • 25. WORKING AT A SAFE DISTANCE
  • 26. OFF-BOARD Cucumber running on PC Wire running on PC Target API running on PC C-implementation Network Target • + Target untouched • - All API’s must be exposed; low-fidelity; many moving parts;
  • 27. UP CLOSE AND PERSONAL
  • 28. IN-SITU Framework running on PC Cucumber- Wire running on Target Target API Network C-implementation • + high-fidelity, API’s not exposed • - Server part of codebase
  • 30. GATEWAY ! •Acts as an end-to-end test orchestrator ! •Switchboard events across heterogeneous devices
  • 31. COLLABORATIVE END-TO-END TESTING Framework running on PC Cucumber- Wire running on Target C-implementation Targets Native Wire Collaboration
  • 32. GATEWAY ARCHITECTURE SpecFlow Target B Proxies A1 B1 Hardware Serial Wire Cucumber Target A Behave
  • 33. END-TO-END FEATURES Feature: Alarm assured to appear in quiet mode ! Scenario: Pressure alarm Given device is in quiet mode When pressure sensor is disconnected Then a silent alarm will appear
  • 34. GATEWAY STEPS public class QuietModeSteps { SignalSimulator signalSimulator = new SignalSimulator(); MedicalDevice medicalDevice = new MedicalDevice(“192.168.1.1”, 3901); ! [Given(@"device is quiet mode")] public void GivenDeviceIsQuietMode() { NUnit.Framework.Assert.IsTrue(medicalDevice.SetQuietMode()); } ! [When(@“pressure sensor is disconnected")] public void GivenPressureSensorIsDisconnected() { NUnit.Framework.Assert.IsTrue(signalSimulator.SetPressure(off)); } }
  • 35. GATEWAY PROXIES class MedicalDevice { protected Wire wire; ! public MedicalDevice(string ipAddress, int port) { myAddress = ipAddress; wire = new Wire(myAddress, port); wire.Open(); } ! public bool SetQuietMode() { wire.Send("["step_matches",{"name_to_match":"set quiet mode on"}]n"); wire.Send("["invoke",{"id":"7","args":["on"]}]n"); return(wire.Ack()); } }
  • 36. EMULATING WIRE public class Wire { public int Open() { client = new TcpClient(myAddress, myPort); stream = client.GetStream(); return(Send(“[”begin_scenario"]n")); } ! public int Close() { stream = client.GetStream(); Send("["end_scenario"]n"); return(client.Close()); } }
  • 37. SPECFLOW TO WIRE SpecFlow int SetQuietMode(“on”) {} Wire Proxies A1 Target TCP Given … quiet mode Wire Match: “set quiet’(on|off)’” Invoke: idx:0, params: “on” A int set_quiet(char* state){}
  • 38. MAINTENANCE CONSIDERATIONS Exists in proxy? Write wrappers Exists in Wire? No No Yes Function table entry Yes API Exists? No Implement API Yes Use in feature/step files
  • 39. COMPLIANCE CONSIDERATIONS •Security - Anyone can connect to Wire! •Regulation may not allow non-application code on a production system Shut down the wire thread in production
  • 40. LESSONS LEARNED Threads & Target Dual Vocabulary Architecture Threading
  • 41. REFERENCES •Specification by example •The Cucumber Book •Cucumber Recipes Photo Credits: @history_pics/@historyinpics Jim Reese#Wikipedia National Library of Australia •SpecFlow
  • 42. THANK YOU! @itababy www.in-context.com