cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically changing Datasource file

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
Super Contributor

Re: Dynamically changing Datasource file

Any suggestion / updates on this issue ?
Highlighted
Super Contributor

Re: Dynamically changing Datasource file

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
Super Contributor

Re: Dynamically changing Datasource file

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
Super Contributor

Re: Dynamically changing Datasource file

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
Super Contributor

Re: Dynamically changing Datasource file

Thanks for you help Ole. This works perfectly now.
New Here?
Join us and watch the welcome video:
Final Interview in the Series
API_testing_mistake#7
Top Kudoed Authors