Writing Reftests

Read first

Your first test

You will need either a Firefox build environment or to download and extract the built test packages.

  1. Create a file named foo.html with the following content:
<html>
  <head>
    <title>reftest0001</title>
  </head>
  <body>
    <strong>Hello!</strong>
  </body>
</html>
  1. Create a file named bar.html with the following content:
<html>
  <head>
    <title>reftest0001</title>
  </head>
  <body>
    <b>Hello!</b>
  </body>
</html>
  1. Create a manifest file named reftest.list with the following content:
== foo.html bar.html
  1. Run the test using the appropriate section in How to run Reftests, making sure to specify your new manifest file. You should see something similar to the following in the resulting output:
REFTEST TEST-START | file:///.../foo.html | 0 / 1 (0%)
REFTEST TEST-START | file:///.../bar.html | 0 / 1 (0%)
REFTEST TEST-PASS | file:///.../foo.html | image comparison (==)

Congratulations! You have just created your first Reftest! When you're feeling reading, try a couple more examples.

Manifest files

Manifest files can contain any number of tests, and can also contain other things, but it doesn't get very complicated. Here is an example:

#example manifest
include ../other.list
== foo.html bar.html
!= aaa.html bbb.html

The first line is a comment. The second line, as one might expect, includes another manifest file. The third line should look familiar. It says that foo.html and bar.html should produce visually identical output. The fourth line says that aaa.html and bbb.html should not produce visually identical output. More information on manifest files can be found in the {{ Source("layout/tools/reftest/README.txt", "README") }}.

Continue reading