The core of every automation project should include the principle that duplication of anything should not happen at any cost whether it's a duplication of code or data or for that matter anything in fact.
Take this example (see pic 1), where we need to execute every method say 5 times each- we all know that it is easily achievable through the TestNG invocation count attribute of the Test annotation. Plus, we want all tests to be re-tried on failure so we can add one more attribute of Test annotation of TestNG i.e. retry analyzer.
I truly believe this is a case of duplication where each method @Test annotation is using 2 attributes: invocation count and retry analyzer.
Did you know that TestNG allows annotations to be used at the test class level to fix this duplication issue? I agree that it's not required always at class level but in case you need it, please follow.
Here, the methods do not have any annotation or attributes because it's getting inherit from the class.
In this case (see pic 2), when you execute the Example class, all its tests run 5 times and are retried in case of any failure.
seleniumautomation testNG automationtesting easier tipsandtricks testing apiautomation avoidDuplication
What is an ARIA Snapshot in Playwright? An ARIA snapshot in Playwright is a structured representation of a page’s accessibility tree , which is used by assistive technologies (e.g., screen readers) to interpret the content of a web page. This snapshot helps verify if elements have the correct roles, names, and properties required for accessibility. Playwright provides the page.accessibility.snapshot() API to capture this accessibility tree at any given moment during test execution. How Does ARIA Work? ARIA ( Accessible Rich Internet Applications ) is a set of attributes that help improve accessibility by defining roles, states, and properties for elements that are not natively accessible. Example: In this case, the aria-label ensures that screen readers identify the button as “Submit Form.” How to Use ARIA Snapshots in Playwright? Playwright’s accessibility.snapshot() method retrieves the accessible structure of the page. Ex...


Comments
Post a Comment