Skip to content

Unable to pass groups in TestNG as an array of constants #3130

Closed Answered by krmahadevan
itkhanz asked this question in Q&A
Discussion options

You must be logged in to vote

This is a Java requirement and NOT something that is enforced by TestNG. The rationale behind is that a string array's value can still be altered. You would need to stick to referring to them individually. Trying to put workarounds around this, will seriously hamper readability and so I would suggest that you stick to what is supported in Java.

If you are still looking for an alternative, then here's what you can do:

  1. Create a global Map of Lists, wherein you will have a pseudo name which will be mapped to a list of group names.
  2. Define a custom annotation, which can be added on top of either a class or a method, and whose value will just be a valid key in the global Map of group lists.
  3. Bu…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@itkhanz
Comment options

Answer selected by krmahadevan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants