I have written a POM for test automation of a web UI using Selenium Webdriver using java.
In the POM, I have created a repository of methods of all the page fields. Basically the web page has more than 100 fields. So I am using an excel sheet for data with the help of apache poi.
The problem is, I want to call all the method in the test script and that particular method should be executed only if the excel sheet has data for that method. I am a beginner to coding so please help with this.
(I am reading the data from the excel sheet using column name and the excel template has a column for all the 100+ fields.)
Now I need to write test script for each test cases. But I want my program to run depending on the data from the excel sheet, ignoring the method for which there is no data in the excel sheet.
Below is a similar example. I have two classes POM and TestCase.
public class POM(){
public method1(String a){
sop("1st method"+a)
}
public method2(String a){
sop("2nd Method"+a)
}
public method2(String a){
sop("3rd Method"+a)
}
}
Below is the test case class, which will call the methods of class POM. The data for the methods is provided by excel file.
public class TestCase(){
main(){
POM obj = new POM();
obj.method1(poi.getDataFromExcel("column name", row_number));
obj.method2(poi.getDataFromExcel("column name", row_number));
obj.method3(poi.getDataFromExcel("column name", row_number));
}
}
So now again my question is, I don't have any data for method2 in my excel sheet. How can I skip that method?