maven - Passing dataProvider parameter inside testng method -
i have 2 @dataproviders:
@dataprovider(name = "smallnumbers") @dataprovider(name = "bignumbers")
variables in pom.xml
<systempropertyvariables> <datap>${dataprovider}</datap> </systempropertyvariables>
accesing parameter:
string sizenumbers = system.getproperty("datap");
and test:
@test(dataprovider=sizenumbers)
dataprovider in test method have be: constant expression idea how pass variable inside @test(dataprovider= ?
you cant this. possible pass dataprovider directly method. why choose way inject data dataprovider? show bit more code architecture cause that's strange.
edit:
you can check way:
@dataprovider(name = "dp") public static object[][] datainject(){ return new object[][]{ {sizenumbers} }; }
and inside "dp" can make validation ex. "isnull" etc.
then in test
@test(dataprovider = "dp", dataproviderclass = xyz.class) public void testfirst(string input){ //... }
Comments
Post a Comment