[Tip] How to Speed up the UI Automation tests?

When we ran our scenarios through the UI using Selenium it made our test suite slow.
What could you do to speed it up?

Often, the best way to speed up a UI test is to remove it, or rather, refactor it to a domain layer test that doesn’t go through the UI, but talks directly to the domain layer.
If you’re unable to do that, there are still things you can do to speed up UI tests. Start by
identifying what steps and hooks are slow.

Are you starting your web app in a Before hook for every scenario? Try starting your app only once, for all scenarios.

Are you launching a new browser for every scenario? Try reusing the browser instance.
Do your scenarios need to go through a lot of pages before you get to the UI you really want to test? Try to go directly to the page you need to test, and set up the data you need “underneath” the UI.

Many of these optimisations introduce a new problem – you might have state leaking between scenarios. When state leaks between scenarios they might pass when run in a certain order, but they might fail when run in a different order. This can make it very difficult and time consuming to fix failing scenarios. To avoid this we recommend you use Before hooks to explicitly clear state that might have been left over from the previous scenario.

Source/References: https://cucumber.io/

One Reply to “[Tip] How to Speed up the UI Automation tests?”

Comments are closed.