Not running some action every time during the test

Hi Team,

The challenge I face. On an E2E workflow, I need to perform the below actions.
User login → perform few action → logout

When I run the test login and logout running every iteration, I don’t want to run login and logout every time. Instead, run login at the first time only and perform the other actions on several iterations, and logout(tear down) at last. The challenge I face is login flow change based on the workflow I’m running. How to handle the situation.

@Tom @nicole

here is how I do it. This is a very common approach if you just want to open multiple login sessions with just one user credentials. Login with user and grab auth token and save it in a variable. return this variable from setup() utilise it in default function to execute actions. Once it is done, logout in teardown.

1 Like

@aakash.gupta Thanks for the response. Is the setup and teardown approach applied to individual VUsers or the test?

If it’s applied to Vuser, my use case was scenario 01 uses the user x, but scenario 02 uses user y. How to handle it on the setup?

applies to test. VUs don’t loop through setup() or teardown(), only through the default or named functions

1 Like