Best practice advice: should each test case login to app before execution?


I am quite new to UI automation and I’m wondering if our current approach is getting isolation of a test at the expense of running time.

  1. Our web application requires login credentials (username and password) to access the app at a specific test company the user belongs to.
  2. We have test cases that perform and validate the most important user flows when logged in. The test cases work just fine.
  3. Each test case starts with logging in the application (same login steps are repeated, they are identical). The idea is that if the login would be a separate test, tests would need to be run in a specific order where the login test must be first and the browser must never be closed / and any test can’t run individually. Obviously if the login isn’t working, the end result would be the same = all tests failing anyway.

Question: what is the best practice for applications that need login credentials in TestProject or in general? should each case start with login or perhaps think of some other approach?

I appreciate all views and answers!

Hi @Wilho.

A good approach would be adding the login test as a step in the flow test.
To achieve that, you can open the flow test and click here:

Let me know if you need any help :slight_smile:

1 Like

Hi @Ricardo.Caster

Didn’t expect an answer so fast :slight_smile:

Thank you for the detailed advice. I understand now that it is possible to create the login as a test and reuse that test as a step in tests where it is required.

I tested it and it works perfectly! Big thanks, case solved.

Always welcome, @Wilho !

Happy to help :slight_smile:
Feel free to contact us anytime.

This topic was automatically closed after 5 days. New replies are no longer allowed.