1

I have a working testsuite which tests some RESTful API's. Up until now the stdout results have been fine:

.......E..F..

However now I need something a bit more informative.

The output should be:

TestName, startTime, endTime, Result

I'll probably write this to a file in csv or xml. Now, I'm having no problems with the test name, start time and end time (multiple ways to do this) but I don't know how to write the result, the . or F or E to the file.

Is there any way I can extract the test result and do something with it within the test or test runner?

Could someone point me in the right direction?

Mark Thomas
  • 37,131
  • 11
  • 74
  • 101
Adrian
  • 143
  • 1
  • 4
  • 13

1 Answers1

1

One alternative - simple - is to work with the output provided using command line string manipulation tools (sed/awk/..) and generate the required output format.

A more involved alternative would be to dig into the test-unit internals and create your own test-runner which gives the required output. The ./lib/test/unit/ui/console/testrunner.rb file would be a good place to start.

Check out https://stackoverflow.com/a/10558600/429758 for an example of how to write a customized test runner.

Community
  • 1
  • 1
Prakash Murthy
  • 12,923
  • 3
  • 46
  • 74