BIT-101 [2003-2017]

Updated Eclipse AsUnit Templates


Thanks to some advice from Christophe Herreman, I’ve updated these templates to use the built in variables Eclipse provides. Now, almost everything is filled in for you.

AllTests:

import com.asunit.framework.*;

class AllTests extends TestSuite {
	private var className:String = "AllTests";

	public function AllTests()
	{
		super();
		addTest(new ${enclosing_package}.${package}.AllTests());
		// and/or add specific tests here
	}
}

TestCase:

import ${enclosing_package}.*;
import com.asunit.framework.*;

class ${enclosing_package_and_type} extends TestCase {
	private var className:String = "${enclosing_package_and_type}";
	private var instance:${enclosing_type};

	public function setUp():Void {
		instance = new ${enclosing_type}();
	}

	public function tearDown():Void {
		delete instance;
 	}

 	public function testInstantiated():Void {
		assertTrue("${enclosing_type} instantiated", instance instanceof ${enclosing_type});
	}
}
« Previous Post
Next Post »