Unity Unit Tests XML Output

784 views
Skip to first unread message

Gregory Boudreau

unread,
Mar 25, 2021, 12:21:44 PM3/25/21
to ThrowTheSwitch Forums
I'm currently doing unity unit tests in C using make and I'm trying to get an XML output. It seems that it is either impossible or extremely difficult to do without using something such as Ceedling. I was wondering if there is any way to have ceedling run for the XML outputs without having to use CMock or CException. Any help would be greatly appreciated!
Thanks,
Greg

Mark Vander Voord

unread,
Mar 25, 2021, 1:10:31 PM3/25/21
to ThrowTheSwitch Forums
Hi Greg,

Yes, Ceeding does not require you to use mocking (just don't include any headers with a "mock" prefix and it'll never generate one for you). CException is even easier to ignore, just don't include it.

I understand your root question is that you would prefer to not use Ceedling at all and would just like to get xml output from Unity. While unity itself doesn't output xml output, it CAN be post-processed using a script. There are some sample scripts in the unity/auto directory of the repo. For example, stylize_as_junit.rb is a ruby script which will output junit-compatible xml from unity's output files.

Best of luck!

Mark

--
You received this message because you are subscribed to the Google Groups "ThrowTheSwitch Forums" group.
To unsubscribe from this group and stop receiving emails from it, send an email to throwtheswitc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/throwtheswitch/ccf0766d-2ae0-4936-b61f-6b9df812084bn%40googlegroups.com.

Gregory Boudreau

unread,
Mar 25, 2021, 1:57:33 PM3/25/21
to ThrowTheSwitch Forums
Sounds great, thank you so much for the quick response!

Mark Migliaccio

unread,
May 3, 2021, 10:36:24 AM5/3/21
to ThrowTheSwitch Forums
For this script, you'll need to save your results from your unit test to an log file of some kind, correct? Is there any specific file extension or name format? Or do we just use the just the -r to specify the directory of the results?

On Thursday, March 25, 2021 at 1:10:31 PM UTC-4 mvandervoord wrote:

Mark Migliaccio

unread,
May 3, 2021, 11:44:38 AM5/3/21
to ThrowTheSwitch Forums
So. i did some digging and in my particular setup, i was just building my own main, then running the executable that I created. Then I tee'd that output to a <test_name>.testResults file. Then after I had that, I was able to use the style_as_junit.rb ruby script to generate the appropriate junit xml file. 
Reply all
Reply to author
Forward
0 new messages