Free/Open Source Test Generator for Java? [closed]

霸气de小男生 提交于 2019-11-29 16:55:23

问题


Are there any libraries for Java that can generate unit tests or unit test skeletons for existing code? I'm looking for something similar to pythoscope. Ideally it would generate code that follows JUnit4 or TestNG conventions.

It looks like Agitar does something like this, but I'm looking for something free.


回答1:


Most IDEs will generate test method stubs for any class. I know Eclipse will.

New->JUnit Class then you tell it which class you're testing and what methods you want to test.




回答2:


My plugin creates unit tests, it does both JUnit or TestNG tests. Hope you like it. http://fast-code.sourceforge.net/




回答3:


Agitar had a free service that allowed you to do this (you had to be prepared to let it send your code to their servers).

If you were using scala, there is "scala check" - but I am not sure how well it works with java source (even though its all byte code).




回答4:


I've been trying to get TestGen4j running but it looks like it hasn't been maintained :( Perhaps you give that a try?




回答5:


from the makers of the google : ( https://developers.google.com/java-dev-tools/codepro/doc/features/junit/test_case_generation)

CodePro Analytix

The CodePro JUnit Test Case Generation facility allows you to automate the creation of comprehensive JUnit regression test cases. Given an input class, the tool creates a corresponding test class complete with multiple test methods for each input class method. The tool analyzes each method and input argument with the goal of generating test cases that exercise each line of code



来源:https://stackoverflow.com/questions/125100/free-open-source-test-generator-for-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!