Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Maven Integration (M2E) » Can't run Maven tests
Can't run Maven tests [message #22104] Wed, 25 February 2009 21:42 Go to next message
Eclipse User
Originally posted by: sadsdfd.asds.com

I have made a Maven project, where I have made a test file in a package
in/src/test/java:

package mytestpackage

import static org.junit.Assert.*;

import org.junit.Test;

public class TableTest{

@Test
public void myFirstTest() throws Exception {
assertEquals("asd","asd");
}

@Test
public void mySecondTest() throws Exception {
assertEquals("asd2","asd2");
}


}


But when I right click on the Maven project (parent) and choose:

Run As -> Maven test

The test in not run, and I just get:

....
....
[INFO] ------------------------------------------------------------ ------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------ ------------
[INFO] Total time: < 1 second
[INFO] Finished at: Wed Feb 25 22:38:21 CET 2009
[INFO] Final Memory: 1M/4M
[INFO] ------------------------------------------------------------ ------------



What do I need to do to enable the maven tests?
Re: Can't run Maven tests [message #22150 is a reply to message #22104] Wed, 25 February 2009 21:51 Go to previous messageGo to next message
Jesse McConnell is currently offline Jesse McConnell
Messages: 11
Registered: July 2009
Junior Member
try having the test case extend TestCase

then it should be picked up

jesse

JS wrote:
> I have made a Maven project, where I have made a test file in a package
> in/src/test/java:
>
> package mytestpackage
>
> import static org.junit.Assert.*;
>
> import org.junit.Test;
>
> public class TableTest{
>
> @Test
> public void myFirstTest() throws Exception {
> assertEquals("asd","asd");
> }
>
> @Test
> public void mySecondTest() throws Exception {
> assertEquals("asd2","asd2");
> }
>
>
> }
>
>
> But when I right click on the Maven project (parent) and choose:
>
> Run As -> Maven test
>
> The test in not run, and I just get:
>
> ...
> ...
> [INFO]
> ------------------------------------------------------------ ------------
> [INFO] BUILD SUCCESSFUL
> [INFO]
> ------------------------------------------------------------ ------------
> [INFO] Total time: < 1 second
> [INFO] Finished at: Wed Feb 25 22:38:21 CET 2009
> [INFO] Final Memory: 1M/4M
> [INFO]
> ------------------------------------------------------------ ------------
>
>
>
> What do I need to do to enable the maven tests?
>
>
>
>
>
>
Re: Can't run Maven tests [message #22193 is a reply to message #22150] Wed, 25 February 2009 21:57 Go to previous messageGo to next message
Eclipse User
Originally posted by: sadsdfd.asds.com

Extending Test Case does not help.

I have access to another Maven project that uses something called surefire:

[INFO] [surefire:test]
[INFO] Surefire report directory:
C:\Users\js\workspace2\parent\model\target\surefire-reports

I think that might be needed to run a maven test, but cannot make it work on
my new clean project.




"Jesse McConnell" <jesse.mcconnell@gmail.com> wrote in message
news:go4egt$qhb$1@build.eclipse.org...
> try having the test case extend TestCase
>
> then it should be picked up
>
> jesse
>
> JS wrote:
>> I have made a Maven project, where I have made a test file in a package
>> in/src/test/java:
>>
>> package mytestpackage
>>
>> import static org.junit.Assert.*;
>>
>> import org.junit.Test;
>>
>> public class TableTest{
>>
>> @Test
>> public void myFirstTest() throws Exception {
>> assertEquals("asd","asd");
>> }
>>
>> @Test
>> public void mySecondTest() throws Exception {
>> assertEquals("asd2","asd2");
>> }
>>
>>
>> }
>>
>>
>> But when I right click on the Maven project (parent) and choose:
>>
>> Run As -> Maven test
>>
>> The test in not run, and I just get:
>>
>> ...
>> ...
>> [INFO] ------------------------------------------------------------ ------------
>> [INFO] BUILD SUCCESSFUL
>> [INFO] ------------------------------------------------------------ ------------
>> [INFO] Total time: < 1 second
>> [INFO] Finished at: Wed Feb 25 22:38:21 CET 2009
>> [INFO] Final Memory: 1M/4M
>> [INFO] ------------------------------------------------------------ ------------
>>
>>
>>
>> What do I need to do to enable the maven tests?
>>
>>
>>
>>
>>
Re: Can't run Maven tests [message #22236 is a reply to message #22193] Thu, 26 February 2009 18:25 Go to previous message
Eclipse User
Originally posted by: sadsdfd.asds.com

Problem solved. Child modules should use 'jar' packaging and NOT 'pom'
packaging.



"JS" <sadsdfd@asds.com> wrote in message
news:go4ert$201$1@build.eclipse.org...
> Extending Test Case does not help.
>
> I have access to another Maven project that uses something called
> surefire:
>
> [INFO] [surefire:test]
> [INFO] Surefire report directory:
> C:\Users\js\workspace2\parent\model\target\surefire-reports
>
> I think that might be needed to run a maven test, but cannot make it work
> on my new clean project.
>
>
>
>
> "Jesse McConnell" <jesse.mcconnell@gmail.com> wrote in message
> news:go4egt$qhb$1@build.eclipse.org...
>> try having the test case extend TestCase
>>
>> then it should be picked up
>>
>> jesse
>>
>> JS wrote:
>>> I have made a Maven project, where I have made a test file in a package
>>> in/src/test/java:
>>>
>>> package mytestpackage
>>>
>>> import static org.junit.Assert.*;
>>>
>>> import org.junit.Test;
>>>
>>> public class TableTest{
>>>
>>> @Test
>>> public void myFirstTest() throws Exception {
>>> assertEquals("asd","asd");
>>> }
>>>
>>> @Test
>>> public void mySecondTest() throws Exception {
>>> assertEquals("asd2","asd2");
>>> }
>>>
>>>
>>> }
>>>
>>>
>>> But when I right click on the Maven project (parent) and choose:
>>>
>>> Run As -> Maven test
>>>
>>> The test in not run, and I just get:
>>>
>>> ...
>>> ...
>>> [INFO] ------------------------------------------------------------ ------------
>>> [INFO] BUILD SUCCESSFUL
>>> [INFO] ------------------------------------------------------------ ------------
>>> [INFO] Total time: < 1 second
>>> [INFO] Finished at: Wed Feb 25 22:38:21 CET 2009
>>> [INFO] Final Memory: 1M/4M
>>> [INFO] ------------------------------------------------------------ ------------
>>>
>>>
>>>
>>> What do I need to do to enable the maven tests?
>>>
>>>
>>>
>>>
>>>
Previous Topic:[tycho-dev-1819] error while building jar
Next Topic:M2, Subclipse and multi-module project
Goto Forum:
  


Current Time: Thu Oct 23 21:28:40 GMT 2014

Powered by FUDForum. Page generated in 0.01698 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software