Jun 06 2012
To mark my return to blogging, I’ve decided to write a series of blog posts around automated testing in CRM2011. This is part 1, an overview of the types of tests I’m creating and the tools I’m using for creating and running the tests. Future posts will look at each of the types of tests in turn and look at how I’m using TeamCity to automate these tests.
The automated testing in place for CRM2011 is broken downv into the following three types of tests:
- Unit Tests
- These are small, fast tests that are written in code and are designed to test isolated pieces of code.
- The tests are for complete systems or sub-systems, e.g. a plugin running in the context of CRM. However, they are still code based and tested in without User Interface interaction.
- This is tests of the system from the perspective of the user. They are based on a simulation of the user clicking and entering values in the browser.
The basic components that are being used for automated testing of CRM are as follows:
- Used for creating the test classes and test runner used for executing the tests.
- This is used to create copies of actual plugin execution contexts from CRM. These are then used in plugin unit tests outside of CRM.
- Used for creating mock copies of external systems, e.g. CRM Web Services, so that unit tests do not require access to CRM.
- This is a web browser runner that simulates a user clicking in the browser.
- This integrates testing functionality into Visual Studio, making it quicker and easier to write and run tests from within Visual Studio without having to rely on an external application.
- This is an automated continuous integration system that is used to both compile the source code and run unit tests. It has also been configured to create a backup of the customisation solution from CRM into Subversion.
The following diagram illustrates the tool stack used for each of the types of tests, with the system under test at the top of the stack and the host environment at the bottom:
All of the test can be run in either Visual Studio or TeamCity and all of the test are based on the Gallio/MbUnit test framework. In addition, the unit tests uyse Moq and CrmPluginTestingTools to allow the unit tests to run in isolation; the integration tests simply call straight to the CRM Web Services for both setting up the test and confirming the results; the user interaction tests use WatiN to control IE to run the test.
- Part 1: Tool Stack
- Part 2: Unit Testing
- Part 3: Inetgration Testing
- Part 4: User Interaction Testing
- Part 5: TeamCity Configuration