@AcfterClass method is not called.

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

@AcfterClass method is not called.

cslspatel
@AfterClass in base class is not getting executed...


In my test automation runs tests on two mobile devices in Parallel with testNG feamework. The @BeforeClass and the @AfterClass methods are in the base (super) class that all other test classes inherit.  The BeforeClass method initialized the driver session and the AfterClass terminates the session.

The problem is that the @AfterClass is not executed.  Because of that, the driver session is not terminated and the subsequent call to BeforeClass fails becasue of that.This results in execution of only the first test in each class - the rest of them are not.

 I am wondering if anyone has come across this...and what the cause/remedy is!


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Parallel Mobile Tests" parallel="tests" thread-count="2"
preserve-order="true" configfailurepolicy="continue">
<parameter name="browserTypes" value="Mobile OS" />

<listeners>
<listener class-name="my.listeners.TestListener" />
<listener class-name="my.listeners.CustomReportListener" />
</listeners>

<test verbose="2" name="IPHONE_6SPLUS : Parallel Tests">
<parameter name="device" value="IPHONE_6SPLUS" />
<parameter name="deviceOS" value="iOS" />
<classes>
<!-- ALL INSTALL TESTS -->
<class name="my.tests.Install" />
<class name="my.tests.Class1_tests" />
<class name="my.tests.Class2_tests" />
<class name="my.tests.Class3_tests" />
<class name="my.tests.Class4_tests" />
<class name="my.tests.Class5_tests" />
</classes>
</test>

<test verbose="2" name="IPHONE_SE : Parallel Tests">
<parameter name="device" value="IPHONE_SE" />
<parameter name="deviceOS" value="iOS" />
<classes>
<!-- ALL INSTALL TESTS -->
<class name="my.tests.Install" />
<class name="my.tests.Class1_tests" />
<class name="my.tests.Class2_tests" />
<class name="my.tests.Class3_tests" />
<class name="my.tests.Class4_tests" />
<class name="my.tests.Class5_tests" />
</classes>
</test>

</suite> <!-- Suite -->

--
You received this message because you are subscribed to the Google Groups "testng-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].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: @AcfterClass method is not called.

⇜Krishnan Mahadevan⇝
What version of TestNG are you on ? Please make sure you are using the latest released version of TestNG viz., 6.14.3
If even after using the latest version, you are still facing the issue, then please help share a simple standalone test (without any dependencies on appium) that can be used to reproduce your issue.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ http://rationaleemotions.wordpress.com/

On Mon, Aug 6, 2018 at 7:40 PM, <[hidden email]> wrote:
@AfterClass in base class is not getting executed...


In my test automation runs tests on two mobile devices in Parallel with testNG feamework. The @BeforeClass and the @AfterClass methods are in the base (super) class that all other test classes inherit.  The BeforeClass method initialized the driver session and the AfterClass terminates the session.

The problem is that the @AfterClass is not executed.  Because of that, the driver session is not terminated and the subsequent call to BeforeClass fails becasue of that.This results in execution of only the first test in each class - the rest of them are not.

 I am wondering if anyone has come across this...and what the cause/remedy is!


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Parallel Mobile Tests" parallel="tests" thread-count="2"
preserve-order="true" configfailurepolicy="continue">
<parameter name="browserTypes" value="Mobile OS" />

<listeners>
<listener class-name="my.listeners.TestListener" />
<listener class-name="my.listeners.CustomReportListener" />
</listeners>

<test verbose="2" name="IPHONE_6SPLUS : Parallel Tests">
<parameter name="device" value="IPHONE_6SPLUS" />
<parameter name="deviceOS" value="iOS" />
<classes>
<!-- ALL INSTALL TESTS -->
<class name="my.tests.Install" />
<class name="my.tests.Class1_tests" />
<class name="my.tests.Class2_tests" />
<class name="my.tests.Class3_tests" />
<class name="my.tests.Class4_tests" />
<class name="my.tests.Class5_tests" />
</classes>
</test>

<test verbose="2" name="IPHONE_SE : Parallel Tests">
<parameter name="device" value="IPHONE_SE" />
<parameter name="deviceOS" value="iOS" />
<classes>
<!-- ALL INSTALL TESTS -->
<class name="my.tests.Install" />
<class name="my.tests.Class1_tests" />
<class name="my.tests.Class2_tests" />
<class name="my.tests.Class3_tests" />
<class name="my.tests.Class4_tests" />
<class name="my.tests.Class5_tests" />
</classes>
</test>

</suite> <!-- Suite -->

--
You received this message because you are subscribed to the Google Groups "testng-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].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-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].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.