Assert
class provide below methods to fail the test cases.
static public void
fail(String message)
Fails
a test with given message.
static public void
fail()
Fails
a test without message.
Find
the below working application.
DemoApp.java
package com.sample.arithmetic; import static org.junit.Assert.fail; import org.junit.Test; public class DemoTestApp { @Test public void testFailWithoutMessage() { fail(); } @Test public void testFailWithMessage() { fail("Failing the test"); } }
When
you ran above test cases, you can see below kind of report in Eclipse.
No comments:
Post a Comment