Search code examples
javascriptunit-testingdynamics-crm-2016

Java Script Unit Testing - CRM 2016 Online


I'm stuck. I want to unit test my Java Scripts (Web Resources) in CRM 2016 but I'm not able to get this going. All the unit testing mocking/faking frameworks on the internet are for older versions of CRM. I'm yet to find a fully working unit testing framework for CRM 2016. There is FakeXRMEasy but that has only been developed for Plugins, Workflows etc. Does anyone know how I can achieve this?


Solution

  • I have now successfully implemented Unit Testing of Java Scripts in my project by using QUnit and a Faking/Mocking framework called XRMPage-Mock. It was an easy setup after I understood it all. The link for the mocking framework is - https://github.com/ambek/XrmPage-Mock Basically - Grab the XRMPage.js, Attribute.js, Control.js files and put them in your Testing Solution. Get QUnit, and all the relevant js, css and HTML files. The example on this link - https://github.com/ambek/XrmPage-Mock/tree/master/Example should help with writing the actual unit test.