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

below sample data.enter image description here

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

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -