cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically changing Datasource file

Highlighted
Super Contributor

Dynamically changing Datasource file

Hello,
I am running a load test with 5 threads. I have 5 external text files Which contain data for my requests.

I want thread0 to access file0.txt, thread1 to access file1.txt ... and so on. Is it possible to write some groovy script before the datasource step that will modify the File location for each thread's context so that the datasource in thread0 will be c:\...\file0.txt etc etc

Thanks

Ali
5 REPLIES 5
Highlighted
Super Contributor

Any suggestion / updates on this issue ?
Highlighted
Super Contributor

Hi Ali,

sorry for the delayed replay.. have you tried setting the filename to something like

c:\data\file${context.ThreadIndex}.txt

?

regards,

/Ole
eviware.com
Highlighted
Super Contributor

Ole,
This does not seems to work. I get the following error.

Test failed [java.io.FileNotFoundException: C:\Workspace\QA\Automation\soapUI_Scripts\Phase2\DataFiles\Email${context.ThreadIndex}.txt (The system cannot find the file specified)], time taken = 1006
Highlighted
Super Contributor

Sorry Ali, my fault.. it should have been just

c:\data\file${ThreadIndex}.txt

but I also found a bug so that the above will only work when running the entire TestCase and not when running with the "Test" button in the DataSource window.. will be fixed in the next snapshot..

regards!

/Ole
eviware.com
Highlighted
Super Contributor

Thanks for you help Ole. This works perfectly now.
New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Want a fun and easy way to learn ReadyAPI and show off your skills? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Get a full Raw JMS request

Participate!

Compare an expected JSON value and actual response in Events

Participate!

Fetch value/data from JSON response using Groovy Script

See replies!

Get data from Petstore and add it to Excel sheets

Participate!
Top Kudoed Authors