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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

garvitagirotraev
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 [hidden email].
To post to this group, send email to [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|

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

cassian
Are you running with parallel=methods or parallel=tests??

Thanks & Regards,
Cassian Raja .T

On Thu, Jun 14, 2018 at 3:09 PM, <[hidden email]> 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 [hidden email].
To post to this group, send email to [hidden email].
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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CABh6KKs%3D3N6wi6qKXBZcWtvGwOYs1ZeycMK81qWHgTkhRS13XQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

garvitagirotraev
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, <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="Bjf4rOTUBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">garvitag...@...> 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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="Bjf4rOTUBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">selenium-user...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="Bjf4rOTUBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/2df94e20-b694-454f-9808-3b9c6fbe523e%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/2df94e20-b694-454f-9808-3b9c6fbe523e%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/2df94e20-b694-454f-9808-3b9c6fbe523e%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/2df94e20-b694-454f-9808-3b9c6fbe523e%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/b7331bfb-9165-4232-a1ea-8cff235b46c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.