[webkit-dev] C++ unit tests for WebKit?

Adam Barth abarth at webkit.org
Wed Jul 11 15:51:56 PDT 2012

Generally speaking, WebKit's testing philosophy is to test at API
boundaries, typically either a given port's WebKit API or the web platform
API.  The benefit of that approach is that it makes it easier for us to
refactor the internals of WebCore without being constrained by fragile
tests---only by API commitments.

In the case of CSS Exclusions, it's likely valuable to think about how you
can test the feature via the web platform.  Developing a rich set of tests
that use web platform APIs has a number of follow-on benefits that
WebCore-internal testing doesn't, such as the ability to run the tests in
other browsers and to contribute them to the W3C as part of the standards

Of course, this sort of one-size-fits-all testing strategy works well in
come cases in less well in others.  I understand that other projects have
different testing strategies that have worked well for them, but I would
encourage you to try our the community's conventions and customs for a
while to get a feel for which ones work well and which ones ought to be


On Wed, Jul 11, 2012 at 3:44 PM, Hans Muller <hmuller at adobe.com> wrote:

> It looks like Tools/TestWebKitAPI/Tests/WebCore just contains one small
> KURL test. I could certainly add more for the Exclusions shape classes,
> but I got that feeling that maybe you get about being the first to take a
> table at an empty restaurant.  Perhaps it's just that most of the C++
> classes in WebCore are too interdependent to merit unit testing?
> - Hans
> On 7/11/12 2:26 PM, "Benjamin Poulain" <benjamin at webkit.org> wrote:
> >On Wed, Jul 11, 2012 at 2:23 PM, Hans Muller <hmuller at adobe.com> wrote:
> >> Have the merits of C++ unit tests been debated before?  I noticed that
> >>a bug
> >> representing as much has been around since 2008
> >> (https://bugs.webkit.org/show_bug.cgi?id=21010).  The last comment
> >>(2009)
> >> concludes with: "I'd be interested to hear other's thoughts."
> >>Personally,
> >> I'd like to be able to include unit tests with worthy C++ classes,
> >>however I
> >> would also like to hear other's thoughts.
> >
> >That has been discussed before.
> >
> >We have some C++ tests, see Tools/TestWebKitAPI/Tests/
> >You can probably integrate yours in there.
> >
> >Cheers,
> >Benjamin
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo/webkit-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20120711/1ea845fc/attachment.html>

More information about the webkit-dev mailing list