SlideShare a Scribd company logo
Organized by the Community, for the Community.
TEST DRIVEN
SITECORE
Dan Solovay
Sitecore MVP
Lead Architect at XCentium
Organized by the Community, for the Community.
OVERVIEW
• What isTDD?
• Unit or Integration tests?
• Tools
• Demo of Sitecore IntegrationTesting
• Demo of Sitecore.FakeDB
• Demo of Glass.Mapper + Autofac
• How to get started withTDD?
SUGCON NORTH AMERICA
2015
2
Organized by the Community, for the Community.
MORE ISOLATION
Sitecore
Integration
Testing
Sitecore.FakeDB
Glass.Mapper +
Autofac
SUGCON NORTH AMERICA
2015
3
Organized by the Community, for the Community.
MORE FLEXIBILITY
SUGCON NORTH AMERICA
2015
4
Organized by the Community, for the Community.
SUGCON NORTH AMERICA
2015
5
TEST DRIVEN
DEVELOPMENT
Organized by the Community, for the Community.
AGILE ORIGINS OF TDD
• Rediscovered by Kent Beck
• Extreme Programming
– Embrace change through
continuous feedback
• Popularized by Robert
Martin
– Author of SOLID principles
– “What if your code always
worked?”
SUGCON NORTH AMERICA
2015
6
Organized by the Community, for the Community.
THE TDD CYCLE
• RED
– Right just enough code to fail
• GREEN
– Right just enough code to pass
• REFACTOR
– Improve design when everything is working
SUGCON NORTH AMERICA
2015
7
Organized by the Community, for the Community.
SUGCON NORTH AMERICA
2015
8
UNIT AND
INTEGRATION
TESTING
Organized by the Community, for the Community.
WHAT IS A UNIT TEST?
• Automated
• Full control / runs in
memory
• Consistent & fast
• Tests a single logical
concept
• Readable &
maintainable
• Trustworthy
SUGCON NORTH AMERICA
2015
9
Roy Osherove,
Art of UnitTesting
Organized by the Community, for the Community.
INTEGRATION TESTS
• More fragile
• Provide full system confidence
• Shows different systems working together
SUGCON NORTH AMERICA
2015
10
Organized by the Community, for the Community.
SUGCON NORTH AMERICA
2015
11
TOOLS
Organized by the Community, for the Community.
MYTOOLBOX
• XUNIT
– Better separation of tests than NUNIT.
• NCRUNCH
– Runs tests as you type.
• NSUBSTITUTE
– Creates fake versions of interfaces in tests.
• AUTOFAC
– Creates real versions in production.
SUGCON NORTH AMERICA
2015
12
Organized by the Community, for the Community.
SUGCON NORTH AMERICA
2015
13
TESTING SITECORE
Organized by the Community, for the Community.
SITECORE INTEGRATION TESTING
• Browser based
– More robust
– Http Context available
• Class Library based
– Works withTest Runners
– Easier to automate
SUGCON NORTH AMERICA
2015
14
Organized by the Community, for the Community.
SITECORE FAKE DB
• Developed by Sergey Shusliapin of Sitecore
Ukraine
• Uses Sitecore DLLs, replaces data layer
• Tests Sitecore Items directly
• No code changes required!
SUGCON NORTH AMERICA
2015
15
Organized by the Community, for the Community.
MAP SITECORE ITEMS
• Use object mapper like Glass
• Use Dependency Injector like Autofac
• Your code does not talk directly to Sitecore
SUGCON NORTH AMERICA
2015
16
Organized by the Community, for the Community.
SUGCON NORTH AMERICA
2015
17
NEXT STEPS
Organized by the Community, for the Community.
BENEFITS
• Encourages focus
• Creates confidence
• Drives good design
SUGCON NORTH AMERICA
2015
18
Organized by the Community, for the Community.
CHALLENGES
• Hard to learn new habits
• Team buy in
• Finding time
SUGCON NORTH AMERICA
2015
19
Organized by the Community, for the Community.
SOLUTIONS
• Avoid all-or-nothing thinking
– One, two hours ofTDD per week
• Get involvement
– Pair up, ask for input
– Run aTDD Kata session
• Sell the value
– Fast feedback
– Flexible design
SUGCON NORTH AMERICA
2015
20
Organized by the Community, for the Community.
FEARLESS
If we have the tests we become fearless about
making changes. If we see messy code, or an
unclean structure, we can clean it without fear.
Because of the tests, the code becomes
malleable again. Because of the tests, software
becomes soft again.
– Robert Martin, bit.ly/tdd3rules
SUGCON NORTH AMERICA
2015
21
Organized by the Community, for the Community.
SUGCON NORTH AMERICA
2015
Thanks!
@DanSolovay
bit.ly/tddlinks

More Related Content

PPTX
Nick Hills - Fashion doesnt stand still neither should the design of your sit...
PDF
Richard Seal - Single Page Application - SUGCON
PDF
Vasiliy Fomichev - Harness the Power of Containers - SUGCON
PPTX
360 Heros End-to-End VR 360 Workflow
PDF
JavaScript Overload
PDF
360 Degree and VR Live Streaming Q&A
PPTX
Pavel Veller - JavaScript overload - SUGCON
PDF
Presentation for OSI of Knight Online Communities
Nick Hills - Fashion doesnt stand still neither should the design of your sit...
Richard Seal - Single Page Application - SUGCON
Vasiliy Fomichev - Harness the Power of Containers - SUGCON
360 Heros End-to-End VR 360 Workflow
JavaScript Overload
360 Degree and VR Live Streaming Q&A
Pavel Veller - JavaScript overload - SUGCON
Presentation for OSI of Knight Online Communities

Similar to Dan Solovay - Test Driven Sitecore - SUGCON (20)

PPTX
Trevor Campbell - Creating a Global Infrastructure to Support China - SUGCON
PPTX
Single Page Applications with Real Time Updates - SUGCON
PDF
Modularity Matters: Bringing Atomic Design to Sitecore Development
PPTX
Brian Beckham - Atomic Design - Modularity Matters: Bringing Atomic Design to...
PPTX
SUGCON 2015: Docker Containers and Sitecore
PPTX
Kam Figy - Serialization 2.0 with Unicorn and Rainbow - SUGCON
PPTX
Ben Sterrett - Sitecore Wars IV: A new way to deliver media - SUGCON
PPTX
Sitecore’s Federated Experience Manager: Keeping the Customer at the Center o...
PPTX
Sitecore’s Federated Experience Manager: Keeping the Customer at the Center o...
PPTX
Jason St-Cyr - Continuous integration - SUGCON
PPTX
Philly Sitecore User Group Meetup | Post-Symposium Knowledge Share
PPTX
SUGCON 2015 Modelling
PPTX
Day One Keynote
PPTX
Day One Keynote
PPTX
UXDX Helsinki - Being DevOps in Desktop Software Development, by Natalia Kaij...
PPTX
Continuous delivery applied (DC CI User Group)
PPTX
Continuous delivery applied
PDF
Automated Browser Testing
PDF
State of the Ecosystem - Atlassian Summit 2010
PDF
The New Era of Code in the Cloud (Bogdan Toporan)
Trevor Campbell - Creating a Global Infrastructure to Support China - SUGCON
Single Page Applications with Real Time Updates - SUGCON
Modularity Matters: Bringing Atomic Design to Sitecore Development
Brian Beckham - Atomic Design - Modularity Matters: Bringing Atomic Design to...
SUGCON 2015: Docker Containers and Sitecore
Kam Figy - Serialization 2.0 with Unicorn and Rainbow - SUGCON
Ben Sterrett - Sitecore Wars IV: A new way to deliver media - SUGCON
Sitecore’s Federated Experience Manager: Keeping the Customer at the Center o...
Sitecore’s Federated Experience Manager: Keeping the Customer at the Center o...
Jason St-Cyr - Continuous integration - SUGCON
Philly Sitecore User Group Meetup | Post-Symposium Knowledge Share
SUGCON 2015 Modelling
Day One Keynote
Day One Keynote
UXDX Helsinki - Being DevOps in Desktop Software Development, by Natalia Kaij...
Continuous delivery applied (DC CI User Group)
Continuous delivery applied
Automated Browser Testing
State of the Ecosystem - Atlassian Summit 2010
The New Era of Code in the Cloud (Bogdan Toporan)
Ad

More from SUGCON (8)

PDF
Darren Guarnaccia - The experience economy and customer outcomes - SUGCON
PPTX
Sean Rusinko - What does full-on personalization look like and how do I get t...
PPTX
Pieter Brinkman - My first mobile experience From mobile no no, to mobile go ...
PPTX
Martin English - Extending the experience with CRM - SUGCON
PPTX
Kevin Keogh - The Challenges of Modern digital Government - SUGCON
PDF
John Ours - Sitecore in the Digital Front Office –Turning Data into Action -...
PPTX
Faulkner IV Frederick - Going Beyond Your Own Domain: How to Effectively Use ...
PPTX
Dean Thrasher - Beyond CRM Integration: Salesforce As Content Gatekeeper on S...
Darren Guarnaccia - The experience economy and customer outcomes - SUGCON
Sean Rusinko - What does full-on personalization look like and how do I get t...
Pieter Brinkman - My first mobile experience From mobile no no, to mobile go ...
Martin English - Extending the experience with CRM - SUGCON
Kevin Keogh - The Challenges of Modern digital Government - SUGCON
John Ours - Sitecore in the Digital Front Office –Turning Data into Action -...
Faulkner IV Frederick - Going Beyond Your Own Domain: How to Effectively Use ...
Dean Thrasher - Beyond CRM Integration: Salesforce As Content Gatekeeper on S...
Ad

Recently uploaded (20)

PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
KodekX | Application Modernization Development
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Cloud computing and distributed systems.
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Approach and Philosophy of On baking technology
PDF
Electronic commerce courselecture one. Pdf
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
Per capita expenditure prediction using model stacking based on satellite ima...
Machine learning based COVID-19 study performance prediction
Diabetes mellitus diagnosis method based random forest with bat algorithm
20250228 LYD VKU AI Blended-Learning.pptx
KodekX | Application Modernization Development
Building Integrated photovoltaic BIPV_UPV.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Advanced methodologies resolving dimensionality complications for autism neur...
Spectral efficient network and resource selection model in 5G networks
Cloud computing and distributed systems.
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Understanding_Digital_Forensics_Presentation.pptx
Approach and Philosophy of On baking technology
Electronic commerce courselecture one. Pdf
sap open course for s4hana steps from ECC to s4
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
MYSQL Presentation for SQL database connectivity
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The Rise and Fall of 3GPP – Time for a Sabbatical?

Dan Solovay - Test Driven Sitecore - SUGCON

  • 1. Organized by the Community, for the Community. TEST DRIVEN SITECORE Dan Solovay Sitecore MVP Lead Architect at XCentium
  • 2. Organized by the Community, for the Community. OVERVIEW • What isTDD? • Unit or Integration tests? • Tools • Demo of Sitecore IntegrationTesting • Demo of Sitecore.FakeDB • Demo of Glass.Mapper + Autofac • How to get started withTDD? SUGCON NORTH AMERICA 2015 2
  • 3. Organized by the Community, for the Community. MORE ISOLATION Sitecore Integration Testing Sitecore.FakeDB Glass.Mapper + Autofac SUGCON NORTH AMERICA 2015 3
  • 4. Organized by the Community, for the Community. MORE FLEXIBILITY SUGCON NORTH AMERICA 2015 4
  • 5. Organized by the Community, for the Community. SUGCON NORTH AMERICA 2015 5 TEST DRIVEN DEVELOPMENT
  • 6. Organized by the Community, for the Community. AGILE ORIGINS OF TDD • Rediscovered by Kent Beck • Extreme Programming – Embrace change through continuous feedback • Popularized by Robert Martin – Author of SOLID principles – “What if your code always worked?” SUGCON NORTH AMERICA 2015 6
  • 7. Organized by the Community, for the Community. THE TDD CYCLE • RED – Right just enough code to fail • GREEN – Right just enough code to pass • REFACTOR – Improve design when everything is working SUGCON NORTH AMERICA 2015 7
  • 8. Organized by the Community, for the Community. SUGCON NORTH AMERICA 2015 8 UNIT AND INTEGRATION TESTING
  • 9. Organized by the Community, for the Community. WHAT IS A UNIT TEST? • Automated • Full control / runs in memory • Consistent & fast • Tests a single logical concept • Readable & maintainable • Trustworthy SUGCON NORTH AMERICA 2015 9 Roy Osherove, Art of UnitTesting
  • 10. Organized by the Community, for the Community. INTEGRATION TESTS • More fragile • Provide full system confidence • Shows different systems working together SUGCON NORTH AMERICA 2015 10
  • 11. Organized by the Community, for the Community. SUGCON NORTH AMERICA 2015 11 TOOLS
  • 12. Organized by the Community, for the Community. MYTOOLBOX • XUNIT – Better separation of tests than NUNIT. • NCRUNCH – Runs tests as you type. • NSUBSTITUTE – Creates fake versions of interfaces in tests. • AUTOFAC – Creates real versions in production. SUGCON NORTH AMERICA 2015 12
  • 13. Organized by the Community, for the Community. SUGCON NORTH AMERICA 2015 13 TESTING SITECORE
  • 14. Organized by the Community, for the Community. SITECORE INTEGRATION TESTING • Browser based – More robust – Http Context available • Class Library based – Works withTest Runners – Easier to automate SUGCON NORTH AMERICA 2015 14
  • 15. Organized by the Community, for the Community. SITECORE FAKE DB • Developed by Sergey Shusliapin of Sitecore Ukraine • Uses Sitecore DLLs, replaces data layer • Tests Sitecore Items directly • No code changes required! SUGCON NORTH AMERICA 2015 15
  • 16. Organized by the Community, for the Community. MAP SITECORE ITEMS • Use object mapper like Glass • Use Dependency Injector like Autofac • Your code does not talk directly to Sitecore SUGCON NORTH AMERICA 2015 16
  • 17. Organized by the Community, for the Community. SUGCON NORTH AMERICA 2015 17 NEXT STEPS
  • 18. Organized by the Community, for the Community. BENEFITS • Encourages focus • Creates confidence • Drives good design SUGCON NORTH AMERICA 2015 18
  • 19. Organized by the Community, for the Community. CHALLENGES • Hard to learn new habits • Team buy in • Finding time SUGCON NORTH AMERICA 2015 19
  • 20. Organized by the Community, for the Community. SOLUTIONS • Avoid all-or-nothing thinking – One, two hours ofTDD per week • Get involvement – Pair up, ask for input – Run aTDD Kata session • Sell the value – Fast feedback – Flexible design SUGCON NORTH AMERICA 2015 20
  • 21. Organized by the Community, for the Community. FEARLESS If we have the tests we become fearless about making changes. If we see messy code, or an unclean structure, we can clean it without fear. Because of the tests, the code becomes malleable again. Because of the tests, software becomes soft again. – Robert Martin, bit.ly/tdd3rules SUGCON NORTH AMERICA 2015 21
  • 22. Organized by the Community, for the Community. SUGCON NORTH AMERICA 2015 Thanks! @DanSolovay bit.ly/tddlinks

Editor's Notes

  • #14: Okay, let’s see how these concepts apply to Sitecore. First, let’s look at tests that actually execute logic against the Sitecore database, so Sitecore integration tests.