SlideShare a Scribd company logo
1 of 17
Download to read offline
Model-based Testing using Microsoft’s
Spec Explorer Tool: A Case Study

Dharmalingam Ganesan

© 2014 Fraunhofer USA, Inc.
Center for Experimental Software Engineering

1
Spec Explorer - Background
Tester develops a model (a.k.a. model program)
Model program is a simplified version of the SUT
Spec Explorer generates state machines from models
Test cases are automatically derived from state machines
SUT’s behavior is automatically compared with model
Tests failure: Deviation between model and SUT
Tests success: model and SUT are consistent

Supports offline and on-the-fly testing
Offline: Tests are generated and executed against the SUT
On-the-fly: Test generation and execution are interleaved
© 2014 Fraunhofer USA, Inc.
Center for Experimental Software Engineering

2
Why we used Spec Explorer?
Testing of asynchronous systems (e.g. software bus)
Components communicate indirectly using the pub-sub style

Non-deterministic behaviors
E.g.: Messages received in different orders than published

Support for parameterization
Instantiating the model for multiple connections to the bus
Automatic generation of parameter values and combinations

Support for configurability
Ability to slice models into smaller models using operators
Test cases can be short tests or long tests

© 2014 Fraunhofer USA, Inc.
Center for Experimental Software Engineering

3
SUT: NASA’s GMSEC API
Message bus for component communication
Standardized API based on the pub-sub style

Supports middleware technologies
Users can configure the middleware of interests
API users are agnostic to middleware vendors’ APIs

Supports multiple programming languages
For example: C, C++, Java, .NET, and Perl
Same concept but different syntax at the API level

Testing question: Can we generate test cases using one
model to test all languages and middleware?
© 2014 Fraunhofer USA, Inc.
Center for Experimental Software Engineering

4
Developing the model programs
Spec Explorer runs as a plug-in to MS Visual Studio
Model programs are written in C# like syntax
Models are based on the API documentation of GMSEC
Sometimes existing test cases were referred
Developers opinion were taken into consideration

Spec Explorer analyses our models
Generates state machines
Checks whether model satisfies invariants

A selected subset of features were modeled incrementally
Test cases were generated and executed in each increment
© 2014 Fraunhofer USA, Inc.
Center for Experimental Software Engineering

5
SUT Adapter
Adapter wraps the SUT
Converts data/commands from the model into SUT’s
syntax
Adapter simplifies modeling complexity
Methods of the model should map to the adapter
Our adapter is in C#
We also “print” test code from our adapter for different
languages such C, C++, and Java

© 2014 Fraunhofer USA, Inc.
Center for Experimental Software Engineering

6
Fragments of model programs
[Rule]
public static void Create([Domain("ConnIdDomain")] int connId)
{
Condition.IsTrue(CanCreate(connId));
Guards enable the rules if
InitConn(connId);
the condition is satisfied.
}
[Rule]
public static void Connect([Domain("ConnIdDomain")]int connId)
{
Condition.IsTrue(CanConnect(connId));
ConnectionData connData = connections[connId];
connData.connected = true;
SetConnState(connId, connData);
}
[Rule]
public static void Disconnect([Domain("ConnIdDomain")]int connId)
{
Condition.IsTrue(CanDisconnect(connId)); CleanupDisconn(connId);
}
© 2014 Fraunhofer USA, Inc.
Center for Experimental Software Engineering

7
[Rule] methods – Key ideas
Rule methods usually update one or more state variables
State variables are members of our model classes
Rule methods do not call one another
Rule methods get called automatically based on guards
Parameters are configurable
Parameters can be generated using domain generators

© 2014 Fraunhofer USA, Inc.
Center for Experimental Software Engineering

8
Invariants for Model V&V- Samples
// if a connection is created it can always be destroyed
[StateInvariant]
public static bool CreateDestroy()
{
bool property = !connections.Exists(c => !IsWaitingMode() &&
!CanDestroy(c.Key));
return property;
}
// if a connection is connected it cannot connect again
[StateInvariant]
public static bool ConnNoDuplicate()
{
bool property = !connections.Exists(c => c.Value.connected &&
CanConnect(c.Key));
return property;
}
© 2014 Fraunhofer USA, Inc.
Center for Experimental Software Engineering

9
Slicing the model - sample
// Create and Destroy connections
machine CreateDestroyScenario() : Main
{
Create* ||| Destroy*
}
machine CreateDestroyProgram() : Main
{
CreateDestroyScenario || DefaultModelProgram
}
machine CreateDestroyTestSuite() : Main where TestEnabled = true
{
construct test cases where strategy = "shorttests" for
CreateDestroyProgram()
}
© 2014 Fraunhofer USA, Inc.
Center for Experimental Software Engineering

10
Composition of slices - sample
// Connect and Disconnect scenario
machine ConnectDisconnectScenario() : Main where forExploration = false
{
CreateDestroyScenario ||| (Connect* ||| Disconnect*)
}
machine ConnMgmtProgram() : Main where Group = "Connect, Disconnect"
{
(ConnectDisconnectScenario || DefaultModelProgram)
}
machine ConnMgmtTestSuite() : Main where TestEnabled = true, Group = "Test"
{
construct test cases where strategy = "shorttests" for ConnMgmtProgram()
}

© 2014 Fraunhofer USA, Inc.
Center for Experimental Software Engineering

11
Generated state machine - sample

© 2014 Fraunhofer USA, Inc.
Center for Experimental Software Engineering

12
Generated test sequences - sample

© 2014 Fraunhofer USA, Inc.
Center for Experimental Software Engineering

13
Advantages of using Spec Explorer
Generated tests are pretty readable
This is due to the ability to slice models into smaller models

Data parameters are well handled
E.g., Model can be configured to test multiple connections

Non-determinism is not a problem
Tests do not fail because messages arrived in different orders

Models are programs
Ideal for programmers (who prefer coding than drawing)
But we can visualize the generated (small) state machines

Models can be formally verified
Invariants encoded in the model help to validate the model
© 2014 Fraunhofer USA, Inc.
Center for Experimental Software Engineering

14
Challenges with Spec Explorer
Modeling errors can lead to infinite state machine
Need to be careful with unbounded types (e.g., int parameters)

Syntax for slicing the model is powerful but not that easy
Easy to misuse some of (algebraic) operators for slicing

Completeness of our slices
Did we miss any combination of behaviors during slicing?

Model debugging. For example:
Why a new state was generated?
Where/Why the invariants are violated?

Managing the model’s abstraction level
Which aspects of the SUT can be moved to the adapter
Which aspects of the SUT can be left out in the testing, etc.
© 2014 Fraunhofer USA, Inc.
Center for Experimental Software Engineering

15
Benefits to SUT
Numerous specification issues during modeling time
Models and generated state machines can be used a spec.

New test failures on a tested system
Often issues with the SUT
In some cases, issues with the model program and/or adapters
Most issues were corner-cases

Innumerable number of test cases from the model
Test cases are agnostic to a particular programming language
Same tests for all supported languages and middleware

© 2014 Fraunhofer USA, Inc.
Center for Experimental Software Engineering

16
Questions
Dharma Ganesan (dganesan@fc-md.umd.edu)

© 2014 Fraunhofer USA, Inc.
Center for Experimental Software Engineering

17

More Related Content

Viewers also liked

Reverse Engineering of Software Architecture
Reverse Engineering of Software ArchitectureReverse Engineering of Software Architecture
Reverse Engineering of Software Architecture
Dharmalingam Ganesan
 
Software Testing Foundations Part 6 - Intuitive and Experience-based testing
Software Testing Foundations Part 6 - Intuitive and Experience-based testingSoftware Testing Foundations Part 6 - Intuitive and Experience-based testing
Software Testing Foundations Part 6 - Intuitive and Experience-based testing
Nikita Knysh
 
Reverse Architecting of a Medical Device Software
Reverse Architecting of a Medical Device SoftwareReverse Architecting of a Medical Device Software
Reverse Architecting of a Medical Device Software
Dharmalingam Ganesan
 
Ivv workshop model-based-testing-of-nasa-systems
Ivv workshop model-based-testing-of-nasa-systemsIvv workshop model-based-testing-of-nasa-systems
Ivv workshop model-based-testing-of-nasa-systems
Dharmalingam Ganesan
 
Assessing Model-Based Testing: An Empirical Study Conducted in Industry
Assessing Model-Based Testing: An Empirical Study Conducted in IndustryAssessing Model-Based Testing: An Empirical Study Conducted in Industry
Assessing Model-Based Testing: An Empirical Study Conducted in Industry
Dharmalingam Ganesan
 
Automated testing of NASA Software - part 2
Automated testing of NASA Software - part 2Automated testing of NASA Software - part 2
Automated testing of NASA Software - part 2
Dharmalingam Ganesan
 
Architecture Analysis of Systems based on Publish-Subscribe Systems
Architecture Analysis of Systems based on Publish-Subscribe SystemsArchitecture Analysis of Systems based on Publish-Subscribe Systems
Architecture Analysis of Systems based on Publish-Subscribe Systems
Dharmalingam Ganesan
 
Automated Testing of NASA Software
Automated Testing of NASA SoftwareAutomated Testing of NASA Software
Automated Testing of NASA Software
Dharmalingam Ganesan
 
Self-Generating Test Artifacts for Selenium/WebDriver
Self-Generating Test Artifacts for Selenium/WebDriverSelf-Generating Test Artifacts for Selenium/WebDriver
Self-Generating Test Artifacts for Selenium/WebDriver
seleniumconf
 

Viewers also liked (20)

Exploiting Cryptographic Misuse - An Example
Exploiting Cryptographic Misuse - An ExampleExploiting Cryptographic Misuse - An Example
Exploiting Cryptographic Misuse - An Example
 
Reverse Engineering of Software Architecture
Reverse Engineering of Software ArchitectureReverse Engineering of Software Architecture
Reverse Engineering of Software Architecture
 
Threat Modeling: Applied on a Publish-Subscribe Architectural Style
Threat Modeling: Applied on a Publish-Subscribe Architectural StyleThreat Modeling: Applied on a Publish-Subscribe Architectural Style
Threat Modeling: Applied on a Publish-Subscribe Architectural Style
 
Test automation is dead CoDe Copenhagen 2016
Test automation is dead   CoDe Copenhagen 2016Test automation is dead   CoDe Copenhagen 2016
Test automation is dead CoDe Copenhagen 2016
 
Software Testing Foundations Part 6 - Intuitive and Experience-based testing
Software Testing Foundations Part 6 - Intuitive and Experience-based testingSoftware Testing Foundations Part 6 - Intuitive and Experience-based testing
Software Testing Foundations Part 6 - Intuitive and Experience-based testing
 
Reverse Architecting of a Medical Device Software
Reverse Architecting of a Medical Device SoftwareReverse Architecting of a Medical Device Software
Reverse Architecting of a Medical Device Software
 
Ivv workshop model-based-testing-of-nasa-systems
Ivv workshop model-based-testing-of-nasa-systemsIvv workshop model-based-testing-of-nasa-systems
Ivv workshop model-based-testing-of-nasa-systems
 
Assessing Model-Based Testing: An Empirical Study Conducted in Industry
Assessing Model-Based Testing: An Empirical Study Conducted in IndustryAssessing Model-Based Testing: An Empirical Study Conducted in Industry
Assessing Model-Based Testing: An Empirical Study Conducted in Industry
 
Secure application programming in the presence of side channel attacks
Secure application programming in the presence of side channel attacksSecure application programming in the presence of side channel attacks
Secure application programming in the presence of side channel attacks
 
Automated testing of NASA Software - part 2
Automated testing of NASA Software - part 2Automated testing of NASA Software - part 2
Automated testing of NASA Software - part 2
 
Explaining my Phd Thesis to layman
Explaining my Phd Thesis to laymanExplaining my Phd Thesis to layman
Explaining my Phd Thesis to layman
 
Architecture Analysis of Systems based on Publish-Subscribe Systems
Architecture Analysis of Systems based on Publish-Subscribe SystemsArchitecture Analysis of Systems based on Publish-Subscribe Systems
Architecture Analysis of Systems based on Publish-Subscribe Systems
 
Automated Testing of NASA Software
Automated Testing of NASA SoftwareAutomated Testing of NASA Software
Automated Testing of NASA Software
 
Self-Generating Test Artifacts for Selenium/WebDriver
Self-Generating Test Artifacts for Selenium/WebDriverSelf-Generating Test Artifacts for Selenium/WebDriver
Self-Generating Test Artifacts for Selenium/WebDriver
 
Automatic Test Case Generation
Automatic Test Case GenerationAutomatic Test Case Generation
Automatic Test Case Generation
 
Carbon Finance
Carbon FinanceCarbon Finance
Carbon Finance
 
How to Release Rock-solid RESTful APIs and Ice the Testing BackBlob
How to Release Rock-solid RESTful APIs and Ice the Testing BackBlobHow to Release Rock-solid RESTful APIs and Ice the Testing BackBlob
How to Release Rock-solid RESTful APIs and Ice the Testing BackBlob
 
Model-based Testing: Today And Tomorrow
Model-based Testing: Today And TomorrowModel-based Testing: Today And Tomorrow
Model-based Testing: Today And Tomorrow
 
10 things about BDD, Cucumber and SpecFlow - Long Version 2016
10 things about BDD, Cucumber and SpecFlow - Long Version 201610 things about BDD, Cucumber and SpecFlow - Long Version 2016
10 things about BDD, Cucumber and SpecFlow - Long Version 2016
 
Model-Based Testing: Why, What, How
Model-Based Testing: Why, What, HowModel-Based Testing: Why, What, How
Model-Based Testing: Why, What, How
 

Similar to Model-based Testing using Microsoft’s Spec Explorer Tool: A Case Study

Automated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra SolutionsAutomated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra Solutions
Quontra Solutions
 
UIAutomation_Testing
UIAutomation_TestingUIAutomation_Testing
UIAutomation_Testing
Krunal Soni
 
Unit Testing Fundamentals
Unit Testing FundamentalsUnit Testing Fundamentals
Unit Testing Fundamentals
Richard Paul
 
MBT_Installers_Dev_Env
MBT_Installers_Dev_EnvMBT_Installers_Dev_Env
MBT_Installers_Dev_Env
Chris Struble
 

Similar to Model-based Testing using Microsoft’s Spec Explorer Tool: A Case Study (20)

Building Maintainable Android Apps (DroidCon NYC 2014)
Building Maintainable Android Apps (DroidCon NYC 2014)Building Maintainable Android Apps (DroidCon NYC 2014)
Building Maintainable Android Apps (DroidCon NYC 2014)
 
Valsatech selenium octopus framework-whitepages
Valsatech selenium octopus framework-whitepagesValsatech selenium octopus framework-whitepages
Valsatech selenium octopus framework-whitepages
 
12 Rational Solo Pruebas 2009
12 Rational Solo Pruebas 200912 Rational Solo Pruebas 2009
12 Rational Solo Pruebas 2009
 
Automated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra SolutionsAutomated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra Solutions
 
Beyond Static Analysis: Integrating .NET Static Analysis with Unit Testing a...
Beyond Static Analysis: Integrating .NET  Static Analysis with Unit Testing a...Beyond Static Analysis: Integrating .NET  Static Analysis with Unit Testing a...
Beyond Static Analysis: Integrating .NET Static Analysis with Unit Testing a...
 
TDD Workshop UTN 2012
TDD Workshop UTN 2012TDD Workshop UTN 2012
TDD Workshop UTN 2012
 
Unit Testing in Flutter - From Workflow Essentials to Complex Scenarios
Unit Testing in Flutter - From Workflow Essentials to Complex ScenariosUnit Testing in Flutter - From Workflow Essentials to Complex Scenarios
Unit Testing in Flutter - From Workflow Essentials to Complex Scenarios
 
UIAutomation_Testing
UIAutomation_TestingUIAutomation_Testing
UIAutomation_Testing
 
Model level debugging and profiling, Code Generation Conference 2014
Model level debugging and profiling, Code Generation Conference 2014Model level debugging and profiling, Code Generation Conference 2014
Model level debugging and profiling, Code Generation Conference 2014
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
Mule testing
Mule testingMule testing
Mule testing
 
50120140502017
5012014050201750120140502017
50120140502017
 
Automating The Process For Building Reliable Software
Automating The Process For Building Reliable SoftwareAutomating The Process For Building Reliable Software
Automating The Process For Building Reliable Software
 
Unit Testing Fundamentals
Unit Testing FundamentalsUnit Testing Fundamentals
Unit Testing Fundamentals
 
Requirements driven Model-based Testing
Requirements driven Model-based TestingRequirements driven Model-based Testing
Requirements driven Model-based Testing
 
Presentation Of Mbt Tools
Presentation Of Mbt ToolsPresentation Of Mbt Tools
Presentation Of Mbt Tools
 
Automation Best Practices.pptx
Automation Best Practices.pptxAutomation Best Practices.pptx
Automation Best Practices.pptx
 
MBT_Installers_Dev_Env
MBT_Installers_Dev_EnvMBT_Installers_Dev_Env
MBT_Installers_Dev_Env
 
Stopping the Rot - Putting Legacy C++ Under Test
Stopping the Rot - Putting Legacy C++ Under TestStopping the Rot - Putting Legacy C++ Under Test
Stopping the Rot - Putting Legacy C++ Under Test
 
Unit tests & TDD
Unit tests & TDDUnit tests & TDD
Unit tests & TDD
 

More from Dharmalingam Ganesan

More from Dharmalingam Ganesan (20)

.NET Deserialization Attacks
.NET Deserialization Attacks.NET Deserialization Attacks
.NET Deserialization Attacks
 
Reverse Architecting using Relation Algebra.pdf
Reverse Architecting using Relation Algebra.pdfReverse Architecting using Relation Algebra.pdf
Reverse Architecting using Relation Algebra.pdf
 
How to exploit rand()?
How to exploit rand()?How to exploit rand()?
How to exploit rand()?
 
Cyclic Attacks on the RSA Trapdoor Function
Cyclic Attacks on the RSA Trapdoor FunctionCyclic Attacks on the RSA Trapdoor Function
Cyclic Attacks on the RSA Trapdoor Function
 
An Analysis of RSA Public Exponent e
An Analysis of RSA Public Exponent eAn Analysis of RSA Public Exponent e
An Analysis of RSA Public Exponent e
 
An Analysis of Secure Remote Password (SRP)
An Analysis of Secure Remote Password (SRP)An Analysis of Secure Remote Password (SRP)
An Analysis of Secure Remote Password (SRP)
 
Thank-a-Gram
Thank-a-GramThank-a-Gram
Thank-a-Gram
 
Active Attacks on DH Key Exchange
Active Attacks on DH Key ExchangeActive Attacks on DH Key Exchange
Active Attacks on DH Key Exchange
 
Can I write to a read only file ?
Can I write to a read only file ?Can I write to a read only file ?
Can I write to a read only file ?
 
How do computers exchange secrets using Math?
How do computers exchange secrets using Math?How do computers exchange secrets using Math?
How do computers exchange secrets using Math?
 
On the Secrecy of RSA Private Keys
On the Secrecy of RSA Private KeysOn the Secrecy of RSA Private Keys
On the Secrecy of RSA Private Keys
 
Computing the Square Roots of Unity to break RSA using Quantum Algorithms
Computing the Square Roots of Unity to break RSA using Quantum AlgorithmsComputing the Square Roots of Unity to break RSA using Quantum Algorithms
Computing the Square Roots of Unity to break RSA using Quantum Algorithms
 
Analysis of Short RSA Secret Exponent d
Analysis of Short RSA Secret Exponent dAnalysis of Short RSA Secret Exponent d
Analysis of Short RSA Secret Exponent d
 
Dependency Analysis of RSA Private Variables
Dependency Analysis of RSA Private VariablesDependency Analysis of RSA Private Variables
Dependency Analysis of RSA Private Variables
 
Analysis of Shared RSA Modulus
Analysis of Shared RSA ModulusAnalysis of Shared RSA Modulus
Analysis of Shared RSA Modulus
 
RSA Game using an Oracle
RSA Game using an OracleRSA Game using an Oracle
RSA Game using an Oracle
 
RSA Two Person Game
RSA Two Person GameRSA Two Person Game
RSA Two Person Game
 
RSA without Integrity Checks
RSA without Integrity ChecksRSA without Integrity Checks
RSA without Integrity Checks
 
RSA without Padding
RSA without PaddingRSA without Padding
RSA without Padding
 
Solutions to online rsa factoring challenges
Solutions to online rsa factoring challengesSolutions to online rsa factoring challenges
Solutions to online rsa factoring challenges
 

Recently uploaded

“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
Muhammad Subhan
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
panagenda
 

Recently uploaded (20)

ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideCollecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 

Model-based Testing using Microsoft’s Spec Explorer Tool: A Case Study

  • 1. Model-based Testing using Microsoft’s Spec Explorer Tool: A Case Study Dharmalingam Ganesan © 2014 Fraunhofer USA, Inc. Center for Experimental Software Engineering 1
  • 2. Spec Explorer - Background Tester develops a model (a.k.a. model program) Model program is a simplified version of the SUT Spec Explorer generates state machines from models Test cases are automatically derived from state machines SUT’s behavior is automatically compared with model Tests failure: Deviation between model and SUT Tests success: model and SUT are consistent Supports offline and on-the-fly testing Offline: Tests are generated and executed against the SUT On-the-fly: Test generation and execution are interleaved © 2014 Fraunhofer USA, Inc. Center for Experimental Software Engineering 2
  • 3. Why we used Spec Explorer? Testing of asynchronous systems (e.g. software bus) Components communicate indirectly using the pub-sub style Non-deterministic behaviors E.g.: Messages received in different orders than published Support for parameterization Instantiating the model for multiple connections to the bus Automatic generation of parameter values and combinations Support for configurability Ability to slice models into smaller models using operators Test cases can be short tests or long tests © 2014 Fraunhofer USA, Inc. Center for Experimental Software Engineering 3
  • 4. SUT: NASA’s GMSEC API Message bus for component communication Standardized API based on the pub-sub style Supports middleware technologies Users can configure the middleware of interests API users are agnostic to middleware vendors’ APIs Supports multiple programming languages For example: C, C++, Java, .NET, and Perl Same concept but different syntax at the API level Testing question: Can we generate test cases using one model to test all languages and middleware? © 2014 Fraunhofer USA, Inc. Center for Experimental Software Engineering 4
  • 5. Developing the model programs Spec Explorer runs as a plug-in to MS Visual Studio Model programs are written in C# like syntax Models are based on the API documentation of GMSEC Sometimes existing test cases were referred Developers opinion were taken into consideration Spec Explorer analyses our models Generates state machines Checks whether model satisfies invariants A selected subset of features were modeled incrementally Test cases were generated and executed in each increment © 2014 Fraunhofer USA, Inc. Center for Experimental Software Engineering 5
  • 6. SUT Adapter Adapter wraps the SUT Converts data/commands from the model into SUT’s syntax Adapter simplifies modeling complexity Methods of the model should map to the adapter Our adapter is in C# We also “print” test code from our adapter for different languages such C, C++, and Java © 2014 Fraunhofer USA, Inc. Center for Experimental Software Engineering 6
  • 7. Fragments of model programs [Rule] public static void Create([Domain("ConnIdDomain")] int connId) { Condition.IsTrue(CanCreate(connId)); Guards enable the rules if InitConn(connId); the condition is satisfied. } [Rule] public static void Connect([Domain("ConnIdDomain")]int connId) { Condition.IsTrue(CanConnect(connId)); ConnectionData connData = connections[connId]; connData.connected = true; SetConnState(connId, connData); } [Rule] public static void Disconnect([Domain("ConnIdDomain")]int connId) { Condition.IsTrue(CanDisconnect(connId)); CleanupDisconn(connId); } © 2014 Fraunhofer USA, Inc. Center for Experimental Software Engineering 7
  • 8. [Rule] methods – Key ideas Rule methods usually update one or more state variables State variables are members of our model classes Rule methods do not call one another Rule methods get called automatically based on guards Parameters are configurable Parameters can be generated using domain generators © 2014 Fraunhofer USA, Inc. Center for Experimental Software Engineering 8
  • 9. Invariants for Model V&V- Samples // if a connection is created it can always be destroyed [StateInvariant] public static bool CreateDestroy() { bool property = !connections.Exists(c => !IsWaitingMode() && !CanDestroy(c.Key)); return property; } // if a connection is connected it cannot connect again [StateInvariant] public static bool ConnNoDuplicate() { bool property = !connections.Exists(c => c.Value.connected && CanConnect(c.Key)); return property; } © 2014 Fraunhofer USA, Inc. Center for Experimental Software Engineering 9
  • 10. Slicing the model - sample // Create and Destroy connections machine CreateDestroyScenario() : Main { Create* ||| Destroy* } machine CreateDestroyProgram() : Main { CreateDestroyScenario || DefaultModelProgram } machine CreateDestroyTestSuite() : Main where TestEnabled = true { construct test cases where strategy = "shorttests" for CreateDestroyProgram() } © 2014 Fraunhofer USA, Inc. Center for Experimental Software Engineering 10
  • 11. Composition of slices - sample // Connect and Disconnect scenario machine ConnectDisconnectScenario() : Main where forExploration = false { CreateDestroyScenario ||| (Connect* ||| Disconnect*) } machine ConnMgmtProgram() : Main where Group = "Connect, Disconnect" { (ConnectDisconnectScenario || DefaultModelProgram) } machine ConnMgmtTestSuite() : Main where TestEnabled = true, Group = "Test" { construct test cases where strategy = "shorttests" for ConnMgmtProgram() } © 2014 Fraunhofer USA, Inc. Center for Experimental Software Engineering 11
  • 12. Generated state machine - sample © 2014 Fraunhofer USA, Inc. Center for Experimental Software Engineering 12
  • 13. Generated test sequences - sample © 2014 Fraunhofer USA, Inc. Center for Experimental Software Engineering 13
  • 14. Advantages of using Spec Explorer Generated tests are pretty readable This is due to the ability to slice models into smaller models Data parameters are well handled E.g., Model can be configured to test multiple connections Non-determinism is not a problem Tests do not fail because messages arrived in different orders Models are programs Ideal for programmers (who prefer coding than drawing) But we can visualize the generated (small) state machines Models can be formally verified Invariants encoded in the model help to validate the model © 2014 Fraunhofer USA, Inc. Center for Experimental Software Engineering 14
  • 15. Challenges with Spec Explorer Modeling errors can lead to infinite state machine Need to be careful with unbounded types (e.g., int parameters) Syntax for slicing the model is powerful but not that easy Easy to misuse some of (algebraic) operators for slicing Completeness of our slices Did we miss any combination of behaviors during slicing? Model debugging. For example: Why a new state was generated? Where/Why the invariants are violated? Managing the model’s abstraction level Which aspects of the SUT can be moved to the adapter Which aspects of the SUT can be left out in the testing, etc. © 2014 Fraunhofer USA, Inc. Center for Experimental Software Engineering 15
  • 16. Benefits to SUT Numerous specification issues during modeling time Models and generated state machines can be used a spec. New test failures on a tested system Often issues with the SUT In some cases, issues with the model program and/or adapters Most issues were corner-cases Innumerable number of test cases from the model Test cases are agnostic to a particular programming language Same tests for all supported languages and middleware © 2014 Fraunhofer USA, Inc. Center for Experimental Software Engineering 16
  • 17. Questions Dharma Ganesan (dganesan@fc-md.umd.edu) © 2014 Fraunhofer USA, Inc. Center for Experimental Software Engineering 17