dependsOn takes only Test Methods.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

dependsOn takes only Test Methods.

Krithi
Hi Tarun,

when I try to add dependsOnMethod attribute to a test method which takes the value on non test method, it shows the error.

"com.selenium.PageObjectExample.testRegistrationNew() is not allowed to depend on public void com.selenium.PageObjectExample.testPageObject()"

My code goes like this  :
@Test(dataProvider = "regData",dataProviderClass = RegistrationData.class, dependsOnMethods = "testPageObject")
        public void testRegistrationNew(String sFirstName,String sLastName,String sPhoneNumber, String sUsername, String sEmail, String sCountry,String sPassword ,String sRepassword)

The method public void testPageObject() is not a test class.
am I not  allowed to include dependsOnMethod on a non test method?

I am attaching PageObjectExample.java for your reference

Thanks
Krithi
PageObjectExample.java
Reply | Threaded
Open this post in threaded view
|

Re: dependsOn takes only Test Methods.

softwaretestingforum
Administrator
That's right, a test method can depend on another test method or a group. Group is used to group a number of methods and a test method could be marked to be run only when all the methods in group are executed. More on group here -

http://testng.org/doc/documentation-main.html#dependent-methods

Now if you want to add dependency on a non test method then you could call it from with in your test method.
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: dependsOn takes only Test Methods.

Krithi
Thanks Tarun. I will look in to the link.

Regards
Krithi