MATLAB Answers

How can I set the testsuite name attribute in the XML file generated by XMLPlugin.​producingJ​UnitFormat​?

12 views (last 30 days)
Paul McKechnie
Paul McKechnie on 16 Jan 2018
Edited: Paul McKechnie on 24 Jan 2019
I am creating a set of unit tests for some code that I am developing. I have been using the Matlab unit test plugins to good effect and generating a JUnit XML output file. However, I would like to set the name attribute of the testsuite to distinguish these tests when viewed in other tools such as Jenkins.
All of the examples that I can see show the name attribute left blank.
< testsuite errors="0" failures="1" name="" skipped="1" tests="3" time="0.0493" >
Is it possible to set this field when using XMLPlugin.producingJUnitFormat with the Matlab TestRunner?

  0 Comments

Sign in to comment.

Answers (1)

Neeraj Badamikar
Neeraj Badamikar on 22 Jan 2019
Hello Paul,
While this is currently not available, starting MATLAB R2018a, the Name attribute on a TestSuite node is populated with the name of the test class (or the test function if you are running a function-based test) in the Junit-XML report produced by the MATLAB XMLPlugin, with the child TestCase nodes holding the information about the test points within the test class or function.
But I am still curious to know more details about what you are trying to do.
Are you looking to distinguish tests written in MATLAB from the tests written in other languages while viewing the Jenkins report using the Name as an identifier?
If there was a way to specify the Name for a TestSuite node in the XML report, would you expect it to be the same across all TestSuite nodes?
Would you expect the Name to persist across multiple test runs, with the same or a different suite?
- Thanks
Neeraj

  1 Comment

Paul McKechnie
Paul McKechnie on 24 Jan 2019
Hi Neeraj,
So, yes, I would like to distinguish the Matlab unit tests from those in other languages. The aim was to have the test results presented in a form that looked good within Jenkins. At present, the results are all grouped into a default root package. I was hoping to be able to place them into a separate "Matlab" package to make them more distinctive. This is just changing the format of the XML rather than a change to the matlab code.
Best regards,
Paul

Sign in to comment.