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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to