Skip to content

Commit

Permalink
Merge pull request MicroFocus#31 from MicroFocus/doc_message_refines_2
Browse files Browse the repository at this point in the history
Refine output messages and README for FTToolsLauncher
  • Loading branch information
soleverxu authored Jan 6, 2021
2 parents 2f710d2 + d012717 commit 6aa801c
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 37 deletions.
30 changes: 17 additions & 13 deletions HpToolsLauncher/Launcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,15 @@ public static string DateFormat
"almUsername",
//"almPassword",
"almDomain",
"almProject",
"almRunMode"/*,
"almProject"/*,
"almRunMode",
"almTimeout",
"almRunHost"*/};
private string[] requiredParamsForQcRunInSSOMode = { "almServerUrl",
"almClientID",
"almApiKeySecretBasicAuth",
"almDomain",
"almProject",
"almRunMode"};
"almProject"};

/// <summary>
/// a place to save the unique timestamp which shows up in properties/results/abort file names
Expand Down Expand Up @@ -409,19 +408,24 @@ private IAssetRunner CreateRunner(TestStorageType runType, JavaProperties ciPara

//parse params that need parsing
double dblQcTimeout = int.MaxValue;
if (!double.TryParse(_ciParams["almTimeout"], out dblQcTimeout))
if (_ciParams.ContainsKey("almTimeout"))
{
ConsoleWriter.WriteLine(Resources.LauncherTimeoutNotNumeric);
dblQcTimeout = int.MaxValue;
if (!double.TryParse(_ciParams["almTimeout"], out dblQcTimeout))
{
ConsoleWriter.WriteLine(Resources.LauncherTimeoutNotNumeric);
dblQcTimeout = int.MaxValue;
}
}

ConsoleWriter.WriteLine(string.Format(Resources.LuancherDisplayTimout, dblQcTimeout));
ConsoleWriter.WriteLine(string.Format(Resources.LauncherDisplayTimout, dblQcTimeout));

QcRunMode enmQcRunMode = QcRunMode.RUN_LOCAL;
if (!Enum.TryParse<QcRunMode>(_ciParams["almRunMode"], true, out enmQcRunMode))
if (_ciParams.ContainsKey("almRunMode"))
{
ConsoleWriter.WriteLine(Resources.LauncherIncorrectRunmode);
enmQcRunMode = QcRunMode.RUN_LOCAL;
if (!Enum.TryParse<QcRunMode>(_ciParams["almRunMode"], true, out enmQcRunMode))
{
ConsoleWriter.WriteLine(Resources.LauncherIncorrectRunmode);
enmQcRunMode = QcRunMode.RUN_LOCAL;
}
}
ConsoleWriter.WriteLine(string.Format(Resources.LauncherDisplayRunmode, enmQcRunMode.ToString()));

Expand Down Expand Up @@ -1033,8 +1037,8 @@ private void RunTests(IAssetRunner runner, string resultsFile, TestSuiteRunResul

if (results.TestRuns.Count == 0)
{
Console.WriteLine("No tests were run");
Launcher.ExitCode = Launcher.ExitCodeEnum.Failed;
Console.WriteLine("No tests were run, exit with code " + ((int)Launcher.ExitCode).ToString());
Environment.Exit((int)Launcher.ExitCode);
}

Expand Down
35 changes: 22 additions & 13 deletions HpToolsLauncher/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions HpToolsLauncher/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,10 @@ Save the test in QuickTest and then run it again.</value>
<value>Starting test set execution</value>
</data>
<data name="AlmRunnerStat" xml:space="preserve">
<value>Test: {0}, Id: {1}, Execution status: {2}\n</value>
<value>Test: {0}, Id: {1}, Execution status: {2}</value>
</data>
<data name="AlmRunnerStatWithMessage" xml:space="preserve">
<value>Test: {0}, Id: {1}, Execution status: {2}, Message: {3}\n</value>
<value>Test: {0}, Id: {1}, Execution status: {2}, Message: {3}</value>
</data>
<data name="AlmRunnerTestCompleteCaption" xml:space="preserve">
<value>Test complete:</value>
Expand All @@ -224,7 +224,7 @@ Save the test in QuickTest and then run it again.</value>
<value>Test set: {0}, finished at {1}</value>
</data>
<data name="AlmRunnerTestStat" xml:space="preserve">
<value>Test: {0}, Status: {1}, Message: {2}, Link: {3}\n</value>
<value>Test: {0}, Status: {1}, Message: {2}, Link: {3}</value>
</data>
<data name="FsRunnerNoValidTests" xml:space="preserve">
<value>===============================\nThere are no valid tests to run!\n===============================</value>
Expand Down Expand Up @@ -313,8 +313,8 @@ Save the test in QuickTest and then run it again.</value>
<data name="LauncherTimeoutNotNumeric" xml:space="preserve">
<value>almTimeout should be an integer!</value>
</data>
<data name="LuancherDisplayTimout" xml:space="preserve">
<value>Timeout is set to: {0}</value>
<data name="LauncherDisplayTimout" xml:space="preserve">
<value>Timeout is set to: {0} seconds</value>
</data>
<data name="SingleSeperator" xml:space="preserve">
<value>-------------------------------------------------------------------------------------------------------</value>
Expand Down Expand Up @@ -505,4 +505,7 @@ Save the test in QuickTest and then run it again.</value>
<data name="JavaPropertyFileBOMNotSupported" xml:space="preserve">
<value>The encoding of the parameter file is not supported. Please save the file with UTF-8 encoding.</value>
</data>
<data name="AlmRunnerDisplayTestRunOnPlannedHost" xml:space="preserve">
<value>Test {0}: {1} will run on host or host group: {2}</value>
</data>
</root>
20 changes: 17 additions & 3 deletions HpToolsLauncher/Runners/AlmTestSetsRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ private ITestSetFolder GetFolder(string testSet)
}
catch
{
Console.WriteLine("The path '{0}' is not a test set folder or does not exist.", testSet);
//Console.WriteLine("The path '{0}' is not a test set folder or does not exist.", testSet);
}

return tsFolder;
Expand Down Expand Up @@ -584,7 +584,7 @@ public ITestSet GetTargetTestSet(List testSetList, string testSuiteName)
ConsoleWriter.WriteLine(string.Format(Resources.AlmRunnerCantFindTestSet, testSuiteName));

//this will make sure run will fail at the end. (since there was an error)
Console.WriteLine("Null target test set");
//Console.WriteLine("Null target test set");
Launcher.ExitCode = Launcher.ExitCodeEnum.Failed;
return null;

Expand Down Expand Up @@ -891,7 +891,15 @@ public void SetTestParameters(IList tList, string testParameters, string runHost
{
hostName = Environment.MachineName;
}
ConsoleWriter.WriteLine(string.Format(Resources.AlmRunnerDisplayTestRunOnHost, i, test.Name, hostName));

if (runMode == QcRunMode.RUN_PLANNED_HOST)
{
ConsoleWriter.WriteLine(string.Format(Resources.AlmRunnerDisplayTestRunOnPlannedHost, i, test.Name, hostName));
}
else
{
ConsoleWriter.WriteLine(string.Format(Resources.AlmRunnerDisplayTestRunOnHost, i, test.Name, hostName));
}

scheduler.RunOnHost[test.ID] = runOnHost;

Expand Down Expand Up @@ -1177,6 +1185,11 @@ public TestSuiteRunResults RunTestSet(string tsFolderName, string tsName, string
Console.WriteLine("Empty target test set list");
}

if (targetTestSet == null)
{
return null;
}

ConsoleWriter.WriteLine(Resources.GeneralDoubleSeperator);
ConsoleWriter.WriteLine(Resources.AlmRunnerStartingExecution);
ConsoleWriter.WriteLine(string.Format(Resources.AlmRunnerDisplayTest, testSuiteName, targetTestSet.ID));
Expand Down Expand Up @@ -1425,6 +1438,7 @@ private TestRunResults UpdateTestStatus(TestSuiteRunResults runResults, ITestSet

string statusString = GetTsStateFromQcState(testExecStatusObj.Status as string).ToString();
ConsoleWriter.WriteLine(string.Format(Resources.AlmRunnerTestStat, currentTest.Name, statusString, testExecStatusObj.Message, linkStr));
ConsoleWriter.WriteLine("");
runResults.TestRuns[testIndex] = qTest;
}
}
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ Some additional actions are required before running ALM test sets:
| **`almProject`** | string | ALM project name | [**Mandatory**] The project (under the specified domain) to open once connected to the ALM server. |
| `SSOEnabled` | boolean | `true` _or_ *`false`* | (*Optional*) Indicates whether to enable the SSO mode when login to the ALM server. Default = `false`. |
| `almClientID` | string | ALM SSO client ID | [**Mandatory** if `SSOEnabled` is `true`] The client ID used together with `almApiKeySecretBasicAuth` parameter as the identifier when login in SSO mode.<br/><br/>See the online topic [API Key Management][alm-api-key-management-url] for the details to manage API keys. |
| `almApiKeySecretBasicAuth` | string | base64-encoded string | **CAUTION: This password is simply encoded in base64 format which can be easily decoded by anyone. Use secure means to transmit the parameter file to prevent sensitive information from being exposed.**<br/><br/>(*Optional*) [**Mandatory** if `SSOEnabled` is `true`] The API key secret used together with `almClientID` parameter as the identifier when login in SSO mode, encoded in base64 format.<br/><br/>See the online topic [API Key Management][alm-api-key-management-url] for the details to manage API keys. |
| `almRunMode` | string | *`RUN_LOCAL`* _or_ `RUN_REMOTE` _or_ `RUN_PLANNED_HOST` | (*Optional*) Indicated where to run the ALM tests, on the local machine or on remote machines. Default = `RUN_LOCAL`.<br/><br/>`RUN_LOCAL`: ALM tests run on the local machine where this tool is running;<br/>`RUN_REMOTE`: ALM tests run on a the machine specified in the `almRunHost` parameter;<br/>`RUN_PLANNED_HOST` runs ALM tests on the machines configured in the ALM server. |
| `almRunHost` | string | hostname _or_ IP address | [**Mandatory** if `almRunMode` is `RUN_REMOTE`] The hostname or IP address of the machine on which to run the ALM tests. |
| `almApiKeySecretBasicAuth` | string | base64-encoded string | **CAUTION: This password is simply encoded in base64 format which can be easily decoded by anyone. Use secure means to transmit the parameter file to prevent sensitive information from being exposed.**<br/><br/>[**Mandatory** if `SSOEnabled` is `true`] The API key secret used together with `almClientID` parameter as the identifier when login in SSO mode, encoded in base64 format.<br/><br/>See the online topic [API Key Management][alm-api-key-management-url] for the details to manage API keys. |
| `almRunMode` | string | *`RUN_LOCAL`* _or_ `RUN_REMOTE` _or_ `RUN_PLANNED_HOST` | (*Optional*) Indicated where to run the ALM tests, on the local machine or on remote machines. Default = `RUN_LOCAL`.<br/><br/>`RUN_LOCAL`: ALM tests run on the local machine where this tool is running;<br/>`RUN_REMOTE`: ALM tests run on a the machine specified in the `almRunHost` parameter;<br/>`RUN_PLANNED_HOST` runs ALM tests on the machines configured in the ALM test set. Only the **Default** test sets are supported. |
| `almRunHost` | string | hostname _or_ IP address | [**Mandatory** if `almRunMode` is `RUN_REMOTE`] The hostname or IP address of the machine on which to run the ALM tests. Takes effect only if `almRunMode` is `RUN_REMOTE`. |
| `almTimeout` | integer | `0` to `2147483647` | (*Optional*) The number of seconds before the ALM test run times out. Default = `2147483647` (around 68 years). |
| **`TestSet{i}`** | string | The path to an ALM test set _or_<br/>an ALM folder that contains test sets | [**Mandatory**] A list of ALM paths that refer to the ALM test set or ALM folder that contains the test sets.<br/><br/>Specify multiple test sets by increasing the `{i}` which starts from `1`. For example, `TestSet1=path1`, `TestSet2=folder2`. |
| `FilterTests` | boolean | `true` _or_ *`false`* | (*Optional*) Indicates whether filters need to be applied on the ALM test sets. Default = `false`. |
Expand Down

0 comments on commit 6aa801c

Please sign in to comment.