SlideShare una empresa de Scribd logo
1 de 17
Descargar para leer sin conexión
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

Más contenido relacionado

Destacado

Verifying Architectural Design Rules of a Flight Software Product Line
Verifying Architectural Design Rules of a Flight Software Product LineVerifying Architectural Design Rules of a Flight Software Product Line
Verifying Architectural Design Rules of a Flight Software Product Line
Dharmalingam Ganesan
 
Interface-Implementation Contract Checking
Interface-Implementation Contract CheckingInterface-Implementation Contract Checking
Interface-Implementation Contract Checking
Dharmalingam Ganesan
 
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
 

Destacado (20)

Linux binary analysis and exploitation
Linux binary analysis and exploitationLinux binary analysis and exploitation
Linux binary analysis and exploitation
 
Automated Test Case Generation and Execution from Models
Automated Test Case Generation and Execution from ModelsAutomated Test Case Generation and Execution from Models
Automated Test Case Generation and Execution from Models
 
Verifying Architectural Design Rules of a Flight Software Product Line
Verifying Architectural Design Rules of a Flight Software Product LineVerifying Architectural Design Rules of a Flight Software Product Line
Verifying Architectural Design Rules of a Flight Software Product Line
 
Interface-Implementation Contract Checking
Interface-Implementation Contract CheckingInterface-Implementation Contract Checking
Interface-Implementation Contract Checking
 
Testing of C software components using Models
Testing of C software components using ModelsTesting of C software components using Models
Testing of C software components using Models
 
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
 

Similar a 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 a 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
 

Más de Dharmalingam Ganesan

Más de 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
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
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
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
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
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

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