You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Allan Valeriano <va...@longadata.com> on 2006/12/07 19:40:04 UTC

Test failure

Hi all,


I'm having some problems running "mvn test". I'm receiving failure at one of
my tests, but when I run it with stacktraces turned on, the exceptions are
not related to what I'm testing. Instead, I receive the following error:


[INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] There are test failures.
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Trace
> org.apache.maven.BuildFailureException: There are test failures.
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
> DefaultLifecycleExecutor.java:555)
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
> (DefaultLifecycleExecutor.java:475)
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
> (DefaultLifecycleExecutor.java:454)
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
> (DefaultLifecycleExecutor.java:306)
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
> DefaultLifecycleExecutor.java:273)
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
> DefaultLifecycleExecutor.java:140)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java
> :315)
>         at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>         at org.codehaus.classworlds.Launcher.mainWithExitCode(
> Launcher.java:430)
>         at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> Caused by: org.apache.maven.plugin.MojoFailureException: There are test
> failures.
>         at org.apache.maven.plugin.surefire.SurefirePlugin.execute(
> SurefirePlugin.java:403)
>         at org.apache.maven.plugin.DefaultPluginManager.executeMojo(
> DefaultPluginManager.java:412)
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
> DefaultLifecycleExecutor.java:534)
>         ... 16 more



I've been looking for it on google, but couldn't find any conclusive help.
Does anybody knows why is this error happening?


thanks in advance
Allan Valeriano

Re: Test failure

Posted by Daniel Kulp <da...@iona.com>.
On Thursday 07 December 2006 13:42, Wendy Smoak wrote:
> On 12/7/06, Allan Valeriano <va...@longadata.com> wrote:
> > I'm having some problems running "mvn test". I'm receiving failure at one
> > of my tests, but when I run it with stacktraces turned on, the exceptions
> > are not related to what I'm testing. Instead, I receive the following
> > error:
>
> ...
>
> > I've been looking for it on google, but couldn't find any conclusive
> > help. Does anybody knows why is this error happening?
>
> Look in target/surefire-reports/*.txt for the test output, or build
> the site with test failures ignored and the surefire report enabled to
> get html output.

Or configure the surefire plugin in your pluginManagement section to have:
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <reportFormat>brief</reportFormat>
        <useFile>false</useFile>
    </configuration>
</plugin>

Then the stacktraces will go to the console as well.   Much more useful for 
developers.


-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com

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


Re: Test failure

Posted by Wendy Smoak <ws...@gmail.com>.
On 12/7/06, Allan Valeriano <va...@longadata.com> wrote:

> I'm having some problems running "mvn test". I'm receiving failure at one of
> my tests, but when I run it with stacktraces turned on, the exceptions are
> not related to what I'm testing. Instead, I receive the following error:
...
> I've been looking for it on google, but couldn't find any conclusive help.
> Does anybody knows why is this error happening?

Look in target/surefire-reports/*.txt for the test output, or build
the site with test failures ignored and the surefire report enabled to
get html output.

-- 
Wendy

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


Re: Test failure

Posted by Allan Valeriano <va...@longadata.com>.
Thanks a lot for all who helped. I found out that my problem was actually a
method that had parameters, which was not being called, therefore maven was
not running any tests at all.

But this creates a new problem for me.
Can I create a test with a main method, that calls other methods which have
parameters?

I've been reading the JUnit Book, and the example for testing a simple
calculator is:

public class TestCalculator
> {
> private int nbErrors = 0;
> public void testAdd()
> {
> Calculator calculator = new Calculator();
> double result = calculator.add(10, 50);
> if (result != 60)
> {
> throw new RuntimeException("Bad result: " + result);
> }
> }
>
public static void main(String[] args)
> {
> TestCalculator test = new TestCalculator();
> try
> {
> test.testAdd();
> }
> catch (Throwable e)
> {
> test.nbErrors++;
> e.printStackTrace();
> }
> if (test.nbErrors > 0)
> {
> throw new RuntimeException("There were " + test.nbErrors
> + " error(s)");
> }
> }
> }
>

After that, I made something like that to test my application, but then I
got the previous error, and some time after, I discovered that it was
because Maven was not reading my main method.
Is there any way to set up maven to do it so?


thanks in advance
Allan Valeriano

On 12/7/06, Andrew Williams <an...@handyande.co.uk> wrote:
>
> when looking for error stack traces do not execute
> mvn -e test
> go for somthing like:
> mvn -Dsurefire.useFile=false test
>
> Andy
>
> On 7 Dec 2006, at 18:40, Allan Valeriano wrote:
>
> > Hi all,
> >
> >
> > I'm having some problems running "mvn test". I'm receiving failure
> > at one of
> > my tests, but when I run it with stacktraces turned on, the
> > exceptions are
> > not related to what I'm testing. Instead, I receive the following
> > error:
> >
> >
> > [INFO]
> >> ---------------------------------------------------------------------
> >> ---
> >> [ERROR] BUILD FAILURE
> >> [INFO]
> >> ---------------------------------------------------------------------
> >> ---
> >> [INFO] There are test failures.
> >> [INFO]
> >> ---------------------------------------------------------------------
> >> ---
> >> [INFO] Trace
> >> org.apache.maven.BuildFailureException: There are test failures.
> >>         at
> >> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
> >> DefaultLifecycleExecutor.java:555)
> >>         at
> >> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
> >> fecycle
> >> (DefaultLifecycleExecutor.java:475)
> >>         at
> >> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
> >> (DefaultLifecycleExecutor.java:454)
> >>         at
> >> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
> >> dleFailures
> >> (DefaultLifecycleExecutor.java:306)
> >>         at
> >> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
> >> ts(
> >> DefaultLifecycleExecutor.java:273)
> >>         at
> >> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
> >> DefaultLifecycleExecutor.java:140)
> >>         at org.apache.maven.DefaultMaven.doExecute
> >> (DefaultMaven.java:322)
> >>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:
> >> 115)
> >>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
> >>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> >> Method)
> >>         at sun.reflect.NativeMethodAccessorImpl.invoke(
> >> NativeMethodAccessorImpl.java:39)
> >>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> >> DelegatingMethodAccessorImpl.java:25)
> >>         at java.lang.reflect.Method.invoke(Method.java:585)
> >>         at org.codehaus.classworlds.Launcher.launchEnhanced
> >> (Launcher.java
> >> :315)
> >>         at org.codehaus.classworlds.Launcher.launch(Launcher.java:
> >> 255)
> >>         at org.codehaus.classworlds.Launcher.mainWithExitCode(
> >> Launcher.java:430)
> >>         at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> >> Caused by: org.apache.maven.plugin.MojoFailureException: There are
> >> test
> >> failures.
> >>         at org.apache.maven.plugin.surefire.SurefirePlugin.execute(
> >> SurefirePlugin.java:403)
> >>         at org.apache.maven.plugin.DefaultPluginManager.executeMojo(
> >> DefaultPluginManager.java:412)
> >>         at
> >> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
> >> DefaultLifecycleExecutor.java:534)
> >>         ... 16 more
> >
> >
> >
> > I've been looking for it on google, but couldn't find any
> > conclusive help.
> > Does anybody knows why is this error happening?
> >
> >
> > thanks in advance
> > Allan Valeriano
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Test failure

Posted by Andrew Williams <an...@handyande.co.uk>.
when looking for error stack traces do not execute
mvn -e test
go for somthing like:
mvn -Dsurefire.useFile=false test

Andy

On 7 Dec 2006, at 18:40, Allan Valeriano wrote:

> Hi all,
>
>
> I'm having some problems running "mvn test". I'm receiving failure  
> at one of
> my tests, but when I run it with stacktraces turned on, the  
> exceptions are
> not related to what I'm testing. Instead, I receive the following  
> error:
>
>
> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> [ERROR] BUILD FAILURE
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> [INFO] There are test failures.
>> [INFO]
>> --------------------------------------------------------------------- 
>> ---
>> [INFO] Trace
>> org.apache.maven.BuildFailureException: There are test failures.
>>         at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
>> DefaultLifecycleExecutor.java:555)
>>         at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi 
>> fecycle
>> (DefaultLifecycleExecutor.java:475)
>>         at  
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
>> (DefaultLifecycleExecutor.java:454)
>>         at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan 
>> dleFailures
>> (DefaultLifecycleExecutor.java:306)
>>         at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen 
>> ts(
>> DefaultLifecycleExecutor.java:273)
>>         at  
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
>> DefaultLifecycleExecutor.java:140)
>>         at org.apache.maven.DefaultMaven.doExecute 
>> (DefaultMaven.java:322)
>>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java: 
>> 115)
>>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
>> Method)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke(
>> NativeMethodAccessorImpl.java:39)
>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>> DelegatingMethodAccessorImpl.java:25)
>>         at java.lang.reflect.Method.invoke(Method.java:585)
>>         at org.codehaus.classworlds.Launcher.launchEnhanced 
>> (Launcher.java
>> :315)
>>         at org.codehaus.classworlds.Launcher.launch(Launcher.java: 
>> 255)
>>         at org.codehaus.classworlds.Launcher.mainWithExitCode(
>> Launcher.java:430)
>>         at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>> Caused by: org.apache.maven.plugin.MojoFailureException: There are  
>> test
>> failures.
>>         at org.apache.maven.plugin.surefire.SurefirePlugin.execute(
>> SurefirePlugin.java:403)
>>         at org.apache.maven.plugin.DefaultPluginManager.executeMojo(
>> DefaultPluginManager.java:412)
>>         at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
>> DefaultLifecycleExecutor.java:534)
>>         ... 16 more
>
>
>
> I've been looking for it on google, but couldn't find any  
> conclusive help.
> Does anybody knows why is this error happening?
>
>
> thanks in advance
> Allan Valeriano


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