Thursday, September 6, 2007

Unit Testing Table methods in AX

There are few additional requirements to unit test table methods.

Override following methods:

1- testElementName
public identifiername testsElementName()
{
identifiername ret;
ret = super();
return "Table1";
}

2- testElementType()
public UtilElementType testsElementType()
{
return UtilElementType::Table;
}

If you don't override these methods then there would be ZERO code coverage of your methods.

Don't forget to inherit your Unit Test class from SysTestCase.
Also take care of the naming requirement of your Unit Test Class.
The name of method must also be in accordance with the naming requirement of methods.

Thanks.

Shujaat.

1 comment:

Anonymous said...

Good tip about Unit Testing. I will try this :-).

-Dilip
http://daxdilip.blogspot.com