Hi,
I'm having a problems with updating a hosts file during my test run and
making an http request.
Here is and example of the scenario
1)
update hosts file to (ip1 is a working ip which should resolve correctly):
ip1 test_domain
2) make an http request with test_domain, which resolves to the ip1 and
returns expected results string
3)
update hosts file to (ip2 is a non-working ip which should not resolve or
return anything):
ip2 test_domain
4) make an http request with test_domain, this request also returns the same
results as step 2 which leads me to believe that somewhere jmeter caches the
hosts during startup?
At all phases of the test the hosts file is guaranteed to have only one entry
"ip1 test_domain" or "ip2 test_domain"
I use beanshell to write a new entry to my hosts file:
====================================
String pattern = "123.123.123 test_domain";
String fileName = "C:\WINDOWS\\system32\\drivers\\etc\\hosts";
try {
BufferedWriter out = new BufferedWriter(new FileWriter(fileName));
out.write(pattern);
out.close();
} catch (Exception e) {
System.out.println(e);
}
====================================
The http request is made with an http request sampler which is a get type
request (keep alive and redirect boxes are not checked)
I also tried using httpclient sampler with no success.
What can i do to have jmeter pickup the hosts change during runtime and only
during startup?
Thanks,
Ken
---------------------------------
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.