locked
Unit Testing in CRM 2011 RRS feed

  • Question

  • Is there any standard approach for unit testing for CRM 2011 apps?
    Monday, February 14, 2011 5:49 PM

Answers

  • With the above response, I was not trying to discourage unit test in CRM development, but rather point out the pitfalls and challenges that you may experience when you want to apply TDD practice to CRM development. The output of unit testing in CRM development may not give you the same level of confidence that you would expect from other development practice using the same unit testing techniques. Even with the above mentioned limited advantage, you should strive to write unit test for your custom plugin and workflow code, since it does help to certain extent.
    Daniel Cai | http://danielcai.blogspot.com
    Tuesday, February 15, 2011 4:38 AM

All replies

  • I am afraid there is no. 

    The challenge when we want to unit test CRM applications resides in the difficulties to mock CRM plugin or workflow execution context due to the dynamic nature of CRM application. If we put it in a different way, whether your plugin or workflow code works really depends on the customizations that you have in your CRM system. Even you could mock up such execution context to certain extent, the mock code is still static, which is not going to be aware of any customization changes that you have made in CRM server. So unit testing your plugin and workflow code using mocked CRM execution context has very limited advantage. But you can do unit tests for all the rest code that doesn't have such dependencies. I have been thinking of developing a VS add-in to dump the plugin or workflow execution context and generate the mock up code, but I still don't think it's elegant enough to be useful. 

    Speaking about the client side unit tests, you have more freedom there, you could use any UI test suite that you are familiar with. 

    Hope this helps. 


    Daniel Cai | http://danielcai.blogspot.com
    Monday, February 14, 2011 10:43 PM
  • With the above response, I was not trying to discourage unit test in CRM development, but rather point out the pitfalls and challenges that you may experience when you want to apply TDD practice to CRM development. The output of unit testing in CRM development may not give you the same level of confidence that you would expect from other development practice using the same unit testing techniques. Even with the above mentioned limited advantage, you should strive to write unit test for your custom plugin and workflow code, since it does help to certain extent.
    Daniel Cai | http://danielcai.blogspot.com
    Tuesday, February 15, 2011 4:38 AM