January 2018
Beginner to intermediate
354 pages
7h 59m
English
Log files are also used frequently in testing to verify entries in server logs, application logs, and browser logs. Static utility methods can be built to extract log data as well. Here is a simple example:
/** * extractData_LOG - method to extract Log file data for use in testing * * @param logFile - the logfile to read * @return List<String> * @throws Exception */public static List<String> extractData_LOG(String logFile) throws IOException { List<String> rows = new ArrayList<String>(); BufferedReader reader = new BufferedReader(new FileReader(logFile)); String line = ""; while ( (line = reader.readLine()) != null ) { rows.add(line); } reader.close(); return rows;}
/** * writeFile - method to stuff a row entry into a file * * ...
Read now
Unlock full access