SlideShare a Scribd company logo
1
Testing a Service
Fabric solution and
live happy!!!
Massimo Bonanni
Paranormal Developer, with the head in the Cloud and all the
REST in microservices!
@massimobonanni
massimo.bonanni@microsoft.com
@cloudgen_verona
#CodeGen
#dotnetconf
3
Main sponsor
4
Community sponsors
5
6
Unit testing
8
Programming
Models
Dev & Ops
Tooling
Orchestration Lifecycle
Management
Health &
Monitoring
Always On
Availability
Auto
Scaling
AzureOn-premises infrastructureAny cloudDev machine
Service Fabric: Microservices platform
ExecutablesReliable Services (.NET, Java)
Reliable Actors (.NET, Java)ASP.NET Core
Containers
9
F5 is our friend….
It is the most used test tools
It's free and you can find it in all Visual
Studio versions
You don’t have to write any additional code
10
F5 is not useful …. with Service Fabric
Resources – you need a local cluster
Time – you need to publish the app
Code complete – you need all the
microservices you interact with
11
Why unit test…
A unit test is an automated piece
of code that invokes a unit of work
in the system and then checks a
single assumption about the
behavior of that unit of work.
Roy Osherove – The Art Of Unit Testing
Microservices are small, perform
single functionality and loosely
coupled.
Microservices Architecture
12
Why unit test…
A unit test is an automated piece
of code that invokes a unit of work
in the system and then checks a
single assumption about the
behavior of that unit of work.
Roy Osherove – The Art Of Unit Testing
Microservices are small, perform
single functionality and loosely
coupled.
Microservices Architecture
A microservice is
your Unit of
Work to test!!!
13
The three obstacles
Your
µService
Service Fabric Platform
Replicas Partitioning State Management……
File System Database Web Service
External Components Others µServices
14
Real case: Shopping Cart & Order
We model 3 typical shopping cart scenarios
• The cart can be created only if it is a new cart
Creating the shopping cart
• Need to check if the product is still available
Adding a product to the cart
• The order is created starting from the cart and only if the order is new
Creating an order from the cart
15
Scenario : Creating the shopping cart
We must "replace" the
Service Fabric platform, so
our tests doesn’t need the
cluster.
Service Fabric Platform
Replicas Partitioning
State
Management
……
16
Scenario : Creating the shopping cart
this.StateManager.TryGetStateAsync<State>(StateKeyName,
cancellationToken);
this.StateManager.SetStateAsync(StateKeyName,
state, cancellationToken);
this.RegisterReminderAsync(ExpiredReminderName, null,
CartExpiredTimeout, TimeSpan.FromMilliseconds(-1));
17
Scenario : Adding a product to the cart
We need to decouple our
microservice from external
components, so that our tests can
verify only the actor's logic.
File System Database Web Service
External Components
18
Scenario : Adding a product to the cart
private async Task<ProductData> GetProductFromStorageAsync(string productId,
double quantity, CancellationToken cancellationToken)
{
ProductData result = null;
try
{
using (SqlConnection conn = new SqlConnection(connectionString))
using (SqlCommand cmd = new SqlCommand("CheckProduct", conn))
{
// Database code
}
}
catch
{
result = null;
}
return result;
}
19
Scenario : Creating an order from the cart
We must to replace the static
classes ActorProxy and
ServiceProxy used in the
creation of communication
proxies.
Others µServices
20
Scenario : Creating an order from the cart
var orderProxy = ActorProxy.Create<IOrderActor>(this.Id,
new Uri("fabric:/TestingApp/OrderActor"));
Demo:
Unit test
22
The three obstacles….three solutions!
Your
µService
Service Fabric Platform
Replicas Partitioning
State
Management
……
File System Database Web Service
External Components Others µServices
Mock the platform
(ServiceFabric.Mocks)
Abstract the proxy
factories
Create a layer of
indirection
The CHAOS
24
Keep the stability!!!!
Solutions based on distributed architectures such as cloud infrastructures
must be:
This is why you need to be able to test the stability of your solutions when
complex state transitions due to errors occur in the underlying
infrastructure.
•able to withstand or recover quickly from difficult conditionsResilient
• its status does not get corrupted as a result of a problemReliable
25
What can go wrong in production?
Restarting a
node
Restarting a
distributed
code package
Removing a
replica
Restarting a
replica
Moving a
primary
replica
Moving a
secondary
replica
Remove a
node
Add a node
26
27
Start-ServiceFabricChaos
Chaos induces faults in the cluster based on the received input
parameters.
Chaos runs in multiple iterations: each iteration consists of faults
and cluster validation.
You can control:
• how long Chaos runs,
• how long it waits between
iterations,
• how many faults it can induce
during an iteration,
• how long it waits between faults.
• ….
Demo:
Chaos test
29
Take away….
Keep the microservices simple….they will be
testability simply!
When design a solution, keep in mind the
testability!
Mock, fake and shim are your best friends!
If car companies launch expensive cars
against a wall to test them, why should not
you do it with your code?
Grazie
massimobonanni @massimobonanni massimobonanni

More Related Content

What's hot

Designing an effective hybrid apps automation framework
Designing an effective hybrid apps automation frameworkDesigning an effective hybrid apps automation framework
Designing an effective hybrid apps automation framework
Andrea Tino
 
Tales of an open source library
Tales of an open source libraryTales of an open source library
Tales of an open source library
Adam Klein
 
Mobx Internals
Mobx InternalsMobx Internals
Mobx Internals
500Tech
 
Spring boot
Spring bootSpring boot
Spring boot
Shatrughna Singh
 
Visualforce remoteobject
Visualforce remoteobjectVisualforce remoteobject
Visualforce remoteobject
Karanraj Sankaranarayanan
 
Progressive Web App Testing With Cypress.io
Progressive Web App Testing With Cypress.ioProgressive Web App Testing With Cypress.io
Progressive Web App Testing With Cypress.io
Knoldus Inc.
 
End to end test automation with cypress
End to end test automation with cypressEnd to end test automation with cypress
End to end test automation with cypress
Kushan Shalindra Amarasiri - Technical QE Specialist
 
What is Spring Boot and Why Spring Boot ?
What is Spring Boot and Why Spring Boot ?What is Spring Boot and Why Spring Boot ?
What is Spring Boot and Why Spring Boot ?
narendrachinnu
 
Why I am hooked on the future of React
Why I am hooked on the future of ReactWhy I am hooked on the future of React
Why I am hooked on the future of React
Maurice De Beijer [MVP]
 
Cypress - Best Practices
Cypress - Best PracticesCypress - Best Practices
Cypress - Best Practices
Brian Mann
 
Automated Testing for Websites With Selenium IDE
Automated Testing for Websites With Selenium IDEAutomated Testing for Websites With Selenium IDE
Automated Testing for Websites With Selenium IDE
Robert Greiner
 
Leveraging Azure for Performance Testing
Leveraging Azure for Performance TestingLeveraging Azure for Performance Testing
Leveraging Azure for Performance Testing
Tarun Arora
 
Microservices with Spring Boot Tutorial | Edureka
Microservices with Spring Boot Tutorial | EdurekaMicroservices with Spring Boot Tutorial | Edureka
Microservices with Spring Boot Tutorial | Edureka
Edureka!
 
Xmas Serverless Transformation: when the elf doesn’t scale!
Xmas Serverless Transformation: when the elf doesn’t scale!Xmas Serverless Transformation: when the elf doesn’t scale!
Xmas Serverless Transformation: when the elf doesn’t scale!
Massimo Bonanni
 
Angular Unit Testing
Angular Unit TestingAngular Unit Testing
Angular Unit Testing
Shailendra Chauhan
 
Windows Azure Acid Test
Windows Azure Acid TestWindows Azure Acid Test
Windows Azure Acid Test
expanz
 
Introduction to Integration Testing With Cypress
Introduction to Integration Testing With CypressIntroduction to Integration Testing With Cypress
Introduction to Integration Testing With Cypress
Erez Cohen
 
Fullstack workshop
Fullstack workshopFullstack workshop
Fullstack workshop
Assaf Gannon
 
Protractor overview
Protractor overviewProtractor overview
Protractor overview
Abhishek Yadav
 
KKBOX WWDC17 Performance and Testing - Hokila
KKBOX WWDC17 Performance and Testing - HokilaKKBOX WWDC17 Performance and Testing - Hokila
KKBOX WWDC17 Performance and Testing - Hokila
Liyao Chen
 

What's hot (20)

Designing an effective hybrid apps automation framework
Designing an effective hybrid apps automation frameworkDesigning an effective hybrid apps automation framework
Designing an effective hybrid apps automation framework
 
Tales of an open source library
Tales of an open source libraryTales of an open source library
Tales of an open source library
 
Mobx Internals
Mobx InternalsMobx Internals
Mobx Internals
 
Spring boot
Spring bootSpring boot
Spring boot
 
Visualforce remoteobject
Visualforce remoteobjectVisualforce remoteobject
Visualforce remoteobject
 
Progressive Web App Testing With Cypress.io
Progressive Web App Testing With Cypress.ioProgressive Web App Testing With Cypress.io
Progressive Web App Testing With Cypress.io
 
End to end test automation with cypress
End to end test automation with cypressEnd to end test automation with cypress
End to end test automation with cypress
 
What is Spring Boot and Why Spring Boot ?
What is Spring Boot and Why Spring Boot ?What is Spring Boot and Why Spring Boot ?
What is Spring Boot and Why Spring Boot ?
 
Why I am hooked on the future of React
Why I am hooked on the future of ReactWhy I am hooked on the future of React
Why I am hooked on the future of React
 
Cypress - Best Practices
Cypress - Best PracticesCypress - Best Practices
Cypress - Best Practices
 
Automated Testing for Websites With Selenium IDE
Automated Testing for Websites With Selenium IDEAutomated Testing for Websites With Selenium IDE
Automated Testing for Websites With Selenium IDE
 
Leveraging Azure for Performance Testing
Leveraging Azure for Performance TestingLeveraging Azure for Performance Testing
Leveraging Azure for Performance Testing
 
Microservices with Spring Boot Tutorial | Edureka
Microservices with Spring Boot Tutorial | EdurekaMicroservices with Spring Boot Tutorial | Edureka
Microservices with Spring Boot Tutorial | Edureka
 
Xmas Serverless Transformation: when the elf doesn’t scale!
Xmas Serverless Transformation: when the elf doesn’t scale!Xmas Serverless Transformation: when the elf doesn’t scale!
Xmas Serverless Transformation: when the elf doesn’t scale!
 
Angular Unit Testing
Angular Unit TestingAngular Unit Testing
Angular Unit Testing
 
Windows Azure Acid Test
Windows Azure Acid TestWindows Azure Acid Test
Windows Azure Acid Test
 
Introduction to Integration Testing With Cypress
Introduction to Integration Testing With CypressIntroduction to Integration Testing With Cypress
Introduction to Integration Testing With Cypress
 
Fullstack workshop
Fullstack workshopFullstack workshop
Fullstack workshop
 
Protractor overview
Protractor overviewProtractor overview
Protractor overview
 
KKBOX WWDC17 Performance and Testing - Hokila
KKBOX WWDC17 Performance and Testing - HokilaKKBOX WWDC17 Performance and Testing - Hokila
KKBOX WWDC17 Performance and Testing - Hokila
 

Similar to Testing a Service Fabric solution and live happy!!

Building strong foundations apex enterprise patterns
Building strong foundations apex enterprise patternsBuilding strong foundations apex enterprise patterns
Building strong foundations apex enterprise patterns
andyinthecloud
 
GemFire In-Memory Data Grid
GemFire In-Memory Data GridGemFire In-Memory Data Grid
GemFire In-Memory Data Grid
Kiril Menshikov (Kirils Mensikovs)
 
Azure development
Azure developmentAzure development
Azure development
wseye
 
Oracle appsloadtestbestpractices
Oracle appsloadtestbestpracticesOracle appsloadtestbestpractices
Oracle appsloadtestbestpractices
sonusaini69
 
Kubernetes & Co, beyond the hype
Kubernetes & Co, beyond the hypeKubernetes & Co, beyond the hype
Kubernetes & Co, beyond the hype
Alexandre Touret
 
E catt tutorial
E catt tutorialE catt tutorial
E catt tutorial
Naveen Raj
 
How to upgrade to MongoDB 4.0 - Percona Europe 2018
How to upgrade to MongoDB 4.0 - Percona Europe 2018How to upgrade to MongoDB 4.0 - Percona Europe 2018
How to upgrade to MongoDB 4.0 - Percona Europe 2018
Antonios Giannopoulos
 
GemFire In Memory Data Grid
GemFire In Memory Data GridGemFire In Memory Data Grid
GemFire In Memory Data Grid
Dmitry Buzdin
 
Muves3 Elastic Grid Java One2009 Final
Muves3 Elastic Grid Java One2009 FinalMuves3 Elastic Grid Java One2009 Final
Muves3 Elastic Grid Java One2009 Final
Elastic Grid, LLC.
 
Architecting .NET solutions in a Docker ecosystem - .NET Fest Kyiv 2019
Architecting .NET solutions in a Docker ecosystem - .NET Fest Kyiv 2019Architecting .NET solutions in a Docker ecosystem - .NET Fest Kyiv 2019
Architecting .NET solutions in a Docker ecosystem - .NET Fest Kyiv 2019
Alex Thissen
 
Coldbox developer training – session 4
Coldbox developer training – session 4Coldbox developer training – session 4
Coldbox developer training – session 4
Billie Berzinskas
 
Aws meetup systems_manager
Aws meetup systems_managerAws meetup systems_manager
Aws meetup systems_manager
Adam Book
 
patchVantage Cloud Starter Pack
patchVantage Cloud Starter Pack patchVantage Cloud Starter Pack
patchVantage Cloud Starter Pack
David McNish
 
Tips for Developing and Testing IBM HATS Applications
Tips for Developing and Testing IBM HATS ApplicationsTips for Developing and Testing IBM HATS Applications
Tips for Developing and Testing IBM HATS Applications
Strongback Consulting
 
API Performance testing with Gatling
API Performance testing with GatlingAPI Performance testing with Gatling
API Performance testing with Gatling
Tetiana Polishchuk
 
Windows 2012 R2 Multi Server Management
Windows 2012 R2 Multi Server ManagementWindows 2012 R2 Multi Server Management
Windows 2012 R2 Multi Server Management
Sharkrit JOBBO
 
Managing Millions of Tests Using Databricks
Managing Millions of Tests Using DatabricksManaging Millions of Tests Using Databricks
Managing Millions of Tests Using Databricks
Databricks
 
Tce automation-d4-110102123012-phpapp01
Tce automation-d4-110102123012-phpapp01Tce automation-d4-110102123012-phpapp01
Tce automation-d4-110102123012-phpapp01
Haggai Philip Zagury
 
Operational Best Practices in the Cloud
Operational Best Practices in the CloudOperational Best Practices in the Cloud
Operational Best Practices in the Cloud
RightScale
 
Rit 8.5.0 virtualization training slides
Rit 8.5.0 virtualization training slidesRit 8.5.0 virtualization training slides
Rit 8.5.0 virtualization training slides
Darrel Rader
 

Similar to Testing a Service Fabric solution and live happy!! (20)

Building strong foundations apex enterprise patterns
Building strong foundations apex enterprise patternsBuilding strong foundations apex enterprise patterns
Building strong foundations apex enterprise patterns
 
GemFire In-Memory Data Grid
GemFire In-Memory Data GridGemFire In-Memory Data Grid
GemFire In-Memory Data Grid
 
Azure development
Azure developmentAzure development
Azure development
 
Oracle appsloadtestbestpractices
Oracle appsloadtestbestpracticesOracle appsloadtestbestpractices
Oracle appsloadtestbestpractices
 
Kubernetes & Co, beyond the hype
Kubernetes & Co, beyond the hypeKubernetes & Co, beyond the hype
Kubernetes & Co, beyond the hype
 
E catt tutorial
E catt tutorialE catt tutorial
E catt tutorial
 
How to upgrade to MongoDB 4.0 - Percona Europe 2018
How to upgrade to MongoDB 4.0 - Percona Europe 2018How to upgrade to MongoDB 4.0 - Percona Europe 2018
How to upgrade to MongoDB 4.0 - Percona Europe 2018
 
GemFire In Memory Data Grid
GemFire In Memory Data GridGemFire In Memory Data Grid
GemFire In Memory Data Grid
 
Muves3 Elastic Grid Java One2009 Final
Muves3 Elastic Grid Java One2009 FinalMuves3 Elastic Grid Java One2009 Final
Muves3 Elastic Grid Java One2009 Final
 
Architecting .NET solutions in a Docker ecosystem - .NET Fest Kyiv 2019
Architecting .NET solutions in a Docker ecosystem - .NET Fest Kyiv 2019Architecting .NET solutions in a Docker ecosystem - .NET Fest Kyiv 2019
Architecting .NET solutions in a Docker ecosystem - .NET Fest Kyiv 2019
 
Coldbox developer training – session 4
Coldbox developer training – session 4Coldbox developer training – session 4
Coldbox developer training – session 4
 
Aws meetup systems_manager
Aws meetup systems_managerAws meetup systems_manager
Aws meetup systems_manager
 
patchVantage Cloud Starter Pack
patchVantage Cloud Starter Pack patchVantage Cloud Starter Pack
patchVantage Cloud Starter Pack
 
Tips for Developing and Testing IBM HATS Applications
Tips for Developing and Testing IBM HATS ApplicationsTips for Developing and Testing IBM HATS Applications
Tips for Developing and Testing IBM HATS Applications
 
API Performance testing with Gatling
API Performance testing with GatlingAPI Performance testing with Gatling
API Performance testing with Gatling
 
Windows 2012 R2 Multi Server Management
Windows 2012 R2 Multi Server ManagementWindows 2012 R2 Multi Server Management
Windows 2012 R2 Multi Server Management
 
Managing Millions of Tests Using Databricks
Managing Millions of Tests Using DatabricksManaging Millions of Tests Using Databricks
Managing Millions of Tests Using Databricks
 
Tce automation-d4-110102123012-phpapp01
Tce automation-d4-110102123012-phpapp01Tce automation-d4-110102123012-phpapp01
Tce automation-d4-110102123012-phpapp01
 
Operational Best Practices in the Cloud
Operational Best Practices in the CloudOperational Best Practices in the Cloud
Operational Best Practices in the Cloud
 
Rit 8.5.0 virtualization training slides
Rit 8.5.0 virtualization training slidesRit 8.5.0 virtualization training slides
Rit 8.5.0 virtualization training slides
 

More from Massimo Bonanni

Architetture Serverless con SQL Server e Azure Functions
Architetture Serverless con SQL Server e Azure FunctionsArchitetture Serverless con SQL Server e Azure Functions
Architetture Serverless con SQL Server e Azure Functions
Massimo Bonanni
 
IoT in salsa serverless
IoT in salsa serverlessIoT in salsa serverless
IoT in salsa serverless
Massimo Bonanni
 
Tutto quello che avreste voluto sapere sull'API Management (e non avete mai o...
Tutto quello che avreste voluto sapere sull'API Management (e non avete mai o...Tutto quello che avreste voluto sapere sull'API Management (e non avete mai o...
Tutto quello che avreste voluto sapere sull'API Management (e non avete mai o...
Massimo Bonanni
 
Empower every Azure Function to achieve more!!
Empower every Azure Function to achieve more!!Empower every Azure Function to achieve more!!
Empower every Azure Function to achieve more!!
Massimo Bonanni
 
Everything you always wanted to know about API Management (but were afraid to...
Everything you always wanted to know about API Management (but were afraid to...Everything you always wanted to know about API Management (but were afraid to...
Everything you always wanted to know about API Management (but were afraid to...
Massimo Bonanni
 
Welcome Azure Functions 2. 0
Welcome Azure Functions 2. 0Welcome Azure Functions 2. 0
Welcome Azure Functions 2. 0
Massimo Bonanni
 
Discovering the Service Fabric's actor model
Discovering the Service Fabric's actor modelDiscovering the Service Fabric's actor model
Discovering the Service Fabric's actor model
Massimo Bonanni
 
Discovering the Service Fabric's actor model
Discovering the Service Fabric's actor modelDiscovering the Service Fabric's actor model
Discovering the Service Fabric's actor model
Massimo Bonanni
 
Soluzioni IoT con le tecnologie Microsoft
Soluzioni IoT con le tecnologie MicrosoftSoluzioni IoT con le tecnologie Microsoft
Soluzioni IoT con le tecnologie Microsoft
Massimo Bonanni
 
Project Gesture & Real Sense: il potere nelle mani!!
Project Gesture & Real Sense: il potere nelle mani!!Project Gesture & Real Sense: il potere nelle mani!!
Project Gesture & Real Sense: il potere nelle mani!!
Massimo Bonanni
 
Project Gesture & RealSense: gestures in a simple way!!
Project Gesture & RealSense: gestures in a simple way!!Project Gesture & RealSense: gestures in a simple way!!
Project Gesture & RealSense: gestures in a simple way!!
Massimo Bonanni
 
Project Prague & RealSense: il potere nelle mani!!
Project Prague & RealSense: il potere nelle mani!!Project Prague & RealSense: il potere nelle mani!!
Project Prague & RealSense: il potere nelle mani!!
Massimo Bonanni
 
L'approccio ai microservizi secondo Service Fabric
L'approccio ai microservizi secondo Service FabricL'approccio ai microservizi secondo Service Fabric
L'approccio ai microservizi secondo Service Fabric
Massimo Bonanni
 
The Microservices world in. NET Core and. NET framework
The Microservices world in. NET Core and. NET frameworkThe Microservices world in. NET Core and. NET framework
The Microservices world in. NET Core and. NET framework
Massimo Bonanni
 
Microservices architecture & Service Fabric
Microservices architecture & Service FabricMicroservices architecture & Service Fabric
Microservices architecture & Service Fabric
Massimo Bonanni
 
Introduzione allo sviluppo UWP per xBox
Introduzione allo sviluppo UWP per xBoxIntroduzione allo sviluppo UWP per xBox
Introduzione allo sviluppo UWP per xBox
Massimo Bonanni
 
Cognitive Services & LUIS
Cognitive Services & LUISCognitive Services & LUIS
Cognitive Services & LUIS
Massimo Bonanni
 
Service Fabric: la potenza dei micro servizi
Service Fabric:  la potenza dei micro serviziService Fabric:  la potenza dei micro servizi
Service Fabric: la potenza dei micro servizi
Massimo Bonanni
 
Automated UI testing for iOs and Android mobile apps
Automated UI testing for iOs and Android mobile appsAutomated UI testing for iOs and Android mobile apps
Automated UI testing for iOs and Android mobile apps
Massimo Bonanni
 
Soluzioni IoT con le tecnologie Microsoft
Soluzioni IoT con le tecnologie MicrosoftSoluzioni IoT con le tecnologie Microsoft
Soluzioni IoT con le tecnologie Microsoft
Massimo Bonanni
 

More from Massimo Bonanni (20)

Architetture Serverless con SQL Server e Azure Functions
Architetture Serverless con SQL Server e Azure FunctionsArchitetture Serverless con SQL Server e Azure Functions
Architetture Serverless con SQL Server e Azure Functions
 
IoT in salsa serverless
IoT in salsa serverlessIoT in salsa serverless
IoT in salsa serverless
 
Tutto quello che avreste voluto sapere sull'API Management (e non avete mai o...
Tutto quello che avreste voluto sapere sull'API Management (e non avete mai o...Tutto quello che avreste voluto sapere sull'API Management (e non avete mai o...
Tutto quello che avreste voluto sapere sull'API Management (e non avete mai o...
 
Empower every Azure Function to achieve more!!
Empower every Azure Function to achieve more!!Empower every Azure Function to achieve more!!
Empower every Azure Function to achieve more!!
 
Everything you always wanted to know about API Management (but were afraid to...
Everything you always wanted to know about API Management (but were afraid to...Everything you always wanted to know about API Management (but were afraid to...
Everything you always wanted to know about API Management (but were afraid to...
 
Welcome Azure Functions 2. 0
Welcome Azure Functions 2. 0Welcome Azure Functions 2. 0
Welcome Azure Functions 2. 0
 
Discovering the Service Fabric's actor model
Discovering the Service Fabric's actor modelDiscovering the Service Fabric's actor model
Discovering the Service Fabric's actor model
 
Discovering the Service Fabric's actor model
Discovering the Service Fabric's actor modelDiscovering the Service Fabric's actor model
Discovering the Service Fabric's actor model
 
Soluzioni IoT con le tecnologie Microsoft
Soluzioni IoT con le tecnologie MicrosoftSoluzioni IoT con le tecnologie Microsoft
Soluzioni IoT con le tecnologie Microsoft
 
Project Gesture & Real Sense: il potere nelle mani!!
Project Gesture & Real Sense: il potere nelle mani!!Project Gesture & Real Sense: il potere nelle mani!!
Project Gesture & Real Sense: il potere nelle mani!!
 
Project Gesture & RealSense: gestures in a simple way!!
Project Gesture & RealSense: gestures in a simple way!!Project Gesture & RealSense: gestures in a simple way!!
Project Gesture & RealSense: gestures in a simple way!!
 
Project Prague & RealSense: il potere nelle mani!!
Project Prague & RealSense: il potere nelle mani!!Project Prague & RealSense: il potere nelle mani!!
Project Prague & RealSense: il potere nelle mani!!
 
L'approccio ai microservizi secondo Service Fabric
L'approccio ai microservizi secondo Service FabricL'approccio ai microservizi secondo Service Fabric
L'approccio ai microservizi secondo Service Fabric
 
The Microservices world in. NET Core and. NET framework
The Microservices world in. NET Core and. NET frameworkThe Microservices world in. NET Core and. NET framework
The Microservices world in. NET Core and. NET framework
 
Microservices architecture & Service Fabric
Microservices architecture & Service FabricMicroservices architecture & Service Fabric
Microservices architecture & Service Fabric
 
Introduzione allo sviluppo UWP per xBox
Introduzione allo sviluppo UWP per xBoxIntroduzione allo sviluppo UWP per xBox
Introduzione allo sviluppo UWP per xBox
 
Cognitive Services & LUIS
Cognitive Services & LUISCognitive Services & LUIS
Cognitive Services & LUIS
 
Service Fabric: la potenza dei micro servizi
Service Fabric:  la potenza dei micro serviziService Fabric:  la potenza dei micro servizi
Service Fabric: la potenza dei micro servizi
 
Automated UI testing for iOs and Android mobile apps
Automated UI testing for iOs and Android mobile appsAutomated UI testing for iOs and Android mobile apps
Automated UI testing for iOs and Android mobile apps
 
Soluzioni IoT con le tecnologie Microsoft
Soluzioni IoT con le tecnologie MicrosoftSoluzioni IoT con le tecnologie Microsoft
Soluzioni IoT con le tecnologie Microsoft
 

Recently uploaded

Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
Fwdays
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Pitangent Analytics & Technology Solutions Pvt. Ltd
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
christinelarrosa
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
Edge AI and Vision Alliance
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
DanBrown980551
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
DianaGray10
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
UiPathCommunity
 
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
Fwdays
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
Mydbops
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 

Recently uploaded (20)

Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
 
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 

Testing a Service Fabric solution and live happy!!

  • 1. 1 Testing a Service Fabric solution and live happy!!! Massimo Bonanni Paranormal Developer, with the head in the Cloud and all the REST in microservices! @massimobonanni massimo.bonanni@microsoft.com
  • 5. 5
  • 6. 6
  • 8. 8 Programming Models Dev & Ops Tooling Orchestration Lifecycle Management Health & Monitoring Always On Availability Auto Scaling AzureOn-premises infrastructureAny cloudDev machine Service Fabric: Microservices platform ExecutablesReliable Services (.NET, Java) Reliable Actors (.NET, Java)ASP.NET Core Containers
  • 9. 9 F5 is our friend…. It is the most used test tools It's free and you can find it in all Visual Studio versions You don’t have to write any additional code
  • 10. 10 F5 is not useful …. with Service Fabric Resources – you need a local cluster Time – you need to publish the app Code complete – you need all the microservices you interact with
  • 11. 11 Why unit test… A unit test is an automated piece of code that invokes a unit of work in the system and then checks a single assumption about the behavior of that unit of work. Roy Osherove – The Art Of Unit Testing Microservices are small, perform single functionality and loosely coupled. Microservices Architecture
  • 12. 12 Why unit test… A unit test is an automated piece of code that invokes a unit of work in the system and then checks a single assumption about the behavior of that unit of work. Roy Osherove – The Art Of Unit Testing Microservices are small, perform single functionality and loosely coupled. Microservices Architecture A microservice is your Unit of Work to test!!!
  • 13. 13 The three obstacles Your µService Service Fabric Platform Replicas Partitioning State Management…… File System Database Web Service External Components Others µServices
  • 14. 14 Real case: Shopping Cart & Order We model 3 typical shopping cart scenarios • The cart can be created only if it is a new cart Creating the shopping cart • Need to check if the product is still available Adding a product to the cart • The order is created starting from the cart and only if the order is new Creating an order from the cart
  • 15. 15 Scenario : Creating the shopping cart We must "replace" the Service Fabric platform, so our tests doesn’t need the cluster. Service Fabric Platform Replicas Partitioning State Management ……
  • 16. 16 Scenario : Creating the shopping cart this.StateManager.TryGetStateAsync<State>(StateKeyName, cancellationToken); this.StateManager.SetStateAsync(StateKeyName, state, cancellationToken); this.RegisterReminderAsync(ExpiredReminderName, null, CartExpiredTimeout, TimeSpan.FromMilliseconds(-1));
  • 17. 17 Scenario : Adding a product to the cart We need to decouple our microservice from external components, so that our tests can verify only the actor's logic. File System Database Web Service External Components
  • 18. 18 Scenario : Adding a product to the cart private async Task<ProductData> GetProductFromStorageAsync(string productId, double quantity, CancellationToken cancellationToken) { ProductData result = null; try { using (SqlConnection conn = new SqlConnection(connectionString)) using (SqlCommand cmd = new SqlCommand("CheckProduct", conn)) { // Database code } } catch { result = null; } return result; }
  • 19. 19 Scenario : Creating an order from the cart We must to replace the static classes ActorProxy and ServiceProxy used in the creation of communication proxies. Others µServices
  • 20. 20 Scenario : Creating an order from the cart var orderProxy = ActorProxy.Create<IOrderActor>(this.Id, new Uri("fabric:/TestingApp/OrderActor"));
  • 22. 22 The three obstacles….three solutions! Your µService Service Fabric Platform Replicas Partitioning State Management …… File System Database Web Service External Components Others µServices Mock the platform (ServiceFabric.Mocks) Abstract the proxy factories Create a layer of indirection
  • 24. 24 Keep the stability!!!! Solutions based on distributed architectures such as cloud infrastructures must be: This is why you need to be able to test the stability of your solutions when complex state transitions due to errors occur in the underlying infrastructure. •able to withstand or recover quickly from difficult conditionsResilient • its status does not get corrupted as a result of a problemReliable
  • 25. 25 What can go wrong in production? Restarting a node Restarting a distributed code package Removing a replica Restarting a replica Moving a primary replica Moving a secondary replica Remove a node Add a node
  • 26. 26
  • 27. 27 Start-ServiceFabricChaos Chaos induces faults in the cluster based on the received input parameters. Chaos runs in multiple iterations: each iteration consists of faults and cluster validation. You can control: • how long Chaos runs, • how long it waits between iterations, • how many faults it can induce during an iteration, • how long it waits between faults. • ….
  • 29. 29 Take away…. Keep the microservices simple….they will be testability simply! When design a solution, keep in mind the testability! Mock, fake and shim are your best friends! If car companies launch expensive cars against a wall to test them, why should not you do it with your code?