Is an automation tester supposed to know concepts of OOPS and design patterns to write Tests in a way where changes & code re-use are possible?For example, I pick up Java to write cucumber step definitions that instruct a selenium webdriver.Should I be using a lot of inheritance, interfaces, delegation etc. to make life easier or would that be overly complicated for something that should just line by line instructions?
Should selenium tests be written in imperative style?
java;bdd;selenium;cucumber
Test code is code that needs to be read, executed and maintained, just like production code, so it should be subjected to the same standards as production code. Just use inheritance, interfaces, whatnot, where it makes sense and where it helps you build a maintainable selenium script.P.S.: the PageObject is a commonly used pattern for Selenium, where you create a class that exposes the buttons, fields, etc. of a page as properties and methods of a class. See PageObjects for more.