how to use assertion in selenium so that if it throws assertion error next line will not skip(java) -
i using assert verify scenario in selenium webdriver. below code. if assertion error in first line, execution not happening next line. want execute next line , want print fail report in testng xslt. using ant trigger build.
assert.assertequals(actualdatesent, expecteddatesent, "comparing assert date"); assert.assertequals(actualuccnumber, expecteduccnumber);
edit
try-catch block
try { assert.assertequals(actualdatesent, expecteddatesent, "date validation failed"); assert.assertequals(actualuccnumber, expecteduccnumber, number validation failed); } catch(throwable t) { errorutils.addverificationfailure(t); seleniumscreenshot.takefailedscreenshot(testname); }
the way surround every assert try {} catch (assertionerror ex)
, store messages exception in list. @ end of method need check if list not empty , throw assertionerror
messages list concatenated.
Comments
Post a Comment