Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev branch | Add fixes to avoid crash whether a TC is failed in the test initializ… #21

Open
wants to merge 1 commit into
base: Dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions TrxerConsole/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Program
/// Main entry of TrxerConsole
/// </summary>
/// <param name="args">First cell shoud be TRX path</param>
static void Main(string[] args)
internal static void Main(string[] args)
{
if (args.Any() == false)
{
Expand Down Expand Up @@ -54,7 +54,16 @@ private static void Transform(string fileName, XmlDocument xsl, string outputFil
XslCompiledTransform x = new XslCompiledTransform(true);
x.Load(xsl, new XsltSettings(true, true), null);
Console.WriteLine("Transforming...");
x.Transform(fileName, outputFile);

try
{
x.Transform(fileName, outputFile);
}
catch (FileNotFoundException)
{
Console.WriteLine("ERROR. File not found: " + fileName);
}

Console.WriteLine("Done transforming xml into html");
}

Expand Down
8 changes: 6 additions & 2 deletions TrxerConsole/Trxer.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@

public string ToExactTimeDefinition(string duration)
{
return ToExtactTime(TimeSpan.Parse(duration).TotalMilliseconds);
}
// Fix in order to prevent crash when execution is aborted
if(duration != null && duration.Length > 0)
return ToExtactTime(TimeSpan.Parse(duration).TotalMilliseconds);
else
return "0";
}

public string ToExactTimeDefinition(string start,string finish)
{
Expand Down