How to continue parallel test in case of JS exception assertion failure - Webdriver/Testng

19 views
Skip to first unread message

garvitag...@gmail.com

unread,
Jun 14, 2018, 5:39:23 AM6/14/18
to Selenium Users
I am having following hierarchy of @AfterMethods after @Test is run : 

1. Assert no js exception is on page.
2. Print log and attach to allure reports 
3. Take screenshot and save to desired folder in case test is failed.

I have set threadcount=3 for parallel run. In case there is any js exception assertion failure, all parallel running test also fail and remaining test also dont start. Is there any way to continue in case there is JS exception failure so that it can be reported as fail and other tests can continue. Below is code for JS exception assertion :

@AfterMethod
public void assertNoJSException()
{   
      JavascriptExecutor jse = (JavascriptExecutor) driver;
      Object jsExcptions = jse.executeScript("if (window.ipdCapturedErrors.length) return JSON.stringify(window.ipdCapturedErrors)");
      Assert.assertEquals(jsExceptions, null);

}


Thanks !!

Cassian Raja Thomas

unread,
Jun 14, 2018, 8:23:52 AM6/14/18
to seleniu...@googlegroups.com
Are you running with parallel=methods or parallel=tests??

Thanks & Regards,
Cassian Raja .T

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/2df94e20-b694-454f-9808-3b9c6fbe523e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

garvitag...@gmail.com

unread,
Jun 15, 2018, 1:19:13 AM6/15/18
to Selenium Users
Hi,

I am running with parallel=classes. My tests are designed in form of user stories and every class has one @test method. So i am using parallel=classes.

Thanks.


On Thursday, June 14, 2018 at 5:53:52 PM UTC+5:30, cassian wrote:
Are you running with parallel=methods or parallel=tests??

Thanks & Regards,
Cassian Raja .T

On Thu, Jun 14, 2018 at 3:09 PM, <garvitag...@gmail.com> wrote:
I am having following hierarchy of @AfterMethods after @Test is run : 

1. Assert no js exception is on page.
2. Print log and attach to allure reports 
3. Take screenshot and save to desired folder in case test is failed.

I have set threadcount=3 for parallel run. In case there is any js exception assertion failure, all parallel running test also fail and remaining test also dont start. Is there any way to continue in case there is JS exception failure so that it can be reported as fail and other tests can continue. Below is code for JS exception assertion :

@AfterMethod
public void assertNoJSException()
{   
      JavascriptExecutor jse = (JavascriptExecutor) driver;
      Object jsExcptions = jse.executeScript("if (window.ipdCapturedErrors.length) return JSON.stringify(window.ipdCapturedErrors)");
      Assert.assertEquals(jsExceptions, null);

}


Thanks !!

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages