com.seleniumtests.util.helper.CSVHelper Maven / Gradle / Ivy
/**
* Orignal work: Copyright 2015 www.seleniumtests.com
* Modified work: Copyright 2016 www.infotel.com
* Copyright 2017-2019 B.Hecquet
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.seleniumtests.util.helper;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import com.seleniumtests.core.Filter;
import com.seleniumtests.customexception.CustomSeleniumTestsException;
import com.seleniumtests.customexception.DatasetException;
import com.seleniumtests.util.logging.SeleniumRobotLogger;
public class CSVHelper {
private static Logger logger = SeleniumRobotLogger.getLogger(CSVHelper.class);
public static final String DOUBLE_QUOTE = "\"";
public static final String DELIM_CHAR = ",";
public static final String TAB_CHAR = " ";
private CSVHelper() {}
/**
* Reads data from csv formatted file. Keep csv file in the same folder as the test case class and specify class as
* this.getClass()
.
*
* @param clazz
* @param filename
* @param filter
* @param readHeaders
*
* @return
*
* @throws Exception
*/
public static Iterator
© 2015 - 2025 Weber Informatics LLC | Privacy Policy