[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/

[Tip] Practical Examples of Shift Left in Software Testing

Shift Left is a buzzword in Software Testing. It is not new, in fact it has always been around. Shift left is all about creating a culture where testers can be involved early in the software development life cycle to start testing activities early. Idea is to reduce the risks.

Perhaps inspired by the maxim, “a stitch in time saves nine”, Shift Left is a practical attempt to actually ensure a timely stitch; to check for errors in the software testing process earlier than the conventional time to do so.  Shift Left testing means testing earlier in the software development cycle, so that risks and unknowns can be reduced which enables smooth deliveries to the clients.

Few Examples of Shift Left:

  • Pair with the developers – More Collaboration and brainstorming on the requirements / test scenarios with the Team (including Devs and PO) so that unknowns and risks can be discovered earlier in the phase. Both Devs and QEs will have the same understanding on the requirements.
    • Rework (Issue fixing & retesting) will be less.
    • Scope creep will be less.
  • Test different layers – In SOA applications, APIs are developed first. Team should plan the API testing so that issues can be identified early in the cycle (rather than just testing from the UI).
  • Plan Non-functional Testing early in the cycle (Performance Testing, Security Testing etc) – Identifies issues early and reduces the risks.
  • Automate the “Automation Test Case Execution” – Integrate the automation scripts with Jenkins/any Build automation tools that automation scripts should run in CI region before the new code deployment. It will help in ensuring that new code change is safe or not.
  • Automate Unit Tests, Integration tests, API Tests – These tests runs faster and help in identifying the defects early in the cycle.