cub-e.net

just coding...

Automating CRM Test Cases

The first level of CRM automated test cases consists of the database and schema unit tests that validate the general structure and data of a deployed CRM solution. 


The second level of CRM tests should include more extensive API tests to check the consistency of CRM query and update operations and test the functionalities of deployed plug-ins and workflows. Negative and positive test scenarios should also be included to test the error and exception branches of the application. 


The third level of automated CRM tests consists of the functional tests. Functional testing of CRM solutions are similar to any ASP.NET or other web applications testing methods, leveraging the web testing framework of Visual Studio environment. 

Two possible automation techniques are available using Visual Studio for automated UI tests: Captured web tests and Coded UI tests. 


The first scenario is recommended to quickly capture and create automated test cases for a specific CRM form or functionality. The captured test scenario will contain all web requests and responses executed by the client browser. Visual Studio test framework provides a lot of tools to pre- and post- process the tests; however, to be able to rerun a captured Web Test, a lot of manual work is still required (for example, extracting CRM view IDs, entity IDs, parameterizing data entries, and randomizing search clauses and data). The captured and parameterized Web Tests can usually support only a specific functional version of a CRM form. After changing the flow of the tested functionality, a recapture of the test is usually be required. 



Creating coded UI tests usually requires more effort for developers but can be more general, making it possible to support even larger structural changes on the tested forms. Coded UI tests can be created either by converting a captured Web Test, or by reusing the existing samples and common components provided by the CRM 2011 Performance Toolkit. 


Using automated tests and Visual Studio for tracking requirements and connecting work-items to check-ins provides the ability for bugs and resolution check-ins to be traced back to the specific requirement and test scenario. In fact, with the Visual Studio test framework, it is possible to track code changes and their impacts through to the application and test suites, including which test cases are required to be re-run. 


Note: To have this experience across all aspects of an enterprise Dynamics CRM delivery (including CRM customizations) requires an offline build process using the unpacked customization source tree.