Dynamics CRM 2011 – Unit Testing

Jaime Smith, 20 December 2011

Dynamics CRM 2011 – Unit Testing

There are so many parts to Quality Assurance and testing but the one part the developers have to play in the game is to conduct unit testing on their code.  Unit testing involves segregating out parts of the code and checking that it is correct and works as intended.  It is preferential to create test cases to which the developer will test against and importantly having Test Driven Development (TDD) to ensure that the tests are created before not after the creation of code, before and not after fixing bugs!  No-one wants to be in the circumstance illustrated in the cartoon yet somehow this is often the case!

An advantage of committing to unit testing is that it has the ability to reduce the amount of time a developer has to run debuggers, as each segment of code is tested and it can be fixed and any errors found in the unit test will only relate to the most recent edit of the code.

I have read a lot of information while researching unit testing for CRM 2011 and my mind is full! One standout point is that it can be difficult to unit test in CRM due to its complex and dynamic nature.   Despite this, unit testing can still play a part in ensuring that the code is behaving as intended and allowing the developer to have confidence in what they have written.  At Magnetism we follow the SureStep Methodology and it has perhaps offered up the most comprehensive pathway to guide best practice of unit testing for CRM 2011 Code. 

I have come to the conclusion as a non-technical member of our team is to leave unit testing to the developers but from the business standpoint ensure that you have checks and balances in place to ensure that this testing is happening to maintain the quality of the product and the reputation of your company.

* Image from http://www.mssoftwareconsulting.com/msswc/blog/post/Coding-Cartoon.aspx