0

In my TestNG based test cases . I have a test class with a test method annotated with my custom annotation along with the @Test annotation .I want to change the behaviour of the test method based upon the parameters that are passer to my custom annotation . Is there a way to achieve this in TestNG ?

jay
  • 791
  • 8
  • 20
  • That depends on the behaviour you are wanting to change. If you are passing a string to the test, simply using that string as a URL will change the behaviour of the test based on the parameters. However, I don't think this is what you are talking about, and even if you were more specific, I don't think that it is possible. Feel free to explain what behaviour you want changed though. – Nathan Merrill Jan 30 '14 at 14:01
  • @MrTi Consider your case itself for URL , i want to achieve the same . Passing parameter in my custom annotation and using that value in my test . – jay Jan 30 '14 at 18:19
  • Then this is what you are looking for: http://testng.org/doc/documentation-main.html#dependency-injection – Nathan Merrill Jan 30 '14 at 22:28
  • 1
    http://stackoverflow.com/questions/1805200/retrieve-java-annotation-attribute - Your custom annotation should have retentionpolicy as runtime – niharika_neo Jan 31 '14 at 08:26

0 Answers0