Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the unit testing frameworks available in java? [closed]

Tags:

What are the technologies out there? (I only know of JUnit) What is the most popular? Can you please explain the pros/cons of each?

like image 504
Sarit Avatar asked Oct 29 '10 21:10

Sarit


People also ask

What is unit testing framework in Java?

JUnit is a Regression Testing Framework used by developers to implement unit testing in Java, and accelerate programming speed and increase the quality of code. JUnit Framework can be easily integrated with either of the following − Eclipse. Ant. Maven.

Which framework is used for unit testing?

JUnit is a unit testing framework for the Java programming language. JUnit has been important in the development of test-driven development, and is one of a family of unit testing frameworks collectively known as xUnit that originated with JUnit.


1 Answers

JUnit and TestNG are the main unit test frameworks.

Comparison can be found here - http://www.mkyong.com/unittest/junit-4-vs-testng-comparison

I've used JUnit in most places I've worked, it seems to be the standard, but there are some nice things in TestNG.

I've used the following in combination with JUnit to facilitate testing:

  • Mockito for mocking objects - http://code.google.com/p/mockito/
  • Hamcrest assertions for more readable assertions - http://code.google.com/p/hamcrest/
  • Twip for parameterized testing, the JUnit stuff isn't the greatest, in fact TestNG does this better as well - http://twip.sourceforge.net/
like image 85
Jon Avatar answered Oct 04 '22 20:10

Jon