Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java - JUnit Test Generators [closed]

Tags:

I would like to know about good tools to automatically generate JUnit4 tests. By automatic generation, I mean that if I write a .java file, then a test file for the same should be created with method placeholders and setup/teardown in place (like the auto-generate constructors feature of eclipse)

I found some but I haven't tried them all and frankly I am overwhelmed by the plethora of choices. I was wondering if someone has tried some/all of them and has any recommendations from these or any other.

  • http://moreunit.sourceforge.net/
  • http://sourceforge.net/projects/junitgenerator/
  • http://sourceforge.net/projects/junittestmaker/
  • http://jub.sourceforge.net/
  • http://testcasegen.sourceforge.net/
  • http://www.softpedia.com/get/Programming/Other-Programming-Files/JUnit-Test-Generator.shtml
  • http://mediakey.dk/~cc/generate-junit-tests/
  • http://developers.google.com/java-dev-tools/codepro/doc/features/junit/test_case_generation?hl=hu-HU
  • http://agile.csc.ncsu.edu/SEMaterials/tutorials/fit/
like image 647
FirstName LastName Avatar asked Jan 03 '13 17:01

FirstName LastName


People also ask

How do you auto generate JUnit test cases?

In the Package Explorer, select the java class you want to generate the Junit test for. Go to File -> New -> Junit Test Cases. Change the Source folder to point to the test using Browse (Note: It is better to separate the source code from the testing code) Change the Package based on the destination package you want.

Can we generate test cases automatically?

The purpose of producing the tool to generate test cases automatically is to reduce the cost of testing the system as well as to save the time of deriving test cases manually. The system's requirements are transformed using use case diagrams, flow of events and sequence diagrams.

Is there any tool to write JUnit test cases?

This is a complete Eclipse code analysis tool for Java programs. The tool will help you to generate unit tests (JUnits) as well as measuring Code and Test Coverage levels. You can use CodePro Analytix. It is open source.


2 Answers

I use the Eclipse plugin MoreUnit. It can generate TestClasses and test-methods. It also shows which methods have test methods ...

Together with TestNG(JUnit is also good) and EclEmma junit testing is quite easy to handle and keep track on the code coverage

like image 167
MrSmith42 Avatar answered Oct 04 '22 05:10

MrSmith42


Some suggestions: Randoop, AgitarOne, and EvoSuit for Java.

like image 33
user3601784 Avatar answered Oct 04 '22 04:10

user3601784