Generating JUnit or NUnit xml reports with SpecRun

869 views
Skip to first unread message

Richard Gilmour

unread,
Jun 18, 2015, 8:40:22 AM6/18/15
to spe...@googlegroups.com
Hi,

I could not find this in the documentation, so asking here. SpecRun's HTML reports are great for humans, but I was looking to also create a JUnit or NUnit XML report after test execution. Is this possible?

My runtests.cmd file script looks like this:

@pushd %~dp0

%windir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe "MyProject.csproj"

@if ERRORLEVEL 1 goto end

@cd ..\packages\SpecRun.Runner.*\tools

@set profile=%1
@if "%profile%" == "" set profile=Default

SpecRun.exe run %profile%.srprofile "/baseFolder:%~dp0\bin\Debug" /log:specrun.log %2 %3 %4 %5

:end

@popd

Thanks in advance,

Richard

Domi Nik

unread,
Aug 4, 2015, 9:41:40 AM8/4/15
to SpecRun
Hi,

as far as i know it is not possible.
But I would like this as well.
We are trying to build our own NUnit XML but the only result info we can get is from ScenarioContext.Current.TestError, which only tells you if there was an error on an executed scenario.
Unfortunately it is not enough to build a sufficient NUnit XML.

Dominik

Greg

unread,
Aug 5, 2015, 7:56:43 AM8/5/15
to SpecRun
hi

Look at specrun from the command line, you can find out more about the commands you can send in from the scheduler (like jenkins)

Type 'SpecRun help <subcommand>' for help on a specific subcommand.
usage: SpecRun run target [/baseFolder:value] [/outputFolder:value] [/log:value]
 [/report:value] [/filter:value] [/toolIntegration:value] [/debug]
    target                    Assembly or test profile (.srprofile)
    [/baseFolder:value]       Base folder for executing the tests. All paths specified are relative to this.
    [/outputFolder:value]     Base folder for test outputs (relative to base folder), default: base folder
    [/log:value]              Path for log file (relative to output folder)
    [/report:value]           Path for the generated report (relative to outputfolder)
    [/filter:value]           Filter expression (overrides profile setting), e.g. '@mytag & !@othertag'
    [/toolIntegration:value]  Used for tool integration
    [/debug]                  Used for tool integration        default value: False

Domi Nik

unread,
Aug 6, 2015, 9:29:47 AM8/6/15
to SpecRun
Yeah I tried that, but I couldn't find anything.
What did you have in mind Greg, did you find anything?

Any other suggestions?
The only possibility would be to parse the HTML-Report and make your own NUNIT XML.
But this would be too time-consuming and complex.

Gáspár Nagy

unread,
Aug 7, 2015, 2:33:29 AM8/7/15
to SpecRun
Hi,

This is possible. The reports are rendered with razor through a configurable cshtml file. The default template you can get from http://go.specflow.org/specrunreporttemplate or extract it from resource.

There is a scenario "Should be able to use custom render template" in the specs (http://www.specflow.org/media/specrun.html#US3) that describes the usage (a bit). Also you can look at Pickles (https://github.com/picklesdoc/pickles) that has such integration with SpecFlow+ Runner.

We can also support you with setting up and maintaining the report for your concrete need.

Br,
Gaspar Nagy

viral shah

unread,
Nov 19, 2015, 8:01:10 PM11/19/15
to SpecRun
Hi Gasper,

For us the same thing as we are generating html report out of the Specrun but now i need to have xml from that Html report so i can use it for Jenkins other plugin like Test Result Analyzer. Can you please give me some steps. i did tried  

SpecRunHtmlToXml

 

0.9.5 but it is giving error like "

Error parsing file: System.Exception: bad name
   at SpecRunReportHTMLToXML.Program.ParseBody(HtmlNode bodyNode)
   at SpecRunReportHTMLToXML.Program.ParseHtml(HtmlNode htmlNode)

   at SpecRunReportHTMLToXML.Program.Main(String[] args)"

Eliezer Cazares

unread,
Jan 25, 2019, 1:07:48 PM1/25/19
to SpecRun
You need to copy the template ReportTemplate_Xml.cshtml from the Specflow Package to your bin folder, and add it to Report node on .srprofile
Reply all
Reply to author
Forward
0 new messages