The most likely culprite<sp?> when tests run in Eclipse but not Maven is
forking.  Eclipse runs each test in it's own forked VM, where as Maven by
default runs all tests within the same VM as mvn itself.  You can enable
the per-test forking in Maven by added the following to your pom.xml

<build>
      <plugins>
            <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-surefire-plugin</artifactId>
                  <configuration>
                        <forkMode>pertest</forkMode>
                  </configuration>
            </plugin>
      </plugins>
</build>

As far as the failed tests, the output from your tests is written to
target/surefire-report by default, with an XML and .TXT file generated for
each test class.  You can force the output to be written directly to the
console by setting useFile = false, either from the command line or in the
<configuration> element of the maven-surefire-plugin.

There is also a maven-surefire-report-plugin, with generates a pretty HTML
report as part of mvn site.  Unfortunately, this plugin has two
shortcomings, IMO:

1) It re-runs all tests.  Not sure if you have to configure forkMode and
similiar settings independently of maven-surefire-plugin
2) It fails to generate a report in case of test failure, severely limiting
its utility


HTH,
Ian

It's better to be hated for who you are
than loved for who you are not

Ian D. Stewart
Appl Dev Analyst-Advisory, DCS Automation
JPMorganChase Global Technology Infrastructure
Phone: (614) 244-2564
Pager: (888) 260-0078


                                                                                
                                                       
                      gdub                                                      
                                                       
                      <[EMAIL PROTECTED]        To:       
[email protected]                                                        
                      om>                      cc:                              
                                                       
                                               Subject:  test cases failing in 
Maven but not Eclipse                                   
                      04/14/2006 12:29                                          
                                                       
                      AM                                                        
                                                       
                      Please respond to                                         
                                                       
                      "Maven Users                                              
                                                       
                      List"                                                     
                                                       
                                                                                
                                                       




I am trying to install a module that
depends on Spring and Hibernate. All
of those dependencies for the app
are in that Maven project. The trouble
is that the tests won't pass. They pass
fine in Eclipse. All the rest of the
modules for this  project pass their
tests in both Maven and Eclipse.

I can't see where the trouble is because
nothing is reported back on the failures.
The console shows INFO lines saying that
Spring is loading the configuration
files (which are all classpath resources,
BTW) but no indication of how the tests
are failing--only a message before
maven exits saying that all the tests
have failed.

I sprinkled some printlns into some test
methods to see if the test methods were
even entered--they are not (well, at
least I don't think they are, maybe
the standard output is being shunted).

The -e switch only reports the surefire
exception that there were failed tests.

I don't think module dependencies are
the issue because I am using eclipse:
eclipse to generate them for Eclipse--
i.e. they are the same in both
environments.

How do I approach finding the source of
this trouble? There doesn't appear to be
enough information to track it down.

   -dub


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to