Category:
TestNG
Using SkipException, we can conditionally skip a test case. On throwing the skipException, the test method is marked as skipped in the test execution report and any statement after throwing the exception will not get executed.
@Test
public void testMethod(){
if(conditionToCheckForSkippingTest)
throw new SkipException(“Skipping the test”);
//test logic
}