forked from qt-creator/qt-creator
AutoTest: Fix handling of data tags in test results
Avoid adding test functions again and put further data tags directly below the respective test function. Change-Id: I29775b836cc4584358ee67b5f07744986c6a6591 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -169,6 +169,8 @@ void QtTestOutputReader::processOutput(const QByteArray &outputLine)
|
||||
} else if (currentTag == QStringLiteral("TestFunction")) {
|
||||
m_testCase = m_xmlReader.attributes().value(QStringLiteral("name")).toString();
|
||||
QTC_ASSERT(!m_testCase.isEmpty(), continue);
|
||||
if (m_testCase == m_formerTestCase) // don't report "Executing..." more than once
|
||||
continue;
|
||||
TestResultPtr testResult = TestResultPtr(createDefaultResult());
|
||||
testResult->setResult(Result::MessageTestCaseStart);
|
||||
testResult->setDescription(tr("Executing test function %1").arg(m_testCase));
|
||||
@@ -261,6 +263,7 @@ void QtTestOutputReader::processOutput(const QByteArray &outputLine)
|
||||
m_futureInterface.reportResult(TestResultPtr(testResult));
|
||||
m_futureInterface.setProgressValue(m_futureInterface.progressValue() + 1);
|
||||
m_dataTag.clear();
|
||||
m_formerTestCase = m_testCase;
|
||||
m_testCase.clear();
|
||||
} else if (currentTag == QStringLiteral("TestCase")) {
|
||||
QtTestResult *testResult = createDefaultResult();
|
||||
|
||||
@@ -62,6 +62,7 @@ private:
|
||||
CDATAMode m_cdataMode = None;
|
||||
QString m_className;
|
||||
QString m_testCase;
|
||||
QString m_formerTestCase;
|
||||
QString m_dataTag;
|
||||
Result::Type m_result = Result::Invalid;
|
||||
QString m_description;
|
||||
|
||||
@@ -78,7 +78,8 @@ bool QtTestResult::isDirectParentOf(const TestResult *other, bool *needsIntermed
|
||||
if (!TestResult::isDirectParentOf(other, needsIntermediate))
|
||||
return false;
|
||||
const QtTestResult *qtOther = static_cast<const QtTestResult *>(other);
|
||||
if (result() == Result::MessageTestCaseStart || result() == Result::MessageIntermediate) {
|
||||
|
||||
if (TestResult::isMessageCaseStart(result())) {
|
||||
if (qtOther->isDataTag()) {
|
||||
if (qtOther->m_function == m_function) {
|
||||
if (m_dataTag.isEmpty()) {
|
||||
|
||||
@@ -161,6 +161,13 @@ QColor TestResult::colorForType(const Result::Type type)
|
||||
}
|
||||
}
|
||||
|
||||
bool TestResult::isMessageCaseStart(const Result::Type type)
|
||||
{
|
||||
return type == Result::MessageTestCaseStart || type == Result::MessageTestCaseSuccess
|
||||
|| type == Result::MessageTestCaseFail || type == Result::MessageTestCaseWarn
|
||||
|| type == Result::MessageIntermediate;
|
||||
}
|
||||
|
||||
bool TestResult::isDirectParentOf(const TestResult *other, bool * /*needsIntermediate*/) const
|
||||
{
|
||||
QTC_ASSERT(other, return false);
|
||||
|
||||
@@ -90,6 +90,7 @@ public:
|
||||
static Result::Type toResultType(int rt);
|
||||
static QString resultToString(const Result::Type type);
|
||||
static QColor colorForType(const Result::Type type);
|
||||
static bool isMessageCaseStart(const Result::Type type);
|
||||
|
||||
virtual bool isDirectParentOf(const TestResult *other, bool *needsIntermediate) const;
|
||||
virtual bool isIntermediateFor(const TestResult *other) const;
|
||||
|
||||
@@ -99,8 +99,7 @@ void TestResultItem::updateDescription(const QString &description)
|
||||
|
||||
void TestResultItem::updateResult()
|
||||
{
|
||||
if (m_testResult->result() != Result::MessageTestCaseStart
|
||||
&& m_testResult->result() != Result::MessageIntermediate)
|
||||
if (!TestResult::isMessageCaseStart(m_testResult->result()))
|
||||
return;
|
||||
|
||||
Result::Type newResult = Result::MessageTestCaseSuccess;
|
||||
|
||||
Reference in New Issue
Block a user