Reputation: 305
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>
Upvotes: 4
Views: 1527
Reputation: 5908
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>
Upvotes: 1