On Tue, Jul 19, 2011 at 11:20 PM, Julien Martin <bal...@gmail.com> wrote:
> Hello,
>
> I appreciate your help Brian!
>
> I changed my POM as follows:
>
> *<plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-surefire-plugin</artifactId>
>                <dependencies>
>                    <dependency>
>                        <groupId>org.apache.maven.surefire</groupId>
>                        <artifactId>surefire-junit4</artifactId>
>                        <version>2.7.2</version>
>                    </dependency>
>                </dependencies>
>                <configuration>
>                    <includes>
>                        <include>**/*Test.java</include>
>                    </includes>
>                </configuration>
>  </plugin>*
>
> It now seems "something" is being run. Here is the output now:
> *-------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> Running TestSuite
> Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.769 sec
>
> Results :
>
> Tests run: 0, Failures: 0, Errors: 0, Skipped: 0*
>
> Notice the "Running TestSuite". However it still fails to find my test
> methods. I suspect it might have to do with this:
>
> *[DEBUG] Adding to surefire test classpath:
> /home/julien/.m2/repository/org/apache/maven/surefire/surefire-testng/2.4.3/surefire-testng-2.4.3.jar
> [DEBUG] Adding to surefire test classpath:
> /home/julien/.m2/repository/org/apache/maven/maven-artifact/2.0/maven-artifact-2.0.jar
> [DEBUG] Adding to surefire test classpath:
> /home/julien/.m2/repository/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.jar
> [DEBUG] Adding to surefire test classpath:
> /home/julien/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
> [DEBUG] Adding to surefire test classpath:
> /home/julien/.m2/repository/org/apache/maven/surefire/surefire-api/2.4.3/surefire-api-2.4.3.jar
> *
> Notice it says it is using version 3.8.1 of Junit...
>
> However it goes on to say:
> Test Classpath :
> ...
> *[DEBUG]   /home/julien/.m2/repository/junit/junit/4.8.2/junit-4.8.2.jar*
> ...
>
> So what is the difference between the "surefire test classpath" and the
> "Test classpath"?
>
> Here is how my test method is named and annotated:
>   *@Test
>    public void test() {*
> ...
>

If surefire thinks you are using junit 3 then it wont run your tests
since you are using annotations instead of extending TestCase.


http://maven.apache.org/plugins/maven-surefire-plugin/examples/junit.html

You aren't specifying a version of surefire but you are locking down
the surefire provider (2.7.2).
That may mean you are using version 2.9 of surefire but with an older provider.
You shouldn't need to specify a provider version - the docs indicate
it will select the correct one based upon your dependencies.
But you can try fiddling with these values.
There is a caveat on the docs when you manually specify a provider
"When using this technique there is no check that the proper
test-frameworks are present on your project's classpath. Failing to
add the proper test-frameworks will result in a build failure."

I also notice testng on the classpath.
Perhaps one of the other dependencies is pulling things in you dont
expect and mucking up surefire (because multiple test frameworks are
available)
You can try
mvn dependency:tree
and see whether that output gives any clues.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to