TRX -> Generic Test Data XSLT

316 views
Skip to first unread message

Anthony Wesley

unread,
Jan 5, 2018, 5:02:29 PM1/5/18
to SonarQube
Hi,

I wrote an XSLT transform (with a few assumptions for my specific needs) to go from TRX (which you can generate for regular tests and XUnit, unsure about NUnit) to the Generic Test Data format described here.

Notes:
  • It's an XSLT 3.0 transform.  It could probably be moved back to 2.0 but certainly not 1.0 due to the use of replace().
  • It supports failures but not errors nor skipped.


Restrictions:

  • Test project structure and namespaces must match.  So MyProject.Tests/AFolder/ATestClass.cs corresponds to a class ATestClass in namespace MyProject.Tests.AFolder.
  • That implies one class per file.
  • .cs file extensions are hardcoded. 
  • The XSLT is parameterized
    • To support a prefix (say, an absolute path to your solution folder) ending in a slash. 
    • Importantly, to convert the namespace to the project folder (e.g MyProject.Tests.AFolder.ATestClass to MyProject.Tests/AFolder/ATestClass.cs) you must provide the name of the project related to these test results.


It will not likely fit perfectly into anyone's needs, but hopefully will be useful to someone.


Cheers.

G. Ann Campbell

unread,
Jan 9, 2018, 4:02:42 PM1/9/18
to SonarQube
Hi,

Thanks for sharing! I've added a link to the Other Contributions page, but there's not the room there to include the documentation you've given in your post. I wonder if you would add a README.md to that repository?


Ann

Anthony Wesley

unread,
Jan 16, 2018, 1:38:43 PM1/16/18
to G. Ann Campbell, SonarQube
Hiya, yes, I can do that.  I will convert it to a full repository, since this is just a gist.  I have to provide an example for my internal group as well.  I'll update this once complete.

-Tony

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/AQ0pExePcTU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/3288cd15-d8d8-4abc-a1dc-9112878e1cda%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Anthony Wesley

unread,
Feb 3, 2018, 5:26:53 PM2/3/18
to G. Ann Campbell, SonarQube
Hi,

I added documentation and the .xsl to this Github repo: https://github.com/awesley/trxToSonarQubeXslt

Thanks,
-Tony Wesley

G. Ann Campbell

unread,
Feb 5, 2018, 7:43:39 AM2/5/18
to Anthony Wesley, SonarQube
Thanks Tony!



---
G. Ann Campbell | SonarSource
Product Manager
@GAnnCampbell

G. Ann Campbell

unread,
Feb 5, 2018, 11:43:54 AM2/5/18
to Anthony Wesley, SonarQube
And BTW I've updated the link on the Other Contributions page to the new repo.


:-)
Ann 



---
G. Ann Campbell | SonarSource
Product Manager
@GAnnCampbell

Grégory Bittan

unread,
Feb 16, 2018, 4:34:50 AM2/16/18
to SonarQube
I did a similar tool in dotnet core to convert all TRX files from a solution with n test projects to one XML Generic Test Data.
I'm testing and i will open source it.
Reply all
Reply to author
Forward
0 new messages