login into application using jmeter api - couldn't login using jmeter API in java

时间:2016-10-19 13:33:52

标签: java jmeter http-post

login into the application using JMeter API - couldn't login using JMeter API in java...

While trying to login into a web application using JMeter API by POST Method, getting the response like "Username/Password mismatch" even though providing valid credentials. I have no idea how Username/Password arguments are being parsed to the application using POST method. Please find my below code...

    URLRewritingModifier sess = new URLRewritingModifier();
    sess.setArgumentName("ci_session");
    sess.setShouldCache(true);

    CookieManager cook = new CookieManager();
    cook.getClearEachIteration();

    HTTPSampler postmethod  = new HTTPSampler();
    postmethod.setDomain("Name of the application");
    postmethod.setPort(80);
    postmethod.setPath("path of the page we are loading")
    postmethod.setMethod("POST");
    HTTPArgument args = new HTTPArgument();
    args.setValue("[{ \"username\": \"valid username\",   \"password\": \"valid pwd"}]");
    postmethod.addTestElement(args );

Could anyone help me at this point............

0 个答案:

没有答案