SlideShare a Scribd company logo
The art of Azure Functions (unit)
testing and monitoring
Massimo Bonanni
Paranormal Trainer, with the head in the Cloud and all the REST in microservices!
massimo.bonanni@microsoft.com
@massimobonanni
The issue….
If you want to use Azure Functions
as a components of your Enterprise
solutions, you must to test and
monitor them!!!
What are Azure Functions
Author functions in
C#, F#, Node.JS, Java,
Powershell, and
more
CodeEvents
React to timers,
HTTP, or events from
your favorite Azure
services, with more
on the way
Outputs
Send results to an
ever-growing
collection of services
What is a Unit Test
In a unit test you invoke a piece of your
code with a set of parameters and you
checks the correctness its behavior.
In a unit test you must substitute all
your external reference with a mock or
stub.
Mock is for the software what a dummy
is for a car crash test (you don’t test a car
with a human being inside…I Hope!!)
Azure Functions Dependencies
You should implement your Azure Functions to allow you to
use mock/stub for all external reference!
Your
Function
Trigger
Binding
Binding
Binding
Binding
Logger
(infrastructure)
Your Service
Your Service
Your Service
Your Service
Azure Function … untestable!!
Azure Function … trigger!!
Trigger
You can mock it because
the trigger payload is a
POCO class
Azure Function … bindings!!
Binding
You can mock it because
the binding payload is an
interface
Azure Function … logger!!
Logger
(infrastructural stuffs)
You can mock it because
the logger is an interface
Azure Function … your service!!
External service
You cannot substitute it
with your mock because it
is created inside the Azure
Function and you haven’t a
way to substitute it
Make your Azure Function testable!!!
Azure Function … testable!!
Constructor Injection
You can choose what kind of actual
service you want to use when you
instantiate the function.
In a test you can substitute it
with a mock!!
Azure Function … how to use mock!!
Mock
Create a mock to use in the
test!!
Azure Functions
Unit Testing
DEMO
Monitoring Azure Functions
Once you deploy your Azure Functions on Azure, you need to monitor them to check when
something goes wrong.
The signature of an Azure Function method provides the instance of ILogger that you can use to
log information about your code.
Using ILogger, you can collect information from your code execution to monitor and triage
errors and exceptions.
Azure Functions Monitor
Azure Functions provide out-of-the-box monitor feature.
For each Function, you have info about every function execution.
Azure Functions and Application Insight
The Azure Functions platform offers built-in integration with Azure
Application Insights.
Put the Application Insights instrumentation key in the function app
settings.
Custom Metric
Azure Function SDK provides
you extension methods to
log custom metrics.
Azure Functions
Monitoring
DEMO
Take away
Writing an Azure Functions is simple!
Testing Azure Functions is simple!
Monitoring Azure Functions is simple!
…. then ….
The art of Azure Functions (unit) testing and monitoring
Q&A
Thanks for your
attention!!!!!
Massimo Bonanni
Azure Technical Trainer @ Microsoft
massimo.bonanni@microsoft.com
@massimobonanni
Connect with me on LinkedIn
linkedin.com/in/massimobonanni/
http://bit.ly/MasteringServerless
Q&A
References
Azure Functions Documentation
https://docs.microsoft.com/en-US/azure/azure-functions/
Azure Functions Code Samples
https://azure.microsoft.com/en-us/resources/samples/?service=functions&sort=0
Azure Updates
https://azure.microsoft.com/en-us/roadmap/?category=compute
Demo MortgageCalculator – GitHub
http://bit.ly/TestAZFunc
Demo Monitor Azure Functions – GitHub
http://bit.ly/MonitorAZFunc
Ad

More Related Content

What's hot (20)

IoT in salsa Serverless
IoT in salsa ServerlessIoT in salsa Serverless
IoT in salsa Serverless
Massimo Bonanni
 
IoT in salsa serverless
IoT in salsa serverlessIoT in salsa serverless
IoT in salsa serverless
Massimo Bonanni
 
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
 
TUTTO SU VISUAL STUDIO ALM 2015
TUTTO SU VISUAL STUDIO ALM 2015TUTTO SU VISUAL STUDIO ALM 2015
TUTTO SU VISUAL STUDIO ALM 2015
DotNetCampus
 
70-534: ARCHITECTING MICROSOFT AZURE SOLUTIONS
70-534: ARCHITECTING MICROSOFT AZURE SOLUTIONS70-534: ARCHITECTING MICROSOFT AZURE SOLUTIONS
70-534: ARCHITECTING MICROSOFT AZURE SOLUTIONS
DotNetCampus
 
Dnc2015 azure-microservizi-vforusso
Dnc2015 azure-microservizi-vforussoDnc2015 azure-microservizi-vforusso
Dnc2015 azure-microservizi-vforusso
DotNetCampus
 
Servicehost Customization
Servicehost CustomizationServicehost Customization
Servicehost Customization
Eyal Vardi
 
First Look at Azure Logic Apps (BAUG)
First Look at Azure Logic Apps (BAUG)First Look at Azure Logic Apps (BAUG)
First Look at Azure Logic Apps (BAUG)
Daniel Toomey
 
Serverless API with Azure Functions
Serverless API with Azure FunctionsServerless API with Azure Functions
Serverless API with Azure Functions
Analben Mehta
 
ALM@Work - Team collaboration with visual studio alm 2012
ALM@Work - Team collaboration with visual studio alm 2012ALM@Work - Team collaboration with visual studio alm 2012
ALM@Work - Team collaboration with visual studio alm 2012
DomusDotNet
 
From AUI to Atlaskit - Streamlining Development for Server & Cloud Apps
From AUI to Atlaskit - Streamlining Development for Server & Cloud AppsFrom AUI to Atlaskit - Streamlining Development for Server & Cloud Apps
From AUI to Atlaskit - Streamlining Development for Server & Cloud Apps
Atlassian
 
Building Faster With Your Team's UI Kit
Building Faster With Your Team's UI KitBuilding Faster With Your Team's UI Kit
Building Faster With Your Team's UI Kit
Atlassian
 
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
 
Azure IoT Central
Azure IoT CentralAzure IoT Central
Azure IoT Central
Marco Parenzan
 
NashTech - Azure Application Insights
NashTech - Azure Application InsightsNashTech - Azure Application Insights
NashTech - Azure Application Insights
Phi Huynh
 
Unleash the power of Serverless Computing
Unleash the power of Serverless ComputingUnleash the power of Serverless Computing
Unleash the power of Serverless Computing
Gaurav Madaan
 
ASP.NET MVC 5 and SignalR 2
ASP.NET MVC 5 and SignalR 2ASP.NET MVC 5 and SignalR 2
ASP.NET MVC 5 and SignalR 2
Jaliya Udagedara
 
Mobx Internals
Mobx InternalsMobx Internals
Mobx Internals
500Tech
 
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
 
Angular2 + Ng-Lightning + Lightning Design System = Great Apps
Angular2 + Ng-Lightning + Lightning Design System = Great AppsAngular2 + Ng-Lightning + Lightning Design System = Great Apps
Angular2 + Ng-Lightning + Lightning Design System = Great Apps
Emily Hurn
 
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
 
TUTTO SU VISUAL STUDIO ALM 2015
TUTTO SU VISUAL STUDIO ALM 2015TUTTO SU VISUAL STUDIO ALM 2015
TUTTO SU VISUAL STUDIO ALM 2015
DotNetCampus
 
70-534: ARCHITECTING MICROSOFT AZURE SOLUTIONS
70-534: ARCHITECTING MICROSOFT AZURE SOLUTIONS70-534: ARCHITECTING MICROSOFT AZURE SOLUTIONS
70-534: ARCHITECTING MICROSOFT AZURE SOLUTIONS
DotNetCampus
 
Dnc2015 azure-microservizi-vforusso
Dnc2015 azure-microservizi-vforussoDnc2015 azure-microservizi-vforusso
Dnc2015 azure-microservizi-vforusso
DotNetCampus
 
Servicehost Customization
Servicehost CustomizationServicehost Customization
Servicehost Customization
Eyal Vardi
 
First Look at Azure Logic Apps (BAUG)
First Look at Azure Logic Apps (BAUG)First Look at Azure Logic Apps (BAUG)
First Look at Azure Logic Apps (BAUG)
Daniel Toomey
 
Serverless API with Azure Functions
Serverless API with Azure FunctionsServerless API with Azure Functions
Serverless API with Azure Functions
Analben Mehta
 
ALM@Work - Team collaboration with visual studio alm 2012
ALM@Work - Team collaboration with visual studio alm 2012ALM@Work - Team collaboration with visual studio alm 2012
ALM@Work - Team collaboration with visual studio alm 2012
DomusDotNet
 
From AUI to Atlaskit - Streamlining Development for Server & Cloud Apps
From AUI to Atlaskit - Streamlining Development for Server & Cloud AppsFrom AUI to Atlaskit - Streamlining Development for Server & Cloud Apps
From AUI to Atlaskit - Streamlining Development for Server & Cloud Apps
Atlassian
 
Building Faster With Your Team's UI Kit
Building Faster With Your Team's UI KitBuilding Faster With Your Team's UI Kit
Building Faster With Your Team's UI Kit
Atlassian
 
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
 
NashTech - Azure Application Insights
NashTech - Azure Application InsightsNashTech - Azure Application Insights
NashTech - Azure Application Insights
Phi Huynh
 
Unleash the power of Serverless Computing
Unleash the power of Serverless ComputingUnleash the power of Serverless Computing
Unleash the power of Serverless Computing
Gaurav Madaan
 
ASP.NET MVC 5 and SignalR 2
ASP.NET MVC 5 and SignalR 2ASP.NET MVC 5 and SignalR 2
ASP.NET MVC 5 and SignalR 2
Jaliya Udagedara
 
Mobx Internals
Mobx InternalsMobx Internals
Mobx Internals
500Tech
 
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
 
Angular2 + Ng-Lightning + Lightning Design System = Great Apps
Angular2 + Ng-Lightning + Lightning Design System = Great AppsAngular2 + Ng-Lightning + Lightning Design System = Great Apps
Angular2 + Ng-Lightning + Lightning Design System = Great Apps
Emily Hurn
 

Similar to The art of Azure Functions (unit) testing and monitoring (20)

slides.pptx
slides.pptxslides.pptx
slides.pptx
abcabc794064
 
Azure Functions.pptx
Azure Functions.pptxAzure Functions.pptx
Azure Functions.pptx
YachikaKamra
 
Anti Patterns and Mistakes Using Serverless (ServerlessConf SF - 08 2018)
Anti Patterns and Mistakes Using Serverless (ServerlessConf SF - 08 2018)Anti Patterns and Mistakes Using Serverless (ServerlessConf SF - 08 2018)
Anti Patterns and Mistakes Using Serverless (ServerlessConf SF - 08 2018)
Yochay Kiriaty
 
Using Azure Machine Learning Models
Using Azure Machine Learning ModelsUsing Azure Machine Learning Models
Using Azure Machine Learning Models
Eng Teong Cheah
 
Angular Unit Testing
Angular Unit TestingAngular Unit Testing
Angular Unit Testing
Alessandro Giorgetti
 
Save Azure Cost
Save Azure CostSave Azure Cost
Save Azure Cost
Karthikeyan VK
 
From PowerShell Function to Serverless code with Azure Functions
From PowerShell Function to Serverless code with Azure FunctionsFrom PowerShell Function to Serverless code with Azure Functions
From PowerShell Function to Serverless code with Azure Functions
Jaap Brasser
 
Automated Testing on iOS
Automated Testing on iOSAutomated Testing on iOS
Automated Testing on iOS
Make School
 
Serverless Computing with Azure
Serverless Computing with AzureServerless Computing with Azure
Serverless Computing with Azure
Analben Mehta
 
Unit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJSUnit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJS
Knoldus Inc.
 
Durable functions
Durable functionsDurable functions
Durable functions
Toan Nguyen
 
Automation strategies for agile testing Gaurav bansal
Automation strategies for agile testing  Gaurav bansalAutomation strategies for agile testing  Gaurav bansal
Automation strategies for agile testing Gaurav bansal
India Scrum Enthusiasts Community
 
Tips for Testing Your Flutter App - Best Practices and Tools.pdf
Tips for Testing Your Flutter App - Best Practices and Tools.pdfTips for Testing Your Flutter App - Best Practices and Tools.pdf
Tips for Testing Your Flutter App - Best Practices and Tools.pdf
Lisa Brown
 
Unit tests & TDD
Unit tests & TDDUnit tests & TDD
Unit tests & TDD
Dror Helper
 
Containers and Virtualisation for Continuous Testing
Containers and Virtualisation for Continuous Testing   Containers and Virtualisation for Continuous Testing
Containers and Virtualisation for Continuous Testing
sbbabu
 
Getting Started with Serverless Architectures using Azure Functions
Getting Started with Serverless Architectures using Azure FunctionsGetting Started with Serverless Architectures using Azure Functions
Getting Started with Serverless Architectures using Azure Functions
Marc Duiker
 
Testing Angular apps_ A complete guide for developers.pdf
Testing Angular apps_ A complete guide for developers.pdfTesting Angular apps_ A complete guide for developers.pdf
Testing Angular apps_ A complete guide for developers.pdf
Peerbits
 
Introduction to Azure Functions
Introduction to Azure FunctionsIntroduction to Azure Functions
Introduction to Azure Functions
Callon Campbell
 
Azure Functions - Introduction
Azure Functions - IntroductionAzure Functions - Introduction
Azure Functions - Introduction
Venkatesh Narayanan
 
Espresso workshop
Espresso workshopEspresso workshop
Espresso workshop
Ketan Soni
 
Azure Functions.pptx
Azure Functions.pptxAzure Functions.pptx
Azure Functions.pptx
YachikaKamra
 
Anti Patterns and Mistakes Using Serverless (ServerlessConf SF - 08 2018)
Anti Patterns and Mistakes Using Serverless (ServerlessConf SF - 08 2018)Anti Patterns and Mistakes Using Serverless (ServerlessConf SF - 08 2018)
Anti Patterns and Mistakes Using Serverless (ServerlessConf SF - 08 2018)
Yochay Kiriaty
 
Using Azure Machine Learning Models
Using Azure Machine Learning ModelsUsing Azure Machine Learning Models
Using Azure Machine Learning Models
Eng Teong Cheah
 
From PowerShell Function to Serverless code with Azure Functions
From PowerShell Function to Serverless code with Azure FunctionsFrom PowerShell Function to Serverless code with Azure Functions
From PowerShell Function to Serverless code with Azure Functions
Jaap Brasser
 
Automated Testing on iOS
Automated Testing on iOSAutomated Testing on iOS
Automated Testing on iOS
Make School
 
Serverless Computing with Azure
Serverless Computing with AzureServerless Computing with Azure
Serverless Computing with Azure
Analben Mehta
 
Unit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJSUnit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJS
Knoldus Inc.
 
Durable functions
Durable functionsDurable functions
Durable functions
Toan Nguyen
 
Tips for Testing Your Flutter App - Best Practices and Tools.pdf
Tips for Testing Your Flutter App - Best Practices and Tools.pdfTips for Testing Your Flutter App - Best Practices and Tools.pdf
Tips for Testing Your Flutter App - Best Practices and Tools.pdf
Lisa Brown
 
Unit tests & TDD
Unit tests & TDDUnit tests & TDD
Unit tests & TDD
Dror Helper
 
Containers and Virtualisation for Continuous Testing
Containers and Virtualisation for Continuous Testing   Containers and Virtualisation for Continuous Testing
Containers and Virtualisation for Continuous Testing
sbbabu
 
Getting Started with Serverless Architectures using Azure Functions
Getting Started with Serverless Architectures using Azure FunctionsGetting Started with Serverless Architectures using Azure Functions
Getting Started with Serverless Architectures using Azure Functions
Marc Duiker
 
Testing Angular apps_ A complete guide for developers.pdf
Testing Angular apps_ A complete guide for developers.pdfTesting Angular apps_ A complete guide for developers.pdf
Testing Angular apps_ A complete guide for developers.pdf
Peerbits
 
Introduction to Azure Functions
Introduction to Azure FunctionsIntroduction to Azure Functions
Introduction to Azure Functions
Callon Campbell
 
Espresso workshop
Espresso workshopEspresso workshop
Espresso workshop
Ketan Soni
 
Ad

More from Massimo Bonanni (17)

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
 
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
 
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
 
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
 
Xamarin Test Cloud
Xamarin Test CloudXamarin Test Cloud
Xamarin Test Cloud
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
 
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
 
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
 
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
 
Ad

Recently uploaded (20)

How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 

The art of Azure Functions (unit) testing and monitoring

  • 1. The art of Azure Functions (unit) testing and monitoring Massimo Bonanni Paranormal Trainer, with the head in the Cloud and all the REST in microservices! [email protected] @massimobonanni
  • 2. The issue…. If you want to use Azure Functions as a components of your Enterprise solutions, you must to test and monitor them!!!
  • 3. What are Azure Functions Author functions in C#, F#, Node.JS, Java, Powershell, and more CodeEvents React to timers, HTTP, or events from your favorite Azure services, with more on the way Outputs Send results to an ever-growing collection of services
  • 4. What is a Unit Test In a unit test you invoke a piece of your code with a set of parameters and you checks the correctness its behavior. In a unit test you must substitute all your external reference with a mock or stub. Mock is for the software what a dummy is for a car crash test (you don’t test a car with a human being inside…I Hope!!)
  • 5. Azure Functions Dependencies You should implement your Azure Functions to allow you to use mock/stub for all external reference! Your Function Trigger Binding Binding Binding Binding Logger (infrastructure) Your Service Your Service Your Service Your Service
  • 6. Azure Function … untestable!!
  • 7. Azure Function … trigger!! Trigger You can mock it because the trigger payload is a POCO class
  • 8. Azure Function … bindings!! Binding You can mock it because the binding payload is an interface
  • 9. Azure Function … logger!! Logger (infrastructural stuffs) You can mock it because the logger is an interface
  • 10. Azure Function … your service!! External service You cannot substitute it with your mock because it is created inside the Azure Function and you haven’t a way to substitute it
  • 11. Make your Azure Function testable!!!
  • 12. Azure Function … testable!! Constructor Injection You can choose what kind of actual service you want to use when you instantiate the function. In a test you can substitute it with a mock!!
  • 13. Azure Function … how to use mock!! Mock Create a mock to use in the test!!
  • 15. Monitoring Azure Functions Once you deploy your Azure Functions on Azure, you need to monitor them to check when something goes wrong. The signature of an Azure Function method provides the instance of ILogger that you can use to log information about your code. Using ILogger, you can collect information from your code execution to monitor and triage errors and exceptions.
  • 16. Azure Functions Monitor Azure Functions provide out-of-the-box monitor feature. For each Function, you have info about every function execution.
  • 17. Azure Functions and Application Insight The Azure Functions platform offers built-in integration with Azure Application Insights. Put the Application Insights instrumentation key in the function app settings.
  • 18. Custom Metric Azure Function SDK provides you extension methods to log custom metrics.
  • 20. Take away Writing an Azure Functions is simple! Testing Azure Functions is simple! Monitoring Azure Functions is simple! …. then ….
  • 22. Q&A Thanks for your attention!!!!! Massimo Bonanni Azure Technical Trainer @ Microsoft [email protected] @massimobonanni Connect with me on LinkedIn linkedin.com/in/massimobonanni/ http://bit.ly/MasteringServerless Q&A
  • 23. References Azure Functions Documentation https://docs.microsoft.com/en-US/azure/azure-functions/ Azure Functions Code Samples https://azure.microsoft.com/en-us/resources/samples/?service=functions&sort=0 Azure Updates https://azure.microsoft.com/en-us/roadmap/?category=compute Demo MortgageCalculator – GitHub http://bit.ly/TestAZFunc Demo Monitor Azure Functions – GitHub http://bit.ly/MonitorAZFunc