qmltest: Count passes, fails and skips consistently.
This commit changes qmltest to count one pass per data row, rather than a single pass for an entire data-driven test function. This makes counting of passes consistent with counting of fails and skips which were already counted once per data row. This change also means that the plain-text, xml and light-xml output formats will now show one result per data row, so that every data row executed will be shown in the test output with either a pass, fail or skip result. Previously data rows that passed were not shown in the output, preventing analysis of total number of tests runs, pass-rates, and various other metrics. This commit corresponds to (and depends on) a commit in the qtbase module which changes the behaviour of qtestlib in the same way. Task-number: QTBUG-21848 Task-number: QTBUG-22124 Change-Id: I3c1f0e68bdff4087b9ccfc80a3f96f4541335b6f Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
This commit is contained in:
parent
09923aec38
commit
5572b4c9ed
|
@ -477,7 +477,7 @@ Item {
|
||||||
e.fileName, e.lineNumber)
|
e.fileName, e.lineNumber)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !qtest_results.dataFailed
|
return !qtest_results.failed
|
||||||
}
|
}
|
||||||
|
|
||||||
function qtest_runFunction(prop, arg) {
|
function qtest_runFunction(prop, arg) {
|
||||||
|
@ -486,6 +486,7 @@ Item {
|
||||||
qtest_runInternal(prop, arg)
|
qtest_runInternal(prop, arg)
|
||||||
qtest_results.finishTestData()
|
qtest_results.finishTestData()
|
||||||
qtest_runInternal("cleanup")
|
qtest_runInternal("cleanup")
|
||||||
|
qtest_results.finishTestDataCleanup()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,6 +516,7 @@ Item {
|
||||||
|
|
||||||
// Run the cleanup function.
|
// Run the cleanup function.
|
||||||
qtest_runInternal("cleanup")
|
qtest_runInternal("cleanup")
|
||||||
|
qtest_results.finishTestDataCleanup()
|
||||||
} while (!qtest_results.measurementAccepted())
|
} while (!qtest_results.measurementAccepted())
|
||||||
qtest_results.endDataRun()
|
qtest_results.endDataRun()
|
||||||
} while (qtest_results.needsMoreMeasurements())
|
} while (qtest_results.needsMoreMeasurements())
|
||||||
|
@ -566,6 +568,8 @@ Item {
|
||||||
var runTests = true
|
var runTests = true
|
||||||
if (!qtest_runInternal("initTestCase"))
|
if (!qtest_runInternal("initTestCase"))
|
||||||
runTests = false
|
runTests = false
|
||||||
|
qtest_results.finishTestData()
|
||||||
|
qtest_results.finishTestDataCleanup()
|
||||||
qtest_results.finishTestFunction()
|
qtest_results.finishTestFunction()
|
||||||
|
|
||||||
// Run the test methods.
|
// Run the test methods.
|
||||||
|
@ -636,6 +640,8 @@ Item {
|
||||||
// Clean up and exit.
|
// Clean up and exit.
|
||||||
running = false
|
running = false
|
||||||
completed = true
|
completed = true
|
||||||
|
qtest_results.finishTestData()
|
||||||
|
qtest_results.finishTestDataCleanup()
|
||||||
qtest_results.finishTestFunction()
|
qtest_results.finishTestFunction()
|
||||||
qtest_results.functionName = ""
|
qtest_results.functionName = ""
|
||||||
|
|
||||||
|
|
|
@ -173,6 +173,7 @@ template <class View> void handleCompileErrors(const QFileInfo &fi, const View &
|
||||||
results.fail(errors.at(0).description(),
|
results.fail(errors.at(0).description(),
|
||||||
errors.at(0).url(), errors.at(0).line());
|
errors.at(0).url(), errors.at(0).line());
|
||||||
results.finishTestData();
|
results.finishTestData();
|
||||||
|
results.finishTestDataCleanup();
|
||||||
results.finishTestFunction();
|
results.finishTestFunction();
|
||||||
results.setFunctionName(QString());
|
results.setFunctionName(QString());
|
||||||
results.stopLogging();
|
results.stopLogging();
|
||||||
|
|
|
@ -192,27 +192,14 @@ void QuickTestResult::setDataTag(const QString &tag)
|
||||||
/*!
|
/*!
|
||||||
\qmlproperty bool TestResult::failed
|
\qmlproperty bool TestResult::failed
|
||||||
|
|
||||||
This property returns true if the current test function has
|
This property returns true if the current test function (or
|
||||||
failed; false otherwise. The fail state is reset when
|
current test data row for a data-driven test) has failed;
|
||||||
functionName is changed or finishTestFunction() is called.
|
false otherwise. The fail state is reset when functionName
|
||||||
|
is changed or finishTestDataCleanup() is called.
|
||||||
|
|
||||||
\sa skipped, dataFailed
|
\sa skipped
|
||||||
*/
|
*/
|
||||||
bool QuickTestResult::isFailed() const
|
bool QuickTestResult::isFailed() const
|
||||||
{
|
|
||||||
return QTestResult::testFailed();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty bool TestResult::dataFailed
|
|
||||||
|
|
||||||
This property returns true if the current data function has
|
|
||||||
failed; false otherwise. The fail state is reset when
|
|
||||||
functionName is changed or finishTestFunction() is called.
|
|
||||||
|
|
||||||
\sa failed
|
|
||||||
*/
|
|
||||||
bool QuickTestResult::isDataFailed() const
|
|
||||||
{
|
{
|
||||||
return QTestResult::currentTestFailed();
|
return QTestResult::currentTestFailed();
|
||||||
}
|
}
|
||||||
|
@ -349,6 +336,11 @@ void QuickTestResult::finishTestData()
|
||||||
QTestResult::finishedCurrentTestData();
|
QTestResult::finishedCurrentTestData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QuickTestResult::finishTestDataCleanup()
|
||||||
|
{
|
||||||
|
QTestResult::finishedCurrentTestDataCleanup();
|
||||||
|
}
|
||||||
|
|
||||||
void QuickTestResult::finishTestFunction()
|
void QuickTestResult::finishTestFunction()
|
||||||
{
|
{
|
||||||
QTestResult::finishedCurrentTestFunction();
|
QTestResult::finishedCurrentTestFunction();
|
||||||
|
|
|
@ -61,7 +61,6 @@ class Q_QUICK_TEST_EXPORT QuickTestResult : public QObject
|
||||||
Q_PROPERTY(QString functionName READ functionName WRITE setFunctionName NOTIFY functionNameChanged)
|
Q_PROPERTY(QString functionName READ functionName WRITE setFunctionName NOTIFY functionNameChanged)
|
||||||
Q_PROPERTY(QString dataTag READ dataTag WRITE setDataTag NOTIFY dataTagChanged)
|
Q_PROPERTY(QString dataTag READ dataTag WRITE setDataTag NOTIFY dataTagChanged)
|
||||||
Q_PROPERTY(bool failed READ isFailed)
|
Q_PROPERTY(bool failed READ isFailed)
|
||||||
Q_PROPERTY(bool dataFailed READ isDataFailed)
|
|
||||||
Q_PROPERTY(bool skipped READ isSkipped WRITE setSkipped NOTIFY skippedChanged)
|
Q_PROPERTY(bool skipped READ isSkipped WRITE setSkipped NOTIFY skippedChanged)
|
||||||
Q_PROPERTY(int passCount READ passCount)
|
Q_PROPERTY(int passCount READ passCount)
|
||||||
Q_PROPERTY(int failCount READ failCount)
|
Q_PROPERTY(int failCount READ failCount)
|
||||||
|
@ -88,7 +87,6 @@ public:
|
||||||
void setDataTag(const QString &tag);
|
void setDataTag(const QString &tag);
|
||||||
|
|
||||||
bool isFailed() const;
|
bool isFailed() const;
|
||||||
bool isDataFailed() const;
|
|
||||||
|
|
||||||
bool isSkipped() const;
|
bool isSkipped() const;
|
||||||
void setSkipped(bool skip);
|
void setSkipped(bool skip);
|
||||||
|
@ -109,6 +107,7 @@ public Q_SLOTS:
|
||||||
void clearTestTable();
|
void clearTestTable();
|
||||||
|
|
||||||
void finishTestData();
|
void finishTestData();
|
||||||
|
void finishTestDataCleanup();
|
||||||
void finishTestFunction();
|
void finishTestFunction();
|
||||||
|
|
||||||
void fail(const QString &message, const QUrl &location, int line);
|
void fail(const QString &message, const QUrl &location, int line);
|
||||||
|
|
Loading…
Reference in New Issue