Rajee,
On 2/17/15 5:43 AM, rajee sudh wrote:
> Thanks Geaorge, can that be done in java too i.e cucumber jvm ?? if so how??
Sure. Have the relevant page objects implement an interface, e.g.,
AddressForm, that contains the methods for entering the address.
@When("^(.*) enters their address$")
public void EntersTheirAddress(String user) {
(AddressForm)currentPage.
enterAddress(TestData.lookupAddressForUser(user);
}
- George
>
www.seleniumframework.com <
http://www.seleniumframework.com>
>
>
> On Friday, February 13, 2015 at 10:24:25 PM UTC+5:30, George
> Dinwiddie wrote:
>
> Rajee,
>
> Step definitions are global. They are all available all the time.
>
> I would suggest putting the appropriate page object into scope when
> navigating to the page. E.g.,
>
> Given /^(.*) visits the "(.*)" page$/ do |user, pagename|
> @user_name = user
> @current_page = create_page_object_for_name(__pagename)
> end
>
> Then other step definitions can use @current_page for
> interactions. If
> multiple pages need to support interactions using the same step
> definition, then those pages should support the same methods
> needed for
> those interactions. E.g.,
>
> When /^(.*) enters their address$/ do |user|
> @current_page.enter_address(__lookup_address_for_user(user)
> end
>
> where multiple page objects would implement the enter_address()
> method.
>
> - George
>
> On 2/13/15 10:43 AM, Rajeshwari Sudhakar wrote:
> > Hi all,
> >
> > Would like to know how to implement multiple stepdefinations
> java file
> > with page objects . I dont understand where should i define
> the page
> > objects for multiple step definations and how will cucumber
> find out
> > which step defination file to use under these circumstances.
> > Kindly help.
> >
> > Thank you,
> >
> > 1. Rajee
>
> --
>
> ------------------------------__------------------------------__----------
> ------------------------------__------------------------------__----------
> <mailto:
cukes+un...@googlegroups.com>.
> <mailto:
cukes+un...@googlegroups.com>.