What is JUnit?
JUnit FAQJUnit is a simple, open source framework to write and run repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks. JUnit features include:
How is JUnit licensed?
JUnit FAQJUnit is Open Source Software, released under IBM's Common Public License Version 0.5 and hosted on SourceForge.
How do I install JUnit?
JUnit FAQTest the installation by running the sample tests distributed with JUnit. Note that the sample tests are located in the installation directory directly, not the junit.jar file. Therefore, make sure that the JUnit installation directory is on your CLASSPATH. Then simply type:
How do I run JUnit using Ant?
JUnit FAQlt;property name="src" value="./src" /> <property name="lib" value="./lib" /> <property name="classes" value="./classes" /> <property name="test.class.name" value="com.xyz.MyTestSuite" /> lt;path id="test.classpath"> <pathelement location="${classes}" /> <pathelement location="/path/to/junit.jar" /> <fileset dir="${lib}"> <include name="**/*.
Why does JUnit only report the first failure in a single test?
JUnit FAQReporting multiple failures in a single test is generally a sign that the test does too much, compared to what a unit test ought to do. Usually this means either that the test is really a functional/acceptance/customer test or, if it is a unit test, then it is too big a unit test. JUnit is designed to work best with a number of small tests. It executes each test within a separate instance of the test class. It reports failure on each test.
What CLASSPATH settings are needed to run JUnit?
JUnit FAQIf attempting to run your tests results in a NoClassDefFoundError, then something is missing from your CLASSPATH.
Why do I get a NoClassDefFoundError when trying to test JUnit or run the samples?
JUnit FAQAlso consider running WhichJunit to print the absolute location of the JUnit class files required to run and test JUnit and its samples.
In Java 1.4, assert is a keyword. Won't this conflict with JUnit's assert() method?
JUnit FAQJUnit 4 is compatible with the assert keyword. If you run with the -ea JVM switch, assertions that fail will be reported by JUnit.
In JUnit, what's the difference between a "failure" and an "error"?
Eclipse FAQA failure is when one of your assertions fails--that is, your program does something wrong, and your JUnit test notices and reports the fact. An error is when some other Exception occurs--one you haven't tested for and didn't expect, such as a NullPointerException or an ArrayIndexOutOfBoundsException.
What happened to the JUnit plugin?
Frequently Asked QuestionsThe Grinder 2 had a JUnit plugin which allowed JUnit test cases to be called. There is no JUnit plugin in The Grinder 3 but you can call arbitrary Java code so you should be able to invoke your JUnit test cases directly. If you have a lot of JUnit test cases, it would be appropriate to wrap up the steps necessary to invoke a test case in a Jython library. Contributions to the script gallery are welcome. We found that it was a problem with DNS configuration.
Are Code Pictures limited to just showing JUnit tests?
NoUnit - Measure your JUnit Test Coverage and Effectiveness ...No! You can easily write a Code Picture report to show you anything you like. Examples (not yet written!) include : Automating the process : you've got better things to do than reading code all day! NoUnit / Code Pictures scan the code and show you what you're looking for in a simple format ... (Green good ,Orange OK red bad!) Share your knowledge! NoUnit reports and Code Pictures can be there , even when you are not.
Q: How can I setup Turbine once for my JUnit Test cases?
Turbine2/FAQ - Turbine WikiThis can be accomplished using JUnit's TestSetup extension. In order to avoid copying the structure to each test case, create a superclass called BaseTurbineTest that you can perform callbacks to get the TestSetup. Below is an example of a BaseTurbineTest class: import junit.extensions.TestSetup; import junit.framework.Test; import junit.framework.TestCase; import org.apache.turbine.util.
