[webkit-dev] choosing a unit test framework
David Levin
levin at chromium.org
Tue Apr 19 14:53:48 PDT 2011
On Tue, Apr 19, 2011 at 2:42 PM, Ryosuke Niwa <rniwa at webkit.org> wrote:
> Can we see examples of tests that use TestWebKitAPI / gtest? I think it'll
> be helpful for people who don't know how the said two testing frameworks
> work.
>
> Ideally, we compare the same test written in TestWebKitAPI and gtest to
> decide which framework is better.
>
Here's a test using TestWebKitAPI
#include "Test.h"
#include <JavaScriptCore/Vector.h>
TEST(WTF, VectorBasic)
{
Vector<int> intVector;
TEST_ASSERT(intVector.isEmpty());
TEST_ASSERT(intVector.size() == 0);
TEST_ASSERT(intVector.capacity() == 0);
}
Here's the same test written using gtest:
#include "gtest.h"
#include <JavaScriptCore/Vector.h>
TEST(WTF, VectorBasic)
{
Vector<int> intVector;
ASSERT_TRUE(intVector.isEmpty());
ASSERT_EQ(0, intVector.size());
ASSERT_EQ(0, intVector.capacity());
}
With respect to writing a simple test, they both make it easy to write one,
so I don't think this is the deciding factor.
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20110419/65900cdf/attachment.html>
More information about the webkit-dev
mailing list