4

I have a bunch of classes with TestNG tests in them, and I have a handy naming convention. I'd like to make test suites that just run all the classes that start with Xyz. Is there any way of doing that? The way I wish it would work is with a wildcard like this:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > <suite name="MySuite" parallel="tests" thread-count="10" preserve-order="false"> <parameter name="sauceOs" value="win7" /> <test name="testName"> <classes> <class name="packageName.BeginningOfClassName*"></package> </classes> </test> </suite> 

1 Answer 1

1

You can use BeanShell.

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > <suite name="MySuite" parallel="tests" thread-count="10" preserve-order="false"> <parameter name="sauceOs" value="win7" /> <test name="testName"> <method-selectors> <method-selector> <script language="beanshell"><![CDATA[ method.getDeclaringClass().getSimpleName().startsWith("ClassNamePrefix") ]]></script> </method-selector> </method-selectors> <packages> <package name="packageName"></package> </packages> </test> </suite> 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.