DEV Community

Jesse Phillips
Jesse Phillips

Posted on

You're not Making Test Automation Mistakes

This topic comes up after reading

https://blog.testproject.io/2020/10/06/common-mistakes-in-test-automation/

I attempted to respond as a comment but it did not make it through review.

Namely I take issue with "Writing WebDriver API Methods in Tests/Page Objects" as being an issue.

The premise of the issue "Having WebDriver methods in tests is a really bad idea since if there are any changes in Selenium WebDrivers API or different versions of the library"

Wrapping your third party libraries can bring the expressed benefits, but I would claim that only happens when you can create an abstraction for your particular use. Let me put it another way.

The library writer is providing an API to control the inner workings. This API is going to expose all sorts of functionality. When writing a wrapping class two things are likely to happen, you expose all of the same functionality (possibly with the same function signatures) or you cut functionality and provide a simpler interface. You will not know how the public API for selenium will be broken so even your trimmed API could need to be modified to accommodate those changes.

An abstraction on the other hand relies not on the browser interaction but the application and that is what you page objects are providing.

Top comments (0)