The Test.Unit.Assertions class is basically a mix-in to Test.Unit.Testcase and provides various assertion methods.

Syntax

The basic call to an assertion within a test method in Test.Unit.Runner looks as follows:


testExample: function() { with(this) {
  var myElement = $('mydiv');
  assertEqual("DIV", myElement.tagName);
  assertEqual("DIV", myElement.tagName, "Hmm, not a DIV?");
}};

All assertations take in a optional message as last parameter, which is used in case of assertions failure for addtional log remarks.

Class methods

Basic assertions

Test.Unit.Assertions.assertEqual
Test.Unit.Assertions.assertNotEqual
Test.Unit.Assertions.assertNull
Test.Unit.Assertions.assertNotNull

Advanced assertions

Test.Unit.Assertions.assertInspect
Test.Unit.Assertions.assertEnumEqual
Test.Unit.Assertions.assertIdentical
Test.Unit.Assertions.assertMatch
Test.Unit.Assertions.assertHidden
Test.Unit.Assertions.assertType
Test.Unit.Assertions.assertNotOfType
Test.Unit.Assertions.assertInstanceOf
Test.Unit.Assertions.assertNotInstanceOf
Test.Unit.Assertions.assertRespondsTo
Test.Unit.Assertions.assertReturnsTrue
Test.Unit.Assertions.assertReturnsFalse
Test.Unit.Assertions.assertRaise
Test.Unit.Assertions.assertElementsMatch
Test.Unit.Assertions.assertElementMatches

Speciality assertions

Test.Unit.Assertions.assertVisible
Test.Unit.Assertions.assertNotVisible