Bunoon: JUST | Manual | Test Types

Below you will find a list of the test types that can be run. You can run any single TestCase() class, or run a list of TestCase() classes, or automatically discover and run any that already exist. Each of these test types except the following options:

  • "ReportToConsole" [Object] - States if logging should be reported in the JavaScript console.
    • Default: false.

  • "ReportIdentifier" [Object] - States the element that the test logs should be outputted to.
    • Default: document.

  • "StopOnFirstError" [Boolean] - States if the tests should stop on the first error encountered.
    • Default: false.

  • "ReportEverything" [Boolean] - States if every test should be report, instead of just a simple summary.
    • Default: false.

  • "ScrollToBottomOnWriteLine" [Boolean] - States if we should scroll to the bottom of the report each time we write a new line.
    • Default: true.

  • "ClearOriginalReport" [Boolean] - States if the original report should be cleared before the tests start.
    • Default: true.

  • "PrintSkips" [Boolean] - States if the skipped cases/tests should be printed in the report.
    • Default: true.

  • "DiscoverScope" [Object] - States the scope area to search (only for the Discover() test) for discoverable TestCase() classes.
    • Default: window.

  • "SleepBetweenTests" [Number] - States a sleep time that should be done between each test (in milliseconds).
    • Default: null.

  • "ReportTextClass" [String] - States the CSS style to apply to all message lines in the report.
    • Default: ''.

  • "ReportTextPassClass" [String] - States the CSS style to apply to all pass message lines in the report.
    • Default: "ReportTextClass" setting.

  • "ReportTextFailClass" [String] - States the CSS style to apply to all fail message lines in the report.
    • Default: "ReportTextClass" setting.

  • "ReportTextSkipClass" [String] - States the CSS style to apply to all skip message lines in the report.
    • Default: "ReportTextClass" setting.

  • "ReportTextIgnoreClass" [String] - States the CSS style to apply to all ignore message lines in the report.
    • Default: "ReportTextClass" setting.

  • "ReportTextWarningClass" [String] - States the CSS style to apply to all warning message lines in the report.
    • Default: "ReportTextClass" setting.

  • "ReportTextExecutionErrorClass" [String] - States the CSS style to apply to all javascript execution errors shown in the report.
    • Default: "ReportTextClass" setting.

  • "ReportTextTestsStoppedClass" [String] - States the CSS style to apply to the message shown when the tests are stopped.
    • Default: "ReportTextClass" setting.

  • "ReportTextAssertVariableClass" [String] - States the CSS style to apply to the variables printed inside assert functions.
    • Default: '' (will use inherited class).

  • "WaitBeforeStartingTests" [Number] - States the duration to wait before starting a TestCase() is run (in milliseconds).
    • Default: 500.

  • "OnAllTestsStart" [Function] - States the function that should be triggered when the tests are started. Test execution will continue if an error is found.
    • Default: null.

  • "OnAllTestsFinish" [Function] - States the function that should be triggered when the tests are finished (only called if "OnAllTestsPassed" and "OnAllTestsFailed" are not set). Test execution will continue if an error is found.
    • Default: null.

  • "OnAllTestsPassed" [Function] - States the function that should be triggered when all the tests have finished and have passed. Test execution will continue if an error is found.
    • Default: null.

  • "OnAllTestsFailed" [Function] - States the function that should be triggered when all the tests have finished and have failed. Test execution will continue if an error is found.
    • Default: null.

  • "IncludeDiscoveredSkippedCases" [Boolean] - States if TestCase() classes that are set to be skipped should be be run (only used in "RunDiscover()" mode).
    • Default: true.

  • "IgnoreRepeats" [Boolean] - Forces all TestCase() and test repeats to be ignored.
    • Default: false.

  • "IgnoreSkips" [Boolean] - Forces all TestCase() and test skips to be ignored.
    • Default: false.

  • "AlterTitleOnFinish" [Boolean] - Adjusts the title of the document to the overall tests complete summary.
    • Default: false.

  • "ExecutionFailureRetries" [Number] - States how many times a test function should be run again when it fails to execute.
    • Default: 0.

  • "MinimumAssertsPerTest" [Number] - States the minimum number of asserts that can be used per test.
    • Default: 1.

  • "MaximumDuration" [Number] - States the duration that the tests can run for.
    • Default: 0 (it won't be used).

  • "UseDateTimeInLogs" [Boolean] - Forces each log to print a Date/Time stamp before the main information.
    • Default: false.

  • "PrintTestDurationsAfterSummary" [Boolean] - Forces each test duration to be printed after the main summary.
    • Default: false.

  • "DurationDecimalPoints" [Number] - States the number of decimal points to use on duration times.
    • Default: 3.

  • "MaximumSleep" [Number] - States the maximum duration the "Sleep()" function can use (in milliseconds).
    • Default: 20000.

  • "IgnoreMaximumDurationsForTests" [Boolean] - Forces the maximum durations for tests to be ignored.
    • Default: false.

  • "AllowIsolatedTests" [Boolean] - States if tests set to isolated mode should be allowed to run in this mode.
    • Default: true.

  • "IsolateTestsOnSetUpError" [Boolean] - States if tests in the current TestCase() should be moved into isolated mode if an error is detected in the "SetUp" function (will allow the tests to run instead of ignoring them and remain isolated until "SetUp" is fixed).
    • Default: false.

  • "MaximumVariablePrintLength" [Number] - States the maximum printable length of a variable passed to an assert function (if set to report).
    • Default: 0.

  • "OnTestsStopped" [Function] - States the function that should be triggered when the tests are stopped (either manually or internally).
    • Default: null.

  • "WaitBetweenTestCases" [Number] - States how long we should wait between running each TestCase() (in milliseconds).
    • Default: 500.

  • "StoreFullStackTraces" [Boolean] - States if we should store full stack traces for each exception found.
    • Default: true.

  • "ReportStackTraceOnTestException" [Boolean] - States if we should report the full stack trace in the report/console when an exception occurs when running a test.
    • Default: false.

  • "AllowCustomPrinting" [Boolean] - States if the "Print()" function can be used within TestCase() classes.
    • Default: false.

Runs all the function tests that has been defined in the class that this object is inherited in.

The main arguments for this function are as follows:

  • properties [Object] - The properties values that determine the settings to use in the tests (see description area for options).

Below is an example of how to use this function:

var test = new $T.Class.New( {

_inherit_: new $J.TestCase(),


test: function () {

this.Assert.StrictEqual( 1, 1 );

}

} );


oTesting.Run( { ReportIdentifier: "LogsElement" } );

Takes an array of test cases then runs them (after the properties have been specified, in the arguments).

The main arguments for this function are as follows:

  • properties [Object] - The properties values that determine the settings to use in the tests (see description area for options).

Below is an example of how to use this function:

var test1 = new $T.Class.New( {

_inherit_: new $J.TestCase(),


test: function () {

this.Assert.StrictEqual( 1, 1 );

}

} );


var test2 = new $T.Class.New( {

_inherit_: new $J.TestCase(),


test: function () {

this.Assert.StrictEqual( 2, 2 );

}

} );


$J.RunSuite( { ReportIdentifier: "LogsElement" }, oTesting1, oTesting2 );

Finds all of the discoverable tests cases available in the window scope and then runs them.

The main arguments for this function are as follows:

  • properties [Object] - The properties values that determine the settings to use in the tests (see description area for options).
  • pattern [String] - States the pattern to use as a searching preference when trying to find TestCase() classes (defaults to null).

The pattern types that can be used for 'sPattern' are as follows:

  • "*Example" - TestCase() class instance name ends with.
  • "Example*" - TestCase() class instance name starts with.
  • "*Example*" - TestCase() class instance name contains.

Below is an example of how to use this function:

function TestClasses () {

var test1 = new $T.Class.New( {

_inherit_: new $J.TestCase(),


test: function () {

this.Assert.StrictEqual( 1, 1 );

}

} );


var test2 = new $T.Class.New( {

_inherit_: new $J.TestCase(),


test: function () {

this.Assert.StrictEqual( 2, 2 );

}

} );


$J.RunDiscover( { Scope: this, ReportIdentifier: "LogsElement" } );

};