java - Selenium_testng_Java_passing data to both @beforetest and @test -
i have testng class 3 test (a,b, c) , class extends base class has @beforemethod , @ aftermethod
now want pass browser @ before method , email method
email has unique every time.
one of ways use @parameters annotation.
code @beforemethod
is-
@beforemethod @parameters("browser") public void testmethod1(string browser) { //do task here }
code method a-
@test @parameters("email") public void a(string email) { //implement test logic here }
sample testng sample-
<suite name="suite1" verbose="1" > <test name="test1"> <parameter name="browser" value="firefox"/> <parameter name="email" value="an-email-id"/> <classes> <class name="packagename.classname"/> </classes> </test> </suite>
Comments
Post a Comment