Forum Discussion

scierniak's avatar
scierniak
Occasional Contributor
5 years ago

How to mark test case as skipped in JUnit report

Hello,

 

Due to dependencies between tests, some of my tests need to be skipped.

 

Today I have setup scripts at test case level using command: testRunner.cancel( "Failure detected" )

It works as expected but into JUnit Report, cancelled tests are displayed as passed because there is no error/failure:

 

For example here my "TestCase 22":

 

<testsuite name="TestSuite 3" tests="22" failures="1" errors="0" time="36.036">
<properties>
</properties>
	<testcase name="TestCase 1" time="0.286"/>
         ...
	<testcase name="TestCase 20" time="0.192"/>
	<testcase name="TestCase 21" time="0.226">
		<failure type="Cancelling due to failed test step" message="Cancelling due to failed test step">
			<h3><b>Delete Failed</b></h3><pre>.... <hr/>
		</failure>
	</testcase>
	<testcase name="TestCase 22" time="0.0"/>
</testsuite>

 

What I would like, is to have test skipped:

<testsuite name="TestSuite 3" tests="22" failures="1" errors="0" skipped="1" time="36.036">
...
	<testcase name="TestCase 22" time="0.0">
<skipped message="Test marked as skipped due to ..."/>
</testcase> </testsuite>

 

so is there a way to do this? ideally a new method: testRunner.skip( "Test marked as skipped due to ..." )

 

Regards

No RepliesBe the first to reply