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:

  1. inject credentials directly url - in case of jmeter "path" input field like:

    http://username:password@host.domain/path 

    basic auth 1 - credentials in url

  2. 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)); 

    beanshell preprocessor - authentication

you shouldn't receiving 401 codes anywhere anymore.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -