Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.

Commit 2c1474b

Browse files
authored
Merge pull request #236 from aslaakso/latest
JENKINS-57130 Multiple issues - https://issues.jenkins-ci.org/browse/JENKINS-57130
2 parents 7e61cef + 6c85faa commit 2c1474b

File tree

29 files changed

+681
-368
lines changed

29 files changed

+681
-368
lines changed

HpToolsAborter/Program.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ private static void KillQtpAutomationProcess()
185185
foreach (var child in children)
186186
{
187187
var proc = Process.GetProcessById(child.ID);
188+
188189
if (proc != null)
189190
{
190191
KillProcess(proc);
@@ -196,6 +197,14 @@ private static void KillQtpAutomationProcess()
196197
private static void KillQtpAutomationFromAlm()
197198
{
198199
var remoteAgent = Process.GetProcessesByName("AQTRmtAgent").FirstOrDefault();
200+
var almProcesses = Process.GetProcessesByName("HP.ALM.Lab.Agent.RemoteService");
201+
foreach(var almProcess in almProcesses)
202+
{
203+
if(almProcess != null)
204+
{
205+
KillProcess(almProcess);
206+
}
207+
}
199208

200209
if (remoteAgent != null)
201210
{
@@ -219,11 +228,9 @@ private static void KillQtpAutomationFromAlm()
219228
}
220229
}
221230

222-
private static void KillServiceTestFromAlm()
231+
public static void KillServiceTestFromAlm()
223232
{
224-
225233
var dllHostProcesses = Process.GetProcessesByName("dllhost");
226-
227234
foreach (var dllhostProcess in dllHostProcesses)
228235
{
229236
List<ProcessData> children = new List<ProcessData>();
@@ -236,7 +243,6 @@ private static void KillServiceTestFromAlm()
236243
{
237244
var process = Process.GetProcessById(internalExecuterData.ID);
238245
KillProcess(process);
239-
240246
KillProcess(dllhostProcess);
241247
break;
242248
}

HpToolsLauncher/Launcher.cs

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@
2828
using HpToolsLauncher.Properties;
2929
using HpToolsLauncher.TestRunners;
3030
using HpToolsLauncher.RTS;
31+
using System.IO;
32+
using System.Xml.Serialization;
3133

3234
namespace HpToolsLauncher
3335
{
36+
3437
public enum CIName
3538
{
3639
Hudson,
@@ -98,6 +101,12 @@ public class Launcher
98101
private static ExitCodeEnum _exitCode = ExitCodeEnum.Passed;
99102
private static string _dateFormat = "dd/MM/yyyy HH:mm:ss";
100103
private static bool rerunFailedTests = false;
104+
XmlSerializer _serializer = new XmlSerializer(typeof(testsuites));
105+
106+
testsuites _testSuites = new testsuites();
107+
108+
public const string ClassName = "HPToolsFileSystemRunner";
109+
101110

102111
public static string DateFormat
103112
{
@@ -267,7 +276,9 @@ public void Run()
267276
Environment.Exit((int)Launcher.ExitCodeEnum.Failed);
268277
}
269278

270-
RunTests(runner, resultsFilename);
279+
TestSuiteRunResults results = runner.Run();
280+
281+
RunTests(runner, resultsFilename, results);
271282

272283

273284
if (_runtype.Equals(TestStorageType.Alm))
@@ -284,22 +295,6 @@ public void Run()
284295
filterSelected = Convert.ToBoolean(filter.ToLower());
285296
}
286297

287-
if(filterSelected.Equals(true) && Launcher.ExitCode != ExitCodeEnum.Passed)
288-
{
289-
//rerun selected tests
290-
initialTestRun = false;
291-
292-
runner = CreateRunner(_runtype, _ciParams, initialTestRun);
293-
294-
//runner instantiation failed (no tests to run or other problem)
295-
if (runner == null)
296-
{
297-
Environment.Exit((int)Launcher.ExitCodeEnum.Failed);
298-
}
299-
300-
RunTests(runner, resultsFilename);
301-
}
302-
303298
}
304299

305300
if (_runtype.Equals(TestStorageType.FileSystem))
@@ -333,7 +328,9 @@ public void Run()
333328
Environment.Exit((int)Launcher.ExitCodeEnum.Failed);
334329
}
335330

336-
RunTests(runner, resultsFilename);
331+
TestSuiteRunResults rerunResults = runner.Run();
332+
results.AppendResults(rerunResults);
333+
RunTests(runner, resultsFilename, results);
337334
}
338335
}
339336

@@ -815,8 +812,9 @@ private Dictionary<string, string> GetKeyValuesWithPrefix(string prefix)
815812
/// </summary>
816813
/// <param name="runner"></param>
817814
/// <param name="resultsFile"></param>
818-
private void RunTests(IAssetRunner runner, string resultsFile)
815+
private void RunTests(IAssetRunner runner, string resultsFile, TestSuiteRunResults results)
819816
{
817+
820818
try
821819
{
822820
if (_ciRun)
@@ -825,13 +823,12 @@ private void RunTests(IAssetRunner runner, string resultsFile)
825823
_xmlBuilder.XmlName = resultsFile;
826824
}
827825

828-
TestSuiteRunResults results = runner.Run();
829-
830826
if (results == null)
831827
Environment.Exit((int)Launcher.ExitCodeEnum.Failed);
832-
828+
833829
_xmlBuilder.CreateXmlFromRunResults(results);
834830

831+
835832
//if there is an error
836833
if (results.TestRuns.Any(tr => tr.TestState == TestState.Failed || tr.TestState == TestState.Error))
837834
{
@@ -841,6 +838,7 @@ private void RunTests(IAssetRunner runner, string resultsFile)
841838
int numFailures = results.TestRuns.Count(t => t.TestState == TestState.Failed);
842839
int numSuccess = results.TestRuns.Count(t => t.TestState == TestState.Passed);
843840
int numErrors = results.TestRuns.Count(t => t.TestState == TestState.Error);
841+
int numWarnings = results.TestRuns.Count(t => t.TestState == TestState.Warning);
844842

845843
//TODO: Temporery fix to remove since jenkins doesnt retrive resutls from jobs that marked as failed and unstable marks jobs with only failed tests
846844
if ((numErrors <= 0) && (numFailures > 0))
@@ -880,7 +878,7 @@ private void RunTests(IAssetRunner runner, string resultsFile)
880878
}
881879

882880
ConsoleWriter.WriteLine(Resources.LauncherDoubleSeperator);
883-
ConsoleWriter.WriteLine(string.Format(Resources.LauncherDisplayStatistics, runStatus, results.TestRuns.Count, numSuccess, numFailures, numErrors));
881+
ConsoleWriter.WriteLine(string.Format(Resources.LauncherDisplayStatistics, runStatus, results.TestRuns.Count, numSuccess, numFailures, numErrors, numWarnings));
884882

885883
if (!runner.RunWasCancelled)
886884
{

HpToolsLauncher/MtbxManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ public static List<TestInfo> LoadMtbx(string xmlContent, Dictionary<string, stri
167167
}
168168

169169
XAttribute xname = GetAttribute(test, "name");
170-
171-
string name = "<None>";
172-
if (xname != null)
170+
string name = "Unnamed Test";
171+
if (xname != null && xname.Value != ""){
173172
name = xname.Value;
173+
}
174174

175175
// optional report path attribute
176176
XAttribute xReportPath = GetAttribute(test, "reportPath");

HpToolsLauncher/Properties/Resources.Designer.cs

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

HpToolsLauncher/Properties/Resources.resx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Save the test in QuickTest and then run it again.</value>
164164
<value>One or more of the required connection parameters is empty.</value>
165165
</data>
166166
<data name="AlmRunnerDisplayLink" xml:space="preserve">
167-
<value>Link: {0}</value>
167+
<value>Copy the following report link inside an IE browser to view the test run results: {0}</value>
168168
</data>
169169
<data name="AlmRunnerDisplayTest" xml:space="preserve">
170170
<value>Test set name: {0}, Test set id: {1}</value>
@@ -221,7 +221,7 @@ Save the test in QuickTest and then run it again.</value>
221221
<value>Test set: {0}, finished at {1}</value>
222222
</data>
223223
<data name="AlmRunnerTestStat" xml:space="preserve">
224-
<value>Test: {0}, Status: {1}, Message: {2} \nLink: {3}\n</value>
224+
<value>Test: {0}, Status: {1}, Message: {2}, Link: {3}</value>
225225
</data>
226226
<data name="FsRunnerNoValidTests" xml:space="preserve">
227227
<value>===============================\nThere are no valid tests to run!\n===============================</value>
@@ -272,7 +272,7 @@ Save the test in QuickTest and then run it again.</value>
272272
<value>Run mode is set to: {0}</value>
273273
</data>
274274
<data name="LauncherDisplayStatistics" xml:space="preserve">
275-
<value>Run status: {0}, total tests: {1}, succeeded: {2}, failures: {3}, errors: {4}</value>
275+
<value>Run status: {0}, total tests: {1}, succeeded: {2}, failures: {3}, errors: {4}, warnings: {5}</value>
276276
</data>
277277
<data name="LauncherDoubleSeperator" xml:space="preserve">
278278
<value>================================================</value>

0 commit comments

Comments
 (0)