Friday, November 21, 2014

Nosetests Output to a File

If you familiar with python, I'm sure you also familiar with nosetests. Running nosetests is a piece of cake (although writing the test cases is sadly... not). But how to output the test result(s) to a file? I use the normal ">" method:
nosetests > result.txt
Surprisingly, it's not working :(
Looking on the internet (yes, google), I found 2 ways to do it:

1. Indeed by using ">", but the "complete" command is:
nosetests > result.txt 2>&1
2. And by using nosetests option:
nosetests --with-xunit --xunit-file=result.xml
Will produce a xml format file

I prefer the 1st option, txt file, cleaner.

No comments:

Post a Comment