maven surefire never run mockito TestCase

1,310 views
Skip to first unread message

jilen

unread,
Jan 16, 2012, 10:33:54 PM1/16/12
to mockito
I have junit 4.5, and maven-surefire-plugin in pom.xml

 <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>-Xmx256m</argLine>
                </configuration>
            </plugin>

And I have a MockitoTestCase like that

@RunWith(MockitoJUnitRunner.class)

public abstract class MockitoTestCase {

}

All test classes extends this class. But when type mvn test,
All these test classes are ignored.


 

Clint Checketts

unread,
Jan 16, 2012, 10:41:21 PM1/16/12
to moc...@googlegroups.com
By default Maven only looks for test classes that match a specific expression, something like Test*.java, *Test.java, and *TestCase.java

What did you name your tests?

--
You received this message because you are subscribed to the Google Groups "mockito" group.
To post to this group, send email to moc...@googlegroups.com.
To unsubscribe from this group, send email to mockito+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mockito?hl=en.

jilen

unread,
Jan 16, 2012, 10:43:30 PM1/16/12
to moc...@googlegroups.com
All my test case are named XXXTest.java
and extends the MockitoTestCase class
--

Brice Dutheil

unread,
Jan 17, 2012, 3:14:12 AM1/17/12
to moc...@googlegroups.com
Hi,

Double check your paths, there is no reason this wouldn't work. Plus it would be more like a maven related problem.
I would recommand you to create a new maven project and see what happens with tests like that.

Hope that helps.

-- 
Brice Dutheil

sign.png

Tomek Kaczanowski

unread,
Jan 17, 2012, 3:26:24 AM1/17/12
to moc...@googlegroups.com
Which surefire version you use? If not the latest, then upgrade and see if it still happens. (Probably not the root of problem here, but surefire versions differ - that is, each has a different set of bugs, so it is worth trying)

--
Ragards,
Tomek Kaczanowski

2012/1/17 Brice Dutheil <brice....@gmail.com>



--
Regards / Pozdrawiam
Tomek Kaczanowski
http://kaczanowscy.pl/tomek
sign.png

Brice Dutheil

unread,
Jan 17, 2012, 3:33:21 AM1/17/12
to moc...@googlegroups.com
Good point Tomek, I remember a certain verison of surefire had a classloader bug that affected mockito. However tests were executed.

-- 
Brice Dutheil

sign.png

jilen

unread,
Jan 17, 2012, 5:18:04 AM1/17/12
to moc...@googlegroups.com
Thanks, all!
Brice Dutheil is right
I googled this problem hours then found that's a problem of surefire plugin.
http://maven.apache.org/plugins/maven-surefire-plugin/examples/junit.html
Using surefire Junit4Provider fix my problem!!!


On 01/17/2012 11:41 AM, Clint Checketts wrote:
--

Brice Dutheil

unread,
Jan 17, 2012, 5:29:44 AM1/17/12
to moc...@googlegroups.com
Good. Anyway this a collaborative effort ;)
Thx for going back with the solution.

-- 
Brice Dutheil

sign.png
Reply all
Reply to author
Forward
0 new messages