Changes between Version 7 and Version 8 of WebInspectorTests
- Timestamp:
- Aug 29, 2017, 3:45:36 PM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WebInspectorTests
v7 v8 67 67 * Use `expectThat` instead of `assert` whenever possible. The former will always add output to the test, prefixing the condition with `PASS:` or `FAIL:`; the latter only produces output when the condition evaluates to false. Why should the default be to always log? For someone trying to understand how a test works or debug a failing test, the extra output is very helpful in understanding control flow. 68 68 * Log runtime states sparingly, and only those that may help to diagnose a failing test. Logging runtime states can make tests more self-documenting at the expense of reducing robustness. For example, if a test logs source code locations, these could change (and cause the test to fail) if text is added to or removed from relevant file. It is better to assert actual output against known-good outputs. Don't dump runtime state that is machine-dependent. 69 70 == Assertion Matchers 71 {{{ 72 InspectorTest.expectThat 73 InspectorTest.expectFalse 74 InspectorTest.expectNull 75 InspectorTest.expectNotNull 76 InspectorTest.expectEqual 77 InspectorTest.expectNotEqual 78 InspectorTest.expectShallowEqual 79 InspectorTest.expectNotShallowEqual 80 InspectorTest.expectEqualWithAccuracy 81 InspectorTest.expectLessThan 82 InspectorTest.expectLessThanOrEqual 83 InspectorTest.expectGreaterThan 84 InspectorTest.expectGreaterThanOrEqual 85 }}} 69 86 70 87 == Important Test Fixtures