From 36d131592d71095a5ab81d3142c4c8d35505e854 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Tue, 31 Jul 2018 22:23:10 -0700 Subject: [PATCH] WIP --- tools/auto-tester/src/TestRailInterface.cpp | 34 +++++++++++++++++++-- tools/auto-tester/src/TestRailInterface.h | 7 ++++- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/tools/auto-tester/src/TestRailInterface.cpp b/tools/auto-tester/src/TestRailInterface.cpp index d82add0db7..3161e4109c 100644 --- a/tools/auto-tester/src/TestRailInterface.cpp +++ b/tools/auto-tester/src/TestRailInterface.cpp @@ -26,6 +26,16 @@ TestRailInterface::TestRailInterface() { ////_testRailSelectorWindow.setProject(1); _testRailTestCasesSelectorWindow.setSuiteID(INTERFACE_SUITE_ID); + + _testRailRunSelectorWindow.setURL("https://highfidelity.testrail.net"); + ////_testRailRunSelectorWindow.setURL("https://nissimhadar.testrail.io"); + _testRailRunSelectorWindow.setUser("@highfidelity.io"); + ////_testRailSelectorWindow.setUser("nissim.hadar@gmail.com"); + + _testRailRunSelectorWindow.setProjectID(INTERFACE_PROJECT_ID); + ////_testRailSelectorWindow.setProject(1); + + _testRailRunSelectorWindow.setSuiteID(INTERFACE_SUITE_ID); } QString TestRailInterface::getObject(const QString& path) { @@ -184,7 +194,7 @@ void TestRailInterface::createStackDotPyScript() { file.close(); } -void TestRailInterface::requestTestRailDataFromUser() { +void TestRailInterface::requestTestRailTestCasesDataFromUser() { // Make sure correct fields are enabled before calling _testRailTestCasesSelectorWindow.reset(); _testRailTestCasesSelectorWindow.exec(); @@ -312,6 +322,11 @@ void TestRailInterface::createAddTestCasesPythonScript(const QString& testDirect } void TestRailInterface::updateMilestonesComboData(int exitCode, QProcess::ExitStatus exitStatus) { + // Quit if user has previously cancelled + if (_testRailTestCasesSelectorWindow.getUserCancelled()) { + return; + } + // Check if process completed successfully if (exitStatus != QProcess::NormalExit) { QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), @@ -424,7 +439,7 @@ void TestRailInterface::createTestSuitePython(const QString& testDirectory, return; } - requestTestRailDataFromUser(); + requestTestRailTestCasesDataFromUser(); createTestRailDotPyScript(); createStackDotPyScript(); @@ -685,6 +700,19 @@ void TestRailInterface::processTestPython(const QString& fullDirectory, stream << "case = client.send_post('add_case/' + str(section_id), data)\n"; } +void TestRailInterface::requestTestRailRunDataFromUser() { + _testRailRunSelectorWindow.reset(); + _testRailRunSelectorWindow.exec(); +} + +void TestRailInterface::getTestCasesFromTestRail() { +} + void TestRailInterface::createTestRailRun() { - + requestTestRailRunDataFromUser(); + createTestRailDotPyScript(); + createStackDotPyScript(); + + // TestRail will be updated after the process initiated by getTestCasesFromTestRail has completed + getTestCasesFromTestRail(); } \ No newline at end of file diff --git a/tools/auto-tester/src/TestRailInterface.h b/tools/auto-tester/src/TestRailInterface.h index 53d4bee618..4501be2d87 100644 --- a/tools/auto-tester/src/TestRailInterface.h +++ b/tools/auto-tester/src/TestRailInterface.h @@ -54,9 +54,13 @@ public: const QString& branchGitHub); void getMilestonesFromTestRail(); + void getTestCasesFromTestRail(); + void createTestRailDotPyScript(); void createStackDotPyScript(); - void requestTestRailDataFromUser(); + + void requestTestRailTestCasesDataFromUser(); + void requestTestRailRunDataFromUser(); void createAddTestCasesPythonScript(const QString& testDirectory, const QString& userGitHub, @@ -68,6 +72,7 @@ public: const QString& branchGitHub); bool isAValidTestDirectory(const QString& directory); + QString getObject(const QString& path); void updateMilestonesComboData(int exitCode, QProcess::ExitStatus exitStatus);