In Hybrid Framework , XLS object of XLS_READER file is getting null value when second @Test method executed . | Selenium Training|Java|WebDriver|TestNG|Frameworks|Videos
30% Mid August Discount Avail now

Selenium Training Forum

In Hybrid Framework , XLS object of XLS_READER file is getting null value when second @Test method executed .

S
suhail.itm Post 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>

S

Instructor

Support Team Reply on 05/07/2019

Did you try debugging the code?

 

S
suhail.itm Reply 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 .

S

Instructor

Support Team Reply on 05/07/2019

Which module are you referring to?

S
suhail.itm Reply on 06/07/2019

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

S

Instructor

Support Team Reply on 08/07/2019

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