|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.javatest.TestSuite
public class TestSuite
A class providing information about and access to the tests in a test suite. The primary methods to access and run the tests are
Nested Class Summary | |
---|---|
static class |
TestSuite.DuplicateLogNameFault
|
static class |
TestSuite.Fault
An exception used to report errors while using a TestSUite object. |
static class |
TestSuite.NoSuchLogFault
|
static class |
TestSuite.NotTestSuiteFault
An exception that is used to report that a given file is not a test suite. |
Field Summary | |
---|---|
static int |
CLEAR_CHANGED_TEST
Should a test be reset to not run if it is found that the test has changed in the test suite (test description does not match the one in the existing result). |
static int |
DELETE_NONTEST_RESULTS
Should tests which no longer exist in the test suite be deleted from a work directory when it is opened? |
static int |
REFRESH_ON_RUN
|
static java.lang.String |
TM_CONTEXT_NAME
|
Constructor Summary | |
---|---|
TestSuite(java.io.File root)
Create a TestSuite object, with no additional test suite properties and no class loader. |
|
TestSuite(java.io.File root,
java.util.Map tsInfo,
java.lang.ClassLoader cl)
Create a TestSuite object. |
Method Summary | |
---|---|
protected TestFinder |
createBinaryTestFinder(java.lang.String finderClassName,
java.lang.String[] finderArgs,
java.io.File testsDir,
java.io.File jtdFile)
In the case where a JTD file is found, attempt to load a binary test finder. |
InterviewParameters |
createInterview()
Create a configuration interview that can be used to collection the configuration data for a test run. |
java.util.logging.Logger |
createLog(WorkDirectory wd,
java.lang.String b,
java.lang.String key)
Creates general purpose logger with given key and ResourceBundleName registered for given WorkDirectory. |
Script |
createScript(TestDescription td,
java.lang.String[] exclTestCases,
TestEnvironment scriptEnv,
WorkDirectory workDir,
BackupPolicy backupPolicy)
Create and initialize a Script that can be used to run a test. |
TestFilter |
createTestFilter(TestEnvironment filterEnv)
Create a test suite specific filter to be used to filter the tests to be selected for a test run. |
protected TestFinder |
createTestFinder()
Create a test finder to be used to access the tests in this test suite. |
TestRunner |
createTestRunner()
Create and initialize a TestRunner that can be used to run a series of tests. |
void |
eraseLog(WorkDirectory wd)
Cleans the log file in given WorkDirectory |
protected java.lang.String[] |
getAdditionalDocNames()
Get the names of any helpsets containing related documents for this test suite. |
javax.help.HelpSet[] |
getAdditionalDocs()
Get helpsets containing any related documents for this test suite. |
java.lang.ClassLoader |
getClassLoader()
Get the class loader specified when this test suite object was created. |
java.net.URL[] |
getDocsForFolder(java.lang.String path)
This method should be overridden in subclasses |
java.net.URL[] |
getDocsForTest(TestDescription td)
This method should be overridden in subclasses |
int |
getEstimatedTestCount()
Get the estimated number of tests in the test suite. |
java.net.URL[] |
getFilesForTest(TestDescription td)
Get a list of associated files for a specified test description. |
java.lang.String |
getID()
Get a string containing a unique ID identifying this test suite, or null if not available. |
java.io.File |
getInitialExcludeList()
Get the file name of the initial exclude list associated with the test suite. |
java.lang.String[] |
getKeywords()
Get the set of valid keywords for this test suite. |
java.net.URL |
getLatestExcludeList()
Get the URL for the latest exclude list associated with the test suite. |
java.util.logging.Logger |
getLog(WorkDirectory wd,
java.lang.String key)
Returns general purpose logger with given key registered for given WorkDirectory. |
java.net.URL |
getLogo()
Get A URL identifying a logo for this test suite, or null if none available. |
java.lang.String |
getName()
Get a string identifying this test suite, or null if not available. |
java.util.logging.Logger |
getNotificationLog(WorkDirectory wd)
|
com.sun.javatest.logging.ObservedFile |
getObservedFile(java.lang.String path)
|
com.sun.javatest.logging.ObservedFile |
getObservedFile(WorkDirectory wd)
|
java.lang.String |
getPath()
Get the path for the root file of this test suite. |
java.io.File |
getRoot()
Get the root file of this test suite. |
java.io.File |
getRootDir()
Get the root directory of this test suite. |
com.sun.javatest.services.ServiceManager |
getServiceManager()
|
com.sun.javatest.services.ServiceReader |
getServiceReader()
Returns a test suite specific ServiceReader, used to read Service definitions. |
TestFinder |
getTestFinder()
Get a shared test finder to read the tests in this test suite. |
boolean |
getTestRefreshBehavior(int event)
Get the requested behavior for dealing with conflicts between which tests are in the test suite vs those in the work directory. |
java.io.File |
getTestsDir()
Get the directory in the test suite that contains the tests. |
protected java.util.Map |
getTestSuiteInfo()
Get a map containing the test suite data in the .jtt file. |
java.lang.String |
getTestSuiteInfo(java.lang.String name)
Get an entry from the data in the .jtt file. |
boolean |
hasInitialExcludeList()
Check if the test suite has an initial exclude list. |
boolean |
hasLatestExcludeList()
Check if the test suite has a latest exclude list. |
protected void |
init(java.lang.String[] args)
Initialize this test suite, with args typically read from a .jtt file. |
static boolean |
isTestSuite(java.io.File root)
Check if a file is the root of a valid test suite. |
java.lang.Class |
loadClass(java.lang.String className)
Load a class using the class loader provided when this test suite was created. |
protected static java.lang.Class |
loadClass(java.lang.String className,
java.lang.ClassLoader cl)
Load a class using a specified loader, translating any errors that may arise into Fault. |
InterviewParameters |
loadInterviewFromTemplate(java.io.File template,
InterviewParameters ip)
Create a configuration interview based on specified template file |
InterviewParameters |
loadInterviewFromTemplate(java.util.Properties templateInfo,
InterviewParameters newInterview)
Create a configuration interview based on specified map of template values |
boolean |
needServices()
|
protected static java.lang.Object |
newInstance(java.lang.Class c)
Create a new instance of a class, translating any exceptions that may arise into Fault. |
protected static java.lang.Object |
newInstance(java.lang.Class c,
java.lang.Class[] argTypes,
java.lang.Object[] args)
Create a new instance of a class using a non-default constructor, translating any exceptions that may arise into Fault. |
static TestSuite |
open(java.io.File root)
Open a test suite. |
protected void |
setTestFinder(TestFinder tf)
Set the shared test finder used to read the tests in this test suite. |
void |
starting(Harness harness)
A notification method that is called when a test suite run is starting. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DELETE_NONTEST_RESULTS
public static final int REFRESH_ON_RUN
public static final int CLEAR_CHANGED_TEST
public static final java.lang.String TM_CONTEXT_NAME
Constructor Detail |
---|
public TestSuite(java.io.File root, java.util.Map tsInfo, java.lang.ClassLoader cl) throws TestSuite.Fault
root
- The root file for this test suite.tsInfo
- Test suite properties, typically read from the test suite properties file
in the root directory of the test suite.cl
- A class loader to be used to load additional classes as required,
typically using a class path defined in the test suite properties file.
TestSuite.Fault
- if a problem occurs while creating this test suite.public TestSuite(java.io.File root)
root
- The root file for this test suite.Method Detail |
---|
public static boolean isTestSuite(java.io.File root)
root
- The file to be checked.
public static TestSuite open(java.io.File root) throws java.io.FileNotFoundException, TestSuite.Fault, TestSuite.NotTestSuiteFault
root
- A file identifying the root of the test suite.
java.io.FileNotFoundException
- if root does not exist.
TestSuite.NotTestSuiteFault
- if root does not identify a valid test suite.
TestSuite.Fault
- if any other problems occur while trying to open the test suite.isTestSuite(java.io.File)
protected void init(java.lang.String[] args) throws TestSuite.Fault
args
- an array of strings to initialize this test suite object
TestSuite.Fault
- if there are any problems initializing the
test suite from the specified arguments.public java.lang.String getPath()
public java.io.File getRoot()
public java.io.File getRootDir()
public java.io.File getTestsDir()
tests
property in the test suite properties file.
If this entry is found, it must either identify an absolute filename, or
a directory relative to the test suite root directory, using '/' to
separate the components of the path.
/tests/testsuite.html
exists,
the result is the directory root/tests
. This is
for compatibility with standard TCK layout.
public void starting(Harness harness) throws TestSuite.Fault
harness
- The harness that will be used to run the tests.
TestSuite.Fault
- if an error occurred while doing test suite-specific
initialization that should cause the test run to be aborted.public TestFilter createTestFilter(TestEnvironment filterEnv)
filterEnv
- Configuration data that may be used by the filter.
public TestFinder getTestFinder()
createTestFinder()
,
setTestFinder(com.sun.javatest.TestFinder)
protected void setTestFinder(TestFinder tf)
tf
- the test finder to be used
java.lang.IllegalStateException
- if the test finder has previously
been set to a different valuegetTestFinder()
protected TestFinder createTestFinder() throws TestSuite.Fault
finder
entry in the
test suite properties file, which should identify the class to be used
and any arguments it may require. The class will be loaded via the class
loader specified when the test suite was opened, if one was given;
otherwise, the system class loader will be used.
The default implementation attempts to use a file testsuite.jtd
in the tests directory. If found, a BinaryTestFinder will be created
using this file. If it is not found, then it searches for a property
named finder in the test suite properties and will attempt to
instantiate that. If no entry is found or it is blank, an
HTMLTestFinder is used, using whatever a basic settings HTMLTestFinder
initializes to.
TestSuite.Fault
- if there is a problem creating the test findergetTestFinder()
,
setTestFinder(com.sun.javatest.TestFinder)
,
getTestsDir()
protected TestFinder createBinaryTestFinder(java.lang.String finderClassName, java.lang.String[] finderArgs, java.io.File testsDir, java.io.File jtdFile) throws TestSuite.Fault, TestFinder.Fault
finderClassName
- Finder class name to attempt to use as a BTF. Null if
the default BTF class should be used.finderArgs
- Arguments to finder given from the test suite property.testsDir
- Reference location to pass to finder.jtdFile
- Location of the JTD file to give to the BTF.
TestSuite.Fault
TestFinder.Fault
TestFinder
,
BinaryTestFinder
public TestRunner createTestRunner()
public Script createScript(TestDescription td, java.lang.String[] exclTestCases, TestEnvironment scriptEnv, WorkDirectory workDir, BackupPolicy backupPolicy) throws TestSuite.Fault
script
entry in the configuration
data provided, and if not found, looks for a script
entry in the
test suite properties. The script entry should define the script class
to use and any arguments it may require. The class will be loaded via the class
loader specified when the test suite was opened, if one was given;
otherwise, the system class loader will be used. Individual test suites will
typically use a more direct means to create an appropriate script object.
The parameters for this method are normally passed through to the script
that is created.
Note that the name of this method is "create", it is not recommended
that the value returned ever be re-used or cached for subsequent requests
to this method.
td
- The test description for the test to be executed.exclTestCases
- Any test cases within the test that should not be executed.scriptEnv
- Configuration data to be given to the test as necessary.workDir
- A work directory in which to store the results of the test.backupPolicy
- A policy object used to control how to backup any files that
might be overwritten.
TestSuite.Fault
- if any errors occur while creating the scriptpublic InterviewParameters createInterview() throws TestSuite.Fault
The default implementation returns a default
interview suitable for use with test suites built with earlier versions
of the JT Harness: it provides questions equivalent to the fields in
the GUI Parameter Editor or command-line -params option. As such, much of the
necessary configuration data is provided indirectly via environment (.jte) files
which must be created and updated separately.
Individual test suites should provide their own interview, with questions customized to the configuration data they require. Note that the name of this method is "create", the harness may instantiate multiple copies for temporary use, resetting data or transferring data. Do not override this method with an implementation which caches the return value.
TestSuite.Fault
- if a problem occurs while creating the interviewpublic InterviewParameters loadInterviewFromTemplate(java.util.Properties templateInfo, InterviewParameters newInterview) throws TestSuite.Fault
TestSuite.Fault
- if a problem occurs while creating the interviewpublic InterviewParameters loadInterviewFromTemplate(java.io.File template, InterviewParameters ip) throws TestSuite.Fault, java.io.IOException
TestSuite.Fault
- if a problem occurs while creating the interview
IOException if a problem occurs while reading a template file
java.io.IOException
public java.lang.String getID()
getName()
public java.lang.String getName()
getID()
public int getEstimatedTestCount()
public java.io.File getInitialExcludeList()
public boolean hasInitialExcludeList()
public java.net.URL getLatestExcludeList()
public boolean hasLatestExcludeList()
public javax.help.HelpSet[] getAdditionalDocs() throws TestSuite.Fault
TestSuite.Fault
- if there are problems opening any of the
helpsets.protected java.lang.String[] getAdditionalDocNames()
public java.lang.String[] getKeywords()
public java.net.URL[] getFilesForTest(TestDescription td)
td
- The test description for which the associated files are required
public java.net.URL[] getDocsForFolder(java.lang.String path)
path
- String, which determines path to currently selected test's folder.
This is root relative path. This shouldn't be null, for the
root folder use "".
public java.net.URL[] getDocsForTest(TestDescription td)
td
- TestDescription for currently selected test case. This shouldn't be null.
public java.net.URL getLogo()
protected static java.lang.Object newInstance(java.lang.Class c) throws TestSuite.Fault
c
- the class to be instantiated
TestSuite.Fault
- if any errors arise while trying to instantiate
the class.protected static java.lang.Object newInstance(java.lang.Class c, java.lang.Class[] argTypes, java.lang.Object[] args) throws TestSuite.Fault
c
- the class to be instantiatedargTypes
- the types of the argument to be passed to the constructor,
(thus implying the constructor to be used.)args
- the arguments to be passed to the constructor
TestSuite.Fault
- if any errors arise while trying to instantiate
the class.public java.lang.Class loadClass(java.lang.String className) throws TestSuite.Fault
className
- the name of the class to be loaded
TestSuite.Fault
- if there was a problem loading the specified classprotected static java.lang.Class loadClass(java.lang.String className, java.lang.ClassLoader cl) throws TestSuite.Fault
className
- the name of the class to be loadedcl
- the class loader to use to load the specified class
TestSuite.Fault
- if there was a problem loading the specified classpublic java.lang.ClassLoader getClassLoader()
public com.sun.javatest.services.ServiceManager getServiceManager()
public boolean needServices()
public com.sun.javatest.services.ServiceReader getServiceReader()
protected java.util.Map getTestSuiteInfo()
public java.lang.String getTestSuiteInfo(java.lang.String name)
name
- The name of the entry to get from the info in the .jtt file
public boolean getTestRefreshBehavior(int event)
DELETE_NONTEST_RESULTS
,
REFRESH_ON_RUN
,
CLEAR_CHANGED_TEST
public java.util.logging.Logger getNotificationLog(WorkDirectory wd)
public com.sun.javatest.logging.ObservedFile getObservedFile(WorkDirectory wd)
public com.sun.javatest.logging.ObservedFile getObservedFile(java.lang.String path)
public java.util.logging.Logger createLog(WorkDirectory wd, java.lang.String b, java.lang.String key) throws TestSuite.DuplicateLogNameFault
wd
- WorkDirectory logger should be registered for; may be null
if no WorkDirectory
currently available (the log will be registered for the first WD created for this TestSuiteb
- name of ResorceBundle used for this logger; may be null
if not requiredkey
- key for this log
TestSuite.DuplicateLogNameFault
- if log with this key has been registered in the system alreadygetLog(com.sun.javatest.WorkDirectory, java.lang.String)
public java.util.logging.Logger getLog(WorkDirectory wd, java.lang.String key) throws TestSuite.NoSuchLogFault
wd
- WorkDirectory desired logger is registered forkey
- key for this log
TestSuite.NoSuchLogFault
- if desired log not registered in the system
java.lang.NullPointerException
- if wd
is nullcreateLog(com.sun.javatest.WorkDirectory, java.lang.String, java.lang.String)
public void eraseLog(WorkDirectory wd) throws java.io.IOException
wd
- WorkDirectory desired logger is registered for
java.io.IOException
- if log file's content can't be erased
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |