Forum Discussion

Sobana's avatar
Occasional Contributor
7 years ago

Is there any way to fetch my xml file from my local in a sequential manner

I am fetching my xml requests from my local using groovy script and getting responses.

And i am using property transfer to JDBC request for validation.


But the requests are not fetched in the sequential manner. I want to fetch my xml file based on the name.







If i am having these 3 xmls in my local, then i need my script to fetch req1.xml first, then req2.xml and so on...


Is there any way to do this?

1 Reply

  • avidCoder's avatar
    Super Contributor

    You can handle this using File in java. Go through this code:-


    //Use File Counter to increase file count and set it at testCase level:-
    fileCtr = Integer.parseInt(fileCtr) + 1
    //It will read the file in String
    File resFolder = new File(path_of_folder_where_files_resides)
    File[] listOfFiles = resFolder.listFiles();
    File fOut = listOfFiles[Integer.parseInt(fileCtr)];
    String res = FileUtils.readFileToString(fOut) res

    Hope, it helps you out.