Using FlexBuilder and Sprouts together

I decided to try to create a Sprouts project over top of my existing FlexBuilder project; the purpose being to use the test generators and framework that comes with Sprouts.

First, I opened a shell and went to my FlexBuilder workspace directory:

    cd c:\dev\flex\FlexBuilder\workspace

I found my workspace location by right-clicking on my FlexBuilder project.
project-properties

Then I threw caution to the wind and just created a sprouts project with the same over the top of it (my project is under version control, isn’t yours?)*

* while my project is under source control, I’m still not happy with the way Eclipse (FlexBuilder) imports the project.  FlexBuilder makes too many assumptions about file locations, and you might have to end up hacking your .project file to get everything smoothe.  I’d like to learn more about how others are handling importing projects from svn into FlexBuilder, and may have a future post discussing it.
    C:\dev\flex\FlexBuilder\workspace>sprout -n as3 taskboard-flex
    >> Creating new project 'taskboard-flex' with as3
          exists  taskboard-flex
          create  taskboard-flex/assets/skins/taskboard-flex
          create  taskboard-flex/bin
          create  taskboard-flex/lib
          create  taskboard-flex/script
          exists  taskboard-flex/src
          exists  taskboard-flex/test
          create  taskboard-flex/assets/skins/taskboard-flex/ProjectSprouts.png
          create  taskboard-flex/rakefile.rb
          create  taskboard-flex/README.txt
          create  taskboard-flex/script/generate.rb
          create  taskboard-flex/assets/skins/taskboard-flexSkin.as
          create  taskboard-flex/src/taskboard-flex.as
          create  taskboard-flex/src/taskboard-flexRunner.as
          create  taskboard-flex/src/taskboard-flexXMLRunner.as

Doesn’t look like it did any harm.

Notice that Sprouts (Sprout?) detected several folders already exist and doesn’t complain about it.  The project folder (taskboard-flex/) and src/ folder were created by FlexBuilder.  The test folder has existing tests, but I don’t have a satisfactory way to run them.  (Perhaps an AsUnit runner inside Eclipse would make a good first Eclipse Plugin project someday.)

Some of the generated objects, such as taskboard-flex.as aren’t needed and can be deleted.  We’ll leave them for now, since they’re not doing any harm.  My application is run from taskboard.mxml anyway.  If it had the same name however, (e.g., taskboard-flex.mxml) that could pose namespace problems.

Now I can create a test case using Sprouts:

    C:\dev\flex\FlexBuilder\workspace>cd taskboard-flex
    C:\dev\flex\FlexBuilder\workspace\taskboard-flex>script\generate.rb test taskboard.model.Task
asunit3.2.8.zip:   100% |....................|  26.7KB 342.4KB/s Time: 00:00:00
flex_sdk_3.zip:    100% |....................| 121.2MB 417.5KB/s Time: 00:04:57
[WARNING] symlink() function is unimplemented on this machine for: runtimes/air/mac/Adobe AIR.framework/Resources
[WARNING] symlink() function is unimplemented on this machine for: runtimes/air/mac/Adobe AIR.framework/Versions/Current
[WARNING] symlink() function is unimplemented on this machine for: runtimes/air/mac/Adobe AIR.framework/Adobe AIR
      create  test/taskboard/model
      create  test/taskboard/model/TaskTest.as
       force  test/AllTests.as

I don’t know what those warnings about symlink are about, but we shouldn’t let that worry us.  c’est Windows!

The ‘force’ on test/AllTests.as turns out to be benign too, despite the ominous comment.  My existing test (SampleTest) is still there.

    package {
        /**
         * This file has been automatically created using
         * #!/usr/bin/ruby script/generate suite
         * If you modify it and run this script, your
         * modifications will be lost!
         */

        import asunit.framework.TestSuite;
        import SampleTest;
        import taskboard.model.TaskTest;

        public class AllTests extends TestSuite {

            public function AllTests() {
                addTest(new SampleTest());
                addTest(new taskboard.model.TaskTest());
            }
        }
    }

I added the test folder to the build path and then noticed this problem in AllTests.as:

    1017: The definition of base class TestSuite was not found.    taskboard-flex/test    AllTests.as    line 13    1240423986281    655

It seems that it can’t find AsUnit in the src path, even though it was also added:

project_build_path1

When running from Sprouts this isn’t a problem because it downloaded both AsUnit and the Flex SDK and added them to the lib/ folder in the project.  (I think I’d like to see a user-level or even system-level cache of these libraries like the .m2/ folder for maven, though I realize this might present problems with multible versions for multiple projects.)

Let’s run the test and see what happens:

    C:\dev\flex\FlexBuilder\workspace\taskboard-flex>rake test
    (in C:/dev/flex/FlexBuilder/workspace/taskboard-flex)
    >> Execute: mxmlc.exe -debug -default-background-color=#FFFFFF -default-frame-rate=24 -default-size 900 550 -ou
    tput=bin/taskboard-flexRunner.swf -source-path+=src -source-path+=assets -source-path+=test -source-path+=lib\a
    sunit3 -verbose-stacktraces=true -warnings=true src/taskboard-flexRunner.as
    Loading configuration file C:\dev\flex\FlexBuilder\workspace\taskboard-flex\Sprouts\cache.7\sprout-flex3sdk-t
    ool-3.3.0\archive\frameworks\flex-config.xml

    rake aborted!
    [ERROR] C:\dev\flex\FlexBuilder\workspace\taskboard-flex\src\taskboard-flexRunner.as(4): col: 24 Error: Syntax
    error: expecting leftbrace before minus.

        public class taskboard-flexRunner extends TestRunner {
                      ^

    C:\dev\flex\FlexBuilder\workspace\taskboard-flex\src\taskboard-flexRunner.as(6): col: 28 Error: Syntax error: e
    xpecting leftparen before minus.

            public function taskboard-flexRunner() {
                         ^

    (See full trace by running task with --trace)

Okay, a simple problem.  Apparently, since it uses the project name for naming functions and classes, you can’t have a hyphen in a project.  Small problem.  Workaround is to rename the the project, or rename the file, class, and function.  Unfortunately, Flexbuilder can’t handle refactoring and I end up with functions like ‘taskboardFlexRunner-flexRunner’

After renaming the Runner files, classes, and functions, it still gives me this complaint:

    rake aborted!
    [ERROR] Error: unable to open 'src/taskboard-flexRunner.as'

So I still have problems.  Is the expected runner name hard-coded (dynamically generated based on project name) somewhere?

I’ll give up for that and just check out again as a new project named ‘taskboard’ (without the ‘-flex’) and worry about conflicting with my non-flex taskboard project later.

Then create a sprouts project on top of that:

    C:\dev\flex\FlexBuilder\workspace>sprout -n as3 taskboard
    >> Creating new project 'taskboard' with as3
          exists  taskboard
          create  taskboard/assets/skins/taskboard
          create  taskboard/bin
          create  taskboard/lib
          create  taskboard/script
          exists  taskboard/src
          create  taskboard/test
          create  taskboard/assets/skins/taskboard/ProjectSprouts.png
          create  taskboard/rakefile.rb
          create  taskboard/README.txt
          create  taskboard/script/generate.rb
          create  taskboard/assets/skins/taskboardSkin.as
          create  taskboard/src/taskboard.as
          create  taskboard/src/taskboardRunner.as
          create  taskboard/src/taskboardXMLRunner.as

And generate a test (note how it downloads the libraries again):

    C:\dev\flex\FlexBuilder\workspace\taskboard>script\generate.rb test taskboard.model.Project
    asunit3.2.8.zip:   100% |....................|  26.7KB 142.8KB/s Time: 00:00:00
    flex_sdk_3.zip:    100% |....................| 121.2MB 421.6KB/s Time: 00:04:54
    [WARNING] symlink() function is unimplemented on this machine for: runtimes/air/mac/Adobe AIR.framework/Resourc
    es
    [WARNING] symlink() function is unimplemented on this machine for: runtimes/air/mac/Adobe AIR.framework/Version
    s/Current
    [WARNING] symlink() function is unimplemented on this machine for: runtimes/air/mac/Adobe AIR.framework/Adobe A
    IR
          create  test/taskboard/model
          create  test/taskboard/model/ProjectTest.as
          create  test/AllTests.as

C:\dev\flex\FlexBuilder\workspace\taskboard>rake test
    (in C:/dev/flex/FlexBuilder/workspace/taskboard)
    >> Execute: mxmlc.exe -debug -default-background-color=#FFFFFF -default-frame-rate=24 -default-size 900 550 -ou
    tput=bin/taskboardRunner.swf -source-path+=src -source-path+=assets -source-path+=test -source-path+=lib\asunit
    3 -verbose-stacktraces=true -warnings=true src/taskboardRunner.as
    Loading configuration file C:\dev\flex\FlexBuilder\workspace\taskboard\Sprouts\cache.7\sprout-flex3sdk-tool-3
    .3.0\archive\frameworks\flex-config.xml
    C:\dev\flex\FlexBuilder\workspace\taskboard\bin\taskboardRunner.swf (90088 bytes)

    [WARNING] FlashPlayer encountered an error working with the mm.cfg log and/or editing the Trust file
    sa_flashplayer_9_: 100% |....................|   3.6MB 451.7KB/s Time: 00:00:08
    The MD5 Sum of the downloaded file (ae1da333575b308ffa5acae9e157512f) does not match what was expected (4135263
    488d95f41b3a846f7be288ad4).
    Would you like to install anyway? [Yn]
    y
    rake aborted!
    can't convert nil into String

    (See full trace by running task with --trace)

It still launches the flashplayer, but seems to re-download it every time. But I see my failing test:
asunit_failing_test

Correcting the deliberate failure by changing this line:

    public function testFailure():void {
        assertTrue("Failing test", false);
    }

to this:

    public function testPass():void {
        assertTrue("Passing test", true);
    }

and rerunning ‘rake test’ gives me the proverbial green :
asunit_passing_tests

I get this funny warning everytime I run it though:

    C:\dev\flex\FlexBuilder\workspace\taskboard>rake test
    (in C:/dev/flex/FlexBuilder/workspace/taskboard)
    >> Execute: mxmlc.exe -debug -default-background-color=#FFFFFF -default-frame-rate=24 -default-size 900 550 -ou
    tput=bin/taskboardRunner.swf -source-path+=src -source-path+=assets -source-path+=test -source-path+=lib\asunit
    3 -verbose-stacktraces=true -warnings=true src/taskboardRunner.as
    Loading configuration file C:\dev\flex\FlexBuilder\workspace\taskboard\Sprouts\cache.7\sprout-flex3sdk-tool-3
    .3.0\archive\frameworks\flex-config.xml
    C:\dev\flex\FlexBuilder\workspace\taskboard\bin\taskboardRunner.swf (90061 bytes)

    [WARNING] FlashPlayer encountered an error working with the mm.cfg log and/or editing the Trust file
    rake aborted!
    can't convert nil into String

    (See full trace by running task with --trace)

Rerunning with trace flace:

    C:\dev\flex\FlexBuilder\workspace\taskboard>rake test --trace
    (in C:/dev/flex/FlexBuilder/workspace/taskboard)
    ** Invoke test (first_time)
    ** Invoke bin/taskboardRunner.swf (first_time, not_needed)
    ** Invoke asunit3 (first_time)
    ** Invoke lib/asunit3 (first_time, not_needed)
    ** Invoke lib/asunit3 (not_needed)
    ** Execute asunit3
    ** Invoke src/main.mxml (first_time, not_needed)
    ** Invoke src/taskboard (first_time, not_needed)
    ** Invoke src/taskboard/components (first_time, not_needed)
    ** Invoke src/taskboard/components/NoteCard.mxml (first_time, not_needed)
    ** Invoke src/taskboard/components/TaskNoteCard.mxml (first_time, not_needed)
    ** Invoke src/taskboard/controller (first_time, not_needed)
    ** Invoke src/taskboard/framework (first_time, not_needed)
    ** Invoke src/taskboard/framework/BaseObject.as (first_time, not_needed)
    ** Invoke src/taskboard/framework/ModelObject.as (first_time, not_needed)
    ** Invoke src/taskboard/framework/ServiceObject.as (first_time, not_needed)
    ** Invoke src/taskboard/model (first_time, not_needed)
    ** Invoke src/taskboard/model/Project.as (first_time, not_needed)
    ** Invoke src/taskboard/model/Story.as (first_time, not_needed)
    ** Invoke src/taskboard/model/Task.as (first_time, not_needed)
    ** Invoke src/taskboard/model/TaskList.as (first_time, not_needed)
    ** Invoke src/taskboard/service (first_time, not_needed)
    ** Invoke src/taskboard/stub (first_time, not_needed)
    ** Invoke src/taskboard/stub/DataLoader.as (first_time, not_needed)
    ** Invoke src/taskboard/view (first_time, not_needed)
    ** Invoke src/taskboard.as (first_time, not_needed)
    ** Invoke src/taskboard.mxml (first_time, not_needed)
    ** Invoke src/taskboardFlexRunner.mxml (first_time, not_needed)
    ** Invoke src/taskboardRunner.as (first_time, not_needed)
    ** Invoke src/taskboardXMLRunner.as (first_time, not_needed)
    ** Invoke assets/skins (first_time, not_needed)
    ** Invoke assets/skins/taskboard (first_time, not_needed)
    ** Invoke assets/skins/taskboard/ProjectSprouts.png (first_time, not_needed)
    ** Invoke assets/skins/taskboardSkin.as (first_time, not_needed)
    ** Invoke test/AllTests.as (first_time, not_needed)
    ** Invoke test/taskboard (first_time, not_needed)
    ** Invoke test/taskboard/model (first_time, not_needed)
    ** Invoke test/taskboard/model/ProjectTest.as (first_time, not_needed)
    ** Invoke test/taskboard/model/StoryTest.as (first_time, not_needed)
    ** Invoke test/taskboard/model/TaskTest.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/errors (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/errors/AbstractError.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/errors/AssertionFailedError.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/errors/ClassNotFoundError.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/errors/InstanceNotFoundError.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/errors/UnimplementedFeatureError.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/framework (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/framework/Assert.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/framework/AsynchronousTestCase.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/framework/AsynchronousTestCaseExample.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/framework/AsyncOperation.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/framework/RemotingTestCase.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/framework/Test.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/framework/TestCase.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/framework/TestCaseExample.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/framework/TestFailure.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/framework/TestListener.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/framework/TestMethod.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/framework/TestResult.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/framework/TestSuite.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/runner (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/runner/BaseTestRunner.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/runner/TestSuiteLoader.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/runner/Version.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/textui (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/textui/AirRunner.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/textui/FlexRunner.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/textui/FlexTestRunner.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/textui/ResultPrinter.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/textui/TestRunner.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/textui/TestTime.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/textui/XMLResultPrinter.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/util (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/util/ArrayIterator.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/util/Iterator.as (first_time, not_needed)
    ** Invoke lib/asunit3/archive/asunit/util/Properties.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/errors (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/errors/AbstractError.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/errors/AssertionFailedError.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/errors/ClassNotFoundError.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/errors/InstanceNotFoundError.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/errors/UnimplementedFeatureError.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/framework (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/framework/Assert.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/framework/AsynchronousTestCase.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/framework/AsynchronousTestCaseExample.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/framework/AsyncOperation.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/framework/RemotingTestCase.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/framework/Test.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/framework/TestCase.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/framework/TestCaseExample.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/framework/TestFailure.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/framework/TestListener.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/framework/TestMethod.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/framework/TestResult.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/framework/TestSuite.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/runner (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/runner/BaseTestRunner.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/runner/TestSuiteLoader.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/runner/Version.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/textui (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/textui/AirRunner.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/textui/FlexRunner.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/textui/FlexTestRunner.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/textui/ResultPrinter.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/textui/TestRunner.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/textui/TestTime.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/textui/XMLResultPrinter.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/util (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/util/ArrayIterator.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/util/Iterator.as (first_time, not_needed)
    ** Invoke lib/asunit3/asunit/util/Properties.as (first_time, not_needed)
    ** Invoke run_bin/taskboardRunner.swf (first_time)
    ** Execute run_bin/taskboardRunner.swf
    [WARNING] FlashPlayer encountered an error working with the mm.cfg log and/or editing the Trust file
    rake aborted!
    can't convert nil into String
    c:/dev/ruby/lib/ruby/gems/1.8/gems/sprout-flashplayer-bundle-9.151.1/lib/sprout/tasks/flashplayer_task.rb:281:i
    n `exists?'
    c:/dev/ruby/lib/ruby/gems/1.8/gems/sprout-flashplayer-bundle-9.151.1/lib/sprout/tasks/flashplayer_task.rb:281:i
    n `read_log'
    c:/dev/ruby/lib/ruby/gems/1.8/gems/sprout-flashplayer-bundle-9.151.1/lib/sprout/tasks/flashplayer_task.rb:233:i
    n `execute'
    c:/dev/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:578:in `invoke_with_call_chain'
    c:/dev/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
    c:/dev/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in `invoke_with_call_chain'
    c:/dev/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:588:in `invoke_prerequisites'
    c:/dev/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:585:in `each'
    c:/dev/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:585:in `invoke_prerequisites'
    c:/dev/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:577:in `invoke_with_call_chain'
    c:/dev/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
    c:/dev/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in `invoke_with_call_chain'
    c:/dev/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:564:in `invoke'
    c:/dev/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2027:in `invoke_task'
    c:/dev/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `top_level'
    c:/dev/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `each'
    c:/dev/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `top_level'
    c:/dev/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in `standard_exception_handling'
    c:/dev/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1999:in `top_level'
    c:/dev/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1977:in `run'
    c:/dev/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in `standard_exception_handling'
    c:/dev/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1974:in `run'
    c:/dev/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake:31
    c:/dev/ruby/bin/rake:16:in `load'
    c:/dev/ruby/bin/rake:16

Anyway, it works, if not gracefully, and I still need to execute ‘rake test’ from the command line.  That’s not optimal, but I can live with it.

I tried creating a TestRunner that looks like this:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="runTests()" layout="absolute">
    <mx:Script>
    <![CDATA[
        import asunit.textui.FlexRunner;
        import asunit.textui.TestRunner;

        var runner:FlexRunner;

        function runTests():void {
            runner = new FlexRunner();
            runner.start(AllTests, null, TestRunner.SHOW_TRACE);
        }

    ]]>
    </mx:Script>

</mx:Application>

And AllTests that looks like this:

package {
    import asunit.framework.TestSuite;
    import taskboard.model.ProjectTest;
    import taskboard.model.StoryTest;
    import taskboard.model.TaskTest;

    public class AllTests extends TestSuite {
        public function AllTests() {
            addTest(new taskboard.model.ProjectTest());
            addTest(new taskboard.model.StoryTest());
            addTest(new taskboard.model.TaskTest());
        }
    }
}

I’m still plagued by this problem:

    1017: The definition of base class TestSuite was not found.    taskboard/test    AllTests.as    line 14    1240434196265    683

even though FlexBuilder has no trouble resolving it for command completion.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s