java - TestNG reporter not logging for exceptions -
hey guys trying customize output of selenium framework using testng. right have 'action' class wrapping selenium methods , wraping in try catches. here's example. (i manually throwing exception testing purposes.)
public void closebrowser(){ try{ driver.quit(); throw new webdriverexception(); } catch(exception e){ exceptionhandler exception = new exceptionhandler(e, null); } } my exception handler class looks this:
public exceptionhandler(exception exceptionname, string element){ this.exceptionname = exceptionname; this.element = element; report(); } public void report(){ string delims = "[.]"; string[] tokens = exceptionname.getclass().tostring().split(delims); system.out.println(tokens[tokens.length-1]); switch(tokens[tokens.length-1]){ case "webdriverexception": system.out.println("made case 1"); reporter.log("test message here <------ \n", true); break; default: reporter.log("unknown exception"); } } when run output on console:
webdriverexception made case 1 test message here <------ but never in html files testng generates. ideas??
Comments
Post a Comment