From 795423beea4b9631ff3734eee9db12671af2754b Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Sat, 7 Jul 2018 17:21:46 -0700 Subject: [PATCH 1/6] WIP. --- tools/auto-tester/CMakeLists.txt | 4 +- tools/auto-tester/src/Test.cpp | 21 +++++ tools/auto-tester/src/Test.h | 3 +- tools/auto-tester/src/TestSuiteCreator.cpp | 105 +++++++++++++++++++++ tools/auto-tester/src/TestSuiteCreator.h | 26 +++++ tools/auto-tester/src/ui/AutoTester.cpp | 4 + tools/auto-tester/src/ui/AutoTester.h | 2 +- tools/auto-tester/src/ui/AutoTester.ui | 27 ++++-- 8 files changed, 181 insertions(+), 11 deletions(-) create mode 100644 tools/auto-tester/src/TestSuiteCreator.cpp create mode 100644 tools/auto-tester/src/TestSuiteCreator.h diff --git a/tools/auto-tester/CMakeLists.txt b/tools/auto-tester/CMakeLists.txt index a2589bb760..1546a35f4c 100644 --- a/tools/auto-tester/CMakeLists.txt +++ b/tools/auto-tester/CMakeLists.txt @@ -5,7 +5,7 @@ project(${TARGET_NAME}) SET (CMAKE_AUTOUIC ON) SET (CMAKE_AUTOMOC ON) -setup_hifi_project (Core Widgets Network) +setup_hifi_project (Core Widgets Network Xml) link_hifi_libraries () # FIX: Qt was built with -reduce-relocations @@ -18,7 +18,7 @@ include_directories (${CMAKE_CURRENT_SOURCE_DIR}) include_directories (${Qt5Core_INCLUDE_DIRS}) include_directories (${Qt5Widgets_INCLUDE_DIRS}) -set (QT_LIBRARIES Qt5::Core Qt5::Widgets) +set (QT_LIBRARIES Qt5::Core Qt5::Widgets QT::Gui Qt5::Xml) if (WIN32) # Do not show Console diff --git a/tools/auto-tester/src/Test.cpp b/tools/auto-tester/src/Test.cpp index 4f02544c12..8255d845f6 100644 --- a/tools/auto-tester/src/Test.cpp +++ b/tools/auto-tester/src/Test.cpp @@ -18,6 +18,7 @@ #include #include +#include "TestSuiteCreator.h" #include "ui/AutoTester.h" extern AutoTester* autoTester; @@ -821,6 +822,26 @@ void Test::createTestsOutline() { QMessageBox::information(0, "Success", "Test outline file " + testsOutlineFilename + " has been created"); } +void Test::createTestRailTestSuite() { + QString previousSelection = testDirectory; + QString parent = previousSelection.left(previousSelection.lastIndexOf('/')); + if (!parent.isNull() && parent.right(1) != "/") { + parent += "/"; + } + + testDirectory = + QFileDialog::getExistingDirectory(nullptr, "Please select the tests root folder", parent, QFileDialog::ShowDirsOnly); + + // If user cancelled then restore previous selection and return + if (testDirectory == "") { + testDirectory = previousSelection; + return; + } + + TestSuiteCreator testSuiteCreator; + testSuiteCreator.createTestSuite(testDirectory); +} + QStringList Test::createListOfAll_imagesInDirectory(const QString& imageFormat, const QString& pathToImageDirectory) { imageDirectory = QDir(pathToImageDirectory); QStringList nameFilters; diff --git a/tools/auto-tester/src/Test.h b/tools/auto-tester/src/Test.h index 5c6d3e5686..47786664fd 100644 --- a/tools/auto-tester/src/Test.h +++ b/tools/auto-tester/src/Test.h @@ -50,6 +50,7 @@ public: void createMDFile(const QString& topLevelDirectory); void createTestsOutline(); + void createTestRailTestSuite(); bool compareImageLists(bool isInteractiveMode, QProgressBar* progressBar); @@ -64,7 +65,7 @@ public: bool createTestResultsFolderPath(const QString& directory); void zipAndDeleteTestResultsFolder(); - bool isAValidDirectory(const QString& pathname); + static bool isAValidDirectory(const QString& pathname); QString extractPathFromTestsDown(const QString& fullPath); QString getExpectedImageDestinationDirectory(const QString& filename); QString getExpectedImagePartialSourceDirectory(const QString& filename); diff --git a/tools/auto-tester/src/TestSuiteCreator.cpp b/tools/auto-tester/src/TestSuiteCreator.cpp new file mode 100644 index 0000000000..0e3d9d52bd --- /dev/null +++ b/tools/auto-tester/src/TestSuiteCreator.cpp @@ -0,0 +1,105 @@ +// +// TestSuiteCreator.cpp +// +// Created by Nissim Hadar on 6 Jul 2018. +// Copyright 2013 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include "TestSuiteCreator.h" +#include "Test.h" + +#include +#include +#include +#include + +void TestSuiteCreator::createTestSuite(const QString& testDirectory) { + QDomProcessingInstruction instruction = document.createProcessingInstruction("xml", "version='1.0' encoding='UTF-8'"); + document.appendChild(instruction); + + // root element + QDomElement root = document.createElement("suite"); + document.appendChild(root); + + // id (empty seems to be OK) + QDomElement idElement = document.createElement("id"); + root.appendChild(idElement); + + // name - our tests are in "Rendering" + QDomElement nameElement = document.createElement("name"); + QDomText nameElementText = document.createTextNode("Rendering"); + nameElement.appendChild(nameElementText); + root.appendChild(nameElement); + + // We create a single section, within sections + QDomElement topLevelSections = document.createElement("sections"); + + QDomElement topLevelSection = document.createElement("section"); + + QDomElement suiteName = document.createElement("name"); + QDomText suiteNameElementElementText = document.createTextNode("Test Suite - " + QDateTime::currentDateTime().toString()); + suiteName.appendChild(suiteNameElementElementText); + topLevelSection.appendChild(suiteName); + + QDomElement secondLevelSections = document.createElement("sections"); + QDomElement tests = processDirectory(testDirectory, secondLevelSections); + topLevelSection.appendChild(tests); + + + topLevelSection.appendChild(secondLevelSections); + topLevelSections.appendChild(topLevelSection); + + root.appendChild(topLevelSections); + + // Write to file + const QString testRailsFilename{ "D:/t/TestRailSuite.xml" }; + QFile file(testRailsFilename); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { + QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Could not create XML file"); + exit(-1); + } + + QTextStream stream(&file); + stream << document.toString(); + + file.close(); + + QMessageBox::information(0, "Success", "TestRail XML file has been created"); +} + +QDomElement TestSuiteCreator::processDirectory(const QString& directory, const QDomElement& element) { + QDomElement result = element; + + // Loop over all entries in directory + QDirIterator it(directory.toStdString().c_str()); + while (it.hasNext()) { + QString directory = it.next(); + + // Only process directories + QDir dir; + if (Test::isAValidDirectory(directory)) { + // Ignore the utils directory + if (directory.right(5) == "utils") { + continue; + } + + // Create a section and process it + // The directory name appears after the last slash (we are assured there is at least 1). + QString directoryName = directory.right(directory.length() - directory.lastIndexOf("/") - 1); + + QDomElement sectionElement = document.createElement("section"); + + QDomElement sectionElementName = document.createElement("name"); + QDomText sectionElementNameText = document.createTextNode(directoryName); + sectionElementName.appendChild(sectionElementNameText); + sectionElement.appendChild(sectionElementName); + + result.appendChild(sectionElement); + } + } + + return result; +} \ No newline at end of file diff --git a/tools/auto-tester/src/TestSuiteCreator.h b/tools/auto-tester/src/TestSuiteCreator.h new file mode 100644 index 0000000000..3ecf046497 --- /dev/null +++ b/tools/auto-tester/src/TestSuiteCreator.h @@ -0,0 +1,26 @@ +// +// TestSuiteCreator.h +// +// Created by Nissim Hadar on 6 Jul 2018. +// Copyright 2013 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_test_suite_creator_h +#define hifi_test_suite_creator_h + +#include +#include +#include + +class TestSuiteCreator { +public: + void createTestSuite(const QString& testDirectory); + QDomElement processDirectory(const QString& directory, const QDomElement& element); +private: + QDomDocument document; +}; + +#endif // hifi_test_suite_creator_h \ No newline at end of file diff --git a/tools/auto-tester/src/ui/AutoTester.cpp b/tools/auto-tester/src/ui/AutoTester.cpp index 079fa63a9d..76ae6c5385 100644 --- a/tools/auto-tester/src/ui/AutoTester.cpp +++ b/tools/auto-tester/src/ui/AutoTester.cpp @@ -68,6 +68,10 @@ void AutoTester::on_createTestsOutlineButton_clicked() { test->createTestsOutline(); } +void AutoTester::on_createTestRailTestSuiteButton_clicked() { + test->createTestRailTestSuite(); +} + // To toggle between show and hide // if (uState & ABS_AUTOHIDE) on_showTaskbarButton_clicked(); // else on_hideTaskbarButton_clicked(); diff --git a/tools/auto-tester/src/ui/AutoTester.h b/tools/auto-tester/src/ui/AutoTester.h index d47c4929c4..76b4741d9a 100644 --- a/tools/auto-tester/src/ui/AutoTester.h +++ b/tools/auto-tester/src/ui/AutoTester.h @@ -45,7 +45,7 @@ private slots: void on_createMDFileButton_clicked(); void on_createAllMDFilesButton_clicked(); void on_createTestsOutlineButton_clicked(); - + void on_createTestRailTestSuiteButton_clicked(); void on_hideTaskbarButton_clicked(); void on_showTaskbarButton_clicked(); diff --git a/tools/auto-tester/src/ui/AutoTester.ui b/tools/auto-tester/src/ui/AutoTester.ui index e12fc70e3f..ddc095ba23 100644 --- a/tools/auto-tester/src/ui/AutoTester.ui +++ b/tools/auto-tester/src/ui/AutoTester.ui @@ -7,7 +7,7 @@ 0 0 612 - 537 + 553 @@ -18,7 +18,7 @@ 380 - 430 + 450 101 40 @@ -44,7 +44,7 @@ 430 - 270 + 320 101 40 @@ -57,7 +57,7 @@ 330 - 110 + 170 220 40 @@ -70,7 +70,7 @@ 320 - 280 + 330 131 20 @@ -86,7 +86,7 @@ 320 - 330 + 380 255 23 @@ -99,7 +99,7 @@ 330 - 170 + 230 220 40 @@ -229,6 +229,19 @@ + + + + 330 + 90 + 220 + 40 + + + + Create TestRail Test Suite + + From 95a2d586c6e654667fe9c4cfdd1bb6c6d43efd8b Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Sat, 7 Jul 2018 21:05:22 -0700 Subject: [PATCH 2/6] WIP. --- tools/auto-tester/src/TestSuiteCreator.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tools/auto-tester/src/TestSuiteCreator.cpp b/tools/auto-tester/src/TestSuiteCreator.cpp index 0e3d9d52bd..d1dc0ce281 100644 --- a/tools/auto-tester/src/TestSuiteCreator.cpp +++ b/tools/auto-tester/src/TestSuiteCreator.cpp @@ -25,8 +25,7 @@ void TestSuiteCreator::createTestSuite(const QString& testDirectory) { document.appendChild(root); // id (empty seems to be OK) - QDomElement idElement = document.createElement("id"); - root.appendChild(idElement); + root.appendChild(document.createElement("id")); // name - our tests are in "Rendering" QDomElement nameElement = document.createElement("name"); @@ -45,9 +44,7 @@ void TestSuiteCreator::createTestSuite(const QString& testDirectory) { topLevelSection.appendChild(suiteName); QDomElement secondLevelSections = document.createElement("sections"); - QDomElement tests = processDirectory(testDirectory, secondLevelSections); - topLevelSection.appendChild(tests); - + topLevelSection.appendChild(processDirectory(testDirectory, secondLevelSections)); topLevelSection.appendChild(secondLevelSections); topLevelSections.appendChild(topLevelSection); @@ -79,7 +76,6 @@ QDomElement TestSuiteCreator::processDirectory(const QString& directory, const Q QString directory = it.next(); // Only process directories - QDir dir; if (Test::isAValidDirectory(directory)) { // Ignore the utils directory if (directory.right(5) == "utils") { @@ -97,6 +93,9 @@ QDomElement TestSuiteCreator::processDirectory(const QString& directory, const Q sectionElementName.appendChild(sectionElementNameText); sectionElement.appendChild(sectionElementName); + QDomElement testsElement = document.createElement("sections"); + sectionElement.appendChild(processDirectory(directory, testsElement)); + result.appendChild(sectionElement); } } From a6dbeb3db7151ed43cec3ae4304ac90309a9b9c7 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Mon, 9 Jul 2018 12:06:20 -0700 Subject: [PATCH 3/6] WIP. --- tools/auto-tester/src/TestSuiteCreator.cpp | 155 +++++++++++++++++---- tools/auto-tester/src/TestSuiteCreator.h | 2 + 2 files changed, 129 insertions(+), 28 deletions(-) diff --git a/tools/auto-tester/src/TestSuiteCreator.cpp b/tools/auto-tester/src/TestSuiteCreator.cpp index d1dc0ce281..7abe214d1c 100644 --- a/tools/auto-tester/src/TestSuiteCreator.cpp +++ b/tools/auto-tester/src/TestSuiteCreator.cpp @@ -20,36 +20,21 @@ void TestSuiteCreator::createTestSuite(const QString& testDirectory) { QDomProcessingInstruction instruction = document.createProcessingInstruction("xml", "version='1.0' encoding='UTF-8'"); document.appendChild(instruction); - // root element - QDomElement root = document.createElement("suite"); + // We create a single section, within sections + QDomElement root = document.createElement("sections"); document.appendChild(root); - // id (empty seems to be OK) - root.appendChild(document.createElement("id")); - - // name - our tests are in "Rendering" - QDomElement nameElement = document.createElement("name"); - QDomText nameElementText = document.createTextNode("Rendering"); - nameElement.appendChild(nameElementText); - root.appendChild(nameElement); - - // We create a single section, within sections - QDomElement topLevelSections = document.createElement("sections"); - QDomElement topLevelSection = document.createElement("section"); QDomElement suiteName = document.createElement("name"); - QDomText suiteNameElementElementText = document.createTextNode("Test Suite - " + QDateTime::currentDateTime().toString()); - suiteName.appendChild(suiteNameElementElementText); + suiteName.appendChild(document.createTextNode("Test Suite - " + QDateTime::currentDateTime().toString())); topLevelSection.appendChild(suiteName); QDomElement secondLevelSections = document.createElement("sections"); topLevelSection.appendChild(processDirectory(testDirectory, secondLevelSections)); topLevelSection.appendChild(secondLevelSections); - topLevelSections.appendChild(topLevelSection); - - root.appendChild(topLevelSections); + root.appendChild(topLevelSection); // Write to file const QString testRailsFilename{ "D:/t/TestRailSuite.xml" }; @@ -73,32 +58,146 @@ QDomElement TestSuiteCreator::processDirectory(const QString& directory, const Q // Loop over all entries in directory QDirIterator it(directory.toStdString().c_str()); while (it.hasNext()) { - QString directory = it.next(); + QString nextDirectory = it.next(); + + // The object name appears after the last slash (we are assured there is at least 1). + QString objectName = nextDirectory.right(nextDirectory.length() - nextDirectory.lastIndexOf("/") - 1); // Only process directories - if (Test::isAValidDirectory(directory)) { - // Ignore the utils directory - if (directory.right(5) == "utils") { + if (Test::isAValidDirectory(nextDirectory)) { + // Ignore the utils and preformance directories + if (nextDirectory.right(QString("utils").length()) == "utils" || nextDirectory.right(QString("performance").length()) == "performance") { continue; } // Create a section and process it - // The directory name appears after the last slash (we are assured there is at least 1). - QString directoryName = directory.right(directory.length() - directory.lastIndexOf("/") - 1); QDomElement sectionElement = document.createElement("section"); QDomElement sectionElementName = document.createElement("name"); - QDomText sectionElementNameText = document.createTextNode(directoryName); - sectionElementName.appendChild(sectionElementNameText); + sectionElementName.appendChild(document.createTextNode(objectName)); sectionElement.appendChild(sectionElementName); QDomElement testsElement = document.createElement("sections"); - sectionElement.appendChild(processDirectory(directory, testsElement)); + sectionElement.appendChild(processDirectory(nextDirectory, testsElement)); result.appendChild(sectionElement); + } else { + if (objectName == "test.js") { + QDomElement sectionElement = document.createElement("section"); + QDomElement sectionElementName = document.createElement("name"); + sectionElementName.appendChild(document.createTextNode("all")); + sectionElement.appendChild(sectionElementName); + sectionElement.appendChild(processTest(nextDirectory, objectName, document.createElement("cases"))); + result.appendChild(sectionElement); + } } } + return result; +} + +QDomElement TestSuiteCreator::processTest(const QString& fullDirectory, const QString& test, const QDomElement& element) { + QDomElement result = element; + + QDomElement caseElement = document.createElement("case"); + + caseElement.appendChild(document.createElement("id")); + + // The name of the test is derived from the full path. + // The first term is the first word after "tests" + // The last word is the penultimate word + QStringList words = fullDirectory.split('/'); + int i = 0; + while (words[i] != "tests") { + ++i; + if (i >= words.length() - 1) { + QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Folder \"tests\" not found in " + fullDirectory); + exit(-1); + } + } + + ++i; + QString title{ words[i] }; + for (++i; i < words.length() - 1; ++i) { + title += " / " + words[i]; + } + + QDomElement titleElement = document.createElement("title"); + titleElement.appendChild(document.createTextNode(title)); + caseElement.appendChild(titleElement); + + QDomElement templateElement = document.createElement("template"); + templateElement.appendChild(document.createTextNode("Test Case (Steps)")); + caseElement.appendChild(templateElement); + + QDomElement typeElement = document.createElement("type"); + typeElement.appendChild(document.createTextNode("3 - Regression")); + caseElement.appendChild(typeElement); + + QDomElement priorityElement = document.createElement("priority"); + priorityElement.appendChild(document.createTextNode("Medium")); + caseElement.appendChild(priorityElement); + + QDomElement estimateElementName = document.createElement("estimate"); + estimateElementName.appendChild(document.createTextNode("60")); + caseElement.appendChild(estimateElementName); + + caseElement.appendChild(document.createElement("references")); + + QDomElement customElement = document.createElement("custom"); + + QDomElement tester_countElement = document.createElement("tester_count"); + tester_countElement.appendChild(document.createTextNode("1")); + customElement.appendChild(tester_countElement); + + QDomElement domain_bot_loadElement = document.createElement("domain_bot_load"); + domain_bot_loadElement.appendChild(document.createElement("id")); + QDomElement domain_bot_loadElementValue = document.createElement("value"); + domain_bot_loadElementValue.appendChild(document.createTextNode(" With Bots (hifiqa-rc-bots / hifi-qa-stable-bots / hifiqa-master-bots)")); + domain_bot_loadElement.appendChild(domain_bot_loadElementValue); + customElement.appendChild(domain_bot_loadElement); + + QDomElement automation_typeElement = document.createElement("automation_type"); + automation_typeElement.appendChild(document.createElement("id")); + QDomElement automation_typeElementValue = document.createElement("value"); + automation_typeElementValue.appendChild(document.createTextNode("None")); + automation_typeElement.appendChild(automation_typeElementValue); + customElement.appendChild(automation_typeElement); + + QDomElement added_to_releaseElement = document.createElement("added_to_release"); + QDomElement added_to_releaseElementId = document.createElement("id"); + added_to_releaseElement.appendChild(document.createElement("id")); + QDomElement added_to_releaseElementValue = document.createElement("value"); + added_to_releaseElementValue.appendChild(document.createTextNode("RC68")); + added_to_releaseElement.appendChild(added_to_releaseElementValue); + customElement.appendChild(added_to_releaseElement); + + QDomElement precondsElement = document.createElement("preconds"); + precondsElement.appendChild(document.createTextNode("Tester is in an empty region of a domain in which they have edit rights\n\n*Note: Press 'n' to advance test script")); + customElement.appendChild(precondsElement); + + QDomElement steps_seperatedElement = document.createElement("steps_separated"); + QDomElement stepElement = document.createElement("step"); + QDomElement stepIndexElement = document.createElement("index"); + stepIndexElement.appendChild(document.createTextNode("1")); + stepElement.appendChild(stepIndexElement); + QDomElement stepContentElement = document.createElement("content"); + stepContentElement.appendChild(document.createTextNode("Execute instructions in [THIS TEST](https://github.com/highfidelity/hifi_tests/blob/RC70/tests/content/entity/light/point/create/test.md)")); + stepElement.appendChild(stepContentElement); + QDomElement stepExpectedElement = document.createElement("expected"); + stepExpectedElement.appendChild(document.createTextNode("Refer to the expected result in the linked description.")); + stepElement.appendChild(stepExpectedElement); + steps_seperatedElement.appendChild(stepElement); + customElement.appendChild(steps_seperatedElement); + + QDomElement notesElement = document.createElement("notes"); + notesElement.appendChild(document.createTextNode("https://github.com/highfidelity/hifi_tests/blob/RC70/tests/content/entity/light/point/create/test.md")); + customElement.appendChild(notesElement); + + caseElement.appendChild(customElement); + + result.appendChild(caseElement); + return result; } \ No newline at end of file diff --git a/tools/auto-tester/src/TestSuiteCreator.h b/tools/auto-tester/src/TestSuiteCreator.h index 3ecf046497..c7175dea89 100644 --- a/tools/auto-tester/src/TestSuiteCreator.h +++ b/tools/auto-tester/src/TestSuiteCreator.h @@ -19,6 +19,8 @@ class TestSuiteCreator { public: void createTestSuite(const QString& testDirectory); QDomElement processDirectory(const QString& directory, const QDomElement& element); + QDomElement processTest(const QString& fullDirectory, const QString& test, const QDomElement& element); + private: QDomDocument document; }; From 112ba27f2d4ff7f11f09aa1f1b567b5e680e8422 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Mon, 9 Jul 2018 14:00:08 -0700 Subject: [PATCH 4/6] Added user and branch - not tested yet! --- tools/auto-tester/src/Test.cpp | 2 +- tools/auto-tester/src/TestSuiteCreator.cpp | 32 +++++++++++----------- tools/auto-tester/src/TestSuiteCreator.h | 7 +++-- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/tools/auto-tester/src/Test.cpp b/tools/auto-tester/src/Test.cpp index 8255d845f6..11e1696bb1 100644 --- a/tools/auto-tester/src/Test.cpp +++ b/tools/auto-tester/src/Test.cpp @@ -839,7 +839,7 @@ void Test::createTestRailTestSuite() { } TestSuiteCreator testSuiteCreator; - testSuiteCreator.createTestSuite(testDirectory); + testSuiteCreator.createTestSuite(testDirectory, autoTester->getSelectedUser(), autoTester->getSelectedBranch()); } QStringList Test::createListOfAll_imagesInDirectory(const QString& imageFormat, const QString& pathToImageDirectory) { diff --git a/tools/auto-tester/src/TestSuiteCreator.cpp b/tools/auto-tester/src/TestSuiteCreator.cpp index 7abe214d1c..0d11a84291 100644 --- a/tools/auto-tester/src/TestSuiteCreator.cpp +++ b/tools/auto-tester/src/TestSuiteCreator.cpp @@ -16,7 +16,7 @@ #include #include -void TestSuiteCreator::createTestSuite(const QString& testDirectory) { +void TestSuiteCreator::createTestSuite(const QString& testDirectory, const QString& user, const QString& branch) { QDomProcessingInstruction instruction = document.createProcessingInstruction("xml", "version='1.0' encoding='UTF-8'"); document.appendChild(instruction); @@ -31,7 +31,7 @@ void TestSuiteCreator::createTestSuite(const QString& testDirectory) { topLevelSection.appendChild(suiteName); QDomElement secondLevelSections = document.createElement("sections"); - topLevelSection.appendChild(processDirectory(testDirectory, secondLevelSections)); + topLevelSection.appendChild(processDirectory(testDirectory, user, branch, secondLevelSections)); topLevelSection.appendChild(secondLevelSections); root.appendChild(topLevelSection); @@ -52,7 +52,7 @@ void TestSuiteCreator::createTestSuite(const QString& testDirectory) { QMessageBox::information(0, "Success", "TestRail XML file has been created"); } -QDomElement TestSuiteCreator::processDirectory(const QString& directory, const QDomElement& element) { +QDomElement TestSuiteCreator::processDirectory(const QString& directory, const QString& user, const QString& branch, const QDomElement& element) { QDomElement result = element; // Loop over all entries in directory @@ -79,25 +79,23 @@ QDomElement TestSuiteCreator::processDirectory(const QString& directory, const Q sectionElement.appendChild(sectionElementName); QDomElement testsElement = document.createElement("sections"); - sectionElement.appendChild(processDirectory(nextDirectory, testsElement)); + sectionElement.appendChild(processDirectory(nextDirectory, user, branch, testsElement)); result.appendChild(sectionElement); - } else { - if (objectName == "test.js") { - QDomElement sectionElement = document.createElement("section"); - QDomElement sectionElementName = document.createElement("name"); - sectionElementName.appendChild(document.createTextNode("all")); - sectionElement.appendChild(sectionElementName); - sectionElement.appendChild(processTest(nextDirectory, objectName, document.createElement("cases"))); - result.appendChild(sectionElement); - } + } else if (objectName == "test.js" || objectName == "testStory.js") { + QDomElement sectionElement = document.createElement("section"); + QDomElement sectionElementName = document.createElement("name"); + sectionElementName.appendChild(document.createTextNode("all")); + sectionElement.appendChild(sectionElementName); + sectionElement.appendChild(processTest(nextDirectory, objectName, user, branch, document.createElement("cases"))); + result.appendChild(sectionElement); } } return result; } -QDomElement TestSuiteCreator::processTest(const QString& fullDirectory, const QString& test, const QDomElement& element) { +QDomElement TestSuiteCreator::processTest(const QString& fullDirectory, const QString& test, const QString& user, const QString& branch, const QDomElement& element) { QDomElement result = element; QDomElement caseElement = document.createElement("case"); @@ -177,13 +175,15 @@ QDomElement TestSuiteCreator::processTest(const QString& fullDirectory, const QS precondsElement.appendChild(document.createTextNode("Tester is in an empty region of a domain in which they have edit rights\n\n*Note: Press 'n' to advance test script")); customElement.appendChild(precondsElement); + QString testMDName = QString("https://github.com/") + user + "/hifi_tests/blob/" + branch + "/tests/content/entity/light/point/create/test.md"; + QDomElement steps_seperatedElement = document.createElement("steps_separated"); QDomElement stepElement = document.createElement("step"); QDomElement stepIndexElement = document.createElement("index"); stepIndexElement.appendChild(document.createTextNode("1")); stepElement.appendChild(stepIndexElement); QDomElement stepContentElement = document.createElement("content"); - stepContentElement.appendChild(document.createTextNode("Execute instructions in [THIS TEST](https://github.com/highfidelity/hifi_tests/blob/RC70/tests/content/entity/light/point/create/test.md)")); + stepContentElement.appendChild(document.createTextNode(QString("Execute instructions in [THIS TEST](") + testMDName + ")")); stepElement.appendChild(stepContentElement); QDomElement stepExpectedElement = document.createElement("expected"); stepExpectedElement.appendChild(document.createTextNode("Refer to the expected result in the linked description.")); @@ -192,7 +192,7 @@ QDomElement TestSuiteCreator::processTest(const QString& fullDirectory, const QS customElement.appendChild(steps_seperatedElement); QDomElement notesElement = document.createElement("notes"); - notesElement.appendChild(document.createTextNode("https://github.com/highfidelity/hifi_tests/blob/RC70/tests/content/entity/light/point/create/test.md")); + notesElement.appendChild(document.createTextNode(testMDName)); customElement.appendChild(notesElement); caseElement.appendChild(customElement); diff --git a/tools/auto-tester/src/TestSuiteCreator.h b/tools/auto-tester/src/TestSuiteCreator.h index c7175dea89..a6ffa762e9 100644 --- a/tools/auto-tester/src/TestSuiteCreator.h +++ b/tools/auto-tester/src/TestSuiteCreator.h @@ -17,9 +17,10 @@ class TestSuiteCreator { public: - void createTestSuite(const QString& testDirectory); - QDomElement processDirectory(const QString& directory, const QDomElement& element); - QDomElement processTest(const QString& fullDirectory, const QString& test, const QDomElement& element); + void createTestSuite(const QString& testDirectory, const QString& user, const QString& branch); + + QDomElement processDirectory(const QString& directory, const QString& user, const QString& branch, const QDomElement& element); + QDomElement processTest(const QString& fullDirectory, const QString& test, const QString& user, const QString& branch, const QDomElement& element); private: QDomDocument document; From f69f0cbd808d0d20f2ea700f8ac8763a47782908 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Mon, 9 Jul 2018 19:59:59 -0700 Subject: [PATCH 5/6] Seems to create a valid test suite. --- tools/auto-tester/src/TestSuiteCreator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/auto-tester/src/TestSuiteCreator.cpp b/tools/auto-tester/src/TestSuiteCreator.cpp index 0d11a84291..98aa4391a1 100644 --- a/tools/auto-tester/src/TestSuiteCreator.cpp +++ b/tools/auto-tester/src/TestSuiteCreator.cpp @@ -167,7 +167,7 @@ QDomElement TestSuiteCreator::processTest(const QString& fullDirectory, const QS QDomElement added_to_releaseElementId = document.createElement("id"); added_to_releaseElement.appendChild(document.createElement("id")); QDomElement added_to_releaseElementValue = document.createElement("value"); - added_to_releaseElementValue.appendChild(document.createTextNode("RC68")); + added_to_releaseElementValue.appendChild(document.createTextNode(branch)); added_to_releaseElement.appendChild(added_to_releaseElementValue); customElement.appendChild(added_to_releaseElement); From cb0f9639ba6e9251173c42e7183c7c7fe5860828 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Wed, 11 Jul 2018 09:08:43 -0700 Subject: [PATCH 6/6] Added IDs where needed. --- tools/auto-tester/src/TestSuiteCreator.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/auto-tester/src/TestSuiteCreator.cpp b/tools/auto-tester/src/TestSuiteCreator.cpp index 98aa4391a1..627012deec 100644 --- a/tools/auto-tester/src/TestSuiteCreator.cpp +++ b/tools/auto-tester/src/TestSuiteCreator.cpp @@ -150,14 +150,18 @@ QDomElement TestSuiteCreator::processTest(const QString& fullDirectory, const QS customElement.appendChild(tester_countElement); QDomElement domain_bot_loadElement = document.createElement("domain_bot_load"); - domain_bot_loadElement.appendChild(document.createElement("id")); + QDomElement domain_bot_loadElementId = document.createElement("id"); + domain_bot_loadElementId.appendChild(document.createTextNode("1")); + domain_bot_loadElement.appendChild(domain_bot_loadElementId); QDomElement domain_bot_loadElementValue = document.createElement("value"); - domain_bot_loadElementValue.appendChild(document.createTextNode(" With Bots (hifiqa-rc-bots / hifi-qa-stable-bots / hifiqa-master-bots)")); + domain_bot_loadElementValue.appendChild(document.createTextNode(" Without Bots (hifiqa-rc / hifi-qa-stable / hifiqa-master)")); domain_bot_loadElement.appendChild(domain_bot_loadElementValue); customElement.appendChild(domain_bot_loadElement); QDomElement automation_typeElement = document.createElement("automation_type"); - automation_typeElement.appendChild(document.createElement("id")); + QDomElement automation_typeElementId = document.createElement("id"); + automation_typeElementId.appendChild(document.createTextNode("0")); + automation_typeElement.appendChild(automation_typeElementId); QDomElement automation_typeElementValue = document.createElement("value"); automation_typeElementValue.appendChild(document.createTextNode("None")); automation_typeElement.appendChild(automation_typeElementValue); @@ -165,7 +169,8 @@ QDomElement TestSuiteCreator::processTest(const QString& fullDirectory, const QS QDomElement added_to_releaseElement = document.createElement("added_to_release"); QDomElement added_to_releaseElementId = document.createElement("id"); - added_to_releaseElement.appendChild(document.createElement("id")); + added_to_releaseElementId.appendChild(document.createTextNode("4")); + added_to_releaseElement.appendChild(added_to_releaseElementId); QDomElement added_to_releaseElementValue = document.createElement("value"); added_to_releaseElementValue.appendChild(document.createTextNode(branch)); added_to_releaseElement.appendChild(added_to_releaseElementValue);