Forum Discussion
M_McDonald
14 years agoSuper Contributor
You could try putting the file contents into the run context. In the test case Setup script put this:
This loads the file when running the test case normally. Now in the load test Setup script put this:
Then in your requests, refer to the file contents this way:
Each thread will still have to construct the request with the full text but this avoids loading the file load on every execution and having multiple copies of a property with the same contents.
// this gets the appropriate context depending if we are in a load test or not
def ctx = context.LoadTestContext ?: context
if (!ctx['myFileContents']) {
// if the file has not already been loaded, do so
ctx['myFileContents'] = new File('c:/test/test.txt').text
}
This loads the file when running the test case normally. Now in the load test Setup script put this:
context['myFileContents'] = new File('c:/test/test.txt').textThen in your requests, refer to the file contents this way:
${=(context.LoadTestContext ?: context)['myFileContents']}Each thread will still have to construct the request with the full text but this avoids loading the file load on every execution and having multiple copies of a property with the same contents.