3

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?

3 Answers 3

3

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.

3

There is no "should". Testing is a tool. It's like asking "Should an artist always use oil-based paint". The answer is (of course!) "it depends".

The goal of tests are to a) test the product, and b) be well engineered. You can write well-engineered tests in many styles. Your team should do what is most compatible with their skills.

1
  • 1
    This made me smile, since the original intent of using "should" in BDD was to invite exactly this kind of question and consideration of context. True, though. :) dannorth.net/introducing-bdd Commented Nov 17, 2013 at 1:18
0

This decision depends on the kind of testing you would want to do , for instance you will test the project once and forget about it .In such scenarios , using a design pattern such as Page Objects does not make a sense. But if the aim is to build a regression library that would need maintenance and a need for adding additional tests that project then it makes perfect sense to use a solid design. A good design is also useful when you want to test continious integration builds.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.