testNG: How to pass class name externally to testNG xml

40 views
Skip to first unread message

sunny sachdeva

unread,
Jun 21, 2017, 12:21:10 AM6/21/17
to testng-users
HI ,

I have huge list of classes which needs to be run. i am using maven surefire plugin and then build is triggered from Jenkins. I am looking for a way where I can pass some regular expression or keyword from jenkins and all the matching classes as per regular expression could be run.

Not sure but want to ask will bean shell script would work in this case? Would appreciate any help.

Thanks
sunny Sachdeva

⇜Krishnan Mahadevan⇝

unread,
Jun 21, 2017, 12:48:33 AM6/21/17
to testng...@googlegroups.com
Yes it should because beanshell script is basically a method selector and since it passes you an instance of ITestNGMethod object, you should be able to query this object to figure out the class name to which it belongs to and then apply your regex logic to it.

You can merely specify the packages part in your xml and you should be good. 

Give it a try and let us know what happens.

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 Scribbings @ http://rationaleemotions.wordpress.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+unsubscribe@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages