ctk hackfest testing framework november 2011 inria – sofia antipolis

8
CTK Hackfest Testing framework November 2011 Inria – Sofia Antipolis

Upload: augusta-peters

Post on 27-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CTK Hackfest Testing framework November 2011 Inria – Sofia Antipolis

CTK HackfestTesting frameworkNovember 2011

Inria – Sofia Antipolis

Page 2: CTK Hackfest Testing framework November 2011 Inria – Sofia Antipolis

MITK

• Custom testing framework• int mitkMyTest(int , char* []) { MITK_TEST_BEGIN(“MyTest");

int value = 10; MITK_TEST_CONDITION_REQUIRED( value < 100, “My Test Message"); MITK_INFO << value;

MITK_TEST_END();}

Page 3: CTK Hackfest Testing framework November 2011 Inria – Sofia Antipolis

GIMIAS

• TestSuite– CppUnit

• (JUnit for C++)• optionally using old QtTestRunner

– CxxTest• JUnit and CppUnit like• lightweight

Page 4: CTK Hackfest Testing framework November 2011 Inria – Sofia Antipolis

Qt Testing

• #include <QtTest/QtTest>class TestQString: public QObject { Q_OBJECTprivate slots: void toUpper() { QString str = "Hello"; QCOMPARE(str.toUpper(), QString("HELLO")); }};

• QTEST_MAIN(TestQString)#include "testqstring.moc"

Page 5: CTK Hackfest Testing framework November 2011 Inria – Sofia Antipolis

MAF3

• Wrapper around QTest

Page 6: CTK Hackfest Testing framework November 2011 Inria – Sofia Antipolis

Google tests

• // Tests factorial of negative numbers.TEST(FactorialTest, Negative) { // This test is named "Negative", // and belongs to the "FactorialTest“ // test case.EXPECT_EQ(1, Factorial(-5));EXPECT_EQ(1, Factorial(-1)); EXPECT_TRUE(Factorial(-10) > 0);}

• RUN_ALL_TESTS() in main().

Page 7: CTK Hackfest Testing framework November 2011 Inria – Sofia Antipolis

Suggestion for CTK

• Use QtTest ?– Offers the same as in CxxTests, Google Tests

• Eventually add macros on top to register tests– What’s missing ?– Mix of MITK / MAF ?

• How about Python ?• How about GUI testing ?

Page 8: CTK Hackfest Testing framework November 2011 Inria – Sofia Antipolis

• QtTest: http://doc.qt.nokia.com/stable/qtestlib-tutorial1.html