JsUnit |
Test unit classes for JavaScript. More...
Classes | |
class | TestListener |
A listener for test progress. More... | |
class | ResultPrinter |
Class to print the result of a TextTestRunner. More... | |
class | ClassicResultPrinter |
The ResultPrinter of JsUnit 1.1. More... | |
class | Assert |
A set of assert methods. More... | |
class | TestSuite |
A TestSuite is a composition of Tests. More... | |
class | BaseTestRunner |
General base class for an application running test suites. More... | |
class | TestCaseCollector |
A TestCase collector for all test cases within a scope. More... | |
class | AssertionFailedError |
Thrown when a test assertion fails. More... | |
class | Test |
A test can be run and collect its results. More... | |
class | TestSuiteCollector |
A TestSuite collector for all test suites within a scope. More... | |
class | TextTestRunner |
Class for an application running test suites with a test based status report. More... | |
class | TestCollector |
A collector for Test classes. More... | |
class | RepeatedTest |
A Decorator that runs a test repeatedly. More... | |
class | TestDecorator |
A Decorator for Tests. More... | |
class | TestSetup |
A Decorator to set up and tear down additional fixture state. More... | |
class | TestFailure |
A TestFailure collects a failed test together with the caught exception. More... | |
class | AllTestsCollector |
A collector for the AllTests class. More... | |
class | TestCase |
A test case defines the fixture to run multiple tests. More... | |
class | XMLResultPrinter |
Convert the result of a TextTestPrinter into XML to be used by JUnitReport. 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 | ExceptionTestCase |
A TestCase that expects an exception of class mClass to be thrown. More... | |
class | GenericTestCollector |
A generic collector for all Test classes within a scope. More... | |
class | TestRunner |
TestRunner of JsUnit 1.1. More... | |
class | Protectable |
A protectable can be run and throw an Error. More... | |
class | TestRunListener |
A listener interface for observing the execution of a test run. More... | |
class | ComparisonFailure |
Thrown when a test assert comparing equal strings fail. More... | |
Functions | |
void | BaseTestRunner_endTest (Test test) |
Implementation of TestListener. More... | |
Boolean | BaseTestRunner_showStackRaw () |
Retrieve the flag for raw stack output. More... | |
void | ClassicResultPrinter_addError (Test test, Error except) |
An occurred error was added. More... | |
Test | TestSuite_findTest (String name) |
Search a test by name. More... | |
Number | TestResult_runCount () |
Retrieve the number of run tests. More... | |
Number | TestCase_countTestCases () |
Counts the number of test cases that will be run by this test. More... | |
Number | TestSuite_testCount () |
Returns the number of tests in this suite. More... | |
void | ClassicResultPrinter_printHeader (Test test) |
Write a header starting the application. More... | |
void | TestSuite_addTestSuite (TestCase testCase) |
Add a test suite to the current suite. More... | |
void | ResultPrinter_setWriter (PrinterWriter writer) |
Sets the PrinterWriter. More... | |
void | TestRunner_runAll (TestResult result) |
Runs all test of all suites and collects their results in a TestResult instance. More... | |
void | XMLResultPrinter_startTest (Test test) |
Implementation of TestListener. More... | |
Object | BaseTestRunner_getPreference (String key, Object value) |
Retrieve the value of a global preference key. More... | |
Boolean | TestResult_wasSuccessful () |
Returns whether the entire test was successful or not. More... | |
void | TestResult_removeListener (TestListener listener) |
Remove a listener. More... | |
Error | TestFailure_thrownException () |
Retrieve the thrown exception. More... | |
Boolean | TestFailure_isFailure () |
Test for a JsUnit failure. More... | |
void | ResultPrinter_addFailure (Test test, AssertionFailedError afe) |
Implementation of TestListener. More... | |
String | ComparisonFailure_toString () |
Returns the error message. More... | |
Test | TestCase_findTest (String testName) |
Find a test by name. More... | |
Number | HTMLTestRunner_setPrinter (Object outdev) |
Set printer. More... | |
void | ExceptionTestCase_runTest () |
Execute the test method expecting that an exception of class mClass or one of its subclasses will be thrown. More... | |
void | ResultPrinter_printDefectTrace (void defect) |
TestResult | TextTestRunner_run (Object test) |
Runs a single test or a suite extracted from a TestCase subclass. More... | |
void | ResultPrinter_startTest (Test test) |
Implementation of TestListener. More... | |
String | TestCase_toString () |
Retrieve the test case as string. More... | |
PrinterWriter | ResultPrinter_getWriter () |
Returns the associated writer to this instance. More... | |
void | TextTestRunner_main (Array< String > args) |
Program entry point. More... | |
void | ClassicResultPrinter_endTest (Test test) |
A test ended. More... | |
void | TestResult_stop () |
Marks that the test run should stop. More... | |
void | ResultPrinter_printHeader (Number runTime) |
Print the header of the test result. More... | |
void | ResultPrinter_printDefectHeader (void defect, void count) |
void | TestResult_addError (Test test, Error except) |
Add an occurred error. More... | |
void | RepeatedTest_toString () |
void | BaseTestRunner_setPreference (String key, Object value) |
Set a global preference. More... | |
void | Assert_assertNotSame (String msg, Object expected, Object actual) |
Asserts that two values are not the same. More... | |
String | ResultPrinter_elapsedTimeAsString (Number runTime) |
Returns the elapsed time in seconds as String. More... | |
void | TestResult_startTest (Test test) |
A test starts. More... | |
void | Assert_fail (String msg, CallStack stack, String usermsg) |
Fails a test with a give message. More... | |
Object | BaseTestRunner_getPreferences () |
Retrieves the Object with the global preferences of any runner. More... | |
String | TestCase_getName () |
Retrieves the name of the test. More... | |
void | ClassicResultPrinter_addFailure (Test test, Error except) |
An occurred failure was added. More... | |
String | TestFailure_exceptionMessage () |
Retrieve the exception message. More... | |
void | TestResult_addFailure (Test test, AssertionFailedError afe) |
Add an occurred failure. More... | |
void | Assert_assertEquals (String msg, Object expected, Object actual) |
Asserts that two values are equal. More... | |
Number | TestResult_failureCount () |
Retrieve the number of occurred failures. More... | |
Test | TestDecorator_findTest (String name) |
Returns the test if it matches the name. More... | |
void | TestResult () |
A TestResult collects the results of executing a test case. More... | |
void | TestSuite_runTest (Test test, TestResult result) |
Runs a single test test and collect its result in a TestResult instance. More... | |
void | TestSuite_setName (String name) |
Sets the name of the suite. More... | |
void | ResultPrinter_addError (Test test, Error except) |
Implementation of TestListener. More... | |
String | TestDecorator_getName () |
Returns name of the test. More... | |
TestResult | TestCase_run (TestResult result) |
Runs a test and collects its result in a TestResult instance. More... | |
Boolean | GenericTestCollector_isTest (Function testFunc) |
Test the function to be collected. More... | |
void | ClassicResultPrinter_startTest (Test test) |
A test started. More... | |
void | ClassicResultPrinter_writeLn (String str) |
Write a line of text. More... | |
void | ResultPrinter_printFailures (TestResult result) |
Print the failures of the test result. More... | |
void | ResultPrinter_printErrors (TestResult result) |
Print the errors of the test result. More... | |
String | TestFailure_trace () |
Retrieve the stack trace. More... | |
void | Assert_assertUndefined (String msg, Object object) |
Asserts that an object is undefined. More... | |
void | TestRunner_addSuite (TestSuite suite) |
Add a test suite to the application. More... | |
void | ResultPrinter_printDefects (Array< TestFailure > array, String type) |
Print the defects of a special type of the test result. More... | |
Array | TestResult_cloneListeners () |
Returns a copy of the listeners. More... | |
void | TestRunner_run (String name, TestResult result) |
Runs all test of all suites and collects their results in a TestResult instance. More... | |
String | TestSuite_toString () |
Retrieve the test suite as string. More... | |
Number | TestSuite_countTestCases () |
Counts the number of test cases that will be run by this test suite. More... | |
TestResult | TestCase_createResult () |
Creates a default TestResult object. More... | |
void | TestDecorator_setName (String name) |
Sets name of the test. More... | |
void | XMLResultPrinter_addError (Test test, Error except) |
Implementation of TestListener. More... | |
void | TestCase_runBare () |
Number | TestDecorator_countTestCases () |
Returns the number of the test cases. More... | |
void | Assert_assertNotNull (String msg, Object object) |
Asserts that an object is not null. More... | |
void | XMLResultPrinter_endTest (Test test) |
Implementation of TestListener. More... | |
void | TestResult_runProtected (Test test, Protectable p) |
Runs a test case protected. More... | |
void | TestDecorator_basicRun (TestResult result) |
The basic run behavior. More... | |
String | TestFailure_toString () |
Retrieve failure as string. More... | |
void | Assert_assertSame (String msg, Object expected, Object actual) |
Asserts that two values are the same. More... | |
TestResult | TextTestRunner_createTestResult () |
Creates an instance of a TestResult to be used for the test run. More... | |
void | Assert_assertMatches (String msg, Object expected, Object actual) |
Asserts that a regular expression matches a string. More... | |
void | XMLResultPrinter_addFailure (Test test, AssertionFailedError afe) |
Implementation of TestListener. More... | |
TestResult | TextTestRunner_start (Object args) |
Starts a test run. More... | |
TestResult | EmbeddedTextTestRunner_run (Array< String > testNames, String suiteName) |
Executes the given tests in the array. More... | |
void | TestSuite_run (TestResult result) |
Runs the tests and collects their result in a TestResult instance. More... | |
void | BaseTestRunner_startTest (Test test) |
Implementation of TestListener. More... | |
Test | TestSuite_testAt (Number index) |
Runs the test at the given index. More... | |
Number | TestRunner_countTestCases () |
Counts the number of test cases that will be run by this test application. More... | |
void | XMLResultPrinter_print (TestResult result, Number runTime) |
Print the complete test result as XML report to be used by JUnitReport. More... | |
void | ResultPrinter_printFooter (TestResult result) |
Print the footer of the test result. More... | |
void | ResultPrinter_print (TestResult result, Number runTime) |
Print the complete test result. More... | |
Boolean | TestResult_shouldStop () |
Checks whether the test run should stop. More... | |
TestResult | TextTestRunner_doRun (Test test) |
Executes a test run with the given test. More... | |
void | RepeatedTest_countTestCases () |
Test | TestSuite_warning (String message) |
Returns a test which will fail and log a warning message. More... | |
void | TestResult_endTest (Test test) |
A test ended. More... | |
Test | TestFailure_failedTest () |
Retrieve the failed test. More... | |
void | Assert_assertTrue (String msg, String cond) |
Asserts that a condition is true. More... | |
void | TestResult_run (Test test) |
Runs a test case. More... | |
void | BaseTestRunner_addFailure (Test test, AssertionFailedError afe) |
Implementation of TestListener. More... | |
void | Assert_assertFloatEquals (String msg, Object expected, Object actual, Object tolerance) |
Asserts that two floating point values are equal to within a given tolerance. More... | |
TestResult | EmbeddedTextTestRunner_createTestResult () |
Creates an instance of a TestResult to be used for the test run. More... | |
void | TestCase_runTest () |
Override to run the test and assert its state. More... | |
void | BaseTestRunner_setPreferences (Array prefs) |
Set any runner's global preferences. More... | |
Test | TestDecorator_getTest () |
Returns name the decorated test. More... | |
void | ClassicResultPrinter_printFooter (TestResult result, Number runTime) |
Write a footer at application end with a summary of the tests. More... | |
String | BaseTestRunner_truncate (String str) |
Truncates string to maximum length. More... | |
String | TestDecorator_toString () |
Returns the test as string. More... | |
void | TestCase_setName (String name) |
Sets the name of the test case. More... | |
void | ResultPrinter_endTest (Test test) |
Implementation of TestListener. More... | |
Number | TextTestRunner_runFailed (String msg) |
Run failed. More... | |
void | Assert_assertNotUndefined (String msg, Object object) |
Asserts that an object is not undefined. More... | |
void | TestSuite_addTest (Test test) |
Add a test to the suite. More... | |
Number | TestResult_errorCount () |
Retrieve the number of occurred errors. More... | |
void | ResultPrinter_printDefect (TestFailure defect, Number count) |
Print a defect of the test result. More... | |
void | Assert_assertNull (String msg, Object object) |
Asserts that an object is null. More... | |
void | Assert_assertFalse (String msg, String cond) |
Asserts that a condition is false. More... | |
void | TestResult_addListener (TestListener listener) |
Add a listener. More... | |
void | TextTestRunner_setPrinter (Object outdev) |
Set printer. More... | |
void | BaseTestRunner_addError (Test test, Error except) |
Implementation of TestListener. More... | |
void | ClassicResultPrinter_print (TestResult result, Number runTime) |
Print the complete test result. More... | |
void | TestSetup_run (TestResult result) |
Runs a test case with additional set up and tear down. More... | |
void | TestDecorator_run (TestResult result) |
Run the test. More... | |
Array | GenericTestCollector_collectTests () |
Collect the Test classes. More... | |
Array | AllTestsCollector_collectTests () |
Collect Test class AllTests. More... | |
void | BaseTestRunner_getTest (String name) |
Returns the Test corresponding to the given suite. More... | |
void | EmbeddedTextTestRunner_setPrinter (ResultPrinter printer) |
Set printer. More... | |
void | RepeatedTest_run (TestResult result) |
Runs a test case with additional set up and tear down. More... | |
String | TestSuite_getName () |
Retrieves the name of the test suite. More... | |
ResultPrinter | TextTestRunner_getPrinter () |
Retrieve the currently used ResultPrinter. More... | |
Test unit classes for JavaScript.
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.
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 | ) |
Implementation of TestListener.
test | The ended 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 | ) |
Implementation of TestListener.
test | The started 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.
References TestResult().
TestResult EmbeddedTextTestRunner_run | ( | Array< String > | testNames, |
String | suiteName | ||
) |
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). |
References TestResult().
void EmbeddedTextTestRunner_setPrinter | ( | ResultPrinter | printer | ) |
Set printer.
printer | The ResultPrinter |
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 | ) |
Returns the elapsed time in seconds as String.
runTime | The elapsed time in ms. |
void ResultPrinter_endTest | ( | Test | test | ) |
Implementation of TestListener.
test | The test that ends. |
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 | ) |
Implementation of TestListener.
test | The test that starts. |
Number TestCase_countTestCases | ( | ) |
Counts the number of test cases that will be run by this test.
TestResult TestCase_createResult | ( | ) |
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. |
References TestResult().
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 | ( | ) |
Test for a JsUnit failure.
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.
Referenced by EmbeddedTextTestRunner_createTestResult(), EmbeddedTextTestRunner_run(), Test::run(), TestCase_createResult(), TestCase_run(), TextTestRunner_createTestResult(), TextTestRunner_doRun(), TextTestRunner_run(), and TextTestRunner_start().
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.
References TestResult().
TestResult TextTestRunner_doRun | ( | Test | test | ) |
Executes a test run with the given test.
test | The test. |
References TestResult().
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. |
References TestResult().
Number TextTestRunner_runFailed | ( | String | msg | ) |
void TextTestRunner_setPrinter | ( | Object | outdev | ) |
Set printer.
outdev | Output device |
TestResult TextTestRunner_start | ( | Object | args | ) |
Starts a test run.
Usage | If an unknown option is used Analyzes the command line arguments and runs the given test suite. If no argument was given, the function tries to run AllTests.suite(). |
References TestResult().
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 | ) |
Implementation of TestListener.
test | The test that ends. |
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 | ) |
Implementation of TestListener.
test | The test that starts. |
JsUnit © 1999, 2000, 2001, 2002, 2003, 2006, 2007 by Jörg Schaible
|
Generated on Wed Apr 15 2015 02:33:06 for JsUnit by doxygen 1.8.5
|