testlib: Add selftests for skip and fail inside cleanupTestCase().
Change-Id: I9bbe774c3259338d452cd1eb1a6f37a85db15921 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
parent
931f4501a6
commit
95d0b27711
15
tests/auto/testlib/selftests/expected_failcleanup.lightxml
Normal file
15
tests/auto/testlib/selftests/expected_failcleanup.lightxml
Normal file
@ -0,0 +1,15 @@
|
||||
<Environment>
|
||||
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
|
||||
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
|
||||
</Environment>
|
||||
<TestFunction name="initTestCase">
|
||||
<Incident type="pass" file="" line="0" />
|
||||
</TestFunction>
|
||||
<TestFunction name="aTestFunction">
|
||||
<Incident type="pass" file="" line="0" />
|
||||
</TestFunction>
|
||||
<TestFunction name="cleanupTestCase">
|
||||
<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/failcleanup/tst_failcleanup.cpp" line="59">
|
||||
<Description><![CDATA['false' returned FALSE. (Fail inside cleanupTestCase)]]></Description>
|
||||
</Incident>
|
||||
</TestFunction>
|
8
tests/auto/testlib/selftests/expected_failcleanup.txt
Normal file
8
tests/auto/testlib/selftests/expected_failcleanup.txt
Normal file
@ -0,0 +1,8 @@
|
||||
********* Start testing of tst_FailCleanup *********
|
||||
Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
|
||||
PASS : tst_FailCleanup::initTestCase()
|
||||
PASS : tst_FailCleanup::aTestFunction()
|
||||
FAIL! : tst_FailCleanup::cleanupTestCase() 'false' returned FALSE. (Fail inside cleanupTestCase)
|
||||
Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/failcleanup/tst_failcleanup.cpp(59)]
|
||||
Totals: 2 passed, 1 failed, 0 skipped
|
||||
********* Finished testing of tst_FailCleanup *********
|
18
tests/auto/testlib/selftests/expected_failcleanup.xml
Normal file
18
tests/auto/testlib/selftests/expected_failcleanup.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<TestCase name="tst_FailCleanup">
|
||||
<Environment>
|
||||
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
|
||||
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
|
||||
</Environment>
|
||||
<TestFunction name="initTestCase">
|
||||
<Incident type="pass" file="" line="0" />
|
||||
</TestFunction>
|
||||
<TestFunction name="aTestFunction">
|
||||
<Incident type="pass" file="" line="0" />
|
||||
</TestFunction>
|
||||
<TestFunction name="cleanupTestCase">
|
||||
<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/failcleanup/tst_failcleanup.cpp" line="59">
|
||||
<Description><![CDATA['false' returned FALSE. (Fail inside cleanupTestCase)]]></Description>
|
||||
</Incident>
|
||||
</TestFunction>
|
||||
</TestCase>
|
13
tests/auto/testlib/selftests/expected_failcleanup.xunitxml
Normal file
13
tests/auto/testlib/selftests/expected_failcleanup.xunitxml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<testsuite errors="0" failures="1" tests="3" name="tst_FailCleanup">
|
||||
<properties>
|
||||
<property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
|
||||
<property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
|
||||
</properties>
|
||||
<testcase result="pass" name="initTestCase"/>
|
||||
<testcase result="pass" name="aTestFunction"/>
|
||||
<testcase result="fail" name="cleanupTestCase">
|
||||
<failure message="'false' returned FALSE. (Fail inside cleanupTestCase)" result="fail"/>
|
||||
</testcase>
|
||||
<system-err/>
|
||||
</testsuite>
|
15
tests/auto/testlib/selftests/expected_skipcleanup.lightxml
Normal file
15
tests/auto/testlib/selftests/expected_skipcleanup.lightxml
Normal file
@ -0,0 +1,15 @@
|
||||
<Environment>
|
||||
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
|
||||
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
|
||||
</Environment>
|
||||
<TestFunction name="initTestCase">
|
||||
<Incident type="pass" file="" line="0" />
|
||||
</TestFunction>
|
||||
<TestFunction name="aTestFunction">
|
||||
<Incident type="pass" file="" line="0" />
|
||||
</TestFunction>
|
||||
<TestFunction name="cleanupTestCase">
|
||||
<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/skipcleanup/tst_skipcleanup.cpp" line="59">
|
||||
<Description><![CDATA[Skip inside cleanupTestCase.]]></Description>
|
||||
</Message>
|
||||
</TestFunction>
|
8
tests/auto/testlib/selftests/expected_skipcleanup.txt
Normal file
8
tests/auto/testlib/selftests/expected_skipcleanup.txt
Normal file
@ -0,0 +1,8 @@
|
||||
********* Start testing of tst_SkipCleanup *********
|
||||
Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
|
||||
PASS : tst_SkipCleanup::initTestCase()
|
||||
PASS : tst_SkipCleanup::aTestFunction()
|
||||
SKIP : tst_SkipCleanup::cleanupTestCase() Skip inside cleanupTestCase.
|
||||
Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/skipcleanup/tst_skipcleanup.cpp(59)]
|
||||
Totals: 2 passed, 0 failed, 1 skipped
|
||||
********* Finished testing of tst_SkipCleanup *********
|
18
tests/auto/testlib/selftests/expected_skipcleanup.xml
Normal file
18
tests/auto/testlib/selftests/expected_skipcleanup.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<TestCase name="tst_SkipCleanup">
|
||||
<Environment>
|
||||
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
|
||||
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
|
||||
</Environment>
|
||||
<TestFunction name="initTestCase">
|
||||
<Incident type="pass" file="" line="0" />
|
||||
</TestFunction>
|
||||
<TestFunction name="aTestFunction">
|
||||
<Incident type="pass" file="" line="0" />
|
||||
</TestFunction>
|
||||
<TestFunction name="cleanupTestCase">
|
||||
<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/skipcleanup/tst_skipcleanup.cpp" line="59">
|
||||
<Description><![CDATA[Skip inside cleanupTestCase.]]></Description>
|
||||
</Message>
|
||||
</TestFunction>
|
||||
</TestCase>
|
15
tests/auto/testlib/selftests/expected_skipcleanup.xunitxml
Normal file
15
tests/auto/testlib/selftests/expected_skipcleanup.xunitxml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<testsuite errors="1" failures="0" tests="3" name="tst_SkipCleanup">
|
||||
<properties>
|
||||
<property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
|
||||
<property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
|
||||
</properties>
|
||||
<testcase result="pass" name="initTestCase"/>
|
||||
<testcase result="pass" name="aTestFunction"/>
|
||||
<testcase name="cleanupTestCase">
|
||||
<!-- message="Skip inside cleanupTestCase." type="skip" -->
|
||||
</testcase>
|
||||
<system-err>
|
||||
<![CDATA[Skip inside cleanupTestCase.]]>
|
||||
</system-err>
|
||||
</testsuite>
|
7
tests/auto/testlib/selftests/failcleanup/failcleanup.pro
Normal file
7
tests/auto/testlib/selftests/failcleanup/failcleanup.pro
Normal file
@ -0,0 +1,7 @@
|
||||
SOURCES += tst_failcleanup.cpp
|
||||
QT = core testlib
|
||||
|
||||
mac:CONFIG -= app_bundle
|
||||
CONFIG -= debug_and_release_target
|
||||
|
||||
TARGET = failcleanup
|
63
tests/auto/testlib/selftests/failcleanup/tst_failcleanup.cpp
Normal file
63
tests/auto/testlib/selftests/failcleanup/tst_failcleanup.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
class tst_FailCleanup: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void aTestFunction() const;
|
||||
void cleanupTestCase() const;
|
||||
};
|
||||
|
||||
void tst_FailCleanup::aTestFunction() const
|
||||
{
|
||||
QVERIFY(true);
|
||||
}
|
||||
|
||||
void tst_FailCleanup::cleanupTestCase() const
|
||||
{
|
||||
QVERIFY2(false, "Fail inside cleanupTestCase");
|
||||
}
|
||||
|
||||
QTEST_APPLESS_MAIN(tst_FailCleanup)
|
||||
#include "tst_failcleanup.moc"
|
@ -4,4 +4,4 @@ SUBPROGRAMS = subtest warnings maxwarnings cmptest globaldata skip \
|
||||
exceptionthrow qexecstringlist datatable commandlinedata\
|
||||
benchlibwalltime benchlibcallgrind benchlibeventcounter benchlibtickcounter \
|
||||
benchliboptions xunit badxml longstring float printdatatags \
|
||||
printdatatagswithglobaltags findtestdata counting
|
||||
printdatatagswithglobaltags findtestdata counting skipcleanup failcleanup
|
||||
|
@ -64,6 +64,10 @@
|
||||
<file>expected_expectfail.txt</file>
|
||||
<file>expected_expectfail.xml</file>
|
||||
<file>expected_expectfail.xunitxml</file>
|
||||
<file>expected_failcleanup.lightxml</file>
|
||||
<file>expected_failcleanup.txt</file>
|
||||
<file>expected_failcleanup.xml</file>
|
||||
<file>expected_failcleanup.xunitxml</file>
|
||||
<file>expected_failinit.lightxml</file>
|
||||
<file>expected_failinit.txt</file>
|
||||
<file>expected_failinit.xml</file>
|
||||
@ -108,6 +112,10 @@
|
||||
<file>expected_skip.txt</file>
|
||||
<file>expected_skip.xml</file>
|
||||
<file>expected_skip.xunitxml</file>
|
||||
<file>expected_skipcleanup.lightxml</file>
|
||||
<file>expected_skipcleanup.txt</file>
|
||||
<file>expected_skipcleanup.xml</file>
|
||||
<file>expected_skipcleanup.xunitxml</file>
|
||||
<file>expected_skipinit.lightxml</file>
|
||||
<file>expected_skipinit.txt</file>
|
||||
<file>expected_skipinit.xml</file>
|
||||
|
7
tests/auto/testlib/selftests/skipcleanup/skipcleanup.pro
Normal file
7
tests/auto/testlib/selftests/skipcleanup/skipcleanup.pro
Normal file
@ -0,0 +1,7 @@
|
||||
SOURCES += tst_skipcleanup.cpp
|
||||
QT = core testlib
|
||||
|
||||
mac:CONFIG -= app_bundle
|
||||
CONFIG -= debug_and_release_target
|
||||
|
||||
TARGET = skipcleanup
|
63
tests/auto/testlib/selftests/skipcleanup/tst_skipcleanup.cpp
Normal file
63
tests/auto/testlib/selftests/skipcleanup/tst_skipcleanup.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
class tst_SkipCleanup: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void aTestFunction() const;
|
||||
void cleanupTestCase() const;
|
||||
};
|
||||
|
||||
void tst_SkipCleanup::aTestFunction() const
|
||||
{
|
||||
QVERIFY(true);
|
||||
}
|
||||
|
||||
void tst_SkipCleanup::cleanupTestCase() const
|
||||
{
|
||||
QSKIP("Skip inside cleanupTestCase.");
|
||||
}
|
||||
|
||||
QTEST_APPLESS_MAIN(tst_SkipCleanup)
|
||||
#include "tst_skipcleanup.moc"
|
@ -338,6 +338,7 @@ void tst_Selftests::runSubTest_data()
|
||||
<< "exceptionthrow"
|
||||
#endif
|
||||
<< "expectfail"
|
||||
<< "failcleanup"
|
||||
<< "failinit"
|
||||
<< "failinitdata"
|
||||
#if !defined(Q_OS_WIN)
|
||||
@ -354,6 +355,7 @@ void tst_Selftests::runSubTest_data()
|
||||
<< "qexecstringlist"
|
||||
<< "singleskip"
|
||||
<< "skip"
|
||||
<< "skipcleanup"
|
||||
<< "skipinit"
|
||||
<< "skipinitdata"
|
||||
<< "sleep"
|
||||
|
Loading…
Reference in New Issue
Block a user