How to pass data stored in excel sheet as parameters under @Parameter in junit selenium?

June 19, 2017, at 02:22 AM

I have around 10 userIds which are pure numbers stored in a excel sheet and am using getUserIds() method to read input file. I want to pass them as Parameters under @Parameters instead of passing individual user ids which also i've tried but commented below. And those user ids have to passed for same testMethod(). Can anyone help me here?

public class PlansClass{
private String userId;
static File file = new File("url.xlsx");
public static Collection<Object> testData() throws Exception {
    return Arrays.asList(ReadExcel.getUserIds(file));
    //return Arrays.
public static Collection<Object> testData(){
    return Arrays.asList(111, 222);
public PlansClass(String userID) {
  this.userID= userID;

public void before() throws Exception {
    MainApp main= new MainApp(driver, "http://launchUrl");
    main.login("q12345", "Selenium");
        //for (String clientID : ReadExcel.getClientIds(file)) {
            int clientData = Integer.parseInt(userId);
            main.launchApplication("Web Application");

public void testMethod(){
try {
    List<String> userNameList = new ArrayList<String>();
    userNameList = baseApp.getUserName();
    System.out.println(userNameList );
} catch (Exception e) {

public class ReadExcel{
public static List<String> getUserIds(File file) throws IOException{
List<String> userIdList = new ArrayList<String>();
FileInputStream inputStream = new FileInputStream(file);
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet workSheet = workbook.getSheetAt(0);
Iterator<Row> rowIterator = workSheet.iterator();
while (rowIterator.hasNext()) {
                Row row = (Row);
                Iterator<Cell> cellIterator = ((Iterable<Cell>) row).iterator();
                while (cellIterator.hasNext()) {
                                Cell cell =;
return userIdList;
Out Of Memory when selecting images from phone storage

Out Of Memory when selecting images from phone storage

I am creating an app in which you store information about clients in your phoneI also store bitmap locations to a database that when loaded are thumbnail size in a gridView when viewing the clients information like so

Always Round UP a Double

Always Round UP a Double

How could I always round UP a double to an int, and never round it downI know of Math

Attribute getting removed after render

Attribute getting removed after render

I am creating a maze solver with a front end solution

Make GridBagLayout JPanel size to contents, not container?

Make GridBagLayout JPanel size to contents, not container?

I have a GridBagLayout JPanel contained within a Box contained within a JTabbedPaneI want the GridBagLayout to size itself to its internal grid