diff options
Diffstat (limited to 'src/testlib/doc')
-rw-r--r-- | src/testlib/doc/snippets/code/doc_src_qtestlib.cpp | 30 | ||||
-rw-r--r-- | src/testlib/doc/src/qttestlib-manual.qdoc | 12 |
2 files changed, 33 insertions, 9 deletions
diff --git a/src/testlib/doc/snippets/code/doc_src_qtestlib.cpp b/src/testlib/doc/snippets/code/doc_src_qtestlib.cpp index 0dc45bef76..de301b8df9 100644 --- a/src/testlib/doc/snippets/code/doc_src_qtestlib.cpp +++ b/src/testlib/doc/snippets/code/doc_src_qtestlib.cpp @@ -48,19 +48,41 @@ ** ****************************************************************************/ +#include <QtTest> + //! [0] class MyFirstTest: public QObject { Q_OBJECT + +private: + bool myCondition() + { + return true; + } + private slots: void initTestCase() - { qDebug("called before everything else"); } + { + qDebug("Called before everything else."); + } + void myFirstTest() - { QVERIFY(1 == 1); } + { + QVERIFY(true); // check that a condition is satisfied + QCOMPARE(1, 1); // compare two values + } + void mySecondTest() - { QVERIFY(1 != 2); } + { + QVERIFY(myCondition()); + QVERIFY(1 != 2); + } + void cleanupTestCase() - { qDebug("called after myFirstTest and mySecondTest"); } + { + qDebug("Called after myFirstTest and mySecondTest."); + } }; //! [0] diff --git a/src/testlib/doc/src/qttestlib-manual.qdoc b/src/testlib/doc/src/qttestlib-manual.qdoc index 9bd210d71f..9c6bdf60a4 100644 --- a/src/testlib/doc/src/qttestlib-manual.qdoc +++ b/src/testlib/doc/src/qttestlib-manual.qdoc @@ -69,8 +69,8 @@ \li Qt Test supports benchmarking and provides several measurement back-ends. \row \li \b {IDE friendly} - \li Qt Test outputs messages that can be interpreted by Visual - Studio and KDevelop. + \li Qt Test outputs messages that can be interpreted by Qt Creator, Visual + Studio, and KDevelop. \row \li \b Thread-safety \li The error reporting is thread safe and atomic. @@ -175,7 +175,7 @@ \list \li \c -o \e{filename,format} \br Writes output to the specified file, in the specified format (one of - \c txt, \c xml, \c lightxml or \c xunitxml). The special filename \c - + \c txt, \c xml, \c lightxml, \c xunitxml or \c tap). The special filename \c - may be used to log to standard output. \li \c -o \e filename \br Writes output to the specified file. @@ -192,6 +192,8 @@ benchmarks, since it suppresses normal pass/fail messages. \li \c -teamcity \br Outputs results in TeamCity format. + \li \c -tap \br + Outputs results in Test Anything Protocol (TAP) format. \endlist The first version of the \c -o option may be repeated in order to log @@ -199,8 +201,8 @@ option can log test results to standard output. If the first version of the \c -o option is used, neither the second version - of the \c -o option nor the \c -txt, \c -xml, \c -lightxml, \c -teamcity - or \c -xunitxml options should be used. + of the \c -o option nor the \c -txt, \c -xml, \c -lightxml, \c -teamcity, + \c -xunitxml or \c -tap options should be used. If neither version of the \c -o option is used, test results will be logged to standard output. If no format option is used, test results will be logged in |