Reputation: 43
We have introduced the PDK lately into our developments chain and are now trying to make everybody happy with the test outputs it generates.
We need an output as JUnit test report for our jenkins jobs. That we have solved.
And we need the output still on the console because some of the developers find it very annoying having to open the JUnit report file before they can see failed tests.
pdk test unit --format=junit:report.xml
Is how we configured the output for JUnit.
Unfortunately as soon as you configure the JUnit report no output gets printed on the console/stdout anymore. Even if you add another format like --format=text
without target file.
Is there a way to achieve both without running the PDK twice?
Upvotes: 1
Views: 191
Reputation: 46
It doesn't appear to be in the docs, but this should work.
pdk test unit --format=junit:report.xml --format=text:stdout
I've filed a ticket to ensure that gets promoted to the docs at https://puppet.com/docs/pdk/1.x/pdk_reference.html#pdk-test-unit-command
Upvotes: 3
Reputation: 6643
From PDK documentation
--format=[:]
Specifies the format of the output. Optionally, you can specify a target file for the given output format, such as --format=junit:report.xml . Multiple
--format
options can be specified as long as they all have distinct output targets
So I believe ,you can try as below
pdk test unit --tests=testcase_name --format=junit:report.xml --format=text:log.txt
Hope it helps.
Upvotes: 0