Search code examples
windowsnetbeansjunit

How to get JUnit version


How to know which version of JUnit do I have installed on my PC?

Second question- How do I upgrade it?


Solution

  • To upgrade to a newer version of JUnit, you just have to download the new version and replace the old version with the new jar. It's as simple as that.

    There isn't really a nice way to tell which version of JUnit you're currently using, unless you're using maven or something like that. In general, you can tell between

    • JUnit 3: if you're using the junit.framework.* classes
    • JUnit 4: if you're using the org.junit.* classes (the tests have @Test annotations on them)

    In general, JUnit is backward compatible (JUnit 3 tests can be run under JUnit 4), but JUnit 4 is recommended.