nunit - How can I write the trace, console and error outputs into my XML report file? -
i want trace, console , console error outputs written common xml report file (for example cad.unittests.xml). default info not written in xml.
how can it? nunit-console.exe
has such parameters:
/output=str file receive test output (short format: /out=str) /err=str file receive test error output
but need in same xml file. need both cases: nunit-console.exe
, nunit.exe
. also, looked settings of gui nunit found nothing.
my bat file has such content:
:: run_me.bat :: © andrey bushman, 2015 echo off cd /d %~dp0 set file_name=cad.unittests :: run nunit tests call "%nunit%\nunit-console.exe" ^ /out="%~dp0%file_name%_out.txt" ^ /err="%~dp0%file_name%_err.txt" ^ /trace=verbose ^ /noshadow ^ /xml="%~dp0%file_name%.xml" ^ "%~dp0%file_name%.dll" :: html report of unit testing call "%reportunit%\reportunit.exe" ^ "%~dp0%file_name%.xml" ^ "%~dp0%file_name%.html"
but if use such command:
call "%nunit%\nunit-console.exe" ^ /out="%~dp0%file_name%_out.txt" ^ /err="%~dp0%file_name%_err.txt" ^ /noshadow ^ /xml="%~dp0%file_name%.xml" ^ "%~dp0%file_name%.dll"
then trace output absent in both files (the "%~dp0%file_name%_out.txt" , "%~dp0%file_name%_err.txt").
i don't see of nunit-console.exe
option trace output redirection (something /tracefile
). see /trace
parameter, has other purpose.
it necessary me, because use result xml generation of html through reportunit.exe. want see detailed info in html.
i can save trace output txt file in code of unit tests:
/* setupclass.cs * © andrey bushman, 2015 */ namespace bushman.cad.unittests { using system; using system.io; using system.diagnostics; using nunit.framework; [setupfixture] public class setupclass { private textwritertracelistener listener = null; [setup] public void runbeforeanytests() { stream tracefile = file.create("trace_out.txt"); listener = new textwritertracelistener(tracefile); trace.listeners.add(listener); } [teardown] public void runafteranytests() { listener.flush(); } } }
but still have hope can info in xml file (which generated nunit) through "native" way of nunit.
Comments
Post a Comment