Regression Testing

The WebKit Tests

Before patches can land in any of the frameworks in the repository, the layout regression tests must pass. To run these tests, execute the run-webkit-tests script.

The script will dump the render trees for all of the pages and diff the results against the expected correct results. If no differences are found, then the patch has passed the tests. If any tests fail, then the patch cannot be committed until the discrepancies in the tests are resolved.

Regression tests must be run on the latest released version of OS X, since that is were the expected results are generated.

The JavaScriptCore Tests

If you are making changes to JavaScriptCore, there is an additional test suite you must run before landing changes. This is the Mozilla JavaScript test suite.

What’s Covered by the JavaScript Tests?

The JavaScript tests cover the functionality of the core JavaScript engine. This includes the following JavaScript objects:

  • Arrays
  • Booleans
  • Dates
  • Functions
  • Global Object
  • Math
  • Numbers
  • Objects
  • Regular Expressions
  • Strings

In addition, the JavaScript tests cover parsing, lexical conventions, expressions, statements, type conversion, and exception handling.

How to Run the Tests

Execute the run-javascriptcore-tests script. The script will run all the tests and summarize how the results differ from what is currently expected.

What Just Happened

After all the test runs have finished the results of tests are saved to actual.html. The script the compares these results from your local tree against what is expected to pass/fail from the tip of tree. If there are any regressions caused by your changes you’ll be made aware of them. If you fixed a bug that caused an existing failure, you’ll also be made aware of what specific test your fix affected.

What to Do Next

So you fixed a bug that fixed a test. This means you’ve now set a new baseline for the tree as a result.

cp actual.html expected.html

When you land your changes, the baseline (expected.html) will be updated in the tree.

What Happens if I Caused a Regression?

It’s not the end of the world. Go back and fix your bug and rerun run-webkit-tests or run-javascriptcore-tests as many times as necessary.