For the framework our team is building, we are required to make a text file that we will edit before we run tests. That text file has two lines - the URL of our web application, and the location of an excel file that contains test cases.
Right now, for reading the file, I've been using Scanner
.
private static void readFile(String fileName) {
try {
File file = new File(fileName);
Scanner scanner = new Scanner(file);
while (scanner.hasNextLine()) {
System.out.println(scanner.nextLine());
}
scanner.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
My code lingo isn't the best so try to get what I'm asking:
Could someone point me in the right direction of extracting these two lines (the URL and the Excel path) from the text file, assigning them to two different variables/objects/functions/whatever you really want to call them, and than passing them into the main test script, so the test script knows what it wants to do.
I drew a picture in paint. Took 100 hours.