Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Crm saturday madrid 2017 jordi montaña - test automation

201 views

Published on

Crm saturday madrid 2017 jordi montaña - test automation

Published in: Technology
  • D0WNL0AD FULL ▶ ▶ ▶ ▶ http://1lite.top/No5qeP ◀ ◀ ◀ ◀
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

Crm saturday madrid 2017 jordi montaña - test automation

  1. 1. Presenter: Jordi Montaña Topic: Test Automation for Dynamics 365
  2. 2. Jordi Montaña • Solution Architect • +10 yrs experience • Business Solutions MVP • @jordimontana • GitHub: jordimontana82 • Blog: • https://dynamicsvalue.com/blog
  3. 3. Agenda • Why Unit Testing? • Why FakeXrmEasy? • How it works • DEMO (VS 2017 + Live Unit Tests)
  4. 4. Why Unit Testing?
  5. 5. 1. Cost €
  6. 6. 1. Epic Bugs: Space Bugs
  7. 7. 1. Epic Bugs: Space Bugs In 1996, first ESA’s Ariane-5 mission…
  8. 8. 1. Epic Bugs: Space Bugs In 1996, first ESA’s Ariane-5 mission… > $370 Million project…
  9. 9. 1. Epic Bugs: Space Bugs In 1996, first ESA’s Ariane-5 mission… > $370 Million project… …which blew up in 40 secs due to an integer overflow
  10. 10. In 1999, NASA’s Mars Climate Orbiter… 2. Epic Bugs: Space Bugs $ 320 Million Project…
  11. 11. In 1999, NASA’s Mars Climate Orbiter… 2. Epic Bugs: Space Bugs $ 320 Million Project… … burned up by a unit of measure conversion issue
  12. 12. 3 Epic Bugs: Financial $440 Million
  13. 13. 3 Epic Bugs: Financial Bankrupt in 45 mins
  14. 14. Bugs have consequences… both external and internal
  15. 15. 2. External implications Customers not happy 
  16. 16. 3. Internal implications Pain… or… can you sleep at night?
  17. 17. “Unit testing gives us automated regression testing. ”
  18. 18. “But…. It also drives development”
  19. 19. Large projects and changes - 500+ Custom entities - 80+ Plugins - 540+ Plugin Steps - 780+ Workflows
  20. 20. Large projects and changes - Web portals - SSIS packages + SSRS Reports - GIS, MDS, Mobile apps,…
  21. 21. “Unit + integration tests provide a sustainable approach to change management.”
  22. 22. Why FakeXrmEasy?
  23. 23. 1. Why FakeXrmEasy? CRM SDK is pretty much “static” composed of: - CRUD - Queries - Other messages
  24. 24. 2. Why FakeXrmEasy? Prior to 2014… started doing unit testing with FakeItEasy and…. - Found myself doing a lot of repetitive tasks… - … and many problems
  25. 25. Problems with existing general purpose .NET frameworks - Generic & Complex - Mocking Queries is REALLY hard - Multiple CRM messages to mock
  26. 26. Problem #1: Complexity var mock = new Mock<IOrganizationService>(); mock.Setup(service => service.Create(It.IsAny<Entity>())) .Callback((Entity e) => { e.Id = id; entities.Add(e); }) .Returns((Entity e) => id);
  27. 27. Problem #2: Mocks ignore query filters / joins etc…
  28. 28. Problem #3: A single .Execute() method with a bunch of different messages to mock
  29. 29. Unit testing for Dynamics 365 would be amazing if….
  30. 30. … everything was already mocked for us, by default.
  31. 31. So… FakeXrmEasy was born in November 2014
  32. 32. “It does so during development, before deploy, functional testing, UAT, Staging and, of course, Production.”
  33. 33. How it Works? - 1 single ctx.GetOrganizationService() call needed. - Query Engine: QueryExpression, LINQ, FetchXml, QueryByAttribute - Fake Messages: many implemented, but not all of them… yet (pull requests pls!)
  34. 34. Architecture Overview FakeItEasy In-Memory DB (this is actually way more simple than it sounds!) CRUD Query Engine Fake Message Executors IOrganizationService
  35. 35. In-Memory DB In-Memory DB (this is actually way more simple than it sounds!) - 2 Levels of Dictionaries - First level indexes by Entity Name, second level indexes entity records by Id (Guid) to simulate the different CRM tables.
  36. 36. In-Memory DB In-Memory DB (this is actually way more simple than it sounds!) Fast! Mainly because memory is several orders of magnitude faster than disks or network. Also, because even in-memory, dictionaries gives us generally Θ(1) algorithm complexity: Constant Access Time for CRUD operations. Given O(n) the worst case. CRUD
  37. 37. What about the Query Engine…? In-Memory DB (this is actually way more simple than it sounds!) Query Engine
  38. 38. QueryExpression In-Memory DB (Dictionaries here…) CRM LINQ CRM LINQ Provider
  39. 39. QueryExpression In-Memory DB (Dictionaries here…) CRM LINQ ??? What about the Query Engine…?
  40. 40. QueryExpression What about the Query Engine…? In-Memory DB (Dictionaries) CRM LINQ LINQ Query Translation Step
  41. 41. QueryExpression What about the Query Engine…? In-Memory DB (Dictionaries) CRM LINQ LINQ QueryByAttribute FetchXml
  42. 42. QueryExpression What about the Query Engine…? In-Memory DB (Dictionaries) CRM LINQ LINQ QueryByAttribute FetchXml
  43. 43. To recap… - 1 single ctx.GetOrganizationService() call needed. No mocks! - Query Engine: QueryExpression, LINQ, FetchXml, QueryByAttribute - Fake Messages: many implemented, but not all of them… yet (pull requests pls!)
  44. 44. “FakeXrmEasy provides a sustainable and cost-effective approach to facilitate change management for Dynamics 365”
  45. 45. Applications “Any .NET app connected to an IOrganizationService”
  46. 46. Applications - Web portals - Plugins, CodeActivities, Custom Actions - Console apps - Xamarin apps - Script component in SSIS - WPF - …
  47. 47. DEMO TIME!
  48. 48. Thanks to the Sponsors!
  49. 49. Thanks to the contributors! @DigitalFlow @slahn @arjenst @rajyraman @ccellar @bacon1986 @daryllabar * Sorted by num of contributions
  50. 50. References Epic Bugs http://www.computerworld.com/article/2515483/enterprise-applications/epic-failures--11- infamous-software-bugs.html https://en.wikipedia.org/wiki/Cluster_(spacecraft) https://dougseven.com/2014/04/17/knightmare-a-devops-cautionary-tale/ Testing Pyramid / TDD https://martinfowler.com/bliki/TestPyramid.html https://testing.googleblog.com/2015/04/just-say-no-to-more-end-to-end-tests.html https://www.thoughtworks.com/insights/blog/mockists-are-dead-long-live-classicists

×