Forum Discussion

SPC's avatar
SPC
Occasional Visitor
3 years ago

How to avoid logging in for every UI Test

Hi, 

 

I need help in figuring out how to avoid having every UI Test go through login. Let me setup the real world picture. Our application is built for police records clerks. They work in shifts. So a user will typically login at the beginning of their shift  and remain logged in for several hours, doing many different tasks/actions while logged in. And then they will eventually log out.  How do I replicate this type of behavior via the recorded UI Tests of LoadNinja?

 

The reason I ask is because the only examples I can find show a basic commercial type website where a user logs in, makes a purchase, and logs out. And the entire series of steps being in one recorded UI Test. If I make the recordings this way, as in, login, perform an action, and logout,  there is so much logging in and out going on it puts an unrealistic load on our server that doesn't happen in the real world. 

 

What I want to have happen is User A logs in via UI Test 1 (and that's the only thing that test does, login). Then have that same user go execute UI Test 2 (without having to go through login again). Then the user executes UI Test 3, and so on, etc. Then the very last thing the user would execute would be a UI Test for logging out. 

 

The problem is that as soon as I put our URL into the LoadNinja recorder it takes me to the login screen of our application because it is an entirely new session. 

 

So 2 questions:

1) How can a make a recording without going through login every time?

2) How can I have one user execute multiple UI Tests while still in the same session?

 

Thanks,

Steve

  • Hi Steve,

     

    During a load test, LoadNinja starts a new session for each iteration and no data can be passed to further tests or iterations. 

     

    A workaround I can think of is to add request headers when creating the script or after creating the script to pass data to the script so you do not have to log into the application, but I am not sure if this is possible with the application you want to test.

     

    You can also use a direct URL mapped to a databank to navigate each user to a URL that will navigate to the logged-in page. 

     

    Greetings,

    Tomasz