Sunday, February 11, 2007

Creating Your First Reftest, and Your Second and Third

I have updated a page on devmo and I think it is a rather nice page, though I am not objective here.

http://developer.mozilla.org/en/docs/Creating_reftest-based_unit_tests


This describes in very practical terms how to create reftests. It turns out to be way easier than it seemed at first. Really, I just had to map what reftest did into my head. Not being a long-time Mozilla-ish person, it probably took me longer than it would take others.

Here is a slice from the page, giving instructions on just the first test. Please see the page for more info. There are details in the full instructions that may be useful. And if something seems wrong, please feel free to update the page. Send me an e-mail if you would like, but wiki is more wiki if people really edit what they see. And now for the show.


Step 1: Build a copy of Firefox for yourself.

Step 2: Open a terminal window. Create a directory and make that your current directory.

Step 3: Create a file named foo.html with the following:

<html><head><title>reftest0001</title><body><strong>Hello!</strong></body></html>

Step 4: Create a file named bar.html with the following:

<html><head><title>reftest0001</title><body><b>Hello!</b></body></html>

Step 5: Create a file named reftest.list with the following:

== foo.html bar.html

One is now ready to run the test. Here is how I run this. Adapt this to your own platform.


% /bin/sh
$ /Users/ray/mo/browser/mozilla/dist/MinefieldDebug.app/Contents/MacOS/firefox -P minefield1 -reftest ./reftest.list 2>&1 | grep REFTEST
REFTEST PASS: file:///Users/ray/moz/reftest0001.html
$

Congratulations! You have just created your first retest!

No comments: