Question

this is the maven surefire plugin i am using

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.16</version>
    <configuration>
    <includes>
    <include>runner.TestSuite.java</include>
    </includes>
    <skipTests>true</skipTests>
    </configuration>
</plugin>

This is testSuite class

package runner;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;

import action.TestLogin;
import action.TestRegister;

@RunWith(Suite.class)
@Suite.SuiteClasses({ TestRegister.class, TestLogin.class })
public class TestSuite {
}

Test Suite runs fine on alone. But when I run maven-Install with eclipse I want to run the test suite without running all the test cases individually. But it says

[INFO] --- maven-surefire-plugin:2.16:test (default-test) @ FinalProject ---
[INFO] Tests are skipped.

Also I am using sonar to check line coverage which is also not able to detect testSuite I made. I am new to Junit TestSuite & do not know how to configure them with maven & sonar.

Any link, reference or clue will be helpful. Thank you.

Was it helpful?

Solution

Make sure you have JUnit dependency specified in your pom.xml

<dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
</dependency>

This is the only step that is required to get started - you can now create tests in your test source directory.

More on this at Maven Surefire Plugin

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top