Wednesday, July 4, 2018

Creating Test Cases

A unit test, in the context of the Unit Test framework, includes test cases, how
test cases are staged with data, and the organization of test cases. A test case is a
class that extends the
SysTestCase class. You can add test methods to test each
requirement of the feature code.
The following example is of how to create a test case. In this example you will be
testing an existing system class, so the results should be successful. You will test
the
SysDictTable class, to make sure its methods to return the table name and
group for a given table name, are correct. The following is the test case class
declaration.



1
2
3
4
5
6
[SysTestTargetAttribute('SysDictTable',
UtilElementType::Class)]
class SysDictTableTest extends SysTestCase
{
  SysDictTable sysDictTable;
}

Note the attribute used on the class. The SysTestTargetAttribute attribute is
attached to the test case to specify which element is being tested. In this case, it is
the
SysDictTable class being tested. There are a number of predefined attributes
available in the Unit Test framework:

Attribute Description Applied to
SysTestMethodAttribute Indicates that a method is
a unit test.
Method
SysTestCheckInAttribute Indicates the test is a
check-in unit test. A
check-in test is run when
checking in code to a
version control system to
ensure a proper level of
quality.
Method or Class
SysTestNonCheckInAttribute Indicates the test is not a
check-in test.
Method

SysTestTargetAttribute Indicates the application
object that is being tested
by the case. This attribute
takes two parameters:
Name of element, and
UtilElementType value.
Class
SysTestInactiveTestAttribute Indicates the class or
method is inactive.
Method

Another variable has been created in the ClassDeclaration, of the type of the class
being tested.


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...