Atul Girishkumar
Atul Girishkumar

Reputation: 73

Unable to run test with VertxUnitRunner

I am new to the Vertx Unit and trying to run the below example, but with no luck

@RunWith(VertxUnitRunner.class)
public class DemoTest {

    @BeforeClass
    public static void before(TestContext context) {
        System.out.println("before");
    }

    @Test
    public void testSomethingElse(TestContext context) {
        System.out.println("testSomethingElse");
    }

    @AfterClass
    public static void after(TestContext context) {
        System.out.println("after");
    }
}

I am running using mvn clean test

Receiving the following output

Running com.example.DemoTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec

Upvotes: 0

Views: 239

Answers (2)

mononoke83
mononoke83

Reputation: 451

Take a look as well to the maven-surefire-plugin (https://maven.apache.org/surefire/maven-surefire-plugin/index.html) and add it to your pom.xml, here I post some mvn commands to test:

# Run all the unit test classes.
$ mvn test

# Run a single test class.
$ mvn -Dtest=TestApp1 test

# Run multiple test classes.
$ mvn -Dtest=TestApp1,TestApp2 test

# Run a single test method from a test class.
$ mvn -Dtest=TestApp1#methodname test

# Run all test methods that match pattern 'testHello*' from a test class.
$ mvn -Dtest=TestApp1#testHello* test

# Run all test methods match pattern 'testHello*' and 'testMagic*' from a test class.
$ mvn -Dtest=TestApp1#testHello*+testMagic* test

Upvotes: 0

Atul Girishkumar
Atul Girishkumar

Reputation: 73

It was solved by adding the JUnit dependency.

Upvotes: 1

Related Questions