I have a Property file called test.properties
in C:\Test\
Directory.
In the Property file i have property ID and Property values as follows:
TestID=Test1,Test2,Test3,Tes4 upto 10
By using Java code how can i pick any 5 random values from the property file and then need to verify the those values are available in the FE.
I'm beginner of Java please help me with some sample code
The code which i have tried as follows:
@Test()
public void test() throws Exception{
Properties APPTEXT = new Properties();
Log.info("Getting Input from the Property file");
FileInputStream fs = new FileInputStream("C:\\FilterSection\\dropdown.properties");
APPTEXT.load(fs);
System.out.println ("" +APPTEXT);
Log.info("1. Verifying the Test drop down values are matching in both property file and UI");
String[] expectedDropDownItemsInArray = APPTEXT.getProperty("TestId").trim().split(",");
Random r = new Random();
//System.out.println(expectedDropDownItemsInArray.length);
ArrayList<String> expectedDropDownItems = new ArrayList<String>();
for(int i=0; i<expectedDropDownItemsInArray.length; i++)
expectedDropDownItems.add(expectedDropDownItemsInArray[i]);
System.out.println(expectedDropDownItems+"" );
Thread.sleep(6000);