Test More for Java?!
Any one know, does there exist a TestSimple/More (from Perl) for Java like the module for Perl?
whats that you say? I wrote about TestMore in Perl and PHP Here and here also!
I did a quick scan with google didn't give me much hope. So I wrote this quickly on the train this morning, since I can't hardly stand to program in any language without a TestMore like implementation.. (I know there's JUnit, and I'ved used it before, but its alot of overhead.. I just needed some quick tests!)
Class: (not making any claim this is the best or greatest way, and not 100% TAP protocol)
JAVA:
Usage:
JAVA:
-
package com.myawesomesite.java;
-
-
import com.myawesomesite.java.*;
-
import com.myawesomesite.util.TestSimple;
-
-
public class TestAnimal {
-
-
TestSimple test = new TestSimple();
-
-
Dog bob = new Dog();
-
-
bob.setColor("green");
-
bob.setCollarSize(10);
-
-
test.ok(bob.getColor() == "green", "bob's color is green");
-
test.ok(bob.getCollarSize() == 10,"bob's collar size is 10");
-
test.ok(bob.getCollarSize() == 0,"bob's collar size 0");
-
-
-
}
-
-
}
output is:
ok 1 - bob's color is green ok 2 - bob's collar size is 10 not ok 3 - bob's collar size is 0