webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
com.netscape.javascript.qa.drivers.TestDriver Class Reference
Inheritance diagram for com.netscape.javascript.qa.drivers.TestDriver:
com.netscape.javascript.qa.drivers.LiveConnectDrv com.netscape.javascript.qa.drivers.NavDrv com.netscape.javascript.qa.drivers.RefDrv com.netscape.javascript.qa.drivers.RhinoDrv com.netscape.javascript.qa.drivers.LiveNavDrv

Public Member Functions

 TestDriver (String[] args)
 
void run ()
 
void start ()
 
void stop ()
 
void closeLogs ()
 
void writeLogHeaders (File output)
 
Vector getSuites (String[] files)
 
void getCases (TestSuite suite)
 
synchronized void executeSuite (TestSuite suite)
 
void writeTinderboxHeader (String executable)
 
void writeTinderboxSuiteName (TestSuite suite)
 
void writeTinderboxSuiteResult (TestSuite suite)
 
String getSuffix ()
 
void setSuffix (String s)
 
boolean sleep (int ms)
 
boolean processOptions ()
 

Static Public Member Functions

static String [] getSystemInformation ()
 
static TestLog getLog (File output, String filename)
 
static void openLogFiles (File output)
 
static String stripDoubleSlashes (String string)
 
static void enablePrivileges ()
 
static void writeSuiteResult (TestSuite suite, File output)
 
static void writeSuiteSummary (TestSuite suite, File output)
 
static void writeFileResult (TestFile file, TestSuite suite, File output)
 
static String readFile (String filePath)
 
static void writeCaseResults (TestFile file, TestSuite suite, File output)
 
static void writeCaseResults (TestFile file, String classname, File output)
 
static void writeDateToLogs (String separator, File output)
 
static void p (String s)
 
static void debug (String s)
 
static String getCurrentDate (String separator)
 
static String getCurrentTime ()
 
static void main (String[] args)
 

Static Public Attributes

static boolean TINDERBOX = false
 
static final boolean DEBUG = true
 
static final boolean TCMS = false
 
static final String SUMMARY_LOG_NAME = "summ.html"
 
static final String CASE_LOG_NAME = "case.html"
 
static final String FILE_LOG_NAME = "file.html"
 
static final String SUITE_LOG_NAME = "suite.html"
 
static final String DEBUG_LOG_NAME = "debug.html"
 
static final String TERMINATOR = "<BR>\n"
 

Detailed Description

Parent class for JavaScript test drivers. Subclasses run tests against the JavaScript engine in C, Java, and its embedding in Navigator.

The default implementation does nothing, but contains methods that are used by all subclasses.

The JavaScript test suite is extendable. To write a new JavaScript test, your test program must call a function that returns array of TestCase objects. The TestCase object is defined in shell.js:

function TestCase( n, d, e, a ) {
    this.name        = n;
    this.description = d;
    this.expect      = e;
    this.actual      = a;
    this.passed      = true;
    this.reason      = "";
    this.passed = getTestCaseResult( this.expect, this.actual );
}

In your test program you should:

To add new test to the suite:

Constructor & Destructor Documentation

◆ TestDriver()

com.netscape.javascript.qa.drivers.TestDriver.TestDriver ( String []  args)
inline

Member Function Documentation

◆ closeLogs()

void com.netscape.javascript.qa.drivers.TestDriver.closeLogs ( )
inline

◆ debug()

static void com.netscape.javascript.qa.drivers.TestDriver.debug ( String  s)
inlinestatic

◆ enablePrivileges()

static void com.netscape.javascript.qa.drivers.TestDriver.enablePrivileges ( )
inlinestatic

If the environment uses a Security Manager and requires privileges to access system properties, override this method to enable privileges. The default method does nothing.

◆ executeSuite()

synchronized void com.netscape.javascript.qa.drivers.TestDriver.executeSuite ( TestSuite  suite)
inline

Subclasses should override this method to iterate through all TestFiles in the TestSuite, create a new TestEnvironment, run the test, and close the TestEnvironment.

For examples,

See also
com.netscape.javascript.qa.drivers.RhinoDrv and
com.netscape.javascript.qa.drivers.RefDrv

◆ getCases()

void com.netscape.javascript.qa.drivers.TestDriver.getCases ( TestSuite  suite)
inline

For each test file in the suite directory, create a TestFile object.

◆ getCurrentDate()

static String com.netscape.javascript.qa.drivers.TestDriver.getCurrentDate ( String  separator)
inlinestatic

From the current Date, return a string in the format "DD?MM?YY", where "/" is specified by the separator argument.

◆ getCurrentTime()

static String com.netscape.javascript.qa.drivers.TestDriver.getCurrentTime ( )
inlinestatic

From the current time, return a string in the format "HH:MM:SS"

◆ getLog()

static TestLog com.netscape.javascript.qa.drivers.TestDriver.getLog ( File  output,
String  filename 
)
inlinestatic
Returns
a file object with the specified in the output directory.

◆ getSuffix()

String com.netscape.javascript.qa.drivers.TestDriver.getSuffix ( )
inline

◆ getSuites()

Vector com.netscape.javascript.qa.drivers.TestDriver.getSuites ( String []  files)
inline

For each subdirectory of the main test directory, create a new TestSuite object.

◆ getSystemInformation()

static String [] com.netscape.javascript.qa.drivers.TestDriver.getSystemInformation ( )
inlinestatic

Get information about the operating system.

◆ main()

static void com.netscape.javascript.qa.drivers.TestDriver.main ( String []  args)
inlinestatic

◆ openLogFiles()

static void com.netscape.javascript.qa.drivers.TestDriver.openLogFiles ( File  output)
inlinestatic

Create and write headers to log files.

Parameters
outputdirectory in which output files are written.

◆ p()

static void com.netscape.javascript.qa.drivers.TestDriver.p ( String  s)
inlinestatic

Convenience methods.

◆ processOptions()

boolean com.netscape.javascript.qa.drivers.TestDriver.processOptions ( )
inline

Implementations need to override this method, which should call its own constructor, passing the args object as an argument. Process options should parse the ARGS object.

return true if the driver should continue. return false if the driver should not continue.

◆ readFile()

static String com.netscape.javascript.qa.drivers.TestDriver.readFile ( String  filePath)
inlinestatic

Read the contents of a file into a string.

◆ run()

void com.netscape.javascript.qa.drivers.TestDriver.run ( )
inline

◆ setSuffix()

void com.netscape.javascript.qa.drivers.TestDriver.setSuffix ( String  s)
inline

◆ sleep()

boolean com.netscape.javascript.qa.drivers.TestDriver.sleep ( int  ms)
inline

Temporary stop this thread for 5 seconds.

◆ start()

void com.netscape.javascript.qa.drivers.TestDriver.start ( )
inline

◆ stop()

void com.netscape.javascript.qa.drivers.TestDriver.stop ( )
inline

Close all logs.

◆ stripDoubleSlashes()

static String com.netscape.javascript.qa.drivers.TestDriver.stripDoubleSlashes ( String  string)
inlinestatic

If two slashes in a row are found, one slash is stripped out. Mac client has trouble if we don't do this. xxx this doesn't work and needs to be fixed.

◆ writeCaseResults() [1/2]

static void com.netscape.javascript.qa.drivers.TestDriver.writeCaseResults ( TestFile  file,
TestSuite  suite,
File  output 
)
inlinestatic

Test Case Management System (TCMS) requires the following information: (MachineID), -pass- or FAIL, TestFileName/Beaker, TestFileName,Date Run in MM/DD/YY, Start Time HH:MM:SS, End Time HH:MM:SS, ExpectedResults String (quite often null), Actual Result String, Reason For Failure

Tests can provide this information. we expected it to be in an object called "TestCase" with the following structure:

function TestCase( passed, name, expect, actual, reason ) {
    this.passed = passed;
    this.name   = "Description of the Test Case";
    this.expect = ( theExpectedResult );
    this.actual = ( theActualResult );
    this.reason = ( reasonForFailure );
}

we will generate machineID, pass/fail, date run, start time, end time.

If TCMS == false, omit unnecessary log id.

◆ writeCaseResults() [2/2]

static void com.netscape.javascript.qa.drivers.TestDriver.writeCaseResults ( TestFile  file,
String  classname,
File  output 
)
inlinestatic

Short version of writing test case results to the CASE_LOG, used by LiveConnecTest subclasses.

Parameters
casesvector of testcases whose results should be written to the CASE_LOG. LiveConnectTest sends a vector of failed TestCase objects.
classnamename of the LiveConnectTest class
outputdirectory in which output is written.
See also
com.netscape.javascript.qa.liveconnect.LiveConnectTest::writeResultsToCaseLog

◆ writeDateToLogs()

static void com.netscape.javascript.qa.drivers.TestDriver.writeDateToLogs ( String  separator,
File  output 
)
inlinestatic

Write system information and current date to the SUMMARY_LOG, FILE_LOG, and SUITE_LOG.

XXX need to fix this to output all test information.

◆ writeFileResult()

static void com.netscape.javascript.qa.drivers.TestDriver.writeFileResult ( TestFile  file,
TestSuite  suite,
File  output 
)
inlinestatic

Write the result of the current file to the FILE_LOG. If the file threw an exception, print the exception.

◆ writeLogHeaders()

void com.netscape.javascript.qa.drivers.TestDriver.writeLogHeaders ( File  output)
inline

◆ writeSuiteResult()

static void com.netscape.javascript.qa.drivers.TestDriver.writeSuiteResult ( TestSuite  suite,
File  output 
)
inlinestatic

Write an HTML-formatted string to SUITE_LOG.

◆ writeSuiteSummary()

static void com.netscape.javascript.qa.drivers.TestDriver.writeSuiteSummary ( TestSuite  suite,
File  output 
)
inlinestatic

Write an HTML-formatted string to the SUMMARY_LOG that looks like this:

 Suite       Number of       Number of       Passed      Failed      Result
 Name        Files           Cases           #  %        #    %
 

◆ writeTinderboxHeader()

void com.netscape.javascript.qa.drivers.TestDriver.writeTinderboxHeader ( String  executable)
inline

Write the suite result to the Tinderbox log.

XXX need machine, branch, startTime, endTime

◆ writeTinderboxSuiteName()

void com.netscape.javascript.qa.drivers.TestDriver.writeTinderboxSuiteName ( TestSuite  suite)
inline

◆ writeTinderboxSuiteResult()

void com.netscape.javascript.qa.drivers.TestDriver.writeTinderboxSuiteResult ( TestSuite  suite)
inline

Member Data Documentation

◆ CASE_LOG_NAME

final String com.netscape.javascript.qa.drivers.TestDriver.CASE_LOG_NAME = "case.html"
static

◆ DEBUG

final boolean com.netscape.javascript.qa.drivers.TestDriver.DEBUG = true
static

◆ DEBUG_LOG_NAME

final String com.netscape.javascript.qa.drivers.TestDriver.DEBUG_LOG_NAME = "debug.html"
static

◆ FILE_LOG_NAME

final String com.netscape.javascript.qa.drivers.TestDriver.FILE_LOG_NAME = "file.html"
static

◆ SUITE_LOG_NAME

final String com.netscape.javascript.qa.drivers.TestDriver.SUITE_LOG_NAME = "suite.html"
static

◆ SUMMARY_LOG_NAME

final String com.netscape.javascript.qa.drivers.TestDriver.SUMMARY_LOG_NAME = "summ.html"
static

◆ TCMS

final boolean com.netscape.javascript.qa.drivers.TestDriver.TCMS = false
static

◆ TERMINATOR

final String com.netscape.javascript.qa.drivers.TestDriver.TERMINATOR = "<BR>\n"
static

◆ TINDERBOX

boolean com.netscape.javascript.qa.drivers.TestDriver.TINDERBOX = false
static

The documentation for this class was generated from the following file: