<p>What GUI should use to run my JUnit tests, and how exactly do I do that? My entire background is in .NET, so I'm used to just firing up my NUnit gui and running my unit tests. If the lights are green, I'm clean. </p>

<p>Now, I have to write some Java code and want to run something similar using JUnit. The JUnit documentation is nice and clear about adding the attributes necessary to create tests, but its pretty lean on how to fire up a runner and see the results of those tests.</p>

[{'answer_id': 59132, 'author': 'jodonnell', 'author_id': 4223, 'author_profile': 'https://Stackoverflow.com/users/4223', 'pm_score': 2, 'selected': False, 'text': "<p>There's a standalone JUnit runner that has a UI, but I recommend using one of the builtin test runners in the Java IDEs (Eclipse, Netbeans, and IntelliJ all have good ones).  They all support JUnit, and most support TestNG as well.</p>\n"}, {'answer_id': 59256, 'author': 'jjnguy', 'author_id': 2598, 'author_profile': 'https://Stackoverflow.com/users/2598', 'pm_score': 3, 'selected': True, 'text': '<p>Eclipse is by-far the best I\'ve used.  Couple JUnit with a <a href="http://www.eclemma.org/" rel="nofollow noreferrer">code coverage</a> plug-in and Eclipse will probably be the best unit-tester.</p>\n'}, {'answer_id': 59279, 'author': 'Graviton', 'author_id': 3834, 'author_profile': 'https://Stackoverflow.com/users/3834', 'pm_score': 0, 'selected': False, 'text': '<p>Why you need a GUI runner? Can\'t you just run the tests from the IDE itself?</p>\n\n<p>In .Net we have <a href="http://testdriven.net/" rel="nofollow noreferrer">TestDriven.net</a>, in Java there must be something equivalent. You can check out <a href="http://en.wikipedia.org/wiki/IntelliJ_IDEA" rel="nofollow noreferrer">IntelliJ IDEA</a>, it has the unit testing support built-in. </p>\n'}, {'answer_id': 59941, 'author': 'Grundlefleck', 'author_id': 4120, 'author_profile': 'https://Stackoverflow.com/users/4120', 'pm_score': 3, 'selected': False, 'text': "<p>JUnit stopped having graphical runners following the release of JUnit 4.</p>\n\n<p>If you do have an earlier version of JUnit you can use a graphical test runner by entering on the command line[1]:</p>\n\n<pre>\njava junit.swingui.TestRunner [optional TestClass]\n</pre>\n\n<p>With the optional test class the specified tests will run straight away. Without it you can enter the class into the GUI.</p>\n\n<p>The benefits of running your tests this way is that you don't have the overhead of an entire IDE (if you're not already running one). However, if you're already working in an IDE such as Eclipse, the integration is excellent and is a lot less hassle to get the test running.</p>\n\n<p>If you do have JUnit 4, and really don't want to use an IDE to run the tests, or want textual feedback, you can run the text UI test runner. In a similar vein as earlier, this can be done by entering on the command line[1]:</p>\n\n<pre>\njava junit.textui.TestRunner [TestClass]\n</pre>\n\n<p>Though in this case the TestClass is not optional, for obvious reasons.</p>\n\n<p>[1] assuming you're in the correct working directory and the classpath has been setup, which may be out of scope for this answer</p>\n"}, {'answer_id': 11132066, 'author': 'antonv', 'author_id': 472020, 'author_profile': 'https://Stackoverflow.com/users/472020', 'pm_score': 1, 'selected': False, 'text': '<p>If you want a standalone test runner (not the build-in IDE one), then for Junit3 you can use</p>\n\n<ul>\n<li><code>junit.textui.TestRunner %your_class%</code> - command line based runner</li>\n<li><code>junit.swingui.TestRunner [%your_class%]</code> - runner with user interface (swing-powered)</li>\n</ul>\n\n<p>For Junit4, the UI-powered runners were removed and so far I haven\'t found a convenient solution to run new Junit4 tests on old swing-powered runner without additional libraries. But you can use <a href="http://junitext.sourceforge.net/index.html" rel="nofollow">JUnit 4 Extensions</a> that provides a workaround to use junit.swingui.TestRunner. More <a href="http://talkingjas.blogspot.com/2010/07/how-to-run-your-junit-4-tests-using-old.html" rel="nofollow">here</a></p>\n'}]
['https://Stackoverflow.com/questions/59128', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']