testRigor Locators
What is testRigor locator?
testRigor locator is a way to describe finding elements from an end-user’s perspective. You, as a human, can rely on a human’s way of referring to elements like sections, relative locations, tables, etc.
enter "Peter" into "First Name" in "From" section
check that table at the row containing stored value "generatedId" and column "Status" contains "Processed"
This is a radically different way to refer to elements compared to traditional ways like XPath and CSS Selectors. And it reflects end-user’s way of doing it.
Why testRigor locator is better than XPath and CSS Selector?
It is better because it does not rely on details of implementation. And, therefore, would require orders of magnitude less test maintenance compared to anything that uses anything related to how page/screen is coded. You won’t need to change your tests if there is a new rendering library or it now looks different.
But what about id/data-test-id?
Both id
and data-test-id
attributes are still details of implementation. Engineers might not always have the bandwidth or even a way to set these parameters. And if they do, there are no guarantees that they won’t change in the future.
Think about migrating from Angular to React or using a responsive library to render tables vs coding tables with tr/td
format. You can read more about testing tables in how to automate testing tables and in how to test tables documentation.
Where do I use testRigor locators?
You can use testRigor locators in testRigor. And, great news, it is absolutely free!
You can find more information about testRigor locators in the documentation here.