A reduced testcase is the simplest possible Web page that still demonstrates the bug. A bug report with a reduced testcase is easier to tackle than a bug report that merely refers to a web page that Firefox displays incorrectly.

Why make reduced testcases?

How do I make a reduced testcase?

To turn a web page that shows a bug into a reduced test case:

  1. Download the latest Firefox Nightly to avoid wasting time on a bug that is already fixed.
  2. Download the Web page that shows the bug to your local machine.
  3. Ensure you can reproduce the bug with the local copy.  If not:
  4. Using a text editor, remove irrelevant HTML markup, CSS rules, and lines of JavaScript from the page. As you remove parts of the page, reload it in Firefox to make sure it still reproduces the bug. If you remove too much, just Undo.
  5. When you've cut away as much HTML, CSS, and JavaScript as you can, and cutting away any more causes the bug to disappear, you're done!

What do I do with a reduced testcase?

Once you have made a reduced testcase, attach the testcase to the bug report using the "Add an attachment" link. Then enter "testcase" into the Keywords1 field so engineers know the bug is ready to be crushed.

Now that you know what HTML tags or CSS properties are involved in triggering the bug, search Bugzilla again to determine whether others have reported similar problems. You may learn that Gecko's behavior is intentional, in which case you can turn1 the bug report into a (tech evangelism bug). Or you may learn that the bug is a duplicate of another open bug report.

Consider rewriting the bug's summary1 to reflect the testcase, so it can be found by someone doing a similar search. For example, you might change "Can't open this page's dropdown" to "Can't open dropdown in table in position:relative span".

1 A standard Bugzilla account does not have sufficient permission to add keywords or change a bug summary. After you have created testcases for two bugs, mail Gerv with links to the two bugs, and he will upgrade your permissions.

External files

If the testcase uses multiple files, try to modify the testcase so all of the information is in a single file.

As a last resort, you can upload ancillary files to Bugzilla, then modify the main file to point to the URLs of the attachments before uploading it. This is better than uploading a zip file because it allows the testcase to be viewed merely by clicking the link in Bugzilla.

Standards and quirks modes

Gecko uses the page's document type declaration to decide whether to display the page in "Quirks mode", "Almost Standards mode", or "Standards Compliance mode". Firefox's "Page Info" window can show you which mode a page uses, but it does not yet distinguish between Almost Standards mode and Standards Compliance mode (bug 154359).

If a page looks bad in Standards Compliance mode, try removing the doctype from the top of the file. If the Web page then display correctly, then the Web page author probably is relying on the (incorrect) rendering behaviors of older browsers but mistakenly asking browsers to render it according to modern web standards. Search for the name of the feature along with "quirk" or "standards mode" to find related bug reports.

Increasing testcase clarity

It is best for a reduced testcase to use a standards-mode doctype. This adds to the size of the file, but it effectively makes the testcase simpler by instructing Gecko not to apply compatibility quirks such as the rules in quirk.css. We prefer the HTML5 doctype

<!DOCTYPE html>

If the bug involves tables or margins, you can make it easier to visualize the bug by adding borders or outlines.

You can also increase the clarity of a testcase by using simpler elements:

Useful tools

See also

Original document information