public class CsvReader extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ACTION_KEY |
static String |
OPTION_RUN_COUNT |
static int |
SERVICE_CSV_COLUMN_COUNT |
static String |
SERVICE_CSV_DATAPROVIDER_COUNT |
static String |
SERVICE_CSV_FILE_PREFIX |
static String |
SERVICE_CSV_INCLUDE_SUB_DIR |
static String |
SERVICE_CSV_SEPARATOR |
static int |
SERVICE_CSV_VISIBLE_COLUMN_COUNT |
static String |
SERVICE_EXCLUDE_LIST |
static String |
SERVICE_INCLUDE_LIST |
static String |
SERVICE_RUN_COUNT |
static String |
SERVICE_RUN_CURRENT_COUNT |
static String |
SERVICE_RUN_PREFIX |
static String |
SERVICE_STEP_PREFIX |
| Constructor and Description |
|---|
CsvReader() |
| Modifier and Type | Method and Description |
|---|---|
static List<Object[]> |
addActionCsvTests(List<Object[]> csvList)
update csv test list with tests from action csv files
eg.
|
static void |
detectDuplicateTests(List<Object[]> testCaseList)
print out warning for duplicated test names
|
static void |
evaluateOption(ServiceObject serviceObject)
set run count for individual test case
|
static ArrayList<File> |
filterTests() |
static void |
getAllKeywords()
gets all keywords And stores them in apiMap in testObject
|
static void |
getAllTestCases(String testPath,
String prefix)
gets all test cases from testcase path based on prefix
|
static int |
getColumnIndexByName(String column,
String[] row)
gets column name by the column name
|
static int |
getCsvFileCount() |
static String |
getCsvFileFromIndex(int index)
returns current csv test file
|
static int |
getCsvFileIndex(String fileName)
returns the index of the file from the list of csv files
|
static int |
getCsvFileIndex(String csvDir,
String fileName)
returns the index of the file from the list of csv files
|
static ArrayList<File> |
getCsvFileList(String csvTestPath)
returns a list of all csv test files
|
static int |
getCsvTestcount()
get the number of tests in csv file
|
static List<Object[]> |
getCsvTestList(File file)
reads csv file and returns the list of rows
include and exclude tests
eg.
|
static List<Object[]> |
getCsvTestListForTestRunner(String csvFile)
gets csv tests list for service tests
|
static List<Object[]> |
getCsvTestListForTestRunner(String csvDir,
String csvInfo)
gets csv tests list for service tests
include and exclude tests
eg.
|
static int |
getCurrentTestInvocation()
gets csv file index does not increment When retry
|
static int |
getFileIndex(ArrayList<File> testCsvFileList,
String csvFile) |
static List<Object[]> |
getMatchingTestId(String[] testIds,
List<Object[]> testRows)
matches testIds with csv data rows TestId
|
static String[] |
getTestCaseIds(String testFileInfo)
gets a list of test case ids from testFile:testcaseId info
Used for actions and test base
testcase ids separated by ","
format: testFile:testcaseId1,testcaseId2
|
static List<Object> |
getTestCasesFromCsvFile()
gets the tests from csv file based on the current test file index
|
static ArrayList<File> |
getTestDataCsvFileList()
returns a list of all csv test files
|
static String |
getTestname(String fullTestname)
get test name without test step identifier
|
static Map<String,List<Object[]>> |
getTestStepMap(List<Object[]> csvList)
get map of test cases with test steps
removes test step prefix from test case id
|
static boolean |
isRunningServiceTest() |
static boolean |
isValidTestFileType(String filename)
returns if file is valid service test type
|
static Map<String,ServiceObject> |
mapToApiObject(List<Object[]> testCases)
maps list of test cases to service object map
|
static ServiceObject |
mapToServiceObject(Object[] testData)
test data array to service object
|
static com.opencsv.CSVReader |
readCsvFile(File file) |
static int |
setTestRangeIndex()
sets the index of the file specified in include and exclude tests
|
static List<Object[]> |
setTestRerun(List<Object[]> testCaseList)
set test cases based on run count
|
static List<Object[]> |
setTestSteps(List<Object[]> csvList,
Map<String,List<Object[]>> testStepMap)
update test cases base on test steps (combining test steps with _step#number postfix.
|
static List<Object[]> |
updateCsvFileFromFile(List<Object[]> csvList,
String csvFileName,
Map<String,List<Object[]>> testStepMap)
update csv test list with additional meta data (csv file name, test index, service type, test count)
if test case is set then single test is returned
|
public static int SERVICE_CSV_COLUMN_COUNT
public static int SERVICE_CSV_VISIBLE_COLUMN_COUNT
public static String SERVICE_CSV_FILE_PREFIX
public static final String ACTION_KEY
public static final String SERVICE_CSV_SEPARATOR
public static final String SERVICE_CSV_DATAPROVIDER_COUNT
public static final String SERVICE_CSV_INCLUDE_SUB_DIR
public static final String SERVICE_INCLUDE_LIST
public static final String SERVICE_EXCLUDE_LIST
public static final String OPTION_RUN_COUNT
public static final String SERVICE_RUN_COUNT
public static final String SERVICE_RUN_CURRENT_COUNT
public static final String SERVICE_RUN_PREFIX
public static final String SERVICE_STEP_PREFIX
public static List<Object> getTestCasesFromCsvFile()
public static int setTestRangeIndex()
index - public static void detectDuplicateTests(List<Object[]> testCaseList)
testCaseList - public static List<Object[]> setTestSteps(List<Object[]> csvList, Map<String,List<Object[]>> testStepMap)
testCaseList - public static String getTestname(String fullTestname)
csvRow - public static Map<String,List<Object[]>> getTestStepMap(List<Object[]> csvList)
csvList - public static List<Object[]> setTestRerun(List<Object[]> testCaseList)
testCaseList - public static List<Object[]> updateCsvFileFromFile(List<Object[]> csvList, String csvFileName, Map<String,List<Object[]>> testStepMap)
csvList - csvFileName - testCaseFile - public static List<Object[]> addActionCsvTests(List<Object[]> csvList)
testData - public static String[] getTestCaseIds(String testFileInfo)
testFileInfo - public static List<Object[]> getMatchingTestId(String[] testIds, List<Object[]> testRows)
testIds - testRows - public static Map<String,ServiceObject> mapToApiObject(List<Object[]> testCases)
testCases - public static ServiceObject mapToServiceObject(Object[] testData)
testData - public static void getAllTestCases(String testPath, String prefix)
public static void getAllKeywords()
public static int getCurrentTestInvocation()
public static boolean isRunningServiceTest()
public static String getCsvFileFromIndex(int index)
public static int getCsvFileCount()
public static ArrayList<File> getTestDataCsvFileList()
public static ArrayList<File> getCsvFileList(String csvTestPath)
csvTestPath: - full path to csv directorypublic static int getCsvFileIndex(String fileName)
fileName - public static int getCsvFileIndex(String csvDir, String fileName)
fileName - public static List<Object[]> getCsvTestListForTestRunner(String csvFile)
csvFile - public static List<Object[]> getCsvTestListForTestRunner(String csvDir, String csvInfo)
csvInfo - public static List<Object[]> getCsvTestList(File file)
file - public static com.opencsv.CSVReader readCsvFile(File file)
public static int getColumnIndexByName(String column, String[] row)
column: - column namerow: - header rowpublic static int getCsvTestcount()
public static boolean isValidTestFileType(String filename)
filename - public static void evaluateOption(ServiceObject serviceObject)
serviceObject - Copyright © 2022. All rights reserved.