Can we have testNg groups in a variable or something and reuse it?

23 views
Skip to first unread message

Dinesh Kumar

unread,
Mar 13, 2023, 2:55:32 AM3/13/23
to testng-users
I am using a beforeClass method for certain 10 tests. So, I have to mention all these method unique group tag to the beforeClass. 

The same goes for afterClass, so is it possible to make the groups array into a single Java object and provide it to the before class parameters.

Ex:
    public static String[] group = {"Check_UT","Test1_UT"};

    @BeforeClass(groups = group)

⇜Krishnan Mahadevan⇝

unread,
Mar 13, 2023, 4:52:11 AM3/13/23
to testng...@googlegroups.com
Annotations need to have constants and they cannot be variables.

You could maybe explore IAnnotationTransformer (or) just use "alwaysRun=true"

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/testng-users/1698545b-e4a1-4673-ac62-8e1079eee946n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages