SysTestCase Class [AX 2012]

The SysTestCase class defines the structure for tests in the Unit Test framework.

Syntax

class SysTestCase extends SysTestAssert implements SysTestable, SysTestSuiteProvider, SysTestSuiteActor, SysTestableExceptionExpected, SysTestListenerInformationProvider, SysTestableFaultExpected

Run On

Called

Methods

  Method Description
Gg933916.pubmethod(en-us,AX.60).gif assertEquals Checks whether two values are equal. (Inherited from SysTestAssert.)
Gg933916.pubmethod(en-us,AX.60).gif assertExpectedInfoLogMessage Validates that an expected message has been put in the Infolog.
Gg933916.pubmethod(en-us,AX.60).gif assertFalse Checks whether a condition is not true. (Inherited from SysTestAssert.)
Gg933916.pubmethod(en-us,AX.60).gif assertNotEqual Checks whether two values are not equal. (Inherited from SysTestAssert.)
Gg933916.pubmethod(en-us,AX.60).gif assertNotNull Checks whether the value is not nullNothingnullptrunita null reference (Nothing in Visual Basic). (Inherited from SysTestAssert.)
Gg933916.pubmethod(en-us,AX.60).gif assertNotSame Checks whether the objects are not the same. (Inherited from SysTestAssert.)
Gg933916.pubmethod(en-us,AX.60).gif assertNull Checks whether the value is nullNothingnullptrunita null reference (Nothing in Visual Basic). (Inherited from SysTestAssert.)
Gg933916.pubmethod(en-us,AX.60).gif assertRealEquals Checks whether two values are equal with regard to a delta. (Inherited from SysTestAssert.)
Gg933916.pubmethod(en-us,AX.60).gif assertSame Checks whether the objects are the same. (Inherited from SysTestAssert.)
Gg933916.pubmethod(en-us,AX.60).gif assertTrue Checks whether the condition is true. (Inherited from SysTestAssert.)
Gg933916.pubmethod(en-us,AX.60).gif cancelTimeOut Cancels a previous method call to the setTimeOut method. (Inherited from Object.)
Gg933916.pubmethod(en-us,AX.60).gif createSuite Constructs the test suite used by this test case.
Gg933916.pubmethod(en-us,AX.60).gif equal Determines whether the specified object is equal to the current one. (Inherited from Object.)
Gg933916.pubmethod(en-us,AX.60).gif exceptionExpected Indicates whether the current test is expected to throw an exception.
Gg933916.pubmethod(en-us,AX.60).gif exceptionMessage Gets the exception message of the expected exception.
Gg933916.pubmethod(en-us,AX.60).gif fail Fails the current test case. (Inherited from SysTestAssert.)
Gg933916.pubmethod(en-us,AX.60).gif faultCode
Gg933916.pubmethod(en-us,AX.60).gif faultExpected
Gg933916.pubmethod(en-us,AX.60).gif faultReason
Gg933916.privmethod(en-us,AX.60).gif findTestTarget
Gg933916.pubmethod(en-us,AX.60).gif getListenerInformation Gets the listener information for the test method.
Gg933916.pubmethod(en-us,AX.60).gif getTimeOutTimerHandle Returns the timer handle for the object. (Inherited from Object.)
Gg933916.pubmethod(en-us,AX.60).gif handle Retrieves the handle of the class of the object. (Inherited from Object.)
Gg933916.pubmethod(en-us,AX.60).gif info Logs an informational message to the Infolog. (Inherited from SysTestAssert.)
Gg933916.pubmethod(en-us,AX.60).gif new Initializes a new instance of the SysTestCase class. (Overrides the new Method.)
Gg933916.pubmethod(en-us,AX.60).gif notify Releases the hold on an object that has called the wait method on this object. (Inherited from Object.)
Gg933916.pubmethod(en-us,AX.60).gif notifyAll Releases a lock on the object that was issued by the wait method on this object. (Inherited from Object.)
Gg933916.pubmethod(en-us,AX.60).gif objectOnServer Determines whether the object is on a server. (Inherited from Object.)
Gg933916.pubmethod(en-us,AX.60).gif owner Returns the instance that owns the object. (Inherited from Object.)
Gg933916.pubmethod(en-us,AX.60).gif parmExceptionExpected Determines whether an exception is expected in the current test.
Gg933916.pubmethod(en-us,AX.60).gif parmFaultExpected
Gg933916.pubmethod(en-us,AX.60).gif run Runs the test case.
Gg933916.pubmethod(en-us,AX.60).gif setTimeOut Sets up the scheduled execution of a specified method. (Inherited from Object.)
Gg933916.pubmethod(en-us,AX.60).gif setUp Sets up the test case environment.
Gg933916.pubmethod(en-us,AX.60).gif setUpTestCase Sets up the test environment for the test case.
Gg933916.pubmethod(en-us,AX.60).gif tearDown Tears down the test case environment.
Gg933916.pubmethod(en-us,AX.60).gif tearDownTestCase Tears down the test environment for the test case.
Gg933916.pubmethod(en-us,AX.60).gif testMethods Returns the test methods for a test case.
Gg933916.pubmethod(en-us,AX.60).gif testsElementName Gets the name of the code coverage element.
Gg933916.pubmethod(en-us,AX.60).gif testsElementType Gets the type of the code coverage element.
Gg933916.pubmethod(en-us,AX.60).gif toString Returns a string that represents the current object. (Inherited from Object.)
Gg933916.pubmethod(en-us,AX.60).gif usageCount Returns the current number of references, that is, the value of the reference counter, that the object has. (Inherited from Object.)
Gg933916.pubmethod(en-us,AX.60).gif useSingleInstance Determines the lifetime of the test case instance used to execute the test methods of the test case.
Gg933916.pubmethod(en-us,AX.60).gif wait Pauses a process. (Inherited from Object.)
Gg933916.privmethod(en-us,AX.60).gif wasExpectedInfoLogMessageThrown Checks whether the expected exception message has been put in the Infolog.
Gg933916.pubmethod(en-us,AX.60).gif xml Returns an XML string that represents the current object. (Inherited from Object.)

Top

Remarks

Steps to create a test case:

  1. Create a class that derives from the SysTestCase class.

  2. Optionally initialize the test state by overriding the setUp method.

  3. Optionally clean up the test state by overriding the tearDown method.

  4. Add tests as public methods that are prefixed with "test" and have no parameters or return value.

Examples

The following code example tests the fictitious Employee class.

class EmployeeTest extends SysTestCase 
{ 
    Employee employee; 
  
    public void setUp() 
    { 
        // Create an instance of the Employee class for each test method. 
        employee = new Employee("your name"); 
        super(); 
    } 
  
    void testName() 
    { 
        // Verify that the name is set. 
        this.assertEquals("your name", employee.name()); 
    } 
}

Inheritance Hierarchy

Object Class
  SysTestAssert Class
    SysTestCase Class
      SysTestCaseCompanyData Class

See Also

Unit Test Framework

Walkthrough: Testing a Class Using the Unit Test Framework