Unit testing is important but… where do I start?

If you have attended the increasingly popular CRM Saturday conference, you probably gained some valuable insights around the key aspects of delivering successful CRM implementations, and how to overcome the main challenges one may face during the implementation.

If not, I encourage you to visit the web site, it has great speakers, great content, and lots of networking opportunities… not to mention is one of the few Dynamics events out there where attendance is 100% free.

Two of the sessions were around test automation and how to implement a true DevOps strategy for Dynamics CRM, two key areas and best practices to increase the overall quality and healthiness of your CRM implementation, which, in turn, would give you the following benefits:

  •     Turning your customers into even more happy customers  (external)
  •     Making your colleagues a bit less stressed because of regression / production bugs will be reduced (internal)

If you are still not convinced about why your team should unit test your code, here’s another blog post with the slides of the test automation presentation.

Once your team realises how important unit testing is, the next immediate question probably is:

  • “Ok, I have an implementation which has been running for years , and I have a bunch of existing code, not tested. At the same time, I have a limited set of resources and trying to unit test everything would be mad… where do I start?”

Ideally, one should achieve a code coverage above 90%, but if you have limited resources, my advice would be: the 80/20 rule.

Try to find the 20% of your code which represents at least the 80% of the total number of executions or executed time, just because if there is a bug in there, then it is likely to affect more users than a piece of code which is executed from time to time only (this might be actually more complex as maybe something than just runs from time to time may have a bigger impact based on a million different variables… but I hope you get the idea).

The next question might be…. how to measure it?

Well, it turns out, from a plugin / codeactivity perspective, you could extract that information from the System Jobs entity rather easily.

Every time a plugin / workflow is executed, a new entry in that table is created, with the Created On, Completed On, fields etc, so you could actually measure how much time a single workflow / plugin execution took. If you have an On-Premise installation, then that is just a SQL query with some groupings, if On-Line, then a data extract plus some Excel manipulation magic should be enough too or… make use of the great Organisation Insights feature in AppSource:

Are you unit testing your code? If so, how did you start unit testing legacy code? Did you use a different approach? We would love to know more about your own experiences.

Please leave a comment below.

Differences between MS CRM 2011 & MS CRM 4.0

We usually work on the newest version of Dynamics CRM e.g. Dynamics 365 now. However we still have some clients who use CRM 4.0 . The thing is, some companies didn’t decide to upgrade their CRM system and they still need our support and CRM strategy. We are even surprised how many clients are asking about our help and strategy in upgrading their CRM 4.0 to CRM 2011 or higher.

Recently we were very often asked to highlight the biggest differences / concerns between MS CRM 2011 & 4.0. First of all, there are many differences about syntax/methods between CRM 2011 and CRM 4.0. Please check some of the comparisons on the above image.

However there are more syntax differences between CRM 4 and CRM 2011 at least in:

  • data types
  • plugins
  • workflows

As we promised we try to keep everything simple. However if you need more technical details about it we would recommend you two following articles:

  1. A Summary Syntax Difference between CRM2011 and CRM4.0 made by Ben Hosking. Ben Hosking did a great job and summarised everything in one post.
  2. Differences between Dynamics CRM 4.0 and CRM 2011 by Ash

Generation Documentation for CRM 4.0

Dynamics CRM 4.0 is the first version of the product which has seen significant takeup in the market and passed the 1 million user mark in July 2009. These days CRM 4.0 is not very popular, but some organisation use it and you can find many supported tools for CRM 4.0 e.g. Microsoft Dynamics CRM 4.0 Documentation Generator.

It is an add-in for Microsoft Office Excel 2007/2010 to automatically generate documentation for Microsoft Dynamics CRM 4.0. You can download it from codeplex using following url: https://crm4documentation.codeplex.com/
I have worked on some CRM 4.0 legacy projects and I have to say that it is a great tool for documenting customizations. You can list all Forms, Picklist values and Scripts for entities. It generates an Excel file with all details about your CRM 4.0 organization which is very useful.  When you dowload that tool you can download sample documentation of Forms, Pickiists, Scripts.