%Unit Test Case

This is the class which I want to test.

Class GSK.MyTestUnit Extends %RegisteredObject
{

ClassMethod Add(num1 As %Integer, num2 As %Integer)
{
s res=num1+num2
q res
}
}

This is my testing class.

Class GSK.TestingClass Extends %UnitTest.TestCase
{

Method test()
{
Do $$$AssertEquals(##class(GSK.MyTestUnit).Add(3,8),41, "Test Add(2,2)=4 passed ")
do $$$AssertNotEquals(##class(GSK.MyTestUnit).Add(3,8),11,"pass/fail")
}

}

The test cases are passed even though they should fail.

s ^UnitTestRoot="C:\TestSuite1"
d ##class(%UnitTest.Manager).RunTest("Test2")

Here TestSuite1 is my parent directory and Test2 is the folder which contains the test case file
please can anybody help me in this issue

  • + 1
  • 1
  • 38
  • 0
  • 1

Answers

I don't think that your test method is being run. I'm pretty sure that it has to start with "Test" (with a capital "T") for the manager to discover it.