W3C Conference logo
Cover page images (keys)

Testing to Perfection

Philippe Le Hégaret,

Interaction Domain Leader

W3C

W3C Conference, November 2011

Boxes

<style>
  #div1 {
    display: inline;
    position: relative;
    top: 20px;
  }
</style>
<div id="div1">
  A
  <div id="div2">B</div>
  C
</div>

Boxes

<style>
  span {
    position: relative;
    top: 20px;
  }
</style>
<span>
  A
  <div id="div2">B</div>
  C
</span>

The Challenge

HTML5 Logo

Testing to Perfection?

Testing is an approximation

The Audience

CSS 2.1 Tests

From CSS 2.1 Test Suite RC6 Results, March 2011
Testcase AHFormatter Gecko Presto Prince Trident WebKit WebToPDF
12.1: The :before and :after pseudo-elements
before-inheritable-001 2 / . / . 1 / . / . 4 / . / . 4 / . / . 4 / . / .
before-inheritable-002 4 / . / . 1 / . / . 4 / . / . 4 / . / . 4 / . / .
before-location-001 3 / . / . 2 / . / . 4 / . / . 5 / . / . 4 / . / .
list-style-position-010 2 / . / . . / 1 / . . / 4 / . 3 / 1 / . 4 / . / .
list-style-position-011 2 / . / . . / 2 / . 1 / . / . . / 4 / . . / 12 / . 4 / . / .
list-style-position-012 2 / . / . . / 2 / . 1 / . / . . / 4 / . . / 10 / . 4 / . / .
list-style-position-013 2 / . / . 1 / . / . . / 4 / . 4 / 1 / . . / 4 / .

SVG 1.1 Tests

From SVG Full 1.1 2nd Edition, Implementation Report, August 2011.
Test Name IE9 Inkscape Batik 1.8pre GPAC Firefox Opera Abbra WebKit
coords-units-03-b Pass Pass Pass Unknown Pass Pass Pass Fail
coords-viewattr-01-b Pass Fail Pass Unknown Pass Pass Fail Fail
coords-viewattr-02-b Pass Partial Pass Unknown Pass Pass Partial Fail
coords-viewattr-03-b Pass Pass Pass Unknown Pass Pass Partial Pass
extend-namespace-01-f Pass NA Pass Unknown Pass Pass Pass Pass
filters-blend-01-b Fail Partial Pass Unknown Pass Pass Fail Pass
filters-color-01-b Fail Partial Pass Unknown Pass Pass Fail Pass
filters-color-02-b Fail Pass Pass Unknown Pass Pass Fail Pass
filters-composite-03-f Fail Partial Pass Unknown Fail Pass Fail Fail
painting-render-02-b Fail Fail Fail Unknown Fail Fail Pass [4] Fail
painting-stroke-10-t Pass Fail Pass Partial Pass Fail Fail Fail

Test Suite Needs

Howto

How to write a test?

testharness.js

<script
  src="/resources/testharness.js">
</script>
<script
  src="/resources/testharnessreport.js">
</script>

testharness.js

<p id="MyE">This is <span>test</span>.</p>
<div id='log'></div>
<script>
test(
  function() {
     var myE = document.getElementById("MyE");
     assert_true(!!MyE.firstElementChild);
  },
  "firstElementChild must exist"
);
</script>

testharness.js

Summary

Found 4 tests

Details

ResultTest Name
PassfirstElementChild must exist
PassfirstElementChild must return null if no child element
PassfirstElementChild must return the first element child
PassfirstElementChild must be dynamically updated

testharness.js (async)

var t = async_test("Simple test");

function run() {
  t.step(
    function () {
      assert_true(!!MyE.firstElementChild);
    }
  );
  t.done();
};
window.onload = run;

Reftest

Test Reference

Hello World!

Hello World!

<style>
 #E:first-letter { color: red; }
</style>
<p id='E'>
Hello World!
</p>
<p>
<span style='color:red'>H</span>ello
World!
</p>

Reftest

Test Reference
OLLEH HELLO
<bdo dir="rtl">OLLEH</bdo>
<span dir="llr">HELLO</span>

Manual test

document.visibilityState

Iconify this window and restore it.

If the square is still red, please indicate that the test has failed.

What can you do?

If something doesn't work, speak up!

Every single test can make a difference!