CoView Test Case Wizard: Creating a DbUnit Test Case
The CoView Test Case Wizard walks you through the creation of a JUnit test case or test suite for a class. The wizard creates fully functional JUnit tests (using fail assertions) for methods you choose. These tests are meant to exercise at least one data-flow path and can be duplicated and modified to other paths.
To create a DbUnit test case, right-click a class in the Package Explorer and select CoView > CoViewDeveloper > CoView DbUnit Test Case.
The following information must be specified:
- JUnit Version: Identifies the JUnit version used to create tests
- Source Folder: Identifes the source folder within the project that will contain the test case
- Package: Identifies the Java package to which the test case belongs
- Name: Identifies the name of the test case class to be created
- SuperClass: Identifies the class which the new test case will extend
- Class Under Test: Identifies the class that is to be tested by the new test case
Select Next on the wizard to proceed.
Add method invocations using. The toggle indicates that the generated test methods should contain invocations of the methods under test. If this toggle is enabled, an instance of the class under test is needed to invoke the non-static methods under test. Use the drop-down list to select a constructor which will be used to instantiate the class under test.
Select Next to continue.
DatabaseTestCase allows the user to specify information for their test test database connection and data set.
- Database driver class name:Identifies the name of the driver class that is to be used when connecting to your database.
- Database URL: Identifies the URL that identifies the location of the database to be used.
- Username: Identifies the username used to connect to the database.
- Password: Identifies the password used to connect to the database. Note that the password is stored in plain text and is not secure.
- Data set file location: Identifies the location of an XML data set file that contains a representation of the database tables and data within them that will be used in your JUnit tests.
Select Finish to create the DbUnit test case.
