Tag Archives: junit

Dynamic JUnit

Recently, I wanted to do something slightly unusual with JUnit. I’m working on a cocoon project, so there are squillions of little XML files floating around. These need to be all well-formed. So I want a test that parses each one. Then, CruiseControl can let us know when they get broken. First, I gave the […]

Java Verbosity

I’ve been doing quite a bit of Java over the last fortnight. It’s much easier with eclipse of course, but it’s still pretty verbose. But I dunno, maybe it’s just me, a whingy old Perl coder. But then again, look what I’ve just found in the Java Cookbook: public class Ls { public static void […]

JUnit 4, the downfall

Sadly, after my excitement about Junit 4, I’ve found the downfall: it doesn’t work with ant yet. However, there does appear to be a workaround. Add this to each class: public static junit.framework.Test suite() { return new junit.framework.JUnit4TestAdapter(SimpleTest.class); } However, that’s now causing my tests to fail with NullPointerExceptions inside HttpUnit. Yet they work fine […]

Junit 4

I’ve got a little project at work that’s completely new (hurrah!), and using Java 5. So, I thought I’d give the latest Junit a try. Junit 4 is quite a departure from the older versions. It relies on features only present in Java 5, like annotations. But this does free up the tests from having […]

Ant & JUnit

I’ve just been tripped up by ant & JUnit. I’m appalled. All the proposed solutions are both hackish and ugly. I don’t actually care about the intricacies of ClassLoaders. I just want a simple way to tell ant “junit is over here” so that my build and tests will work on whatever system I check […]