EasyMock gentle introduction? - unit-testing

I am completely baffled while trying to use EasyMock. Does anybody know of a (very) gentle introduction to EasyMock?
I already heavily use TDD, and I use mocking (which I guess is almost a prerequisite for doing TDD). I have just never used a framework for mocking before.

Here are some articles you might like:
Easier testing with EasyMock
Unit testing with JUnit and EasyMock
Mock Object Testing With EasyMock 2
Getting Started with EasyMock2
You could also check out other mocking frameworks such as Mockito, PowerMock and JMockit.

How about their own Documentation? http://easymock.org/EasyMock3_0_Documentation.html

Have you tried this tutorial? http://www.vogella.de/articles/EasyMock/article.html
Do you already have a background in Test Driven Development? If not, I'd get my hands on a copy of Roy Osherove's book The Art of Unit Testing. http://artofunittesting.com/

Related

Difference b/w Mockito,junit and TestNG

I am new to unit testing so please can anybody tell me difference b/w Mockito and TestNG. And which tool will be suitable for unit testing.
Both tools are suitable for unit testing and you can use them together. TestNG is similar to JUnit but introducing some new functionalities, and Mockito allows you to add mock objects to your tests.

What mock frameworks work with cppunit?

I'm in the middle of implementing a unit test infrastructure for a large C++ project, and due to political reasons I'm almost sure CppUnit will be pushed as the unit testing framework.
I'm trying to identify mock frameworks that blend with CppUnit. I've found mockpp, and I've heard that Google Mock should work.
What frameworks work alongside CppUnit?
Mocking libraries are typically independent of the unit testing framework. They accomplish two different jobs, and frankly don't have much reason to talk to each other. Where they do integrate is in answering these questions:
When should I create my mock objects?
When should I initialize the mock objects with my expectations?
When should I validate the mocks were called as expected?
And you do that at the appropriate points in your tests.
For one example, check opmock. http://sourceforge.net/projects/opmock/
According to their wiki, opmock is easily called from a CppUnit test. See http://sourceforge.net/p/opmock/wiki/Using%20Opmock%20with%20other%20unit%20testing%20frameworks/

unit testing in clojure

I am new to Clojure and I'm trying to write my unit tests. What is the best way to write unit tests in Clojure and how do I import the file where my functions are defined to my unit test.
Thanks for the help.
To start with, there's clojure.test. Using Leiningen, you can call lein test to run the tests.
See also Speclj which is useful for BDD.
Another accepted way to do unittest in clojure is using Midje.
I have read good comments about it.
Speclj is also a testing framework for the clojure language widely accepted that you may consider as well. Here you can find a longer discussion about it's strong-weak points

Syntax Comparison between Moq and Rhino mocks

My company is trying to decide if we are going to standardize on Moq, Rhino Mocks or MS Moles and Stubs.
I know Rhino Mocks and Moles and Stubs fairly well. But I am unfamiliar with Moq. How does the syntax work? Does it support Arrange Act Assert (AAA) like Rhino Mocks (I hear they created it, but I am not sure). Does it have strong typing?
Basically, I am leaning towards Rhino Mocks (using Moles where needed). But I don't want to do that just because I am familiar with Rhino Mocks. If Moq is in fact better or (even more important) easier to use, then I want to learn it and pick that one.
So, any one out there that has used both and feels like giving me a syntax comparison?
I've done a multi-part blog series on the differences between a number of mocking frameworks. Feel free to check it out at http://www.richard-banks.org/2010/07/mocking-comparison-part-1-basics.html
Have you looked at http://code.google.com/p/moq/wiki/QuickStart ?
Moq supports AAA and strong typing (via use of lambdas)
This project compares many mock framework against each other: mocking frameworks compare

How to migrate Cppunit tests into GoogleTest?

I have a bunch of module tests written in CPPunit with some mocks created by hand. I am looking for a way to migrate them to GoogleTest as smoothly as possible.
Have you tried such an operation?
What was the effort needed?
Google Test and Cppunit seem to share somewhat the same syntax for invoking tests but as I suspect have too much differences in that syntax.
I'm almost sure you can't somehow automate it and this operation would require rethinking and recompositioning of your tests to follow the Google Test semantics (if you use something specialized to create your mocks, then porting them to Google Mock would require even more effort, simply because Google Mock's approach is not the obvious one and is actually complicated).
I would say that you'd better rethink the following questions: "why do I need to port my tests", "what would be the benefit of this operation" and "do I really want to study a whole new testing framework and then rewrite all of my tests for some purpose".
It seems that you can use google test from another framework (cppunit, in your case):
https://code.google.com/p/googletest/wiki/AdvancedGuide#Letting_Another_Testing_Framework_Drive
To some extent I agree with #Kotti. Automatic conversion will be non-trivial for the tests, so you'd need to consider whether the number of existing tests justify the effort.
I'm a huge fan of the Googlemock framework, and if you make a significant investment in manual mocking, then porting your mocks to Googlemock could have a huge benefit to your ongoing testing costs.
If this is the reason for considering the port, then remember that Googlemock can work with other test frameworks - not just Googletest. (NOTE: I have not used this feature, but have seen online reports its use)