If you undertake a Webkit project, at some point, you are probably going to want to test it. Call me silly, but it seems like the right thing to do. Webkit has some regression testing frameworks that are available to you, and so I figured I would share my thoughts on these frameworks.
The second set of regression tests are the LayoutTests. These tests require a little bit more of an investment in time. These tests are launched from a script called run-webkit-tests. It grabs tests from the directory LayoutTests, and passes them to and applciation called DumpRenderTree. You will need to port the DumpRenderTree application. The name pretty much says it all. It links against the WebKit shared object, and it takes a page given to it by the launching script, creates an offscreen buffer which it passes to the WebView class, and then tells that WebView class to render the page. It also has a set of controllers and delegates to manipulate the pages that are loaded so events can be tested inside of the page. Once the test is complete, it will dump the contents of the page, either as a render layout tree, or as the textual contents of the page, to a file and then the launching script compares that with a known result. You can also add an option to dump the contents to an image to see what the rendering actually looks like. As I said earlier, this frameworks requires an investment of time. You need to port DumpRenderTree and get that to work with your rendering system, on your target. This port will also require you to implement the delegates and controllers that you interested in, such as the LayoutTestController, and the Editing delegate. Also, there are approximately 14000 tests in the framework. Roughly 40% to 50% will need to have the results verified for your platform as they are considered to be platform specific¹. You can skip tests using a skip file, and only test the areas that you are interested in, but you still may be looking at upwards of 6000 tests. The other thing to keep in mind is that these tests are to be used for finding regressions moving forward. The platform independent ones give you a sense that your implementation of the WebKit shared objects behaves like the other platforms, but the rendering ones are for your platform only, and therefore you need that initial baseline to compare with. For this reason, if you don't have a lot of time, you may want to forgo these tests and set up a simpler rendering test framework.
- Matching rendering between different GUI's is difficult. For example, something rendered on Windows will look very different compared to something rendered on a Mac.