Once you become familiar with the layout of the autogenerated test and test driver, the modifications you need to make to increase code coverage will become obvious.
To modify the test script:
In the Project Browser tab on the right-hand side of the screen, double-click the node TestPhoneNumber.java.
Maximize the test script editor.
This is the test driver script. In it you will perform those steps necessary to drive and test methods in the class under test.
Combined with the test driver script - discussed in the next section - full Java class testing is possible. The idea is that the files TestDriver.java (the test harness), TestPhoneNumber.java (the test), and PhoneNumber.java (the relevant source file) will be compiled and executed together (with execution taking place on the target specified by the currently selected Target Deployment Port Configuration).
Java component testing test scripts are written using the Java language. For detailed information about the script layout, take advantage of the Reference Manual. For the Tutorial, only critical script elements will be discussed.
Each Java class under test is assigned a test class whose name, by default, is the name of the class under test preceded by the word Test - thus the test class for the PhoneNumber class is named TestPhoneNumber. Each test class inherits from the TestCase class, which is a part of the JUnit framework. Certain duties, such as constructors and set-up/tear-down functions - as defined within JUnit - are automatically generated for you by the Component Testing Wizard.
Your responsibility is to simply define the actual tests - just as you would do with JUnit alone. To ensure that Test RealTimePurifyPlus RealTimePurifyPlus for Linux is able to check the success and failure of your tests, each test should be a method of the test class assigned a name beginning with the word test. For example, to test the removeDigit() method, the TestPhoneNumber class should be supplied with a method named testRemoveDigit() (or testFoo, or testBar - anything that begins with test).
You now understand the essence of IBM Rational Test RealTimePurifyPlus RealTimePurifyPlus for Linux component testing test script for Java. Rather than having you define tests yourself, a test script has been configured for you.