Jmeter test with keystore works only for the first iteration of the loop

I created a simple test where user logs in to the system using OpenAm and then logs out. I put my thread group to work in a loop and for the first iteration it works properly. But when it goes to the next iteration, my test fails, because someone else was trying to log in and of course he can't.

I have 15 user certificates and created .jks file based on them. User names are e.g. "hperfteste001" and so on. I configured 'Keystore Configuration' config element and provided path and password in system.properties file

enter image description here

I added Cache Manager and Cookie Manager, where I checked Clear cookies each iteration? checkbox I also added lines (I was trying various values with them, but didn't help):

https.use.cached.ssl.context=false

CookieManager.check.cookies=false

I ran the test for 5 users in two loops enter image description here

As you see, the first iteration works and proper user logs in. Here is the response message:

enter image description here

but in the next iteration test fails because it didn't pass the assertions. Some 'Guest' user was trying to logged in and also this login attempt was re-directed to different page, than the one in first iteration. Here is the response message:

enter image description here

But in the debug sampler I see that proper alias was read and I have certificate with such alias

enter image description here

enter image description here

It happens after first iteration of the loop and it doesn't matter for how many users I run this test. I would really appreciate it if someone could help me, because I have no idea what is going on.

1 answer

  • answered 2021-06-10 12:26 Dmitri T

    Sounds like there is no certificate with alias of hp7 in the keystore, you can check all certificates as:

    keytool -v -list -keystore /path/to/your/keystore
    

    or try getting the certificate with hp7 alias:

    keytool -list -keystore /path/to/your/keystore -alias hp7
    

    if you get keytool error: java.lang.Exception: Alias does not exist it means that there is no such an alias in the keystore and you need to re-visit the way you created it.

    More information: keytool utility

    If you have problems with command-line tools you can consider using Keystore Explorer which provides simple GUI interface to managing keys and certificates.

    You may also find How to Use Multiple Certificates When Load Testing Secure Websites article useful