The test model is generated against the following specifications:

Processed elements:

The following UML elements are processed by the test model generator:

  • C# Packages

  • C# public classes

  • C# public operations.

    • constructors and destructors are ignored.

All other elements are ignored.

Generated model

In most case is generated test element owns a «UnitTest» stereotyped Dependency towards the tested element.

Test root

A «Test folder» stereotyped package is created in the same package as the root C# package.

This test folder will contain all generated test models.

These test models can be freely moved from this test folder. Running the "Update test" command will update the moved test model without moving it back to its original parent.

For a C# package

A C# package is generated with the same name as the tested package, including its composition children.

For a C# class

For each public ‘Client’ C# class, a C# test class is generated as following:

  • It is named ‘TestClient’: it has the same name as the one generated by C# Designer, prepended with "Test".

  • It has the same name-spacing as the tested class.

  • It has an ElementImport towards ‘Client so that a using is generated in the .cs file.

  • It is stereotyped «Test namespace» and «C# Class».

  • It has the [TestFixture] attribute.

  • It contains the two methods ‘SetUp’ and ‘TearDown'.

For a C# operation

For each testable doSomething(…​) operation a test operation is generated in the test class as following:

  • it has the void testDoSomething() signature, with no parameters.

  • it has a default implementation that generates a test failure, telling the test is not implemented.

  • It has the «TestOperation» stereotype