Tuesday, February 14, 2017

How to create a Junit test case with failure

Today for testing, I need to create a junit test case xml file. Here is the sample which helps to create this failure xml.


<testsuite tests="3">
    <testcase classname="foo1" name="ASuccessfulTest"/>
    <testcase classname="foo2" name="AnotherSuccessfulTest"/>
    <testcase classname="foo3" name="AFailingTest">
        <failure type="NotEnoughFoo"> details about failure </failure>
    </testcase>
</testsuite>
 
This helps me to create a test.xml file having a failure in test case.