SlideShare a Scribd company logo
1 of 67
Download to read offline
For Microsoft Dynamics CRM Partners and Customers
Testing & Dynamics CRM
2011
Wael Hamze
CRM Architect
For Microsoft Dynamics CRM Partners and Customers
Agenda
• Scope
• Current Reality of Testing
• Objectives
• How?
• Future Considerations
• Summary, Next Steps & Conclusion
• Questions
For Microsoft Dynamics CRM Partners and Customers
Current Reality of Testing
• No Testing
• Manual Testing in the end
• It works for me
• Testing using one client only
• Testing using no real data
• Assume all data is correct
• Difficult to test Dynamics in general
For Microsoft Dynamics CRM Partners and Customers
Objectives
• Show how to easily test Plug-ins & Custom
Workflow Activities
• Provide best practices for testing Plug-ins
& Custom Workflow Activities
• Encourage testing practices in CRM
Projects
• Improve Quality & Reliability of CRM
Projects without impacting Timescales
For Microsoft Dynamics CRM Partners and Customers
How?
For Microsoft Dynamics CRM Partners and Customers
Tools & Patterns
• Tools
– CRM Developer Toolkit
– Unit Test Framework (MSTest)
– Mocking Framework (MOQ)
• Patterns
– Dependency Injection
For Microsoft Dynamics CRM Partners and Customers
Planning
• Plan for Testing from the beginning
– Decide on Tools & Framework
• CRM Developer Toolkit
– Provide a Testable Architecture
– Write Testable Code
For Microsoft Dynamics CRM Partners and Customers
Component Design/Architecture
CRM SDK/Platform
Framework
Common
Plug-ins WF Activities
Testing
For Microsoft Dynamics CRM Partners and Customers
Visual Studio Solution
For Microsoft Dynamics CRM Partners and Customers
Common & Framework Deployment
Framework
Common
Plug-ins
Merged Plug-in
Framework
Common
Plug-ins
ILMerge CRMDeploy
For Microsoft Dynamics CRM Partners and Customers
How to Merge?
For Microsoft Dynamics CRM Partners and Customers
How to Deploy?
For Microsoft Dynamics CRM Partners and Customers
Solution Design Benefits
• Reusable Logic (Framework & Common)
• No Code Duplication
• Framework & Common can be Tested in
Isolation
• CRM Developer Toolkit
– Speed Up Development
– Easy Deployment
– Consistency
For Microsoft Dynamics CRM Partners and Customers
Write Testable Code
• Use Interfaces
• Use Dependency Injection
• De-couple Business & Data Access logic
For Microsoft Dynamics CRM Partners and Customers
Unit Testing
Dependency 1
Component
Dependency 2
Unit Tests
Mock 1 Mock 2
For Microsoft Dynamics CRM Partners and Customers
Why Write Unit Tests?
• Ability to Test Plug-ins & Custom Workflow
Activities without CRM Environment
• Ability to Test without Deployment
• Tests run much quicker
• Detect bugs very early and fix quickly
• No Remote Debugging means Easier
Development by Debugging in Visual
Studio
For Microsoft Dynamics CRM Partners and Customers
Testable Code
Dependency Injection
ClassA ServiceA
Uses
Builder
Container
ServiceA
Creates
IServiceAClassA
Uses
Implements
Create ClassA + Inject IServiceA
For Microsoft Dynamics CRM Partners and Customers
Dependency Injection
• Types of Injection
– Constructor Injection
– Property Injection
– Method Injection
• Execute (IServiceProvider)
• Resolves Dependencies using Factory or
Container
– Plugins & Custom Workflow Activities
For Microsoft Dynamics CRM Partners and Customers
XrmContainer
• Light Weight Dependency Injection
Container
• Runs inside the Sandbox
• Resolves Components based on Interfaces
– By Conventions
– By Registering Dependencies
• Use in Plug-ins & Custom Workflows
• Comes with the Framework
For Microsoft Dynamics CRM Partners and Customers
XrmContainer
For Microsoft Dynamics CRM Partners and Customers
Code Design Benefits
• Mock Components behind Interfaces
– Dependencies
– Data Access Layer
• Unit Testing of Components in Isolation
– Testing with Mocked Dependencies
• Easily Resolve Dependencies using the
XrmContainer
For Microsoft Dynamics CRM Partners and Customers
Mocking With Moq
• Create a Mock Implementation of a
component using the Interface
• Setup the behavior of the Methods or
Properties you want to Mock
• Invoke the Methods or Properties on the
Mocked Object
• Verify that your Methods were called on
the Mocked Object
For Microsoft Dynamics CRM Partners and Customers
Moq Sample
For Microsoft Dynamics CRM Partners and Customers
How to Unit Test Plug-ins?
For Microsoft Dynamics CRM Partners and Customers
Sample Plug-in
For Microsoft Dynamics CRM Partners and Customers
Unit Test Mock<IServiceProvider> Plugin
Create
Setup Mocks
Create
Execute
Call
Verify
For Microsoft Dynamics CRM Partners and Customers
Steps
• Create a Unit Test
• Create a Mock for the
IPluginExecutionContext
• Setup Mock Implementations for the Methods
and Properties you will call
• Call the Execute Method with Mocked Object
• Examine the Mocked Object or Catch any
Exceptions
• Perform your Asserts
For Microsoft Dynamics CRM Partners and Customers
Seems like too much Effort?
For Microsoft Dynamics CRM Partners and Customers
Plug-in Unit Test Framework
For Microsoft Dynamics CRM Partners and Customers
Sample Plug-in Unit Test
For Microsoft Dynamics CRM Partners and Customers
Setup Mocks required by Plug-in
For Microsoft Dynamics CRM Partners and Customers
Verify & Assert
For Microsoft Dynamics CRM Partners and Customers
How to Unit Test Custom Workflow
Activities?
For Microsoft Dynamics CRM Partners and Customers
Sample WF Activity
For Microsoft Dynamics CRM Partners and Customers
Extract Services From Activity
Context
For Microsoft Dynamics CRM Partners and Customers
Perform Custom Logic
For Microsoft Dynamics CRM Partners and Customers
Unit Test Mock<Extensions> Workflow Runtime
Create
Setup Mocks
Create + Inputs
Create + Inject Activity + Extensions
Execute
Workflow Activity
Invoke
Call
Verify
Outputs
For Microsoft Dynamics CRM Partners and Customers
Steps
• Create a Unit Test
• Mock any Workflow Services extracted from
CodeActivityContext (ITracingService,
IWorkflowContext,
IOrganizationServiceFactory)
• Create a Sandbox Workflow Runtime using
the Mocked Services to Test the activity
• Verify the Mocked Objects, Catch any
Exceptions & Check Activity Outputs
• Perform your Asserts
For Microsoft Dynamics CRM Partners and Customers
WF Activity Unit Test Framework
For Microsoft Dynamics CRM Partners and Customers
Sample WF Activity Unit Test
For Microsoft Dynamics CRM Partners and Customers
Setup Organization Service
For Microsoft Dynamics CRM Partners and Customers
Setup Credit Check Service
For Microsoft Dynamics CRM Partners and Customers
Verify
For Microsoft Dynamics CRM Partners and Customers
Demo – Debugging…
For Microsoft Dynamics CRM Partners and Customers
Unit Testing Tips
• Write as less code as possible
– Move common code to Common Library
– Test common code in Common Library
• Mock Logic in Common Library
– Logic already tested
– Focus testing on the plug-in
• Use the Unit Test Base Classes
– Speed Up your testing
– Make it easier
• Mock only methods you need in your test
For Microsoft Dynamics CRM Partners and Customers
Integration Testing
Dependency 1
Component
Dependency 2
Integration Tests
Dependency 3
S
c
o
p
e
For Microsoft Dynamics CRM Partners and Customers
Why Write Integration Tests?
• Make sure Plug-ins & Custom Workflow
Activities work within the CRM
Environment
• Make sure Deployment process works
• Create Automated Tests that be re-run to
detect Integration Issues between
different components in the same solution
or other solutions
For Microsoft Dynamics CRM Partners and Customers
Plug-insIntegration
Test
Organization
Service
Pre-Validate
Plug-in
Pre-Operation
Plug-in
Platform
Post-
Operation
Plug-in
Asynchronous
Plug-inDB
For Microsoft Dynamics CRM Partners and Customers
Steps
• Make sure all Unit Tests Pass
• Deploy Plug-in to Target CRM Environment
• Write Integration Tests that will test the
functionality of plug-ins by Invoking the CRM
Platform Services
• Query CRM or Check Return Values to Assert
• If tests fail look at diagnostics before
attempting any Remote Debugging
• Use Plug-in Profiler if needed
For Microsoft Dynamics CRM Partners and Customers
Plug-in Integration Test Framework
For Microsoft Dynamics CRM Partners and Customers
Sample Plugin Integration Test
For Microsoft Dynamics CRM Partners and Customers
Setup, Do & Verify
For Microsoft Dynamics CRM Partners and Customers
Custom Workflow Activities
Integration
Test
Integration Test Workflow
Inputs
Workflow
Activity
Assert
Pass Fail
Trigger
Check Status
For Microsoft Dynamics CRM Partners and Customers
Steps
• Make sure all Unit Tests Pass
• Deploy Activity to Target CRM Environment
• Create a Test Workflow Integration Test in Dynamics
– Add Custom Workflow Activity
– Set Input Parameters
– Add steps to verify output parameters
• Create an Integration Test in your Visual Studio
Integration Project
– Create a test entity
– Invoke the Workflow on the entity
– Wait until Workflow Pass or Fails
– Report Feedback to Integration Test
For Microsoft Dynamics CRM Partners and Customers
Test Workflow Settings
For Microsoft Dynamics CRM Partners and Customers
Test Workflow Logic
For Microsoft Dynamics CRM Partners and Customers
WF Activity Integration Test
Framework
For Microsoft Dynamics CRM Partners and Customers
Sample WF Activity Integration Test
For Microsoft Dynamics CRM Partners and Customers
Setup & Verify
For Microsoft Dynamics CRM Partners and Customers
Integration Testing Tips
• Use Base Classes for your tests
• Think about clean ups before or after
Tests
• Impersonate the user with the correct
privileges
• Run your Integration Tests on your DEV,
SIT & UAT environments
• Run your Integration Tests often
For Microsoft Dynamics CRM Partners and Customers
Demo – Integration Testing
For Microsoft Dynamics CRM Partners and Customers
Future Considerations
• JavaScript Testing
• End to End Tests
– Coded UI Tests
• Load & Performance Testing
• Testing from different geographical locations
• Continuous Integration
• Test Driven Development
• Multi-Browser Testing
For Microsoft Dynamics CRM Partners and Customers
Summary
• Visual Studio Solution Design
– CRM Developer Toolkit
– Framework & Common Libraries
– ILMerge for Plug-ins & Workflow Assemblies
• Code Design
– Interfaces & Dependency Injection
– XrmContainer
• XRM Testing Framework
– Unit & Integration Tests
For Microsoft Dynamics CRM Partners and Customers
Next Steps
• XRM Developer Framework
– Built on top of the CRM Developer Toolkit
– Productivity Tools for XRM Developers
– Code Generation Extensions
– Silverlight Framework
– Testing Framework
• Coming to CodePlex Soon !!!
– http://xrmdevframework.codeplex.com/
For Microsoft Dynamics CRM Partners and Customers
Conclusion
• Plan for Testing from Beginning
• Test as Early as Possible
– Increased Confidence
– Detect Bugs Early -> Easier to Fix
– Improve Quality
– Happy Users
• Automate your Testing
• Use XRM Testing Framework to Improve
Productivity
For Microsoft Dynamics CRM Partners and Customers
Questions
For Microsoft Dynamics CRM Partners and Customers
Wael Hamze
Thank You to all of our Sponsors
And Thank YOU for Attending
eXtremeCRM 2012 Berlin!
Please remember to fill out your session evaluation form.

More Related Content

What's hot

Silverlight & Microsoft CRM Development - extremeCRM Berlin 2012
Silverlight & Microsoft CRM Development - extremeCRM Berlin 2012Silverlight & Microsoft CRM Development - extremeCRM Berlin 2012
Silverlight & Microsoft CRM Development - extremeCRM Berlin 2012Wael Hamze
 
Automated Testing for Dynamics CRM 4 - CRMUG 2014
Automated Testing for Dynamics CRM 4 - CRMUG 2014Automated Testing for Dynamics CRM 4 - CRMUG 2014
Automated Testing for Dynamics CRM 4 - CRMUG 2014Wael Hamze
 
DevOps for Dynamics 365/CRM - Summit EMEA 2017 Amsterdam
DevOps for Dynamics 365/CRM - Summit EMEA 2017 AmsterdamDevOps for Dynamics 365/CRM - Summit EMEA 2017 Amsterdam
DevOps for Dynamics 365/CRM - Summit EMEA 2017 AmsterdamWael Hamze
 
Continuous Delivery with Dynamics CRM - extremeCRM 2014 Barcelona
Continuous Delivery with Dynamics CRM - extremeCRM 2014 BarcelonaContinuous Delivery with Dynamics CRM - extremeCRM 2014 Barcelona
Continuous Delivery with Dynamics CRM - extremeCRM 2014 BarcelonaWael Hamze
 
Microsoft Team Foundation Server Build 2015
Microsoft Team Foundation Server Build 2015Microsoft Team Foundation Server Build 2015
Microsoft Team Foundation Server Build 2015Chris Kadel, MBA
 
Team Foundation Server Demo
Team Foundation Server DemoTeam Foundation Server Demo
Team Foundation Server Demophase2int
 
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler Framworks
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler FramworksSalesforce Meetup 18 April 2015 - Apex Trigger & Scheduler Framworks
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler FramworksSumitkumar Shingavi
 
Continuous Integration In The Cloud Final (1)
Continuous Integration In The Cloud Final (1)Continuous Integration In The Cloud Final (1)
Continuous Integration In The Cloud Final (1)Alexis Williams
 
Managing Your Batch and Scheduled Apex Processes with Relax
Managing Your Batch and Scheduled Apex Processes with RelaxManaging Your Batch and Scheduled Apex Processes with Relax
Managing Your Batch and Scheduled Apex Processes with RelaxSalesforce Developers
 
Introduction to Enterprise-Release Engineering on the Salesforce Platform
Introduction to Enterprise-Release Engineering on the Salesforce PlatformIntroduction to Enterprise-Release Engineering on the Salesforce Platform
Introduction to Enterprise-Release Engineering on the Salesforce PlatformSalesforce Developers
 
Team Development on Force.com with Github and Ant
Team Development on Force.com with Github and AntTeam Development on Force.com with Github and Ant
Team Development on Force.com with Github and AntSalesforce Developers
 
Application Lifecycle Management with TFS
Application Lifecycle Management with TFSApplication Lifecycle Management with TFS
Application Lifecycle Management with TFSMehdi Khalili
 
Tfs 2015 Upgrade Tips and Tricks
Tfs 2015 Upgrade Tips and TricksTfs 2015 Upgrade Tips and Tricks
Tfs 2015 Upgrade Tips and TricksInCycleSoftware
 
Fun with Jenkins & Salesforce
Fun with Jenkins & SalesforceFun with Jenkins & Salesforce
Fun with Jenkins & SalesforceAbhinav Gupta
 
Optimizing deployment & dev ops with tfs 2013
Optimizing deployment & dev ops with tfs 2013Optimizing deployment & dev ops with tfs 2013
Optimizing deployment & dev ops with tfs 2013Kobi Moraz
 
Triggers for Admins: A Five-step Framework for Creating Triggers
Triggers for Admins: A Five-step Framework for Creating TriggersTriggers for Admins: A Five-step Framework for Creating Triggers
Triggers for Admins: A Five-step Framework for Creating TriggersSalesforce Developers
 
Team Foundation Server - Tracking & Reporting
Team Foundation Server - Tracking & ReportingTeam Foundation Server - Tracking & Reporting
Team Foundation Server - Tracking & ReportingSteve Lange
 
What's new in Visual Studio 2013 & TFS 2013
What's new in Visual Studio 2013 & TFS 2013What's new in Visual Studio 2013 & TFS 2013
What's new in Visual Studio 2013 & TFS 2013Danijel Malik
 
Integration Testing in AEM
Integration Testing in AEMIntegration Testing in AEM
Integration Testing in AEMconnectwebex
 
Ordina SOFTC Presentation - Deployment with TFS Build and Workflow
Ordina SOFTC Presentation - Deployment with TFS Build and WorkflowOrdina SOFTC Presentation - Deployment with TFS Build and Workflow
Ordina SOFTC Presentation - Deployment with TFS Build and WorkflowOrdina Belgium
 

What's hot (20)

Silverlight & Microsoft CRM Development - extremeCRM Berlin 2012
Silverlight & Microsoft CRM Development - extremeCRM Berlin 2012Silverlight & Microsoft CRM Development - extremeCRM Berlin 2012
Silverlight & Microsoft CRM Development - extremeCRM Berlin 2012
 
Automated Testing for Dynamics CRM 4 - CRMUG 2014
Automated Testing for Dynamics CRM 4 - CRMUG 2014Automated Testing for Dynamics CRM 4 - CRMUG 2014
Automated Testing for Dynamics CRM 4 - CRMUG 2014
 
DevOps for Dynamics 365/CRM - Summit EMEA 2017 Amsterdam
DevOps for Dynamics 365/CRM - Summit EMEA 2017 AmsterdamDevOps for Dynamics 365/CRM - Summit EMEA 2017 Amsterdam
DevOps for Dynamics 365/CRM - Summit EMEA 2017 Amsterdam
 
Continuous Delivery with Dynamics CRM - extremeCRM 2014 Barcelona
Continuous Delivery with Dynamics CRM - extremeCRM 2014 BarcelonaContinuous Delivery with Dynamics CRM - extremeCRM 2014 Barcelona
Continuous Delivery with Dynamics CRM - extremeCRM 2014 Barcelona
 
Microsoft Team Foundation Server Build 2015
Microsoft Team Foundation Server Build 2015Microsoft Team Foundation Server Build 2015
Microsoft Team Foundation Server Build 2015
 
Team Foundation Server Demo
Team Foundation Server DemoTeam Foundation Server Demo
Team Foundation Server Demo
 
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler Framworks
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler FramworksSalesforce Meetup 18 April 2015 - Apex Trigger & Scheduler Framworks
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler Framworks
 
Continuous Integration In The Cloud Final (1)
Continuous Integration In The Cloud Final (1)Continuous Integration In The Cloud Final (1)
Continuous Integration In The Cloud Final (1)
 
Managing Your Batch and Scheduled Apex Processes with Relax
Managing Your Batch and Scheduled Apex Processes with RelaxManaging Your Batch and Scheduled Apex Processes with Relax
Managing Your Batch and Scheduled Apex Processes with Relax
 
Introduction to Enterprise-Release Engineering on the Salesforce Platform
Introduction to Enterprise-Release Engineering on the Salesforce PlatformIntroduction to Enterprise-Release Engineering on the Salesforce Platform
Introduction to Enterprise-Release Engineering on the Salesforce Platform
 
Team Development on Force.com with Github and Ant
Team Development on Force.com with Github and AntTeam Development on Force.com with Github and Ant
Team Development on Force.com with Github and Ant
 
Application Lifecycle Management with TFS
Application Lifecycle Management with TFSApplication Lifecycle Management with TFS
Application Lifecycle Management with TFS
 
Tfs 2015 Upgrade Tips and Tricks
Tfs 2015 Upgrade Tips and TricksTfs 2015 Upgrade Tips and Tricks
Tfs 2015 Upgrade Tips and Tricks
 
Fun with Jenkins & Salesforce
Fun with Jenkins & SalesforceFun with Jenkins & Salesforce
Fun with Jenkins & Salesforce
 
Optimizing deployment & dev ops with tfs 2013
Optimizing deployment & dev ops with tfs 2013Optimizing deployment & dev ops with tfs 2013
Optimizing deployment & dev ops with tfs 2013
 
Triggers for Admins: A Five-step Framework for Creating Triggers
Triggers for Admins: A Five-step Framework for Creating TriggersTriggers for Admins: A Five-step Framework for Creating Triggers
Triggers for Admins: A Five-step Framework for Creating Triggers
 
Team Foundation Server - Tracking & Reporting
Team Foundation Server - Tracking & ReportingTeam Foundation Server - Tracking & Reporting
Team Foundation Server - Tracking & Reporting
 
What's new in Visual Studio 2013 & TFS 2013
What's new in Visual Studio 2013 & TFS 2013What's new in Visual Studio 2013 & TFS 2013
What's new in Visual Studio 2013 & TFS 2013
 
Integration Testing in AEM
Integration Testing in AEMIntegration Testing in AEM
Integration Testing in AEM
 
Ordina SOFTC Presentation - Deployment with TFS Build and Workflow
Ordina SOFTC Presentation - Deployment with TFS Build and WorkflowOrdina SOFTC Presentation - Deployment with TFS Build and Workflow
Ordina SOFTC Presentation - Deployment with TFS Build and Workflow
 

Similar to Test & Dynamics CRM - extremeCRM Berlin 2012

Best Practices in Testing Force.com Application
Best Practices in Testing Force.com ApplicationBest Practices in Testing Force.com Application
Best Practices in Testing Force.com ApplicationEmtec Inc.
 
Software Factory Tools Partner Day Final
Software Factory Tools Partner Day FinalSoftware Factory Tools Partner Day Final
Software Factory Tools Partner Day FinalLek Pongpatimet
 
Putting Quality First through Continuous Testing
Putting Quality First through Continuous TestingPutting Quality First through Continuous Testing
Putting Quality First through Continuous TestingTechWell
 
Udvid din test portefølje med coded ui test og cloud load test
Udvid din test portefølje med coded ui test og cloud load testUdvid din test portefølje med coded ui test og cloud load test
Udvid din test portefølje med coded ui test og cloud load testPeter Lindberg
 
ALM with TFS: From the Drawing Board to the Cloud
ALM with TFS: From the Drawing Board to the CloudALM with TFS: From the Drawing Board to the Cloud
ALM with TFS: From the Drawing Board to the CloudJeremy Likness
 
Test automation lessons from WebSphere Application Server
Test automation lessons from WebSphere Application ServerTest automation lessons from WebSphere Application Server
Test automation lessons from WebSphere Application ServerRobbie Minshall
 
Webinar "Gestión de la calidad en entornos SAP"
Webinar "Gestión de la calidad en entornos SAP"Webinar "Gestión de la calidad en entornos SAP"
Webinar "Gestión de la calidad en entornos SAP"Globe Testing
 
Build the Right Regression Suite with Behavior-Driven Testing
Build the Right Regression Suite with Behavior-Driven TestingBuild the Right Regression Suite with Behavior-Driven Testing
Build the Right Regression Suite with Behavior-Driven TestingTechWell
 
Enterprise QA and Application Testing Services
Enterprise QA and Application Testing ServicesEnterprise QA and Application Testing Services
Enterprise QA and Application Testing ServicesHemang Rindani
 
Enterprise QA and Application Testing Services
Enterprise QA and Application Testing ServicesEnterprise QA and Application Testing Services
Enterprise QA and Application Testing ServicesCygnet Infotech
 
Best Practices for a Repeatable Shift-Left Commitment
Best Practices for a Repeatable Shift-Left CommitmentBest Practices for a Repeatable Shift-Left Commitment
Best Practices for a Repeatable Shift-Left CommitmentApplause
 
SDLC Models - testing
SDLC Models - testingSDLC Models - testing
SDLC Models - testingPrasad Gali
 
Overview DYN365O
Overview DYN365OOverview DYN365O
Overview DYN365OJuan Fabian
 

Similar to Test & Dynamics CRM - extremeCRM Berlin 2012 (20)

Best Practices in Testing Force.com Application
Best Practices in Testing Force.com ApplicationBest Practices in Testing Force.com Application
Best Practices in Testing Force.com Application
 
Software Factory Tools Partner Day Final
Software Factory Tools Partner Day FinalSoftware Factory Tools Partner Day Final
Software Factory Tools Partner Day Final
 
Putting Quality First through Continuous Testing
Putting Quality First through Continuous TestingPutting Quality First through Continuous Testing
Putting Quality First through Continuous Testing
 
Automatied Testing QA
Automatied Testing QAAutomatied Testing QA
Automatied Testing QA
 
LMS TESTING SERVICES
LMS TESTING SERVICESLMS TESTING SERVICES
LMS TESTING SERVICES
 
Udvid din test portefølje med coded ui test og cloud load test
Udvid din test portefølje med coded ui test og cloud load testUdvid din test portefølje med coded ui test og cloud load test
Udvid din test portefølje med coded ui test og cloud load test
 
Amq Overview Continuous Quality Assurance
Amq Overview Continuous Quality AssuranceAmq Overview Continuous Quality Assurance
Amq Overview Continuous Quality Assurance
 
ALM with TFS: From the Drawing Board to the Cloud
ALM with TFS: From the Drawing Board to the CloudALM with TFS: From the Drawing Board to the Cloud
ALM with TFS: From the Drawing Board to the Cloud
 
Rushcode overview
Rushcode overviewRushcode overview
Rushcode overview
 
Test automation lessons from WebSphere Application Server
Test automation lessons from WebSphere Application ServerTest automation lessons from WebSphere Application Server
Test automation lessons from WebSphere Application Server
 
Webinar "Gestión de la calidad en entornos SAP"
Webinar "Gestión de la calidad en entornos SAP"Webinar "Gestión de la calidad en entornos SAP"
Webinar "Gestión de la calidad en entornos SAP"
 
Build the Right Regression Suite with Behavior-Driven Testing
Build the Right Regression Suite with Behavior-Driven TestingBuild the Right Regression Suite with Behavior-Driven Testing
Build the Right Regression Suite with Behavior-Driven Testing
 
Enterprise QA and Application Testing Services
Enterprise QA and Application Testing ServicesEnterprise QA and Application Testing Services
Enterprise QA and Application Testing Services
 
Enterprise QA and Application Testing Services
Enterprise QA and Application Testing ServicesEnterprise QA and Application Testing Services
Enterprise QA and Application Testing Services
 
Best Practices for a Repeatable Shift-Left Commitment
Best Practices for a Repeatable Shift-Left CommitmentBest Practices for a Repeatable Shift-Left Commitment
Best Practices for a Repeatable Shift-Left Commitment
 
Manul resume 1+
Manul resume 1+Manul resume 1+
Manul resume 1+
 
SDLC Models - testing
SDLC Models - testingSDLC Models - testing
SDLC Models - testing
 
Sure CRM
Sure CRMSure CRM
Sure CRM
 
Overview DYN365O
Overview DYN365OOverview DYN365O
Overview DYN365O
 
Agile testing MyBTEC
Agile testing MyBTECAgile testing MyBTEC
Agile testing MyBTEC
 

Recently uploaded

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
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.pdfsudhanshuwaghmare1
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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 Scriptwesley chun
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
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?Igalia
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
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 CVKhem
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Recently uploaded (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
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?
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

Test & Dynamics CRM - extremeCRM Berlin 2012

  • 1. For Microsoft Dynamics CRM Partners and Customers Testing & Dynamics CRM 2011 Wael Hamze CRM Architect
  • 2. For Microsoft Dynamics CRM Partners and Customers Agenda • Scope • Current Reality of Testing • Objectives • How? • Future Considerations • Summary, Next Steps & Conclusion • Questions
  • 3. For Microsoft Dynamics CRM Partners and Customers Current Reality of Testing • No Testing • Manual Testing in the end • It works for me • Testing using one client only • Testing using no real data • Assume all data is correct • Difficult to test Dynamics in general
  • 4. For Microsoft Dynamics CRM Partners and Customers Objectives • Show how to easily test Plug-ins & Custom Workflow Activities • Provide best practices for testing Plug-ins & Custom Workflow Activities • Encourage testing practices in CRM Projects • Improve Quality & Reliability of CRM Projects without impacting Timescales
  • 5. For Microsoft Dynamics CRM Partners and Customers How?
  • 6. For Microsoft Dynamics CRM Partners and Customers Tools & Patterns • Tools – CRM Developer Toolkit – Unit Test Framework (MSTest) – Mocking Framework (MOQ) • Patterns – Dependency Injection
  • 7. For Microsoft Dynamics CRM Partners and Customers Planning • Plan for Testing from the beginning – Decide on Tools & Framework • CRM Developer Toolkit – Provide a Testable Architecture – Write Testable Code
  • 8. For Microsoft Dynamics CRM Partners and Customers Component Design/Architecture CRM SDK/Platform Framework Common Plug-ins WF Activities Testing
  • 9. For Microsoft Dynamics CRM Partners and Customers Visual Studio Solution
  • 10. For Microsoft Dynamics CRM Partners and Customers Common & Framework Deployment Framework Common Plug-ins Merged Plug-in Framework Common Plug-ins ILMerge CRMDeploy
  • 11. For Microsoft Dynamics CRM Partners and Customers How to Merge?
  • 12. For Microsoft Dynamics CRM Partners and Customers How to Deploy?
  • 13. For Microsoft Dynamics CRM Partners and Customers Solution Design Benefits • Reusable Logic (Framework & Common) • No Code Duplication • Framework & Common can be Tested in Isolation • CRM Developer Toolkit – Speed Up Development – Easy Deployment – Consistency
  • 14. For Microsoft Dynamics CRM Partners and Customers Write Testable Code • Use Interfaces • Use Dependency Injection • De-couple Business & Data Access logic
  • 15. For Microsoft Dynamics CRM Partners and Customers Unit Testing Dependency 1 Component Dependency 2 Unit Tests Mock 1 Mock 2
  • 16. For Microsoft Dynamics CRM Partners and Customers Why Write Unit Tests? • Ability to Test Plug-ins & Custom Workflow Activities without CRM Environment • Ability to Test without Deployment • Tests run much quicker • Detect bugs very early and fix quickly • No Remote Debugging means Easier Development by Debugging in Visual Studio
  • 17. For Microsoft Dynamics CRM Partners and Customers Testable Code Dependency Injection ClassA ServiceA Uses Builder Container ServiceA Creates IServiceAClassA Uses Implements Create ClassA + Inject IServiceA
  • 18. For Microsoft Dynamics CRM Partners and Customers Dependency Injection • Types of Injection – Constructor Injection – Property Injection – Method Injection • Execute (IServiceProvider) • Resolves Dependencies using Factory or Container – Plugins & Custom Workflow Activities
  • 19. For Microsoft Dynamics CRM Partners and Customers XrmContainer • Light Weight Dependency Injection Container • Runs inside the Sandbox • Resolves Components based on Interfaces – By Conventions – By Registering Dependencies • Use in Plug-ins & Custom Workflows • Comes with the Framework
  • 20. For Microsoft Dynamics CRM Partners and Customers XrmContainer
  • 21. For Microsoft Dynamics CRM Partners and Customers Code Design Benefits • Mock Components behind Interfaces – Dependencies – Data Access Layer • Unit Testing of Components in Isolation – Testing with Mocked Dependencies • Easily Resolve Dependencies using the XrmContainer
  • 22. For Microsoft Dynamics CRM Partners and Customers Mocking With Moq • Create a Mock Implementation of a component using the Interface • Setup the behavior of the Methods or Properties you want to Mock • Invoke the Methods or Properties on the Mocked Object • Verify that your Methods were called on the Mocked Object
  • 23. For Microsoft Dynamics CRM Partners and Customers Moq Sample
  • 24. For Microsoft Dynamics CRM Partners and Customers How to Unit Test Plug-ins?
  • 25. For Microsoft Dynamics CRM Partners and Customers Sample Plug-in
  • 26. For Microsoft Dynamics CRM Partners and Customers Unit Test Mock<IServiceProvider> Plugin Create Setup Mocks Create Execute Call Verify
  • 27. For Microsoft Dynamics CRM Partners and Customers Steps • Create a Unit Test • Create a Mock for the IPluginExecutionContext • Setup Mock Implementations for the Methods and Properties you will call • Call the Execute Method with Mocked Object • Examine the Mocked Object or Catch any Exceptions • Perform your Asserts
  • 28. For Microsoft Dynamics CRM Partners and Customers Seems like too much Effort?
  • 29. For Microsoft Dynamics CRM Partners and Customers Plug-in Unit Test Framework
  • 30. For Microsoft Dynamics CRM Partners and Customers Sample Plug-in Unit Test
  • 31. For Microsoft Dynamics CRM Partners and Customers Setup Mocks required by Plug-in
  • 32. For Microsoft Dynamics CRM Partners and Customers Verify & Assert
  • 33. For Microsoft Dynamics CRM Partners and Customers How to Unit Test Custom Workflow Activities?
  • 34. For Microsoft Dynamics CRM Partners and Customers Sample WF Activity
  • 35. For Microsoft Dynamics CRM Partners and Customers Extract Services From Activity Context
  • 36. For Microsoft Dynamics CRM Partners and Customers Perform Custom Logic
  • 37. For Microsoft Dynamics CRM Partners and Customers Unit Test Mock<Extensions> Workflow Runtime Create Setup Mocks Create + Inputs Create + Inject Activity + Extensions Execute Workflow Activity Invoke Call Verify Outputs
  • 38. For Microsoft Dynamics CRM Partners and Customers Steps • Create a Unit Test • Mock any Workflow Services extracted from CodeActivityContext (ITracingService, IWorkflowContext, IOrganizationServiceFactory) • Create a Sandbox Workflow Runtime using the Mocked Services to Test the activity • Verify the Mocked Objects, Catch any Exceptions & Check Activity Outputs • Perform your Asserts
  • 39. For Microsoft Dynamics CRM Partners and Customers WF Activity Unit Test Framework
  • 40. For Microsoft Dynamics CRM Partners and Customers Sample WF Activity Unit Test
  • 41. For Microsoft Dynamics CRM Partners and Customers Setup Organization Service
  • 42. For Microsoft Dynamics CRM Partners and Customers Setup Credit Check Service
  • 43. For Microsoft Dynamics CRM Partners and Customers Verify
  • 44. For Microsoft Dynamics CRM Partners and Customers Demo – Debugging…
  • 45. For Microsoft Dynamics CRM Partners and Customers Unit Testing Tips • Write as less code as possible – Move common code to Common Library – Test common code in Common Library • Mock Logic in Common Library – Logic already tested – Focus testing on the plug-in • Use the Unit Test Base Classes – Speed Up your testing – Make it easier • Mock only methods you need in your test
  • 46. For Microsoft Dynamics CRM Partners and Customers Integration Testing Dependency 1 Component Dependency 2 Integration Tests Dependency 3 S c o p e
  • 47. For Microsoft Dynamics CRM Partners and Customers Why Write Integration Tests? • Make sure Plug-ins & Custom Workflow Activities work within the CRM Environment • Make sure Deployment process works • Create Automated Tests that be re-run to detect Integration Issues between different components in the same solution or other solutions
  • 48. For Microsoft Dynamics CRM Partners and Customers Plug-insIntegration Test Organization Service Pre-Validate Plug-in Pre-Operation Plug-in Platform Post- Operation Plug-in Asynchronous Plug-inDB
  • 49. For Microsoft Dynamics CRM Partners and Customers Steps • Make sure all Unit Tests Pass • Deploy Plug-in to Target CRM Environment • Write Integration Tests that will test the functionality of plug-ins by Invoking the CRM Platform Services • Query CRM or Check Return Values to Assert • If tests fail look at diagnostics before attempting any Remote Debugging • Use Plug-in Profiler if needed
  • 50. For Microsoft Dynamics CRM Partners and Customers Plug-in Integration Test Framework
  • 51. For Microsoft Dynamics CRM Partners and Customers Sample Plugin Integration Test
  • 52. For Microsoft Dynamics CRM Partners and Customers Setup, Do & Verify
  • 53. For Microsoft Dynamics CRM Partners and Customers Custom Workflow Activities Integration Test Integration Test Workflow Inputs Workflow Activity Assert Pass Fail Trigger Check Status
  • 54. For Microsoft Dynamics CRM Partners and Customers Steps • Make sure all Unit Tests Pass • Deploy Activity to Target CRM Environment • Create a Test Workflow Integration Test in Dynamics – Add Custom Workflow Activity – Set Input Parameters – Add steps to verify output parameters • Create an Integration Test in your Visual Studio Integration Project – Create a test entity – Invoke the Workflow on the entity – Wait until Workflow Pass or Fails – Report Feedback to Integration Test
  • 55. For Microsoft Dynamics CRM Partners and Customers Test Workflow Settings
  • 56. For Microsoft Dynamics CRM Partners and Customers Test Workflow Logic
  • 57. For Microsoft Dynamics CRM Partners and Customers WF Activity Integration Test Framework
  • 58. For Microsoft Dynamics CRM Partners and Customers Sample WF Activity Integration Test
  • 59. For Microsoft Dynamics CRM Partners and Customers Setup & Verify
  • 60. For Microsoft Dynamics CRM Partners and Customers Integration Testing Tips • Use Base Classes for your tests • Think about clean ups before or after Tests • Impersonate the user with the correct privileges • Run your Integration Tests on your DEV, SIT & UAT environments • Run your Integration Tests often
  • 61. For Microsoft Dynamics CRM Partners and Customers Demo – Integration Testing
  • 62. For Microsoft Dynamics CRM Partners and Customers Future Considerations • JavaScript Testing • End to End Tests – Coded UI Tests • Load & Performance Testing • Testing from different geographical locations • Continuous Integration • Test Driven Development • Multi-Browser Testing
  • 63. For Microsoft Dynamics CRM Partners and Customers Summary • Visual Studio Solution Design – CRM Developer Toolkit – Framework & Common Libraries – ILMerge for Plug-ins & Workflow Assemblies • Code Design – Interfaces & Dependency Injection – XrmContainer • XRM Testing Framework – Unit & Integration Tests
  • 64. For Microsoft Dynamics CRM Partners and Customers Next Steps • XRM Developer Framework – Built on top of the CRM Developer Toolkit – Productivity Tools for XRM Developers – Code Generation Extensions – Silverlight Framework – Testing Framework • Coming to CodePlex Soon !!! – http://xrmdevframework.codeplex.com/
  • 65. For Microsoft Dynamics CRM Partners and Customers Conclusion • Plan for Testing from Beginning • Test as Early as Possible – Increased Confidence – Detect Bugs Early -> Easier to Fix – Improve Quality – Happy Users • Automate your Testing • Use XRM Testing Framework to Improve Productivity
  • 66. For Microsoft Dynamics CRM Partners and Customers Questions
  • 67. For Microsoft Dynamics CRM Partners and Customers Wael Hamze Thank You to all of our Sponsors And Thank YOU for Attending eXtremeCRM 2012 Berlin! Please remember to fill out your session evaluation form.