Use Beanshell Sample to close the CSV file because it has been used by the first user. So when the second user access that CSV file it causes an error . Therefore, close the CSV file immediately after exiting the While loop.

import org.apache.jmeter.services.FileServer;
FileServer.getFileServer().closeFile("${testPlanFileDir}${__BeanShell(File.separator,)}adminApprovalSettings.csv");
vars.put("iterationApprovalLSettings", "");

In the HTTP Request. Use BeanShell Assertion which will assert based on user type.

if("${users}".equals("SuperAdmin"))
{
    if (ResponseCode.equals ("${response}") == true )
        {
        Failure= false ;
        prev.setResponseOK();
        }

        else 
        {
        Failure=true ;
        FailureMessage ="Response code was not, " +${response} + "it was"  + ResponseCode + "." ;
        }
}

else
{
    if (ResponseCode.equals ("403") == true )
        {
        Failure= false ;
        prev.setResponseOK();
        }

        else 
        {
        Failure=true ;
        FailureMessage ="Response code was not 403, it was " + ResponseCode + "." ;
        }
}

enter image description here

enter image description here

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top