Implementation:SeleniumHQ Selenium Closure Testing Asserts
| Knowledge Sources | |
|---|---|
| Domains | JavaScript_Atoms, Vendored_Library |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
Vendored Google Closure Library module providing JsUnit-style test assertion functions used by Selenium JavaScript atoms.
Description
goog.testing.asserts is a vendored copy of the Google Closure Library module. It provides a comprehensive set of assertion functions for unit testing, including equality checks for primitives, objects, arrays, dates, and regular expressions. It supports deep object comparison with configurable equality predicates, tolerance-based numeric comparison, and detailed error messaging. Selenium uses this as part of its JavaScript atom infrastructure.
Usage
This module is consumed internally by Selenium's JavaScript atoms build system. Not imported directly by end users.
Code Reference
Source Location
- Repository: SeleniumHQ_Selenium
- File: third_party/closure/goog/testing/asserts.js
- Lines: 1-1907
Key Exports
goog.provide('goog.testing.asserts');
// Equality predicates for well-known types
const EQUALITY_PREDICATES = {
'String': DOUBLE_EQUALITY_PREDICATE,
'Number': DOUBLE_EQUALITY_PREDICATE,
'Boolean': DOUBLE_EQUALITY_PREDICATE,
'Date': function(date1, date2) { return date1.getTime() == date2.getTime(); },
'RegExp': TO_STRING_EQUALITY_PREDICATE,
'Function': TO_STRING_EQUALITY_PREDICATE,
// ...
};
// Key assertion functions: assertEquals, assertNotEquals,
// assertObjectEquals, assertArrayEquals, assertTrue, assertFalse, etc.