public class ReadTextFile {
@Test
public void readtext() throws IOException
{
//Specify the location where to read the data from text file
String text="D:\\testexp1.txt";
// Creating File reader class pass the variable to file reader
FileReader fr=new FileReader(text);
//Bufferedreader is used to store all characters one by one
BufferedReader br=new BufferedReader(fr);
String content="";
//loop will continue until no data found
while((content=br.readLine())!=null)
{
System.out.println(content);
}
}
}
Output:
This is selenium
Webdriver
PASSED: readtext
No comments:
Post a Comment