Standard Java test patterns
The Rational Developer products contain several test patterns that you can use to help you create tests for Java components. You select the test pattern to use as part of the Java Component Test wizard. All tests based on these patterns use data from the test data table.
The following test patterns for testing standard Java components are included:
Test pattern Description For method-level testing Creates a JUnit test script to test one or several public methods from one or several public, non-abstract classes, allowing you to test each individual method independently. When you create a method-level test, a test case is created for each method selected. For scenario testing Creates a JUnit test script to test a sequence of public methods from one or several public, non-abstract classes. When you create a scenario-based test, one test case is created for the entire scenario. For testing an abstract class, interface, or superclass Creates an abstract JUnit test script for testing abstract classes, interfaces, and superclasses. These tests cannot be run on their own and do not include a test suite. To run an abstract test, make the test concrete by specifying the classes that implement the interface, realize the abstract class, or inherit from the superclass. You can make the tests concrete at the time of test creation if there are implementing classes available or any time after the abstract test has been created.
Example: Method-level testing pattern
The following figure shows a test behavior script for a test created with the method-level testing pattern. In this example, a test case is created for each method that is tested: createLoanProposal and SetCustomer.
Example: Scenario-based testing pattern
The following figure shows a test behavior script for a test created with the scenario-based testing pattern. In this example, one test case is created for the two methods that are tested: createLoanProposaland SetCustomer
Example: Abstract test pattern
The following figure shows a test behavior script created for testing an interface named IRandomGenerator.
Related concepts
Test-generation process
Test patterns for Enterprise JavaBeans
Related tasks
Creating new component test projects
Creating method-level Java tests
Creating scenario-based Java tests
Creating abstract Java tests