Hey Folks,
Just caught this on the osflash list and wanted to make sure we had
'em here too!
Many thanks to Keith!
Luke Bayes
www.asunit.com
---------- Forwarded message ----------
From: Keith Peters
Date: Jun 13, 2005 1:46 PM
One thing I missed about Eclipse is the missing Create Classes command.
These templates should help:
AllTests:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D
import com.asunit.framework.*;
class AllTests extends TestSuite {
private var className:String =3D "AllTests";
public function AllTests()
{
super();
addTest(new ${package}.AllTests());
// and/or add specific tests here
}
}
TestCase:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D
import ${package}.*;
import com.asunit.framework.*;
class ${package}.${className} extends TestCase {
private var className:String =3D "${package}.${className}";
private var instance:${className};
public function setUp():Void {
instance =3D new ${className}();
}
public function tearDown():Void {
delete instance;
}
public function testInstantiated():Void {
assertTrue("${className} instantiated", instance instanceof
${className});
}
}
Just go to Windows/Preferences/ActionScript 2/Templates. Click "New...", ad=
d
name and description and paste the code.
Now, in an .as file, type "TestCase" or "AllTests" and hit control-space.
You'll be prompted for the needed info to finish the class.
|