Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run a single plug-in test method using tycho-surefire-plugin

How can I run a single plug-in test method in Maven using tycho-surefire-plugin?

I tried the -Dtest option with #, but it doesn't work:

mvn clean install -Dtest=MyUITest#testDummy

Is there something I am missing?

like image 998
Prasanth Kumar Diddi Avatar asked Nov 02 '22 14:11

Prasanth Kumar Diddi


1 Answers

Your question is already answered here.

However you can use TestSuite and Filter to achieve what you want or even more customized selection of tests.

public class FilteredTests extends TestSuite {

public static TestSuite suite() {
    TestSuite suite = new TestSuite();

    suite.addTest(new JUnit4TestAdapter(YourTestClass.class).filter(new Filter() {

            @Override
            public boolean shouldRun(Description description) {
                return description.getMethodName().equals("Your_Method_name");
            }

            @Override
            public String describe() {
                // TODO Auto-generated method stub
                return null;
            }
        }));

    return suite;
}

}

Now configure tycho-surefire plugin to run this suite

<configuration>
                ...
                <testSuite>bundle.symbolic.name.of.test.plugin</testSuite>
                <testClass>package.of.test.suite.FilteredTests</testClass>
                ...
</configuration>
like image 128
coder11 Avatar answered Jan 04 '23 15:01

coder11