2

I am a novice in Selenium, need some advice.

As I understand, in Page Object, we must create a Java class for each page. In Keyword Driven Framework, we need to create a generic module, which based on input key perform an action based on the predefined rule(s).

My question is when we implement a keyword driven framework, is page object not an option anymore? Can a keyword driven framework and Page Object implementation co-exist?

sophros
  • 14,672
  • 11
  • 46
  • 75
Murko Agom
  • 29
  • 1
  • 2

5 Answers5

1

Yes they can coexists.

Whatever way you want to test I see Page Object as the foundation. It lower the maintainance cost a lot.

Keyword driven Framework is created as a higher abstraction layer so that non-technical easier understands the test case design. Such as a function named login explains that it will login. This login function then uses the Page Objects to create element calls.

So Page Object is only a lower level of abstraction to make it easier to create test cases.

http://www.ranorex.com/blog/keyword-driven-test-automation-framework

This link explains what keword driven is.

0

This is a sample keyword driven framework implemented in Selenium.

http://www.testautomationguru.com/keyword-driven-framework-for-localization-testing-using-selenium-webdriver/

It, kind of, does not make sense to use POM in the pure low level keyword driven framework. Because each and every element of the page and the corresponding action would be described in a spreadsheet.

If you are going for high level keyword driven or hybrid framework, then you can use POM.

Hybrid framework: http://www.testautomationguru.com/hybrid-test-automation-framework/

The above example is in QTP. But you will get the idea.

Page Object Design: http://www.testautomationguru.com/arquillian-graphene-page-fragments/

vins
  • 15,030
  • 3
  • 36
  • 47
0

Keyword driven will work based on abstraction of keywords in your classes. For simple example click, input, button, dropdown, radio button, check box etc are keywords and have to maintain individual functions in your class. For maintain these most of them uses excel, csv.

Ex: BaseClass contains all the operations of key words like public void input(String locatorType, String locatorValue) //here locator type would be of xpath, id, name, class, tag and respective value

Issues:- Today I want to go with signup and signin, Ok no probs. I prepared steps and ran successfully then tomorrow management want to execute only login functionality. How can we manage, can you rewrite the steps? Can i use any testing framework, may be ambiguity comes from excel input and testng! So is it preferable? NO because it is easy to see but hard to manage!

Now Page Object Model:- It's not a framework, its a design pattern or methodology. Here if you use any testing framework(testng) its easy to maintain your methods/operations. We can use datadrivern that make sense.

So based on your project and need we have to maintain and prepare framework and stick with that framework.

Praneeth
  • 1
  • 2
0

I have Keyword Driven, Hybrid and Page Object Modal.

Page Object Modal: It works well for the completed application. But if you are working on a agile then it is not suitable.. If the locator keeps on changing, every time you will get failure.. Consider that there is a cancel button on your sign in page and you are least bother about the change in cancel. if the locator changes for that then it will make you fail all the test case because every test case should come across login page only/.

Hybrid: Keyword+ POM:

It is a better choice. Because you keep every locator in a separate file and always you will look the locator whatever you need for that test case only.

ChanGan
  • 4,254
  • 11
  • 74
  • 135
0

I am not agree with statement "If the locator keeps on changing, every time you will get failure.." it's true, if locators got changed scripts will failed irrespective of framework. We need to handle this with scripting logic, script should be smart enough to find element with any locators.