|
From: Chris A. <mrc...@gm...> - 2006-05-17 13:33:49
|
I have a variation on this that I can share with you soon. Sorry that
I can't do so now, I'm rushing off to a meeting. Will email later.
-Chris
On 5/17/06, Jan Harmsen <za...@ar...> wrote:
>
> Hi Sam,
>
> I've been following this thread and remember that I struggled myself quit=
e
> a bit when trying to get unit testing to work under OSX....
> I don't have too much time currently, but here's at least a short
> description how to use Asunit with mtasc under OSX:
>
>
> 1. For displaying the results of the testcases / Sys.println statements u=
se
> the
> 'AsUnit Ui.swf' which can be found in the AsUnit-src.zip (or if you
> installed Asunit,
> it's under
> '$HOME/Library/Application Support/Macromedia/Flash
> 8/en/Configuration/WindowSWF/AsUnit Ui.swf'
> )
>
> Fire this up in a browser window and click the 'Show Sys.println' in the
> lower
> left corner, then you'll see the output of any Sys.println statements use=
d
> in
> your code. (Make sure Sys.as from the Asunit package is in your classpath=
)
>
>
> 2. Create a Main class for your unit tests like this one:
> --------------- SNIP -----------------------------------
> class MainUnitTests {
>
> public static function runUnitTests():Void {
>
> var st:SelectedTests =3D new SelectedTests();
>
> }
> }
> ---------------- SNAP ---------------------------------
>
>
> 3. Create SelectedTests classes for EACH of your packages
> Example source folder: src
> Example package structure: org
>
> SelectedTests class in ./src:
> --------------- SNIP -----------------------------------
> import com.asunit.framework.*;
>
> class SelectedTests extends TestSuite {
> private var className:String =3D "SelectedTests";
>
> public function SelectedTests() {
> super();
> addTest(new org.SelectedTests());
> }
> }
>
> ---------------- SNAP ---------------------------------
>
>
> SelectedTests class in ./src/org:
> --------------- SNIP -----------------------------------
> import com.asunit.framework.*;
>
> class org.SelectedTests extends TestSuite {
> private var className:String =3D "org.SelectedTests";
>
> public function SelectedTests() {
> super();
> addTest(new org.MyClassOneTest());
> //addTest(new org.MyClassTwoTest());
> }
> }
> ---------------- SNAP ---------------------------------
>
> where MyClassOneTest and MyClassTwoTest are the Asunit Test Classes
> containing the unit tests for your classes.
>
>
> 4. In your .swf have the following ActionScript code on a frame AFTER the
> frame where your classes get imported:
>
> --------------- SNIP -----------------------------------
> import MainUnitTests;
>
> MainUnitTests.runUnitTests();
> ---------------- SNAP ---------------------------------
>
> 5. Now compile using mtasc:
>
> --------------- SNIP -----------------------------------
> /usr/local/bin/mtasc -strict -keep -frame 6 -cp /path/to/your/classes -s=
wf
> to/your/swfFile.swf MainUnitTests
> ---------------- SNAP ---------------------------------
>
> This assumes that your classes get imported at frame 6 of your .swf, you
> need to set this to the frame
> where your classes should get imported (after the preloader code).
>
>
> 6. Run your .swf and see the results + Sys.println output in 'AsUnit UI.s=
wf'
>
> 7. By commenting / uncommenting the statements in SelectedTests you can
> quickly exclude / include
> the TestClasses you want to get executed. Just recompile and run, this wi=
ll
> execute the tests.
>
>
> Hope this helps you to get started.....
> I switched from Flash 8 to Eclipse + FDT (http://fdt.powerflasher.com/)
> which works really well for me.
>
> Best regards,
>
> Jan Harmsen
>
>
>
>
> On 17-Mai-2006, at 03:19, Sam wrote:
>
> Hi Chris,
>
> Thanks for your input, I have exhausted trying to figure out the XUL stuf=
f.
> I would be interested in knowing the process you use when making the test
> cases by hand. Not specifics on unit testing or anything like that, but
> after you've built the test how do you run them. The documentation on usi=
ng
> just the framework seems, well, non-existant.
> I am using textmate and the mtasc compiler. Actually I'm using a developm=
ent
> process I found here:
> http://www.unfitforprint.com/articles/2006/01/02/howto-develop-flash-on-m=
ac-osx-with-rake-mtasc-swfmill-and-textmate
> and I'd love to add testing to the process.
>
> Thanks much, any suggestions or tips are appreciated.
> -Sam
>
>
|