Child pages
  • JSUnit

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Divcache
HTML Table
id
classservoy sSummary
Colgroup Tag
Col
width80px
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Row (tr)
Table Cell (td)
void
Table Cell (td)assertEquals(expected, actual)
indexstyletruedisplay:none

DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.

Div
iddescription

See Unit Testing for more info on how to utilize the methods of the JSUnit class.

 

servoy sSummary12%30%58%height: 30px;3Methods SummaryvoidAsserts that two values are equal.voidassertEquals(message, expected, actual)
Asserts that two values are equal.
refresh100d
showRefreshtrue
iddoc
titleRefresh page
showDatetrue
retryEnable

servoy sReturnTypes2100%height: 30px;2Supported ClientssWordListSmartClientsWordListWebClientsWordListNGClientsWordListMobileClient

Table Row (tr)
Table Cell (td)
Table Cell (td)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)assertFalse(boolean_condition)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
assertFalse(message, boolean_condition)
Asserts that a condition is false.
Table Row (tr)
Table Cell (td)
void
Table Cell (td)assertFloatEquals(expectedFloat, actualFloat, tolerance)
Asserts that voidAsserts that a condition is false.voidAsserts that a condition is false. Table Row (tr) Table Cell (td)voidAsserts that two floating point values are equal to within a given tolerance.void Table Cell (td)assertFloatEquals(message, expectedFloat, actualFloat, tolerance)
assertMatches(regularExpression, actualString)
Asserts that a regular Asserts that two floating point values are equal to within a given tolerance. Table Row (tr)
Table Cell (td)
void
Table Cell (td) Table Row (tr) Table Cell (td)voidAsserts that a regular expression matches a string.void Table Cell (td)assertMatches(message, regularExpression, actualString)
Table Row (tr) Table Cell (td)Asserts that a regular expression matches a string.void Table Cell (td)assertNotNull(object)
Table Row (tr) Table Cell (td)Asserts that an object is not null.void Table Cell (td)assertNotNull(message, object)
Asserts that an object is not null. Table Row (tr)
Table Cell (td)
void
Table Cell (td)assertNotSame(notExpected, actual)
Asserts that two values are Table Row (tr) Table Cell (td)voidAsserts that two values are not the same.void Table Cell (td)assertNotSame(message, notExpected, actual)
Table Row (tr) Table Cell (td)Asserts that two values are not the same.void Table Cell (td)assertNotUndefined(definedObject)
Table Row (tr) Table Cell (td)Asserts that an object is not undefined.void Table Cell (td)assertNotUndefined(message, definedObject)
Table Row (tr) Table Cell (td)Asserts that an object is not undefined.void Table Cell (td)assertNull(nullValue)
Table Row (tr) Table Cell (td)Asserts that an object is null.void Table Cell (td)assertNull(message, nullValue)
Table Row (tr) Table Cell (td)Asserts that an object is null.void Table Cell (td)assertSame(expected, actual)
Table Row (tr) Table Cell (td)Asserts that two values are the same.void Table Cell (td)assertSame(message, expected, actual)
Table Row (tr) Table Cell (td)Asserts that two values are the same.void Table Cell (td)assertTrue(boolean_condition)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)assertTrue(message, boolean_condition)
Asserts that Asserts that a condition is true. Table Row (tr) Table Cell (td)voidAsserts that a condition is true.void Table Cell (td)assertUndefined(undefinedValue)
Table Row (tr) Table Cell (td)Asserts that an object is undefined.void Table Cell (td)assertUndefined(message, undefinedValue)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)fail(message)
Asserts that an object is undefined.voidFails a test.voidFails a test.
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
fail(message, instanceOfCallStack)
Fails a test.
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
fail(message, instanceOfCallStack, userMessage)
Fails a test.
HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Col
colspan2
width100%
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Details
Table Body (tbody)
idassertEquals-Object_Object
Table Row (tr)
idname
Table Cell (td)

assertEquals

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertEquals
Span
(expected, actual)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that two values are equal. AssertionFailedError is thrown if the actual value does not match the regular expression.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Object} expected - the expected value.
{Object} actual - the actual value.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that two values are equal. AssertionFailedError is thrown if the actual value does not match the regular expression.
jsunit.assertEquals("Solution name test", "someSolution", application.getSolutionName());
jsunit.assertEquals("Simple math test", 2, 1 + 1);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertEquals-String_Object_Object
Table Row (tr)
idname
Table Cell (td)

assertEquals

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertEquals
Span
(message, expected, actual)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that two values are equal. AssertionFailedError is thrown if the actual value does not match the regular expression.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} message - The test description/message.
{Object} expected - the expected value.
{Object} actual - the actual value.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that two values are equal. AssertionFailedError is thrown if the actual value does not match the regular expression.
jsunit.assertEquals("Solution name test", "someSolution", application.getSolutionName());
jsunit.assertEquals("Simple math test", 2, 1 + 1);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertFalse-Boolean
Table Row (tr)
idname
Table Cell (td)

assertFalse

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertFalse
Span
(boolean_condition)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that a condition is false. AssertionFailedError is thrown if the evaluation was not false.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Boolean} boolean_condition - the actual value.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that a condition is false. AssertionFailedError is thrown if the evaluation was not false.
jsunit.assertFalse("False test", application.isLastPrintPreviewPrinted());
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertFalse-String_Boolean
Table Row (tr)
idname
Table Cell (td)

assertFalse

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertFalse
Span
(message, boolean_condition)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that a condition is false. AssertionFailedError is thrown if the evaluation was not false.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} message - The test description/message.
{Boolean} boolean_condition - the actual value.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that a condition is false. AssertionFailedError is thrown if the evaluation was not false.
jsunit.assertFalse("False test", application.isLastPrintPreviewPrinted());
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertFloatEquals-Number_Number_Number
Table Row (tr)
idname
Table Cell (td)

assertFloatEquals

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertFloatEquals
Span
(expectedFloat, actualFloat, tolerance)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that two floating point values are equal to within a given tolerance. AssertionFailedError is thrown if the expected value is not within the tolerance of the actual one.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Number} expectedFloat - the expected value.
{Number} actualFloat - the actual value.
{Number} tolerance - tolerance when comparing.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that two floating point values are equal to within a given tolerance. AssertionFailedError is thrown if the expected value is not within the tolerance of the actual one.
jsunit.assertFloatEquals("Float equals test", 3.12, 3.121, 0.0015);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertFloatEquals-String_Number_Number_Number
Table Row (tr)
idname
Table Cell (td)

assertFloatEquals

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertFloatEquals
Span
(message, expectedFloat, actualFloat, tolerance)
Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
Asserts that two floating point values are equal to within a given tolerancevoidFails a test.

functionservoy sDetail2100%height:30px2Methods DetailsassertEqualsname

assertEquals(expected, actual)

dessIndentAsserts that two values are equal. AssertionFailedError is thrown if the actual value does not match the regular expression.prs

Parameters

sIndentexpectedthe expected value.actualthe actual value.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow assertEqualsname

assertEquals(message, expected, actual)

dessIndentAsserts that two values are equal. AssertionFailedError is thrown if the actual value does not match the regular expression.prs

Parameters

sIndentmessageThe test description/message.expectedthe expected value.actualthe actual value.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
assertFalsename

assertFalse(boolean_condition)

dessIndentAsserts that a condition is false. AssertionFailedError is thrown if the evaluation was not false.prs

Parameters

sIndentboolean_conditionthe actual value.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
assertFalsename

assertFalse(message, boolean_condition)

dessIndentAsserts that a condition is false. AssertionFailedError is thrown if the evaluation was not false.prs

Parameters

sIndentmessageThe test description/message.boolean_conditionthe actual value.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
assertFloatEqualsname

assertFloatEquals(expectedFloat, actualFloat, tolerance)

dessIndentAsserts that two floating point values are equal to within a given tolerance. AssertionFailedError is thrown if the expected value is not within the tolerance of the actual one.prs

Parameters

sIndentexpectedFloatthe expected value.actualFloatthe actual value.tolerancetolerance when comparing.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
assertFloatEqualsname

assertFloatEquals(message, expectedFloat, actualFloat, tolerance)

dessIndentAsserts that two floating point values are equal to within a given tolerance. AssertionFailedError is thrown if the expected value is not within the tolerance of the actual one.prs

Parameters

sIndentmessageThe test description/message.expectedFloatthe expected value.actualFloatthe actual value.tolerancetolerance when comparing.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
assertMatchesname

assertMatches(regularExpression, actualString)

dessIndentAsserts that a regular expression matches a string. AssertionFailedError is thrown if the expected value is not the actual one.prs

Parameters

sIndentregularExpressionthe regular expression used for matching.actualStringthe actual value to be matched.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
assertMatchesname

assertMatches(message, regularExpression, actualString)

dessIndentAsserts that a regular expression matches a string. AssertionFailedError is thrown if the expected value is not the actual one.prs

Parameters

sIndentmessageThe test description/message.regularExpressionthe regular expression used for matching.actualStringthe actual value to be matched.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
assertNotNullname

assertNotNull(object)

dessIndentAsserts that an object is not null. AssertionFailedError is thrown if the object is not null.prs

Parameters

sIndentobjectthe actual value.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
assertNotNullname

assertNotNull(message, object)

dessIndentAsserts that an object is not null. AssertionFailedError is thrown if the object is not null.prs

Parameters

sIndentmessageThe test description/message.objectthe actual value.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
assertNotSamename

assertNotSame(notExpected, actual)

dessIndentAsserts that two values are not the same. AssertionFailedError is thrown if the expected value is the actual one.prs

Parameters

sIndentnotExpectedthe value that is not expected.actualthe actual value.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
assertNotSamename

assertNotSame(message, notExpected, actual)

dessIndentAsserts that two values are not the same. AssertionFailedError is thrown if the expected value is the actual one.prs

Parameters

sIndentmessageThe test description/message.notExpectedthe value that is not expected.actualthe actual value.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
assertNotUndefinedname

assertNotUndefined(definedObject)

dessIndentAsserts that an object is not undefined. AssertionFailedError is thrown if the object is undefined.prs

Parameters

sIndentdefinedObjectthe actual value.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
assertNotUndefinedname

assertNotUndefined(message, definedObject)

dessIndentAsserts that an object is not undefined. AssertionFailedError is thrown if the object is undefined.prs

Parameters

sIndentmessageThe test description/message.definedObjectthe actual value.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
assertNullname

assertNull(nullValue)

dessIndentAsserts that an object is null. AssertionFailedError is thrown if the object is not null.prs

Parameters

sIndentnullValuethe actual value.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
assertNullname

assertNull(message, nullValue)

dessIndentAsserts that an object is null. AssertionFailedError is thrown if the object is not null.prs

Parameters

sIndentmessageThe test description/message.nullValuethe actual value.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
assertSamename

assertSame(expected, actual)

dessIndentAsserts that two values are the same. AssertionFailedError is thrown if the expected value is not the actual one.prs

Parameters

sIndentexpectedthe expected value.actualthe actual value.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
assertSamename

assertSame(message, expected, actual)

dessIndentAsserts that two values are the same. AssertionFailedError is thrown if the expected value is not
within the tolerance of the id actual one. Table Row (tr)prs

Table Cell (td)

Parameters

Divclass

sIndent{String} message - The test description/message.
{Number} expectedFloat - expectedthe expected value.
{Number} actualFloat -

Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that two floating point values are equal to within a given tolerance. AssertionFailedError is thrown if the expected value is not within the tolerance of the actual one.
jsunit.assertFloatEquals("Float equals test", 3.12, 3.121, 0.0015);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertMatches-Object_String
Table Row (tr)
idname
Table Cell (td)

assertMatches

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertMatches
Span
(regularExpression, actualString)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that a regular expression matches a string. AssertionFailedError is thrown if the expected value is not the actual one.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Object} regularExpression - the regular expression used for matching.
{String} actualString - the actual value to be matched.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that a regular expression matches a string. AssertionFailedError is thrown if the expected value is not the actual one.
jsunit.assertMatches(new RegExp("gr(a|e)y"), "gray");
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertMatches-String_Object_String
Table Row (tr)
idname
Table Cell (td)

assertMatches

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertMatches
Span
(message, regularExpression, actualString)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that a regular expression matches a string. AssertionFailedError is thrown if the expected value is not the actual one.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} message - The test description/message.
{Object} regularExpression - the regular expression used for matching.
{String} actualString - the actual value to be matched.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that a regular expression matches a string. AssertionFailedError is thrown if the expected value is not the actual one.
jsunit.assertMatches("Match test", new RegExp("gr(a|e)y"), "gray");
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertNotNull-Object
Table Row (tr)
idname
Table Cell (td)

assertNotNull

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertNotNull
Span
(object)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that an object is not null. AssertionFailedError is thrown if the object is not null.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Object} object - the actual value.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that an object is not null. AssertionFailedError is thrown if the object is not null.
var a; // this is undefined, not null
jsunit.assertNotNull(a);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertNotNull-String_Object
Table Row (tr)
idname
Table Cell (td)

assertNotNull

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertNotNull
Span
(message, object)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that an object is not null. AssertionFailedError is thrown if the object is not null.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} message - The test description/message.
{Object} object - the actual value.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that an object is not null. AssertionFailedError is thrown if the object is not null.
var a; // this is undefined, not null
jsunit.assertNotNull("Not null test", a);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertNotSame-Object_Object
Table Row (tr)
idname
Table Cell (td)

assertNotSame

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertNotSame
Span
(notExpected, actual)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that two values are not the same. AssertionFailedError is thrown if the expected value is the actual one.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Object} notExpected - the value that is not expected.
{Object} actual - the actual value.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that two values are not the same. AssertionFailedError is thrown if the expected value is the actual one.
var a = new Date(1990, 1, 1);
var b = new Date(1990, 1, 1);
jsunit.assertNotSame(a, b);
jsunit.assertEquals("But equals", a, b);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertNotSame-String_Object_Object
Table Row (tr)
idname
Table Cell (td)

assertNotSame

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertNotSame
Span
(message, notExpected, actual)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that two values are not the same. AssertionFailedError is thrown if the expected value is the actual one.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} message - The test description/message.
{Object} notExpected - the value that is not expected.
{Object} actual - the actual value.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that two values are not the same. AssertionFailedError is thrown if the expected value is the actual one.
var a = new Date(1990, 1, 1);
var b = new Date(1990, 1, 1);
jsunit.assertNotSame("Not same test", a, b);
jsunit.assertEquals("But equals", a, b);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertNotUndefined-Object
Table Row (tr)
idname
Table Cell (td)

assertNotUndefined

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertNotUndefined
Span
(definedObject)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that an object is not undefined. AssertionFailedError is thrown if the object is undefined.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Object} definedObject - the actual value.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that an object is not undefined. AssertionFailedError is thrown if the object is undefined.
var a = 0;
jsunit.assertNotUndefined(a);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertNotUndefined-String_Object
Table Row (tr)
idname
Table Cell (td)

assertNotUndefined

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertNotUndefined
Span
(message, definedObject)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that an object is not undefined. AssertionFailedError is thrown if the object is undefined.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} message - The test description/message.
{Object} definedObject - the actual value.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that an object is not undefined. AssertionFailedError is thrown if the object is undefined.
var a = 0;
jsunit.assertNotUndefined("Not undefined test", a);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertNull-Object
Table Row (tr)
idname
Table Cell (td)

assertNull

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertNull
Span
(nullValue)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that an object is null. AssertionFailedError is thrown if the object is not null.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Object} nullValue - the actual value.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that an object is null. AssertionFailedError is thrown if the object is not null.
jsunit.assertNull("Null test", null);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertNull-String_Object
Table Row (tr)
idname
Table Cell (td)

assertNull

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertNull
Span
(message, nullValue)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that an object is null. AssertionFailedError is thrown if the object is not null.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} message - The test description/message.
{Object} nullValue - the actual value.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that an object is null. AssertionFailedError is thrown if the object is not null.
jsunit.assertNull("Null test", null);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertSame-Object_Object
Table Row (tr)
idname
Table Cell (td)

assertSame

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertSame
Span
(expected, actual)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that two values are the same. AssertionFailedError is thrown if the expected value is not the actual one.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Object} expected - the expected value.
{Object} actual - the actual value.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that two values are the same. AssertionFailedError is thrown if the expected value is not the actual one.
var a = new Date(1990, 1, 1);
var b = a;
jsunit.assertSame(a, b);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertSame-String_Object_Object
Table Row (tr)
idname
Table Cell (td)

assertSame

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertSame
Span
(message, expected, actual)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that two values are the same. AssertionFailedError is thrown if the expected value is not the actual one.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} message - The test description/message.
{Object} expected - the expected value.
{Object} actual - the actual value.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that two values are the same. AssertionFailedError is thrown if the expected value is not the actual one.
var a = new Date(1990, 1, 1);
var b = a;
jsunit.assertSame("Same test", a, b);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertTrue-Boolean
Table Row (tr)
idname
Table Cell (td)

assertTrue

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertTrue
Span
(boolean_condition)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that a condition is true. AssertionFailedError is thrown if the evaluation was not true.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Boolean} boolean_condition - the actual value.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that a condition is true. AssertionFailedError is thrown if the evaluation was not true.
jsunit.assertTrue("True test", application.isLastPrintPreviewPrinted());
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertTrue-String_Boolean
Table Row (tr)
idname
Table Cell (td)

assertTrue

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertTrue
Span
(message, boolean_condition)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that a condition is true. AssertionFailedError is thrown if the evaluation was not true.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} message - The test description/message.
{Boolean} boolean_condition - the actual value.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that a condition is true. AssertionFailedError is thrown if the evaluation was not true.
jsunit.assertTrue("True test", application.isLastPrintPreviewPrinted());
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertUndefined-Object
Table Row (tr)
idname
Table Cell (td)

assertUndefined

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertUndefined
Span
(undefinedValue)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that an object is undefined. AssertionFailedError is thrown if the object is defined.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Object} undefinedValue - the actual value.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that an object is undefined. AssertionFailedError is thrown if the object is defined.
jsunit.assertUndefined("Undefined test", thisIsUndefined);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idassertUndefined-String_Object
Table Row (tr)
idname
Table Cell (td)

assertUndefined

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
assertUndefined
Span
(message, undefinedValue)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Asserts that an object is undefined. AssertionFailedError is thrown if the object is defined.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} message - The test description/message.
{Object} undefinedValue - the actual value.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Asserts that an object is undefined. AssertionFailedError is thrown if the object is defined.
jsunit.assertUndefined(thisIsUndefined);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idfail-String
Table Row (tr)
idname
Table Cell (td)

fail

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
fail
Span
(message)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Fails a test. AssertionFailedError is always thrown.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} message - The test description/message. This is usually the only parameter specified when calling this method.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Fails a test. AssertionFailedError is always thrown.
jsunit.fail("Fail test");
jsunit.fail("test", null, "Fail"); // 2nd param is not used in Servoy, params 3 and 1 get merged to form a message. The result is the same as in the line above.
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idfail-String_Object
Table Row (tr)
idname
Table Cell (td)

fail

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
fail
Span
(message, instanceOfCallStack)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Fails a test. AssertionFailedError is always thrown.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} message - The test description/message. This is usually the only parameter specified when calling this method.
{Object} instanceOfCallStack - an internal JSUnit call stack. Use null for this if you want to get to the next optional parameter. Usually not specified.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Fails a test. AssertionFailedError is always thrown.
jsunit.fail("Fail test");
jsunit.fail("test", null, "Fail"); // 2nd param is not used in Servoy, params 3 and 1 get merged to form a message. The result is the same as in the line above.
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idfail-String_Object_String
Table Row (tr)
idname
Table Cell (td)

fail

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
fail
Span
(message, instanceOfCallStack, userMessage)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Fails a test. AssertionFailedError is always thrown.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} message - The test description/message. This is usually the only parameter specified when calling this method.
{Object} instanceOfCallStack - an internal JSUnit call stack. Use null for this if you want to get to the next optional parameter. Usually not specified.
{String} userMessage - a user message. Usually not specified.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// Fails a test. AssertionFailedError is always thrown.
jsunit.fail("Fail test");
jsunit.fail("test", null, "Fail"); // 2nd param is not used in Servoy, params 3 and 1 get merged to form a message. The result is the same as in the line above.
Table Row (tr)
classlastDetailRow
Table Cell (td) actualthe actual value.
{Number} tolerance - tolerance when comparing.ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
assertTruename

assertTrue(boolean_condition)

dessIndentAsserts that a condition is true. AssertionFailedError is thrown if the evaluation was not true.prs

Parameters

sIndentboolean_conditionthe actual value.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
assertTruename

assertTrue(message, boolean_condition)

dessIndentAsserts that a condition is true. AssertionFailedError is thrown if the evaluation was not true.prs

Parameters

sIndentmessageThe test description/message.boolean_conditionthe actual value.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
assertUndefinedname

assertUndefined(undefinedValue)

dessIndentAsserts that an object is undefined. AssertionFailedError is thrown if the object is defined.prs

Parameters

sIndentundefinedValuethe actual value.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
assertUndefinedname

assertUndefined(message, undefinedValue)

dessIndentAsserts that an object is undefined. AssertionFailedError is thrown if the object is defined.prs

Parameters

sIndentmessageThe test description/message.undefinedValuethe actual value.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
failname

fail(message)

dessIndentFails a test. AssertionFailedError is always thrown.prs

Parameters

sIndentmessageThe test description/message. This is usually the only parameter specified when calling this method.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
failname

fail(message, instanceOfCallStack)

dessIndentFails a test. AssertionFailedError is always thrown.prs

Parameters

sIndentmessageThe test description/message. This is usually the only parameter specified when calling this method.instanceOfCallStackan internal JSUnit call stack. Use null for this if you want to get to the next optional parameter. Usually not specified.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
failname

fail(message, instanceOfCallStack, userMessage)

dessIndentFails a test. AssertionFailedError is always thrown.prs

Parameters

sIndentmessageThe test description/message. This is usually the only parameter specified when calling this method.instanceOfCallStackan internal JSUnit call stack. Use null for this if you want to get to the next optional parameter. Usually not specified.userMessagea user message. Usually not specified.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow