Creating reftest-based unit tests

  • Revision slug: Creating_reftest-based_unit_tests
  • Revision title: Creating reftest-based unit tests
  • Revision id: 27075
  • Created:
  • Creator: Hw9Ix7
  • Is current revision? No
  • Comment

Revision Content

Your first reftest

The reftest harness can be thought of as comparing two visual constructs. If the visual constructs produced by two files are identical, the test passes. If they differ, the test fails. The power of the tool comes from the fact that there is more than one way to achieve any given visual effect in a browser. So, if the effect of complex markup is being tested, put that complex markup into a page and create another page that uses simple markup to achieve the same visual effect. Reftest will then compare them and verify whether they produce the same visual construct.

This idea can seem odd when first encountered. Automated testing usually compares output against an invariant, a "gold standard", that is determined to be correct. If one has software that multiplies numbers, one wants a regression test to show that 2 * 2 continues to be calculated to be 4, not something similar to but not quite exactly 4. But an operating systems does change with time. It is not invariant. And a browser may change the visual effect produced by a tag while still being compliant with relevant standards. For example, the HTML 4.01 specification at the W3C specifies that text inside of a

Revision Source

<p>
</p>
<h3 name="Your_first_reftest"> Your first reftest </h3>
<p>The reftest harness can be thought of as comparing two visual constructs. If the visual constructs produced by two files are identical, the test passes. If they differ, the test fails. The power of the tool comes from the fact that there is more than one way to achieve any given visual effect in a browser. So, if the effect of complex markup is being tested, put that complex markup into a page and create another page that uses simple markup to achieve the same visual effect. Reftest will then compare them and verify whether they produce the same visual construct.
</p><p>This idea can seem odd when first encountered. Automated testing usually compares output against an invariant, a "gold standard", that is determined to be correct. If one has software that multiplies numbers, one wants a regression test to show that 2 * 2 continues to be calculated to be 4, not something similar to but not quite exactly 4. But an operating systems does change with time. It is not invariant. And a browser may change the visual effect produced by a tag while still being compliant with relevant standards. For example, the HTML 4.01 specification at the W3C specifies that text inside of a <code></code>
</p>
Revert to this revision