Reputation: 21
something like this:
@Test(groups = {"eventAdmin"}, dataProvider="EventAdminProvider",
dataProviderClass= EventAdminCurationDataproviderClass.class)
public void EventCurationclearFilter(String eventName) throws Exception {
@AfterMethod(groups={"eventAdmin"})
public void teardown(String eventName) throws Exception {
Upvotes: 2
Views: 2134
Reputation: 31214
Yes but not directly like with a @Test
. You can get the array of parameters passed to the test using native dependency injection. I see two ways of doing so:
Using ITestResult
:
@Test(groups = {"eventAdmin"}, dataProvider = "EventAdminProvider",
dataProviderClass = EventAdminCurationDataproviderClass.class)
public void EventCurationclearFilter(String eventName) throws Exception {
/* Your test code using `eventName` here. */
}
@AfterMethod(groups = {"eventAdmin"})
public void teardown(ITestResult result) throws Exception {
String eventName = (String) result.getParameters()[0];
/* Your teardown code using `eventName` here. */
}
Using Object[]
:
@Test(groups = {"eventAdmin"}, dataProvider = "EventAdminProvider",
dataProviderClass = EventAdminCurationDataproviderClass.class)
public void EventCurationclearFilter(String eventName) throws Exception {
/* Your test code using `eventName` here. */
}
@AfterMethod(groups = {"eventAdmin"})
public void teardown(Object[] parameters) throws Exception {
String eventName = (String) parameters[0];
/* Your teardown code using `eventName` here. */
}
Upvotes: 2