In Hybrid Framework , XLS object of XLS_READER file is getting null value when second @Test method executed . | Selenium Forum
S
suhail.itm Posted on 04/07/2019

I have initilized XLS object in base class @BeforeTest annotation . It is getting null value in second @Test Annotation . i have executed the suite through testng.xml file which is mentioned below .

 

<?xml version="1.0" encoding="UTF-8"?>
<suite name="jet-Airways">
<test name="regression">
<classes>
<class name="com.framework.flightbooking.LoginTest"/>
<class name="com.framework.flightbooking.FlightTest"/>


</classes>

</test>
</suite>


A
Ashish Thakur Replied on 05/07/2019

Did you try debugging the code?

 


S
suhail.itm Replied on 05/07/2019

yes, i debug my code and found that methods of 1st class executed successfully  but when 2nd class method is executed it starts from @BeforeMethod , but xls object is initilized in @BeforeTest which is why xls is null . 

please advice where to initilize xls object .


A
Ashish Thakur Replied on 05/07/2019

Which module are you referring to?


S
suhail.itm Replied on 06/07/2019

Hybrid framework with TestNG. Creating basetest class . Where we initilize xls inside @BeforeTest annotation.


A
Ashish Thakur Replied on 08/07/2019

You can try initializing your XLSReader in before Method as well.