I am trying to change the test parameter description on run time. All the examples I have seen refers to changing annotation value at class level. But, I want to do it at method level.
My sample code is as below:
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.lang.reflect.Method;
public class TestClass {
@BeforeMethod
public void beforeMethod(Method method){
Test annotation = method.getAnnotation(Test.class);
// I want to change description to "some modified description"
}
@Test(description = "some description")
public void test(){
System.out.println("in test");
}
}
Aucun commentaire:
Enregistrer un commentaire