Selenium Java - Page Object Model Query -
imagine there page http://google.com/adduser , here enter details record , click save. once page redirects
where can see list of users including new record entered.
if going page object model, method enter details , save record should exist on adduser.java
, method validate if record saved , displayed should on userlist.java
if consider adduser , userlist corresponding objects both classes below :
adduser.enterdetailssaverecord(); userlist.validatesavedrecord();
so in test case need call 2 separate methods, 1 action , other validate.
both adduser.java
, userlist.java
have basepage.java
superclass. there way club them both single method or there i'm going in wrong way , there better approach?
thank you
i don't see wrong approach either, although, approach logically separate functional interaction application testing functions. so, still have
adduser.enterdetailssaverecord();
but userlist use
useritem founduser = userlist.finduser(targetuser);
where useritem row in table of users. test verify founduser correct.
although ends few more lines of code, results in object model cleanly , modeling object under test, , testing code being found in test itself.
Comments
Post a Comment