C H A P T E R  3

Introducing the Developer’s Kit

Although writing tests is your responsibility, the Java Device Test Suite Developer’s Kit contains components you can modify, or, in some cases, use as is. This chapter introduces many of those components by examining, slightly modifying, and building the sample runtime test pack included in the Developer’s Kit.

To follow this section, begin with a fresh copy of the unzipped Developer’s Kit (see Unzip and Configure the Developer’s Kit). Do not run devKitHome/tests/demo.xml in this copy of the Developer’s Kit.

This chapter has these sections:


Developer’s Kit Structure

This section introduces the directories and files in the Developer’s Kit, focusing on those that implement the sample runtime test pack. The sample benchmark test pack has a very similar structure. The distributed and OTA samples have additional structures to support the more complicated execution models of their tests.

devKitHome

TABLE 3-1 shows the contents of the Developer’s Kit top level directory.

TABLE 3-1 devKitHome Directory Contents
devKitHome

 

  tests/ 

Build scripts and sample test packs

  docs/

Javadoctrademark tool documentation for test APIs

  tpim.sh and tpim.cmd

Scripts for faster test pack installation, see Chapter 19

version.id

Developer’s Kit version identifier. Do not change this file.

tests/

This directory contains three sample test packs, a set of common resources used by all test packs, and the demo.xml file you used to build and install the sample test packs in Chapter 2. Do not delete this directory.

TABLE 3-2 devKitHome /tests/ Directory Contents
devKitHome/tests/

 

common/

Common resources, notably build scripts in build/

benchmark/

Sample benchmark test pack

runtime/

Sample runtime test pack

distributed/

Sample runtime distributed test pack

ota/

Sample over-the-air provisioning test pack

tests/common/

Do not delete this directory or its contents. It holds common resources required to build any kind of test pack.

TABLE 3-3 devKitHome /tests/common/ Directory Contents
devKitHome/tests/common/

 

src/

Common (test-independent) sources for distributed test packs

lib/

Libraries for build

build/

Build scripts and configuration files common to all test packs. .properties files specify default build options.

tests/runtime/

This directory contains the sample runtime test pack. If you are writing a benchmark or OTA test pack, you can delete this directory.

TABLE 3-4 devKitHome /tests/runtime/ Directory Contents

devKitHome/tests/runtime/

 

build/

Files that control the build for this test pack. Every test pack must have these files. You can edit these files to override default values specified in build/. build.xml is the main Ant build file.

src/

Source and related files that implement the tests in this test pack. Every test pack must have a directory like this.

src/client/

Source and related files for test components that run on test devices

src/server/

Source and related files for the server side of network tests

src/server2/

Additional server sources (directory is named in testsuite.info TestServerSourcesDir property)

testserver_resources/

Sample server resources for network tests

testsuite.html

Top level documentation for this test pack. Every test pack must have a file like this. See Documenting a Test Pack for more information.

testsuite.info

Global test suite properties. Every test pack must have a file like this. See Chapter 6 for details.

testpack.version.properties

Test pack version identifier. See Chapter 20 for details.


Editing and Building a Test Pack

Exactly how you create a test pack is subject to variations, such as whether you assemble the files from scratch or begin with a sample. This section introduces one way to begin with the runtime sample test pack.



Note - A real test pack differs substantially from a sample or this trivial modification. Notably, the directory structure in devKitHome/tests/runtime/src/client/ and server/ will reflect your company, not com/sun/. There are many options you can change to suit your needs and preferences. Consult the sample files for examples.


1. Change to devKitHome/tests/common/build/.

1. Either edit environment.properties as you did in Unzip and Configure the Developer’s Kit or replace environment.properties with the corresponding file from the other Developer’s Kit.

2. Optionally, delete devKitHome/tests/distributed/, benchmark/, and ota/.

You do not need these files in a runtime test pack.

3. Change to devKitHome/tests/runtime/.

4. In testsuite.info change the following lines:

a. Change the value of TestPackName to My Runtime.

b. Change the value of TestSuiteName to My Runtime TestSuite.

c. Change the value of TestSuiteID to com.sun.jdts.devkit.my.runtime.

5. In testpack.version.properties change 1.4 to ++1.0.

6. Change to build/.

7. In build.properties, append these lines:

doc.copyright=\
\ Copyright 2007 My Company. All rights reserved. \n\
\ Use is subject to license terms.

8. Run one of these commands, depending on your platform:

> ant clean all install
% ant clean all install

The command displays several hundred messages, ending with BUILD SUCCESSFUL and the elapsed time.

9. Launch or restart your administrator harness.

The new test pack My_Runtime appears in the test tree. It is ready for testing.


Files Generated by the Build

TABLE 3-5 summarizes the files that the build generates.

TABLE 3-5 Files Generated by the Build

devKitHome/tests/runtime/

 

bin/

Class and other files that constitute the executable test pack

resources/

Test pack properties for configuration and template editors.

tmp-bin/

Temporary directory deleted by ant clean.

listings/

Catalog of the test pack components. Can be viewed in a web browser.

test-doc/

Javadoc tool-style test documentation that is displayed when a tester selects a package or test and clicks the Documentation tab


Packaging a Test Pack

When you have tested your tests, you must package them in a zip file so an administrator can install them in the production Central Installation with the Configure > Test Packs command. In the test pack’s build/ directory, use one of the following commands, depending on your platform:

> ant pack
% ant pack

Give the resulting zip file to an administrator.