Changes between Initial Version and Version 1 of WebInspectorTests


Ignore:
Timestamp:
Feb 21, 2014 11:51:48 AM (8 years ago)
Author:
BJ Burg
Comment:

explain how inspector protocol tests work

Legend:

Unmodified
Added
Removed
Modified
  • WebInspectorTests

    v1 v1  
     1This page describes how various parts of the Web Inspector are tested.
     2
     3-----
     4
     5== Test areas
     6
     7There are two flavors of inspector tests: tests that exercise the raw inspector protocol (independently of any particular frontend), and tests that exercise the models and controllers underlying the current user interface. In some cases, model/controller tests are written instead of protocol tests if the protocol test would be unusually large or hard to debug.
     8
     9There are no tests that exercise the user interface of the Web Inspector (UI tests). In practice, the Inspector UI changes frequently so such tests are very brittle, and are rarely worth the trouble of maintaining.
     10
     11
     12== Test mechanisms
     13
     14Each test is an HTML file in the `LayoutTests/inspector-protocol/` directory. The special `test()` method is evaluated in the inspector page (see below), and other scripts are executed in the test page (i.e., the page being inspected by the inspector).
     15
     16=== Dummy inspector frontend
     17
     18Many protocol and model tests do not need to persist across main frame navigations, nor do they need access all of the Web Inspector functionality. For such tests, the test harness creates a dummy inspector frontend by using `window.open()` from the test page, and establishes bidirectional communication with the '''child''' inspector page using `window.postMessage` and a `message` event handler. It then evaluates a subset of inspector resources into existence on the dummy page. Finally, it runs the provided test function by calling `toString()` on the fuction, sending to the child inspector page, and then using `eval()`. This functionality is implemented by `LayoutTests/http/tests/inspector-protocol/resources/protocol-test.js` on the test page, and `LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js` on the inspector page.