performance testing - How to test with jMeter against basic auth protected domain? -
i running staging cluster of apache/nginx webservers domain has basic authentication restricted access. goal test performance of cluster jmeter.
in order pass authentication have added http authentication controler of jmeter. works, every request shows 2 logentries @ apache. 1 200 , 1 401. normal behavior of first request user must authenticated. unfortunatelly, jmeter on every request.
how can make sure each thread/user requests access once. or better, how grant jmeter access without every user needing authenticat. believe impact test results.
thank hint on this.
it sounds jmeter bug given proper "authorization" header provided there shouldn't www-authenticate challenge. if file via jmeter bugzilla or flag via jmeter users mailing list great
in meantime can work around using 1 of following approaches:
inject credentials directly url - in case of jmeter "path" input field like:
http://username:password@host.domain/path
use beanshell scripting construct proper "authorization" header on-the-fly. in order so:
- make sure http header manager present. if not - add on test plan level or child of http request needs authenticated
- add beanshell preprocessor child of http request needs authenticated
- provide username , password separated space via "parameters" input
put following code preprocessor's "script" area
import org.apache.jmeter.protocol.http.util.base64encoder; import org.apache.jmeter.protocol.http.control.header; string encodedcredentials = base64encoder.encode(bsh.args[0] + ":" + bsh.args[1]); sampler.getheadermanager().add(new header("authorization", "basic " + encodedcredentials));
you shouldn't receiving 401 codes anywhere anymore.
Comments
Post a Comment