JsUnit 1.3 |
![]() |
![]() |
This file contains a port of the JUnit Java package of Kent Beck and Erich Gamma for JavaScript.
If this file is loaded within a browser, an onLoad event handler is set. This event handler will set the global variable isJsUnitPageLoaded to true. Any previously set onLoad event handler is restored and called.
Classes | |
class | ComparisonFailure |
Thrown when a test assert comparing equal strings fail. More... | |
class | AllTestsCollector |
A collector for the AllTests class. More... | |
class | TestRunner |
TestRunner of JsUnit 1.1. More... | |
class | Protectable |
A protectable can be run and throw an Error. More... | |
class | XMLResultPrinter |
Convert the result of a TextTestPrinter into XML to be used by JUnitReport. More... | |
class | RepeatedTest |
A Decorator that runs a test repeatedly. More... | |
class | ResultPrinter |
Class to print the result of a TextTestRunner. More... | |
class | TextTestRunner |
Class for an application running test suites with a test based status report. More... | |
class | TestSuite |
A TestSuite is a composition of Tests. More... | |
class | TestListener |
A listener for test progress. More... | |
class | TestSetup |
A Decorator to set up and tear down additional fixture state. More... | |
class | TestDecorator |
A Decorator for Tests. More... | |
class | TestFailure |
A TestFailure collects a failed test together with the caught exception. More... | |
class | TestCase |
A test case defines the fixture to run multiple tests. More... | |
class | ClassicResultPrinter |
The ResultPrinter of JsUnit 1.1. More... | |
class | TestCollector |
A collector for Test classes. More... | |
class | TestRunListener |
A listener interface for observing the execution of a test run. More... | |
class | TestCaseCollector |
A TestCase collector for all test cases within a scope. More... | |
class | GenericTestCollector |
A generic collector for all Test classes within a scope. More... | |
class | Test |
A test can be run and collect its results. More... | |
class | BaseTestRunner |
General base class for an application running test suites. More... | |
class | TestSuiteCollector |
A TestSuite collector for all test suites within a scope. More... | |
class | ExceptionTestCase |
A TestCase that expects an exception of class mClass to be thrown. More... | |
class | Assert |
A set of assert methods. More... | |
class | EmbeddedTextTestRunner |
Class for an embeddable text-oriented TestRunner used in other applications with a status report. More... | |
class | HTMLTestRunner |
Class for an application running test suites reporting in HTML. More... | |
class | AssertionFailedError |
Thrown when a test assertion fails. More... | |
Functions | |
void | Assert_assertNull (String msg, Object object) |
Asserts that an object is null. | |
Array | GenericTestCollector_collectTests () |
Collect the Test classes. | |
void | XMLResultPrinter_addFailure (Test test, AssertionFailedError afe) |
Implementation of TestListener. | |
void | ResultPrinter_printFooter (TestResult result) |
Print the footer of the test result. | |
void | ResultPrinter_startTest (Test test) |
Implementation of TestListener. | |
String | TestDecorator_getName () |
Returns name of the test. | |
String | TestFailure_trace () |
Retrieve the stack trace. | |
void | XMLResultPrinter_startTest (Test test) |
Implementation of TestListener. | |
void | TestSuite_addTest (Test test) |
Add a test to the suite. | |
void | ResultPrinter_printDefects (Array< TestFailure > array, String type) |
Print the defects of a special type of the test result. | |
Number | TestCase_countTestCases () |
Counts the number of test cases that will be run by this test. | |
TestResult | TestCase_createResult () |
Creates a default TestResult object. | |
void | Assert_assertSame (String msg, Object expected, Object actual) |
Asserts that two values are the same. | |
void | ClassicResultPrinter_printHeader (Test test) |
Write a header starting the application. | |
ResultPrinter | TextTestRunner_getPrinter () |
Retrieve the currently used ResultPrinter. | |
void | TestDecorator_run (TestResult result) |
Run the test. | |
void | ResultPrinter_print (TestResult result, Number runTime) |
Print the complete test result. | |
String | BaseTestRunner_truncate (String str) |
Truncates string to maximum length. | |
Test | TestCase_findTest (String testName) |
Find a test by name. | |
void | XMLResultPrinter_endTest (Test test) |
Implementation of TestListener. | |
Boolean | GenericTestCollector_isTest (Function testFunc) |
Test the function to be collected. | |
void | ResultPrinter_printDefectTrace (void defect) |
void | Assert_assertUndefined (String msg, Object object) |
Asserts that an object is undefined. | |
TestResult | TextTestRunner_doRun (Test test) |
Executes a test run with the given test. | |
void | TestResult_endTest (Test test) |
A test ended. | |
void | BaseTestRunner_addFailure (Test test, AssertionFailedError afe) |
Implementation of TestListener. | |
void | TestResult_addListener (TestListener listener) |
Add a listener. | |
void | TestResult_stop () |
Marks that the test run should stop. | |
Number | TestResult_runCount () |
Retrieve the number of run tests. | |
void | ResultPrinter_addError (Test test, Error except) |
Implementation of TestListener. | |
void | ResultPrinter_printDefect (TestFailure defect, Number count) |
Print a defect of the test result. | |
Number | HTMLTestRunner_setPrinter (Object outdev) |
Set printer. | |
void | BaseTestRunner_startTest (Test test) |
Implementation of TestListener. | |
void | RepeatedTest_run (TestResult result) |
Runs a test case with additional set up and tear down. | |
void | ClassicResultPrinter_addFailure (Test test, Error except) |
An occurred failure was added. | |
void | TestResult_removeListener (TestListener listener) |
Remove a listener. | |
void | TestSuite_run (TestResult result) |
Runs the tests and collects their result in a TestResult instance. | |
void | TextTestRunner_main (Array< String > args) |
Program entry point. | |
Object | BaseTestRunner_getPreferences () |
Retrieves the Object with the global preferences of any runner. | |
void | TestRunner_run (String name, TestResult result) |
Runs all test of all suites and collects their results in a TestResult instance. | |
void | TestResult_addError (Test test, Error except) |
Add an occurred error. | |
String | TestSuite_getName () |
Retrieves the name of the test suite. | |
Test | TestSuite_testAt (Number index) |
Runs the test at the given index. | |
void | TextTestRunner_setPrinter (Object outdev) |
Set printer. | |
void | ClassicResultPrinter_print (TestResult result, Number runTime) |
Print the complete test result. | |
void | ResultPrinter_printErrors (TestResult result) |
Print the errors of the test result. | |
void | BaseTestRunner_addError (Test test, Error except) |
Implementation of TestListener. | |
void | Assert_assertFloatEquals (String msg, Object expected, Object actual, Object tolerance) |
Asserts that two floating point values are equal to within a given tolerance. | |
Boolean | BaseTestRunner_showStackRaw () |
Retrieve the flag for raw stack output. | |
void | ResultPrinter_printHeader (Number runTime) |
Print the header of the test result. | |
void | TestResult_startTest (Test test) |
A test starts. | |
TestResult | TextTestRunner_createTestResult () |
Creates an instance of a TestResult to be used for the test run. | |
void | TestRunner_addSuite (TestSuite suite) |
Add a test suite to the application. | |
void | Assert_assertNotUndefined (String msg, Object object) |
Asserts that an object is not undefined. | |
void | ClassicResultPrinter_writeLn (String str) |
Write a line of text. | |
void | TestDecorator_setName (String name) |
Sets name of the test. | |
void | ClassicResultPrinter_startTest (Test test) |
A test started. | |
String | TestCase_toString () |
Retrieve the test case as string. | |
Test | TestDecorator_getTest () |
Returns name the decorated test. | |
void | TestSetup_run (TestResult result) |
Runs a test case with additional set up and tear down. | |
Test | TestSuite_warning (String message) |
Returns a test which will fail and log a warning message. | |
Array | AllTestsCollector_collectTests () |
Collect Test class AllTests. | |
Number | TestResult_failureCount () |
Retrieve the number of occurred failures. | |
Boolean | TestResult_wasSuccessful () |
Returns whether the entire test was successful or not. | |
void | Assert_assertEquals (String msg, Object expected, Object actual) |
Asserts that two values are equal. | |
Test | TestSuite_findTest (String name) |
Search a test by name. | |
void | TestRunner_runAll (TestResult result) |
Runs all test of all suites and collects their results in a TestResult instance. | |
void | Assert_assertTrue (String msg, String cond) |
Asserts that a condition is true. | |
void | ResultPrinter_setWriter (PrinterWriter writer) |
Sets the PrinterWriter. | |
void | ResultPrinter_addFailure (Test test, AssertionFailedError afe) |
Implementation of TestListener. | |
void | TestResult_run (Test test) |
Runs a test case. | |
void | TestCase_runTest () |
Override to run the test and assert its state. | |
String | TestSuite_toString () |
Retrieve the test suite as string. | |
String | TestCase_getName () |
Retrieves the name of the test. | |
Number | TestResult_errorCount () |
Retrieve the number of occurred errors. | |
void | RepeatedTest_toString () |
void | TestSuite_setName (String name) |
Sets the name of the suite. | |
void | ResultPrinter_printDefectHeader (void defect, void count) |
void | TestCase_setName (String name) |
Sets the name of the test case. | |
void | RepeatedTest_countTestCases () |
TestResult | TextTestRunner_run (Object test) |
Runs a single test or a suite extracted from a TestCase subclass. | |
void | Assert_assertNotNull (String msg, Object object) |
Asserts that an object is not null. | |
void | XMLResultPrinter_addError (Test test, Error except) |
Implementation of TestListener. | |
Number | TestDecorator_countTestCases () |
Returns the number of the test cases. | |
Test | TestDecorator_findTest (String name) |
Returns the test if it matches the name. | |
void | ResultPrinter_endTest (Test test) |
Implementation of TestListener. | |
void | ClassicResultPrinter_addError (Test test, Error except) |
An occurred error was added. | |
void | ExceptionTestCase_runTest () |
Execute the test method expecting that an exception of class mClass or one of its subclasses will be thrown. | |
void | BaseTestRunner_endTest (Test test) |
Implementation of TestListener. | |
void | TestResult_addFailure (Test test, AssertionFailedError afe) |
Add an occurred failure. | |
void | BaseTestRunner_getTest (String name) |
Returns the Test corresponding to the given suite. | |
void | TestResult_runProtected (Test test, Protectable p) |
Runs a test case protected. | |
TestResult | EmbeddedTextTestRunner_run (Array< String > testNames, String suiteName) |
Executes the given tests in the array. | |
String | ResultPrinter_elapsedTimeAsString (Number runTime) |
Returns the elapsed time in seconds as String. | |
void | XMLResultPrinter_print (TestResult result, Number runTime) |
Print the complete test result as XML report to be used by JUnitReport. | |
void | ClassicResultPrinter_endTest (Test test) |
A test ended. | |
Boolean | TestFailure_isFailure () |
Test for a JsUnit failure. | |
Array | TestResult_cloneListeners () |
Returns a copy of the listeners. | |
Error | TestFailure_thrownException () |
Retrieve the thrown exception. | |
Test | TestFailure_failedTest () |
Retrieve the failed test. | |
void | BaseTestRunner_setPreference (String key, Object value) |
Set a global preference. | |
Boolean | TestResult_shouldStop () |
Checks whether the test run should stop. | |
void | TestDecorator_basicRun (TestResult result) |
The basic run behavior. | |
void | TestSuite_runTest (Test test, TestResult result) |
Runs a single test test and collect its result in a TestResult instance. | |
TestResult | EmbeddedTextTestRunner_createTestResult () |
Creates an instance of a TestResult to be used for the test run. | |
String | TestDecorator_toString () |
Returns the test as string. | |
Object | BaseTestRunner_getPreference (String key, Object value) |
Retrieve the value of a global preference key. | |
void | Assert_fail (String msg, CallStack stack, String usermsg) |
Fails a test with a give message. | |
void | BaseTestRunner_setPreferences (Array prefs) |
Set any runner's global preferences. | |
Number | TestRunner_countTestCases () |
Counts the number of test cases that will be run by this test application. | |
void | ResultPrinter_printFailures (TestResult result) |
Print the failures of the test result. | |
TestResult | TextTestRunner_start (Object args) |
Starts a test run. | |
Number | TestSuite_countTestCases () |
Counts the number of test cases that will be run by this test suite. | |
Number | TestSuite_testCount () |
Returns the number of tests in this suite. | |
void | ClassicResultPrinter_printFooter (TestResult result, Number runTime) |
Write a footer at application end with a summary of the tests. | |
String | ComparisonFailure_toString () |
Returns the error message. | |
void | EmbeddedTextTestRunner_setPrinter (ResultPrinter printer) |
Set printer. | |
void | TestResult () |
A TestResult collects the results of executing a test case. | |
void | Assert_assertFalse (String msg, String cond) |
Asserts that a condition is false. | |
void | Assert_assertNotSame (String msg, Object expected, Object actual) |
Asserts that two values are not the same. | |
PrinterWriter | ResultPrinter_getWriter () |
Returns the associated writer to this instance. | |
String | TestFailure_exceptionMessage () |
Retrieve the exception message. | |
void | TestSuite_addTestSuite (TestCase testCase) |
Add a test suite to the current suite. | |
void | Assert_assertMatches (String msg, Object expected, Object actual) |
Asserts that a regular expression matches a string. | |
String | TestFailure_toString () |
Retrieve failure as string. | |
TestResult | TestCase_run (TestResult result) |
Runs a test and collects its result in a TestResult instance. | |
Number | TextTestRunner_runFailed (String msg) |
Run failed. | |
void | TestCase_runBare () |
Array AllTestsCollector_collectTests | ( | ) |
void Assert_assertEquals | ( | String | msg, | |
Object | expected, | |||
Object | actual | |||
) |
Asserts that two values are equal.
msg | An optional error message. | |
expected | The expected value. | |
actual | The actual value. |
AssertionFailedError | Thrown if the expected value is not the actual one. |
Asserts that a condition is false.
msg | An optional error message. | |
cond | The condition to evaluate. |
AssertionFailedError | Thrown if the evaluation was not false. |
void Assert_assertFloatEquals | ( | String | msg, | |
Object | expected, | |||
Object | actual, | |||
Object | tolerance | |||
) |
Asserts that two floating point values are equal to within a given tolerance.
msg | An optional error message. | |
expected | The expected value. | |
actual | The actual value. | |
tolerance | The maximum difference allowed to make equality check pass. |
AssertionFailedError | Thrown if the expected value is not within the tolerance of the actual one. |
void Assert_assertMatches | ( | String | msg, | |
Object | expected, | |||
Object | actual | |||
) |
Asserts that a regular expression matches a string.
msg | An optional error message. | |
expected | The regular expression. | |
actual | The actual value. |
AssertionFailedError | Thrown if the actual value does not match the regular expression. |
void Assert_assertNotNull | ( | String | msg, | |
Object | object | |||
) |
Asserts that an object is not null.
msg | An optional error message. | |
object | The valid object. |
AssertionFailedError | Thrown if the object is not null. |
void Assert_assertNotSame | ( | String | msg, | |
Object | expected, | |||
Object | actual | |||
) |
Asserts that two values are not the same.
msg | An optional error message. | |
expected | The expected value. | |
actual | The actual value. |
AssertionFailedError | Thrown if the expected value is not the actual one. |
void Assert_assertNotUndefined | ( | String | msg, | |
Object | object | |||
) |
Asserts that an object is not undefined.
msg | An optional error message. | |
object | The defined object. |
AssertionFailedError | Thrown if the object is undefined. |
void Assert_assertNull | ( | String | msg, | |
Object | object | |||
) |
Asserts that an object is null.
msg | An optional error message. | |
object | The null object. |
AssertionFailedError | Thrown if the object is not null. |
void Assert_assertSame | ( | String | msg, | |
Object | expected, | |||
Object | actual | |||
) |
Asserts that two values are the same.
msg | An optional error message. | |
expected | The expected value. | |
actual | The actual value. |
AssertionFailedError | Thrown if the expected value is not the actual one. |
Asserts that a condition is true.
msg | An optional error message. | |
cond | The condition to evaluate. |
AssertionFailedError | Thrown if the evaluation was not true. |
void Assert_assertUndefined | ( | String | msg, | |
Object | object | |||
) |
Asserts that an object is undefined.
msg | An optional error message. | |
object | The undefined object. |
AssertionFailedError | Thrown if the object is not undefined. |
Fails a test with a give message.
msg | The error message. | |
stack | The call stack of the error. | |
usermsg | The message part of the user. |
AssertionFailedError | Is always thrown. |
Implementation of TestListener.
test | The test that had an error. | |
except | The thrown error. |
void BaseTestRunner_addFailure | ( | Test | test, | |
AssertionFailedError | afe | |||
) |
Implementation of TestListener.
test | The test that had a failure. | |
afe | The thrown failure. |
void BaseTestRunner_endTest | ( | Test | test | ) |
Object BaseTestRunner_getPreference | ( | String | key, | |
Object | value | |||
) |
Retrieve the value of a global preference key.
key | The key of the preference. | |
value | The default value. |
Object BaseTestRunner_getPreferences | ( | ) |
Retrieves the Object with the global preferences of any runner.
void BaseTestRunner_getTest | ( | String | name | ) |
Returns the Test corresponding to the given suite.
name | The name of the test. This is a template method, subclasses override runFailed(), clearStatus(). |
void BaseTestRunner_setPreference | ( | String | key, | |
Object | value | |||
) |
Set a global preference.
key | The key of the preference. | |
value | The value of the preference. |
void BaseTestRunner_setPreferences | ( | Array | prefs | ) |
Set any runner's global preferences.
prefs | The new preferences. |
Boolean BaseTestRunner_showStackRaw | ( | ) |
Retrieve the flag for raw stack output.
void BaseTestRunner_startTest | ( | Test | test | ) |
Truncates string to maximum length.
str | The string to truncate. |
An occurred error was added.
test | The failed test. | |
except | The thrown exception. |
An occurred failure was added.
test | The failed test. | |
except | The thrown exception. |
void ClassicResultPrinter_endTest | ( | Test | test | ) |
A test ended.
test | The ended test. |
void ClassicResultPrinter_print | ( | TestResult | result, | |
Number | runTime | |||
) |
Print the complete test result.
result | The complete test result. | |
runTime | The elapsed time in ms. Overloaded, because only the footer is needed. |
void ClassicResultPrinter_printFooter | ( | TestResult | result, | |
Number | runTime | |||
) |
Write a footer at application end with a summary of the tests.
result | The result of the test run. | |
runTime | The elapsed time in ms. |
void ClassicResultPrinter_printHeader | ( | Test | test | ) |
Write a header starting the application.
test | The top level test. |
void ClassicResultPrinter_startTest | ( | Test | test | ) |
A test started.
test | The started test. |
void ClassicResultPrinter_writeLn | ( | String | str | ) |
Write a line of text.
str | The text to print on the line. The method of this object does effectively nothing. It must be overloaded with a proper version, that knows how to print a line, if the script engine cannot be detected (yet). |
String ComparisonFailure_toString | ( | ) |
Returns the error message.
TestResult EmbeddedTextTestRunner_createTestResult | ( | ) |
Creates an instance of a TestResult to be used for the test run.
Executes the given tests in the array.
testNames | The name of the tests to execute. | |
suiteName | The name of the generated TestSuite (may be undefined). |
void EmbeddedTextTestRunner_setPrinter | ( | ResultPrinter | printer | ) |
void ExceptionTestCase_runTest | ( | ) |
Execute the test method expecting that an exception of class mClass or one of its subclasses will be thrown.
Array GenericTestCollector_collectTests | ( | ) |
Boolean GenericTestCollector_isTest | ( | Function | testFunc | ) |
Test the function to be collected.
The method tests the testFunc for the class type given in the constructor. A derived implementation may add additional criteria like the existence of a specific method of the class type.
testFunc | The Function to be tested. |
true
if the function is a Test. Number HTMLTestRunner_setPrinter | ( | Object | outdev | ) |
Set printer.
outdev | Output device |
void RepeatedTest_countTestCases | ( | ) |
void RepeatedTest_run | ( | TestResult | result | ) |
Runs a test case with additional set up and tear down.
result | The result set. |
void RepeatedTest_toString | ( | ) |
Implementation of TestListener.
test | The test that had an error. | |
except | The thrown error. |
void ResultPrinter_addFailure | ( | Test | test, | |
AssertionFailedError | afe | |||
) |
Implementation of TestListener.
test | The test that had a failure. | |
afe | The thrown failure. |
String ResultPrinter_elapsedTimeAsString | ( | Number | runTime | ) |
void ResultPrinter_endTest | ( | Test | test | ) |
PrinterWriter ResultPrinter_getWriter | ( | ) |
Returns the associated writer to this instance.
void ResultPrinter_print | ( | TestResult | result, | |
Number | runTime | |||
) |
Print the complete test result.
result | The complete test result. | |
runTime | The elapsed time in ms. |
void ResultPrinter_printDefect | ( | TestFailure | defect, | |
Number | count | |||
) |
Print a defect of the test result.
defect | The defect to print. | |
count | The counter for this defect type. |
void ResultPrinter_printDefectHeader | ( | void | defect, | |
void | count | |||
) |
void ResultPrinter_printDefects | ( | Array< TestFailure > | array, | |
String | type | |||
) |
Print the defects of a special type of the test result.
array | The array with the defects. | |
type | The type of the defects. |
void ResultPrinter_printDefectTrace | ( | void | defect | ) |
void ResultPrinter_printErrors | ( | TestResult | result | ) |
Print the errors of the test result.
result | The complete test result. |
void ResultPrinter_printFailures | ( | TestResult | result | ) |
Print the failures of the test result.
result | The complete test result. |
void ResultPrinter_printFooter | ( | TestResult | result | ) |
Print the footer of the test result.
result | The complete test result. |
void ResultPrinter_printHeader | ( | Number | runTime | ) |
Print the header of the test result.
runTime | The elapsed time in ms. |
void ResultPrinter_setWriter | ( | PrinterWriter | writer | ) |
Sets the PrinterWriter.
writer | The writer for the report. Initialization of the ResultPrinter. If no writer is provided the instance uses the SystemWriter. |
void ResultPrinter_startTest | ( | Test | test | ) |
Number TestCase_countTestCases | ( | ) |
Counts the number of test cases that will be run by this test.
TestResult TestCase_createResult | ( | ) |
Creates a default TestResult object.
Find a test by name.
testName | The name of the searched test. |
String TestCase_getName | ( | ) |
Retrieves the name of the test.
TestResult TestCase_run | ( | TestResult | result | ) |
Runs a test and collects its result in a TestResult instance.
The function can be called with or without argument. If no argument is given, the function will create a default result set and return it. Otherwise the return value can be omitted.
result | The test result to fill. |
void TestCase_runBare | ( | ) |
void TestCase_runTest | ( | ) |
Override to run the test and assert its state.
void TestCase_setName | ( | String | name | ) |
Sets the name of the test case.
name | The new name of test cases. |
String TestCase_toString | ( | ) |
Retrieve the test case as string.
void TestDecorator_basicRun | ( | TestResult | result | ) |
The basic run behavior.
The function calls the run method of the decorated test.
result | The test result. |
Number TestDecorator_countTestCases | ( | ) |
Returns the number of the test cases.
Returns the test if it matches the name.
name | The searched test name. |
String TestDecorator_getName | ( | ) |
Returns name of the test.
Test TestDecorator_getTest | ( | ) |
Returns name the decorated test.
void TestDecorator_run | ( | TestResult | result | ) |
Run the test.
result | The test result. |
void TestDecorator_setName | ( | String | name | ) |
Sets name of the test.
name | The new name of the test. |
String TestDecorator_toString | ( | ) |
Returns the test as string.
String TestFailure_exceptionMessage | ( | ) |
Retrieve the exception message.
Test TestFailure_failedTest | ( | ) |
Retrieve the failed test.
Boolean TestFailure_isFailure | ( | ) |
Error TestFailure_thrownException | ( | ) |
Retrieve the thrown exception.
String TestFailure_toString | ( | ) |
Retrieve failure as string.
Slightly enhanced message format compared to JsUnit 3.7.
String TestFailure_trace | ( | ) |
Retrieve the stack trace.
void TestResult | ( | ) |
A TestResult collects the results of executing a test case.
The test framework distinguishes between failures and errors. A failure is anticipated and checked for with assertions. Errors are unanticipated problems like a JavaScript run-time error.
Add an occurred error.
Add an occurred error and call the registered listeners.
test | The failed test. | |
except | The thrown error. |
void TestResult_addFailure | ( | Test | test, | |
AssertionFailedError | afe | |||
) |
Add an occurred failure.
Add an occurred failure and call the registered listeners.
test | The failed test. | |
afe | The thrown assertion failure. |
void TestResult_addListener | ( | TestListener | listener | ) |
Add a listener.
listener | The listener. |
Array TestResult_cloneListeners | ( | ) |
Returns a copy of the listeners.
void TestResult_endTest | ( | Test | test | ) |
A test ended.
A test ended, inform the listeners.
test | The ended test. |
Number TestResult_errorCount | ( | ) |
Retrieve the number of occurred errors.
Number TestResult_failureCount | ( | ) |
Retrieve the number of occurred failures.
void TestResult_removeListener | ( | TestListener | listener | ) |
Remove a listener.
listener | The listener. |
void TestResult_run | ( | Test | test | ) |
Runs a test case.
test | The test case to run. |
Number TestResult_runCount | ( | ) |
Retrieve the number of run tests.
void TestResult_runProtected | ( | Test | test, | |
Protectable | p | |||
) |
Runs a test case protected.
test | The test case to run. | |
p | The protectable block running the test. To implement your own protected block that logs thrown exceptions, pass a Protectable to TestResult.runProtected(). |
Boolean TestResult_shouldStop | ( | ) |
Checks whether the test run should stop.
void TestResult_startTest | ( | Test | test | ) |
A test starts.
A test starts, inform the listeners.
test | The test to start. |
void TestResult_stop | ( | ) |
Marks that the test run should stop.
Boolean TestResult_wasSuccessful | ( | ) |
Returns whether the entire test was successful or not.
void TestRunner_addSuite | ( | TestSuite | suite | ) |
Add a test suite to the application.
suite | The suite to add. |
Number TestRunner_countTestCases | ( | ) |
Counts the number of test cases that will be run by this test application.
void TestRunner_run | ( | String | name, | |
TestResult | result | |||
) |
Runs all test of all suites and collects their results in a TestResult instance.
name | The name of the test. | |
result | The test result to fill. |
void TestRunner_runAll | ( | TestResult | result | ) |
Runs all test of all suites and collects their results in a TestResult instance.
result | The test result to fill. |
void TestSetup_run | ( | TestResult | result | ) |
Runs a test case with additional set up and tear down.
result | The result set. |
void TestSuite_addTest | ( | Test | test | ) |
Add a test to the suite.
test | The test to add. The test suite will add the given test to the suite and prepends the name of a TestCase with the name of the suite. |
void TestSuite_addTestSuite | ( | TestCase | testCase | ) |
Add a test suite to the current suite.
All fixtures of the test case will be collected in a suite which will be added.
testCase | The TestCase object to add. |
Number TestSuite_countTestCases | ( | ) |
Counts the number of test cases that will be run by this test suite.
Search a test by name.
name | The name of the searched test. |
String TestSuite_getName | ( | ) |
Retrieves the name of the test suite.
void TestSuite_run | ( | TestResult | result | ) |
Runs the tests and collects their result in a TestResult instance.
result | The test result to fill. |
void TestSuite_runTest | ( | Test | test, | |
TestResult | result | |||
) |
Runs a single test test and collect its result in a TestResult instance.
test | The test to run. | |
result | The test result to fill. |
void TestSuite_setName | ( | String | name | ) |
Sets the name of the suite.
name | The name to set. |
Test TestSuite_testAt | ( | Number | index | ) |
Runs the test at the given index.
index | The index. |
Number TestSuite_testCount | ( | ) |
Returns the number of tests in this suite.
String TestSuite_toString | ( | ) |
Retrieve the test suite as string.
Returns a test which will fail and log a warning message.
message | The warning message. |
TestResult TextTestRunner_createTestResult | ( | ) |
Creates an instance of a TestResult to be used for the test run.
TestResult TextTestRunner_doRun | ( | Test | test | ) |
Executes a test run with the given test.
test | The test. |
ResultPrinter TextTestRunner_getPrinter | ( | ) |
Program entry point.
args | Program arguments. The function will create a TextTestRunner or the TestRunner given by the preference "TestRunner" and run the tests given by the arguments. The function will exit the program with an error code indicating the type of success. |
TestResult TextTestRunner_run | ( | Object | test | ) |
Runs a single test or a suite extracted from a TestCase subclass.
test | The class to test or a test. This static method can be used to start a test run from your program. |
Number TextTestRunner_runFailed | ( | String | msg | ) |
void TextTestRunner_setPrinter | ( | Object | outdev | ) |
Set printer.
outdev | Output device |
TestResult TextTestRunner_start | ( | Object | args | ) |
Implementation of TestListener.
test | The test that had an error. | |
except | The thrown error. |
void XMLResultPrinter_addFailure | ( | Test | test, | |
AssertionFailedError | afe | |||
) |
Implementation of TestListener.
test | The test that had a failure. | |
afe | The thrown failure. |
void XMLResultPrinter_endTest | ( | Test | test | ) |
void XMLResultPrinter_print | ( | TestResult | result, | |
Number | runTime | |||
) |
Print the complete test result as XML report to be used by JUnitReport.
result | The complete test result. | |
runTime | The elapsed time in ms. |
void XMLResultPrinter_startTest | ( | Test | test | ) |
JsUnit © 1999, 2000, 2001, 2002, 2003, 2006, 2007 by Jörg Schaible
|
Generated on Fri Oct 19 23:10:41 2007 for JsUnit by doxygen 1.5.2
|