Forum Discussion

ccarnes's avatar
ccarnes
New Contributor
2 months ago

Save Groovy output to JUnit report

As the title states, I'd like to run my current tests via ReadyAPI GUI or through Testrunner cli and have the JUnit report also have the groovy log output present for each test ran, pass or fail. In browsing the questions here and various sources online, it has been a challenge to find a working or reliable solution. 

Would anyone here on the forums know of a way to achieve the above?

Thank you

3 Replies

  • Hello ccarnes​ 

    I don't think there is a native way to do that... 

    We us a third party tool to keep track of test results...  that tool imports JUnit files.  Unfortunately, the ReadyAPI JUnit output file did not contain all the data that I wanted to get propagated to the third party tool.  We wrote a groovy script that would read the JUnit file and travel the log output file that can be created from running from the CLI.  By putting testcase name or step or some key mechanism in the log output file and reading that for each testcase in the JUnit file we were able to put whatever we wanted into the JUnit file.  The third party result tracking tool could then import the JUnit file that contained normal formatted output plus the merged content from log that we wanted.  As it turns out it was not to painful to accomplish.

    Just an idea for you.

    Regards,

    Todd

  • ccarnes's avatar
    ccarnes
    New Contributor

    As an aside, I have gotten around this by capturing the test step data in a testCase scoped custom property and then writing to a text file after the testCase has finished executing.

    While this is a decent workaround, I would still like to know if there is a native or better solution to capturing groovy test logs/output. 

     

  • ccarnes's avatar
    ccarnes
    New Contributor

    Thanks, TNeuschwanger​ for the reply, sorry for my delay. 

    I had a hunch as much. It would be great if there was a feature to output some of these data points to a flat file natively. 

    Like I mentioned above, I was able to implement some groovy catches in and at the end of the test suite for the data I was looking for. It was surprisingly easy to put together once I understood a lot of the native objects, classes and functions. I'm happy to share if anyone needs something similar setup.

    All the best,

    ~ CC