Wednesday, July 4, 2018

Isolation

The isolation level of a test case varies based on the changes that the test case
will make to the data. Each test case could have different needs for isolation
based on what data it will change. The Unit Test framework provides four test
suite base classes that provide different levels of isolation. The following table
describes the test suites by the level of isolation that they provide.

Test suite class Description
SysTestSuite Default test suite. No isolation.
SysTestSuiteCompanyIsolate
Class
Constructs an empty company account for
each test class. All test methods on the class
are run within the company, then it is
deleted.
SysTestSuiteCompanyIsolate
Method
Constructs an empty company account for
each test method, and then deletes it at the
end of the method.
SysTestSuiteTTS Wraps each test method in a transaction.
After the method is complete, the transaction
is aborted.
Note: Tests that need to commit data will not
work in this suite. Also, the
ParmExceptionExpected exception is not
supported in this suite.
SysTestSuiteCompIsolate
ClassWithTts
This is a combination of
SysTestSuiteCompanyIsolateClass and
SysTestSuiteTTS.

To apply a specific test suite to a test class, override the createSuite method on
the test class, and return an object of the type of the suite required.


The following example demonstrates how a test suite can be applied to a test
class.



1
2
3
4
5
class SysTestSuite createSuite()
{
  // Isolation level: construct a company account for the entire test class.
  return new SysTestSuiteCompanyIsolateClass(this);
}

Best Regards,
Hossein Karimi

No comments:

Post a Comment

Configure the Firewall on the Enterprise Portal Server

After you install Enterprise Portal, enable Web Server (HTTP) in Windows Firewall. If you do not enable the web server in Windows Firewall...