Optimize your Automation Tests
Feb 28, 2023
Wait! Don’t Pause
It is better to wait for an element to appear rather than pausing for a set amount of time for a number of reasons:
Reliability: Pausing for an amount of time assumes that the element will always appear within that time frame. However, if the element takes longer to appear than expected, the test will fail even if there is no issue with the application. Waiting for an element ensures that the test will only proceed when the element is actually present, making the test more reliable.
Efficiency: Waiting for an element allows the test to continue as soon as the element is present, rather than waiting unnecessarily for a predetermined amount of time. This can save a significant amount of time. Minutes which can be used to provide even greater coverage.
Maintainability: If your application changes, in such a way that a once slow element now appears more quickly, tests that are designed to pause for a set amount of time will need to be updated. Waiting for an element ensures that the test will continue to work as expected and will automatically benefit from the faster load times.
“Stop on first fail”
Instructing tests to stop on the first fail can be a powerful optimization feature in software testing, but it should be used judiciously. Stopping tests on the first failure may help to save run minutes, but it can also result in missing other potential defects in the software. Ultimately, the decision of whether to stop testing on the first failure or not should be based on factors such as the severity of the issue, the impact on the system, and the goals of the testing effort. Careful consideration should be given to the potential risks and benefits before implementing this optimization feature.
Specific tests for Lighthouse
Lighthouse is an automated tool that audits the performance, accessibility, best practices, and SEO of web pages. It provides reports with insights and recommendations based on metrics and audits and generates a score that reflects the overall quality of the web page. It is widely used by developers and website owners to improve the user experience and DoesQA enables you to add these to your Flows in 2 simple ways.
Enabling lighthouse audits across your entire Flow can be achieved in Flow options. Doing this will generate a sharable report at the end of your test.
To use Lighthouse scores as quality gates you can integrate the provided Validation Nodes.
Both of these will increase the length of your tests and so creating a specific Flow, or Flows, which focus on Lighthouse auditing can help to optimise your pack.