Custom code input values are located in references or field references. These references must be included in the tests. Within the tests, the references must precede the code that they affect. Verify that the test contains the references that are required for customized inputs to your code. For details about creating references and field references, see Creating a reference or field reference.
If your custom code uses external JAR files, you probably need to change the Java™ build path: see the Java Build Path page. In some cases, you can avoid changing the build path manually by running the test before adding your custom code to it. The first time a test runs, classes and libraries that are required for compilation are added to the build path. For example, you can import Test and Performance Tools Platform (TPTP) classes that are needed to create custom events in the test log if the test, to which you have added your custom code, has run previously. However, if the test has never been run, import errors occur because the classes are not named in the build path for the project until the test has run.
If your code uses external resources, for example, an SQL database or a product that manages customer relationships, you must configure the custom code to work on every computer on which your test runs.
Custom code resides in the src folder of the project that contains the test that calls the code. By default, custom code is located in a package named test inside the src folder.
The following example shows the standard Navigator view of two custom code classes. (The Test Navigator does not display Java source files.)
When you add the ReplaceCC.java and VerifyYUserID.java custom code classes to the test and return a value to the test, Substitute from lists these two classes as shown in the following example:
The test package also contains the generated Java code for tests in the project.
You can put custom code in a different package (for example, custom). Separate custom code from generated code, especially if you use a source-control system. For information about source control and custom code, see Putting test assets under source control.
To add custom code: