Please see a simplified code below
public class testClass
{
static WebDriver driver;
@Test
public void Checking()
{
driver = new FirefoxDriver();
driver.get("http://xyz.com");
try
{
Assert.assertEquals("Hello", "Not Hello");
}
catch(Exception e)
{
System.out.println("Fail" + e.getMessage());
}
System.out.println("just to check");
}
}
While debugging the code, once the Assertion fails in try block it ask for 'Source' to attach for testNG. see the screenshot below:
and then I added the source with the help of an eclipse plugin. Now when I start debugging and if the Assertion in try block fails then controll passed to the attached source (invoker.class) and does not return to the catch block ever.
Please suggest what shall I do in this case.