Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Anda Laakso committed Aug 22, 2019
1 parent 4203bff commit 101e50d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 42 deletions.
44 changes: 17 additions & 27 deletions HpToolsLauncher/Launcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,41 +272,31 @@ public void Run()
RunTests(runner, resultsFilename, results);


switch (_runType)
if (_runType.Equals(TestStorageType.FileSystem))
{
case TestStorageType.Alm:
// string filter = (_ciParams.ContainsKey("FilterTests") ? _ciParams["FilterTests"] : "");

// bool filterSelected = !string.IsNullOrEmpty(filter) && Convert.ToBoolean(filter.ToLower());
break;
case TestStorageType.FileSystem:
{
string onCheckFailedTests = (_ciParams.ContainsKey("onCheckFailedTest") ? _ciParams["onCheckFailedTest"] : "");

_rerunFailedTests = !string.IsNullOrEmpty(onCheckFailedTests) && Convert.ToBoolean(onCheckFailedTests.ToLower());
string onCheckFailedTests = (_ciParams.ContainsKey("onCheckFailedTest") ? _ciParams["onCheckFailedTest"] : "");

_rerunFailedTests = !string.IsNullOrEmpty(onCheckFailedTests) && Convert.ToBoolean(onCheckFailedTests.ToLower());

//the "On failure" option is selected and the run build contains failed tests
if (_rerunFailedTests.Equals(true) && Launcher.ExitCode != ExitCodeEnum.Passed)
{
ConsoleWriter.WriteLine("There are failed tests. Rerun the selected tests.");

//rerun the selected tests (either the entire set or just the selected ones)
//create the runner according to type
runner = CreateRunner(_runType, _ciParams, false);
//the "On failure" option is selected and the run build contains failed tests
if (_rerunFailedTests.Equals(true) && Launcher.ExitCode != ExitCodeEnum.Passed)
{
ConsoleWriter.WriteLine("There are failed tests. Rerun the selected tests.");

//runner instantiation failed (no tests to run or other problem)
if (runner == null)
{
Environment.Exit((int)Launcher.ExitCodeEnum.Failed);
}
//rerun the selected tests (either the entire set or just the selected ones)
//create the runner according to type
runner = CreateRunner(_runType, _ciParams, false);

TestSuiteRunResults rerunResults = runner.Run();
results.AppendResults(rerunResults);
RunTests(runner, resultsFilename, results);
//runner instantiation failed (no tests to run or other problem)
if (runner == null)
{
Environment.Exit((int)Launcher.ExitCodeEnum.Failed);
}

break;
TestSuiteRunResults rerunResults = runner.Run();
results.AppendResults(rerunResults);
RunTests(runner, resultsFilename, results);
}
}

Expand Down
17 changes: 2 additions & 15 deletions HpToolsLauncher/Runners/AlmTestSetsRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,9 @@ private ITestSetFolder GetFolder(string testSet)
}
catch (Exception ex)
{
return null;
Console.WriteLine("Unable to retrieve test set folder: " + ex.Message);
}

return tsFolder;
}

Expand Down Expand Up @@ -1197,14 +1198,6 @@ public override TestSuiteRunResults Run()
//need to run this to install everything needed http://AlmServer:8080/qcbin/start_a.jsp?common=true
//start the scheduler
scheduler = targetTestSet.StartExecution("");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}

try
{
currentTestSetInstances = GetTestInstancesString(targetTestSet);
}
catch (Exception ex)
Expand Down Expand Up @@ -1418,17 +1411,11 @@ private TestRunResults UpdateTestStatus(TestSuiteRunResults runResults, ITestSet
qTest.ErrorDesc = testExecStatusObj.Status + " : " + testExecStatusObj.Message;
break;
case TestState.Waiting:
break;
case TestState.Running:
break;
case TestState.NoRun:
break;
case TestState.Passed:
break;
case TestState.Warning:
break;
case TestState.Unknown:
break;
default:
break;
}
Expand Down

0 comments on commit 101e50d

Please sign in to comment.