Parameter passing from Property file


Reading file from Property file

       

public class ReadingFiles {
 String Fistname;
 String Lastname;
 String Age;
  
 static Properties jd= new Properties();
 
 public static void main(String args[]) throws IOException
 {
  ReadingFiles readFile=new ReadingFiles();
  readFile.readPropertyFile();
  
 }
 public void readPropertyFile() throws IOException
 {
  InputStream journeyD= new FileInputStream("F:/eclipse/Practice/BookWriting/TestFiles.properties");
  jd.load(journeyD);
  
  Fistname=jd.getProperty("Name");
  Lastname=jd.getProperty("LastName");
  Age=jd.getProperty("Age");
  
  System.out.println("Fistname:-"+" "+Fistname+"\n"+"Lastname:-"+Lastname+"\n"+"Age:-"+Age);
 }
}


 

Property file-
















Output-











No comments:

Post a Comment

Software Testing Automation Guide

  get methods in Selenium Webdriver Below are the list of get methods that can be use with driver. Get()- This com...