Junit Test Case Generation Tool with Mockito

3,199 views
Skip to first unread message

Suhaas Lang

unread,
May 28, 2015, 2:30:31 PM5/28/15
to moc...@googlegroups.com
Hi,

At our company we are trying to use code coverage (in some cases from 15% to 50%) . We do want to have sensible test cases and not just the coverage :-)

We use Junit and Mockito. I am wondering if there is a tool that would generate test cases that would include Mockito.Though I use Eclipse as my main IDE, I am open to changing it to to anything else including the good old command line option.

I am open to exploring options where it is not one step process as well.

I apologize if this topic was discussed on an old thread earlier.

Regards,

Suhaas

KARR, DAVID

unread,
May 28, 2015, 2:34:09 PM5/28/15
to moc...@googlegroups.com

Nothing is going to generate the actual test cases.  That requires humans to write.

 

However, the MoreUnit Eclipse plugin can be used to generate the skeleton of a Mockito-based unit test, including convenient “@Mock” annotations and test stubs for the methods you want to test.  It also has nice navigation functions for moving back and forth between the test and CUT.

 

--
You received this message because you are subscribed to the Google Groups "mockito" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mockito+u...@googlegroups.com.
To post to this group, send email to moc...@googlegroups.com.
Visit this group at http://groups.google.com/group/mockito.
To view this discussion on the web visit https://groups.google.com/d/msgid/mockito/9d7734cc-289d-4ae6-843a-53635508ad22%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Suhaas Lang

unread,
May 28, 2015, 3:41:19 PM5/28/15
to moc...@googlegroups.com
Thanks, David.

Pardon my ignorance. What is CUT? Is it Code Under Test?

KARR, DAVID

unread,
May 28, 2015, 4:14:56 PM5/28/15
to moc...@googlegroups.com

Yup, that’s it.  It’s a common phrase in this domain.

 

Malte Finsterwalder

unread,
May 29, 2015, 8:41:24 AM5/29/15
to mockito
Agitar has tooling to generate Unit Tests for Java Code: http://www.agitar.com/
I don't know whether they are still "in business" or not really.
To generate meaningfull tests, you do need humans.
But yes, it is possible to generate JUnit Tests from code. Those tests will test, that your code is correct as is. After the generation, they can detect any changes and then you can decide, whether the detected change is correct or not. I have never really worked with their tooling apart from simple experiments.
I didn't think the approach is worthwhile.

Greetings,
   Malte

Reply all
Reply to author
Forward
0 new messages