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

조회 수: 6 (최근 30일)
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?

답변 (1개)

Neeraj Badamikar
Neeraj Badamikar 2019년 1월 22일
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
Paul McKechnie
Paul McKechnie 2019년 1월 24일
편집: Paul McKechnie 2019년 1월 24일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Write Unit Tests에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by