RE: Implement global variable for Testcase number to execute from excel.

I am using Selenium webdriver with Testng for automation with data driven module where i am reading the testcases data from excel. I have hard coded the row numbers for each test case . If i want to add any cases in the middle again i have to change the numbering of all the cases. So how can i solve this issue.

mallik9292 Train Asked on October 28, 2014 in Selenium WebDriver.
Add Comment
5 Answers

Hi Lakshay,

Thanks for the reply… I am very new to java and selenium so i am trying to learn . I am using the below function

//Function to validate the Logo on Dashboard
public static WebElement lnk_Home_Logo(WebDriver driver) throws Exception{

 

  in a separate class. But  sTestcasename varible is in  Excelutils. So i am not able to acces the sTestcasename variable in this method


//Function to validate the Logo on Dashboard
public static WebElement lnk_Home_Logo(WebDriver driver) throws Exception{
int iTestCaseRow = ExcelUtils.getRowContains(sTestCaseName,Constant.Col_TestCaseName);
Log.startTestCase(ExcelUtils.getCellData(iTestCaseRow, Constant.Col_XXXX));

//Function to validate the Logo on Dashboard

public static WebElement lnk_Home_Logo(WebDriver driver) throws Exception{
int iTestCaseRow = ExcelUtils.getRowContains(Excelutils.sTestCaseName,Constant.Col_TestCaseName);
Log.startTestCase(ExcelUtils.getCellData(iTestCaseRow, Constant.Col_XXXX));

 

if i try using Excelutils.sTestCaseName  where i am declaring this variable in Excelutils class it doesnt give any error but its giving me null value.

Please help on this

Train Answered on October 29, 2014.

Hi Mallik,

I would not be able to do any more help in this, please get in touch with any developer in your team and ask him to debug the code for you to get the right error, it seems you are not providing right col & row to your Excel methods and it is hard to comment without debugging the code.

But still I would suggest you to go through the complete Automation Framework chapters on ToolsQA, hopefully you will be able to resolve your problem. But please go through all the chapters with implementing the code given on the chapters.

Regards,
Lakshay Sharma

on October 29, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.