Fake Xrm Easy TDD for Dynamics made simple
- Slides: 59
#Fake. Xrm. Easy TDD for Dynamics made simple
Hi! @jordimontana 82
Why Unit Testing?
1. Cost €
1. Epic Bugs: Space Bugs
1. Epic Bugs: Space Bugs In 1996, first ESA’s Ariane-5 mission…
1. Epic Bugs: Space Bugs In 1996, first ESA’s Ariane-5 mission… > $370 Million project…
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
2. Epic Bugs: Space Bugs In 1999, NASA’s Mars Climate Orbiter… $ 320 Million Project…
2. Epic Bugs: Space Bugs In 1999, NASA’s Mars Climate Orbiter… $ 320 Million Project… … burned up by a unit of measure conversion issue
3 Epic Bugs: Financial $440 Million
3 Epic Bugs: Financial Bankrupt in 45 mins
Bugs have consequences… both external and internal
Bugs have consequences… both external and internal
2. External implications Brand
Brand implications
Brand implications
3. Internal implications Pain… or… can you sleep at night?
“Unit testing gives us automated regression testing. ”
“It does so during development, before deploy, functional testing, UAT, Staging and, of course, Production. ”
Unit Tests vs UI / Api Testing…
Why Unit Testing vs… - Fast - Reliable - Isolation
Why Unit Testing vs… - Is something broken? - What exactly? - Where?
Unit testing cons… - Is not gonna find new bugs for us… - Not for high level testing like UI or E 2 E tests…
“That’s why we need testers!” “So that we can create new unit tests for the bugs they raise!”
Bug = Missing Unit Test
Large projects and changes - 500+ Custom entities - 80+ Plugins - 540+ Plugin Steps - 780+ Workflows
Large projects and changes - Web portals - SSIS packages + SSRS Reports - GIS, MDS, Mobile apps, …
“Unit + integration tests provide a sustainable approach to change management. ”
Why Fake. Xrm. Easy?
1. Why Fake. Xrm. Easy? CRM SDK is pretty much “static” composed of: - CRUD - Queries - Other messages
2. Why Fake. Xrm. Easy? Prior to 2014… started doing unit testing with Fake. It. Easy and…. - Found myself doing a lot of repetitive tasks… - … and many problems
Problems with existing general purpose. NET frameworks - Generic & Complex - Mocking Queries is REALLY hard - Multiple CRM messages to mock
Problem #1: Complexity var mock = new Mock<IOrganization. Service>(); mock. Setup(service => service. Create(It. Is. Any<Entity>())). Callback((Entity e) => { e. Id = id; entities. Add(e); }). Returns((Entity e) => id);
Problem #2: Mocks ignore query filters / joins etc…
Problem #3: A single. Execute() method with a bunch of different messages to mock
Unit testing for Dynamics 365 would be amazing if….
… everything was already mocked for us, by default.
So… Fake. Xrm. Easy was born in November 2014
How it Works? - 1 single ctx. Get. Organization. Service() call needed. - Query Engine: Query. Expression, LINQ, Fetch. Xml, Query. By. Attribute - Fake Messages: many implemented, but not all of them… yet (pull requests pls!)
Architecture Overview IOrganization. Service Fake. It. Easy Fake Message Executors CRUD Query Engine In-Memory DB (this is actually way more simple than it sounds!)
In-Memory DB - 2 Levels of Dictionaries - First level indexes by Entity Name, second level indexes entity records by Id (Guid) to simulate the different CRM tables. In-Memory DB (this is actually way more simple than it sounds!)
Fast! In-Memory DB 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 In-Memory DB (this is actually way more simple than it sounds!)
What about the Query Engine…? Query Engine In-Memory DB (this is actually way more simple than it sounds!)
CRM LINQ Provider CRM LINQ Query. Expression In-Memory DB (Dictionaries here…)
What about the Query Engine…? CRM LINQ Query. Expression ? ? ? In-Memory DB (Dictionaries here…)
What about the Query Engine…? CRM LINQ Query. Expression LINQ In-Memory DB (Dictionaries) Query Translation Step
What about the Query Engine…? CRM LINQ Query. By. Attribute Query. Expression LINQ In-Memory DB (Dictionaries) Fetch. Xml
What about the Query Engine…? CRM LINQ Query. By. Attribute Query. Expression LINQ In-Memory DB (Dictionaries) Fetch. Xml
To recap… - 1 single ctx. Get. Organization. Service() call needed. - Query Engine: Query. Expression, LINQ, Fetch. Xml, Query. By. Attribute - Fake Messages: many implemented, but not all of them… yet (pull requests pls!)
“Fake. Xrm. Easy provides a sustainable and cost-effective approach to facilitate change management for Dynamics 365”
Applications “Any. NET app connected to an IOrganization. Service”
Applications - Web portals Plugins, Code. Activities, Custom Actions Console apps Xamarin apps Script component in SSIS WPF …
DEMO TIME!
Thanks! @Digital. Flow @slahn @arjenst @rajyraman @ccellar @bacon 1986 @daryllabar * Sorted by num of contributions
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/Test. Pyramid. 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
- Fake xrm easy examples
- Fake xrm easy examples
- No mayten tree is deciduous
- Inductive vs deductive
- Deductive reasoning
- Junit testing private methods
- Tdd
- Exercise
- Msc gsm
- Tdd clinique
- Tdd framing flexible (legacy)
- Tdd pros and cons
- Tdd ciclo
- Tdd aaa
- Smalltalk
- Tdd tutorial java
- Tdd
- Tdd junit
- Bdd atdd
- Simulation made easy
- Rhonda scharf
- Coagulation pathway made easy
- Tabe 11/12 individual diagnostic profile
- Nepotism laws in texas
- Evangelism made easy
- Balancing chemical equations made easy
- Significant figures made easy
- Sales force mobility
- Leed v4 addenda
- Dental chart sample
- Essay made easy
- Online meetings made easy
- Poetry made easy
- Cosmetics made easy
- Communication made easy
- Easy agile
- Xkcd specifications
- Key hodgkin murmur
- Eeg made easy
- Ge orbital diagram
- Filings made easy
- Pes formule
- Orlies
- Project payback period
- Simple is not always easy
- Iso 22301 utbildning
- Novell typiska drag
- Tack för att ni lyssnade bild
- Ekologiskt fotavtryck
- Shingelfrisyren
- En lathund för arbete med kontinuitetshantering
- Kassaregister ideell förening
- Personlig tidbok
- Anatomi organ reproduksi
- Densitet vatten
- Datorkunskap för nybörjare
- Boverket ka
- Hur skriver man en tes
- Magnetsjukhus
- Nyckelkompetenser för livslångt lärande