Coder Social home page Coder Social logo

trxer's People

Contributors

nivnavick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

trxer's Issues

Not working with TRX file generated from VSTestConsole

Hi,
Not sure if this tool supports transforming TRX file, generated from VSTestConsole, but this is not working for me.

Environment: VS 2015, output generated from running regular C# unit tests.
Test Console: VSTest.Console.

Exception while transforming:
Length can not be less than zero.

Stack strace as below:
Unhandled Exception: System.ArgumentOutOfRangeException: Length cannot be less t
han zero.
Parameter name: length
at System.String.Substring(Int32 startIndex, Int32 length)
at System.Xml.Xsl.CompiledQuery.Script1.RemoveAssemblyName(String asm) in c:
Users\praveen.polepalli\AppData\Local\Temp\2wyfjtpf.0.cs:line 29
at System.Xml.Xsl.CompiledQuery.Query.<xsl:template name="compiler:generated"

(6)(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNaviga
tor {urn:schemas-microsoft-com:xslt-debug}current, Double {urn:schemas-microsoft
-com:xslt-debug}position, Double {urn:schemas-microsoft-com:xslt-debug}last, ILi
st1 {urn:schemas-microsoft-com:xslt-debug}namespaces, IList1 testRunOutcome, I
List1 testsFailedSet, IList1 testsFailedCount, IList1 classSet, IList1 class
Count)
at System.Xml.Xsl.CompiledQuery.Query.<xsl:template name="compiler:generated"
(4)(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNaviga
tor {urn:schemas-microsoft-com:xslt-debug}current, Double {urn:schemas-microsoft
-com:xslt-debug}position, Double {urn:schemas-microsoft-com:xslt-debug}last, ILi
st1 {urn:schemas-microsoft-com:xslt-debug}namespaces, IList1 classCount, IList
1 classSet, IList1 testsFailedCount, IList1 testsFailedSet, IList1 testRunOu
tcome)

Issue: TRX file for VS: 2015: App crash (Fixed)

Hi,
Thanks for this nice tool. Just now tested this with VS 2015 TRX file (generated from VSTest.Console.Exe).

Wanted to share a fix, so that it will help others in using this one.

Application is crashing at line where it is removing the namespace from the assembly name. So, just placed a condition in Trxer.xslt (line#13, RemoveAssemblyName method).

public string RemoveAssemblyName(string asm)
{
if (asm.IndexOf(',') > 0)
return asm.Substring(0,asm.IndexOf(','));
else
return asm;
}

Now, it started generating the file without any problems.

Some other issues might turn up, e.g. Duration not present etc, so just get the project and fix. I believe the fixes might be limited to the XSLT file.

Not working if duration attribute is not present

I have an ignored test class in my project like this:

using NUnit.Framework;

namespace SomeNamespace
{
  [Ignore]
  class Class1
  {
    [Test]
    public void Test1()
    {
    }
  }
}

When I run the tests I get a TestResult like this:

<UnitTestResult executionId="cb49743c-98b4-469a-b396-f075359b7093" testId="d9844934-2718-40fe-9f86-64ebc9e03a45" testName="Test1" computerName="MyMachine" startTime="2016-01-07T16:53:27.6797496+01:00" endTime="2016-01-07T16:53:27.6797496+01:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="NotExecuted" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="cb49743c-98b4-469a-b396-f075359b7093">
  <Output>
  </Output>
</UnitTestResult>

Since there is no duration attribute on this UnitTestResult element the method ToExactTimeDefinition(string duration) failes.

TRX generated from OpenCover not working

errorinfo
Getting error in Script1 file for

public string RemoveAssemblyName(string asm)
{
return asm.Substring(0,asm.IndexOf(','));
}

**Error :
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll

Additional information: Length cannot be less than zero.**

Unhandled Exception: System.ArgumentOutOfRangeException: Length cannot be less than zero.

trx file on VS2013
Not getting converted to HTML
Below exception arised

C:\covertedFiles>"C:\Program Files (x86)\Trxer\TrxerConsole.exe" testResults1.trx
Trx File
testResults1.trx
Loading xslt template...
Loading css...
Loading javascript...
Transforming...

Unhandled Exception: System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
at System.String.Substring(Int32 startIndex, Int32 length)
at System.Xml.Xsl.CompiledQuery.Script1.RemoveAssemblyName(String asm)
at System.Xml.Xsl.CompiledQuery.Query.<xsl:template name="compiler:generated"> (6)(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:
xslt-debug}last, IList1 {urn:schemas-microsoft-com:xslt-debug}namespaces, IList1 testRunOutcome, IList1 testsFailedSet, IList1 testsFailedCount, IList1 classSet, IList1 classCount)
at System.Xml.Xsl.CompiledQuery.Query.<xsl:template name="compiler:generated"> (4)(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:
xslt-debug}last, IList1 {urn:schemas-microsoft-com:xslt-debug}namespaces, IList1 classCount, IList1 classSet, IList1 testsFailedCount, IList1 testsFailedSet, IList1 testRunOutcome)
at System.Xml.Xsl.CompiledQuery.Query.<xsl:template name="compiler:generated"> (3)(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:
xslt-debug}last, IList1 {urn:schemas-microsoft-com:xslt-debug}namespaces, IList1 testRunOutcome)
at System.Xml.Xsl.CompiledQuery.Query.<xsl:template name="compiler:generated"> (2)(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:
xslt-debug}last, IList1 {urn:schemas-microsoft-com:xslt-debug}namespaces, IList1 testRunOutcome)
at System.Xml.Xsl.CompiledQuery.Query.<xsl:template match="/">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current,
st`1 {urn:schemas-microsoft-com:xslt-debug}namespaces)
at System.Xml.Xsl.CompiledQuery.Query.xsl:apply-templates(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator , Double , Double )
at System.Xml.Xsl.CompiledQuery.Query.Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at System.Xml.Xsl.CompiledQuery.Query.Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)
at System.Xml.Xsl.XslCompiledTransform.Transform(String inputUri, String resultsFile)
at TrxerConsole.Program.Transform(String fileName, XmlDocument xsl)
at TrxerConsole.Program.Main(String[] args)

License

Hi Niv

Thanks for the good work mate. This is a great utility and everyone loved the fruitful html reports converted from html. My team and manager loved it and we wanted to use it across our organisation but unfortunately couldn't due to undefined License.

Is it possible for you to add MIT License to it so that it could be used at a large scale.

Anything you could do what Autofac has done would be much appreciated.

https://github.com/autofac/Autofac/blob/develop/LICENSE

Thanks

How to get screenshot if we use test data

Hi i am using test data and i want to insert screenshots in the message. I was not able to get right now even after changing the path in the xsl file accordingly to the trx file like below.
<xsl:for-each select="/t:TestRun/t:Results/t:UnitTestResult[@Testid=$testId]/t:InnerResults/t:UnitTestResult[@Testid=$testId]/t:Output">

and my trx file is like below









StdOut "D:\Personal\desktopImage.png" /StdOut


Assert.Fail failed. Exception is:Assert.Fail failed. No content available for the search criteria



Exception has been thrown by the target of an invocation.
Please help me if there is anything wrong.

Incorrect file specification

I was finding if a .trx file is specified which does not exist, Trxr would stop working. So I modified the Main method within the program to cover the situations of no file specified, an incorrect file specified to go with correct terms provided.

Program.cs line 26:
static void Main(string[] args)
{
if (args.Any())
{
string path = args[0].ToString();
if (!File.Exists(path))
{
Console.WriteLine("Incorrect file specified, Trxer.exe ");
return;
}
Console.WriteLine("Trx File\n{0}", args[0]);
Transform(args[0], PrepareXsl());
}
else
{
Console.WriteLine("No trx file specified, Trxer.exe ");
}
}

Tests:

Command input Outcome
Trxr.exe No trx file specified, Trxer.exe
Trxr.exe [noFileExists].trx Incorrect file specified, Trxer.exe
Trxr.exe [fileExists].trx Done transforming xml in to html

I did this as I was finding MSText.exe will not run one test at a time and I can run them in that manner if I specify each test at a time. This produces many trx files. Now I need to find a way to combine my many test results into one file.

Unhandled Exception: System.FormatException: String was not recognized as a vali d TimeSpan.

Hi,
Thanks for providing nice and rich test report utility.
I have used the used your TRXER utility to generate the HTML report from TRX. It did generate the HTML but the HTML does not contain rich test result data as mentioned. HTML report did not display the result for individual test cases.
And also the utility did not output any error or warning while generating the report. please find below findings on the same for reference.

Output:
image

HTML Report:Attaching snap of report generated for your reference

image

Any help on how to generate the full rich test result data html, would be highly appreciated.

Thanks
Murali

Solved Issue related to Unhandled Exception: System.ArgumentOutOfRangeException: Length cannot be less than zero.

Hi NivNavick.

I get your code to generate html from my trx and i had an issue related to :

Unhandled Exception: System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
at System.String.Substring(Int32 startIndex, Int32 length)
at System.Xml.Xsl.CompiledQuery.Script1.RemoveAssemblyName(String asm)
at System.Xml.Xsl.CompiledQuery.Query.<xsl:template name="compiler:generated"> (6)(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:
xslt-debug}last, IList1 {urn:schemas-microsoft-com:xslt-debug}namespaces, IList1 testRunOutcome, IList1 testsFailedSet, IList1 testsFailedCount, IList1 classSet, IList1 classCount)
at System.Xml.Xsl.CompiledQuery.Query.<xsl:template name="compiler:generated"> (4)(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:
xslt-debug}last, IList1 {urn:schemas-microsoft-com:xslt-debug}namespaces, IList1 classCount, IList1 classSet, IList1 testsFailedCount, IList1 testsFailedSet, IList1 testRunOutcome)
at System.Xml.Xsl.CompiledQuery.Query.<xsl:template name="compiler:generated"> (3)(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:
xslt-debug}last, IList1 {urn:schemas-microsoft-com:xslt-debug}namespaces, IList1 testRunOutcome)
at System.Xml.Xsl.CompiledQuery.Query.<xsl:template name="compiler:generated"> (2)(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:
xslt-debug}last, IList1 {urn:schemas-microsoft-com:xslt-debug}namespaces, IList1 testRunOutcome)
at System.Xml.Xsl.CompiledQuery.Query.<xsl:template match="/">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current,
st`1 {urn:schemas-microsoft-com:xslt-debug}namespaces)
at System.Xml.Xsl.CompiledQuery.Query.xsl:apply-templates(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator , Double , Double )
at System.Xml.Xsl.CompiledQuery.Query.Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at System.Xml.Xsl.CompiledQuery.Query.Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)
at System.Xml.Xsl.XslCompiledTransform.Transform(String inputUri, String resultsFile)
at TrxerConsole.Program.Transform(String fileName, XmlDocument xsl)
at TrxerConsole.Program.Main(String[] args)

It was solved updating only the file txer.xslt in the rott of your project. To solve overwrite your RemoveAssemblyName method by this one:


public string RemoveAssemblyName(string asm)
    {
      if(asm.IndexOf(',')>0) {
        return asm.Substring(0,asm.IndexOf(','));
      }
      else 
      {
        return asm;
      }
    }

Consider to add this change to your last merge.

No IE support

Pie and class statuses are not shown(canvas not supported)

Please improve readme info around screenshots

The verbiage around how to attach a screenshot to a test is vague. The documentation could be improved with some code examples and more detailed explanations of the requirements, including perhaps links to relevant NUnit documentation. Thanks!

Not seeing all test results in show/hide

This is a VS2015 trx file. It runs without error but does not show all 4 test result details in the class area.The summary info is correct. I am trying to work through the xslt but am quite new to xpath and xslt.

tmiRun.txt

Visual Studio 2019

I tried parsing unit test from Visual Studio 2019 Community and it doesn't work. I ran the tests using command: vstest.console.exe xxx.dll /logger:trx
from console:

Loading xslt template...
Loading css...
Loading javascript...
Transforming...

Unhandled Exception: System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
   at System.String.Substring(Int32 startIndex, Int32 length)
   at System.Xml.Xsl.CompiledQuery.Script1.RemoveAssemblyName(String asm) in c:\Users\xxx\AppData\Local\Temp\d1xp0pdy.0.cs:line 29

This is from .trx file where I guess it failed.
From .trx which failed:

<UnitTest name="xxx" storage="c:\xxx" id="xxx">
      <Execution id="xxx" />
      <TestMethod codeBase="c:\xxx" adapterTypeName="executor://mstestadapter/v2" className="xxx.xxx" name="xxx" />
    </UnitTest>

From .trx which passed (your example):

<UnitTest name="WarnTest" storage="c:\users\nivnavick\desktop\prologwin\prolog\prologgertests\bin\release\prologgertests.dll" id="5e3cd15a-aba7-333e-80af-38c992a98a19">
      <Execution id="e62eeea5-984e-4eb1-87a5-22c4fec39062" />
      <TestMethod codeBase="C:/Users/NivNavick/Desktop/ProLogWin/ProLog/ProLoggerTests/bin/Release/ProLoggerTests.DLL" adapterTypeName="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" className="ProLoggerTests.UnitTest1, ProLoggerTests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="WarnTest" />
    </UnitTest>

Also, when I fix it, it throws another exception. It would be great to catch these and just log them and add N/A in HTML || ignoring the exception would work as well.

Unhandled Exception: System.FormatException: String was not recognized as a valid TimeSpan.
   at System.Globalization.TimeSpanParse.TimeSpanResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument, String failureArgumentName)
   at System.Globalization.TimeSpanParse.TryParseTimeSpan(String input, TimeSpanStandardStyles style, IFormatProvider formatProvider, TimeSpanResult& result)
   at System.Globalization.TimeSpanParse.Parse(String input, IFormatProvider formatProvider)
   at System.TimeSpan.Parse(String s)

Not Listing DataDriven Tests

So A test method could look like this:

`
public TestContext TestContext { get; set; }

    [TestMethod]
    [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", @"|DataDirectory|\DataFiles\PolynomialParseTests.csv", "PolynomialParseTests#csv", DataAccessMethod.Sequential)]
    public void PolynomialParsing()
    {
        string source = (string)TestContext.DataRow["source"]; // get the value from the 'input polynomial string' column
        string target = (string)TestContext.DataRow["target"]; // get the value from the 'expected' coeffecients column

        Polynomial P = new Polynomial();
        P.Parse(source);

        string[] coeffecients = target.Trim().Split(';');
        List<double> C = coeffecients.Select(c => double.Parse(c, CultureInfo.InvariantCulture)).ToList();

        CollectionAssert.AreEqual(C, P.P);
    }

`

with a datafile like this:

id,source,target,comment
0, "2x^2+x" ,0;1;2,
1, " 2x^2 + 1.0x " ,0;1;2,
2, "2x^2 + 1.0
x + 0" ,0;1;2,
3, "2u^3 + u " ,0;1;0;2

`this actually prduces 4 runs of datadriven tests, for this test method.
this is not shown in the html.

Emtpy duration and unhandled exception

Hi
Can you fix those issues? Sometimes you get string.Empty duration parameter to ToExactTimeDefinition(..)
Error handling should be also nice, eg. log and console report.

Author: dmikulastik <[email protected]>
Date:   Tue Sep 15 15:02:30 2015 +0200

    Fixed empty duration in Trxer.xlst
    Program handled exexception while tranforming.

diff --git a/TrxerConsole/Program.cs b/TrxerConsole/Program.cs
index 5fb92b1..0f0530e 100644
--- a/TrxerConsole/Program.cs
+++ b/TrxerConsole/Program.cs
@@ -30,7 +30,16 @@ namespace TrxerConsole
                 return;
             }
             Console.WriteLine("Trx File\n{0}", args[0]);
-            Transform(args[0], PrepareXsl());
+            try
+            {
+                Transform(args[0], PrepareXsl());
+            }
+            catch (Exception ex)
+            {
+                Console.OpenStandardError();
+                Console.Error.WriteLine("Failed to transform TRX: {0}", ex.Message);
+                System.Threading.Thread.Sleep(5000);
+            }
         }

         /// <summary>
diff --git a/TrxerConsole/Trxer.xslt b/TrxerConsole/Trxer.xslt
index 1ada859..1ce1e8d 100644
--- a/TrxerConsole/Trxer.xslt
+++ b/TrxerConsole/Trxer.xslt
@@ -40,7 +40,7 @@

     public string ToExactTimeDefinition(string duration)
     {
-         return  ToExtactTime(TimeSpan.Parse(duration).TotalMilliseconds);
+         return  string.IsNullOrWhiteSpace(duration)?ToExtactTime(0):ToExtactTime(TimeSpan.Parse(duration).TotalMilliseconds);
     }

     public string ToExactTimeDefinition(string start,string finish)

New section showing duration for each namespace

We have a usecase where it is useful to show duration of namespaces. So i propose a new section where each namespace is listed and their total duration. The sortorder should be from slowest to fastest namespace.

Wrong code base in Release 1.0.0.2

I believe Release 1.0.0.2 contains the wrong code base. I ran into the ArgumentOutOfRangeException problem described in Issue #27 using TrxerConsole.exe from the release. Comparing the source in the cloned repo with the 1.0.0.2 source code download, the commit for PR #28 does not appear to be included.

HTML Report shows empty informations in Test tables

First of all thanks a lot for the great work done on this project, to me the only one that gives a real design and usefull output html report for my Automated tests.

Sadly, since last or two last updates of MS Visual Studio 2017, I've got a problem in generation of the html report with Trxer. The .Trx file generated by Coded UI Test engine seems to have changed, with a lack of line breaks (maybe new structure?) and in UNIX (LF) format (instead of Windows (CR LF) like it was before).
The result is that Trxer seems to not being able anymore to parse de file correctly, and the html report doesn't show any information in Tests Tables, as shown in the following picture:

image

Any idea or trick for this?

If you need I can post an example of the .trx file if you want to check what's going wrong within the .trx structure...

Thanks in advance for any help on this!

Build support for DataTestMethod

Data tests (annotated with DataTestMethod and DataRow or DynamicData) do not show as separate tests in the generated HTML even though their execution data exists in the trx file. It would be good to show each of the data test under the parent test.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.