Charlie Mott

  Home  |   Contact  |   Syndication    |   Login
  20 Posts | 0 Stories | 20 Comments | 0 Trackbacks

News

View Charlie Mott's profile on LinkedIn



Archives

Post Categories

Article Source: http://geekswithblogs.net/charliemott

Often it is handy to organise BizUnit tests into test lists. This way longer running tests and edge case tests can be removed from check-in builds keep them running a bit more quickly. However, updating a .vsmdi test lists for each individual test method is time consuming.

A better solution is to use the new Category attribute that comes with MSTest in .NET4 (nUnit  has supported a categories feature for a while).  In the TFS build processes, the mstest command line can make use of the /category flag. The check-in build will run tests categorised as Happy Flow. A Full build (nightly build) will run the lot. (Note, it is possible to do specify multiple categories).

In my solution, I have created constants for the followoing categories:

Acme.TestCategory.TestType.WakeUpBizTalk
(e.g tests where we just fire messages through biztalk without checking the results.)
  
Acme.TestCategory.SourceSystem.DyanmicsAx
Acme.TestCategory.SourceSystem.DynamicsCrm
Acme.TestCategory.SourceSystem.Maximo
etc
  
Acme.TestCategory.TargetSystem.DyanmicsAx
Acme.TestCategory.TargetSystem.Icon
etc
  
Acme.TestCategory.UseCase.HappyFlow
Acme.TestCategory.UseCase.AlternativeFlow (e.g. fault scenarios)

Acme.TestCategory.DataType.CustomerServices
Acme.TestCategory.DataType.Journal
etc

So a sample test method with these attributes would be as follows.  Notice the multiple target systems.

/// <summary>
/// Test valid Tax Codes message from Dynamics AX
/// </summary>
[TestMethod]
[TestTimer(5, 0)]
[TestCategory(SourceSystem.DynamicsAx)]
[TestCategory(TargetSystem.Maximo)]
[TestCategory(TargetSystem.Oms)]
[TestCategory(DataType.TaxCodes)]
[TestCategory(UseCase.HappyFlow)]
public void DynamicsAx_TaxCodes_Valid_Success()
{
       ...

Note: For details of the TestTimer attribute, see here. This is also a handy feature for BizUnit tests to validate performance.

posted on Friday, April 1, 2011 10:06 AM