[Laszlo-dev] problem porting lzunit to swf9

Henry Minsky hminsky at laszlosystems.com
Fri Jul 4 06:08:56 PDT 2008


We don't have a good way right now to automatically enumerate the
method names at runtime
of a class. So I'm wondering if we should make an API call that you
need to use in your test which
explicitly adds a test method to a list of tests to run.  So you're
required to define a method named "addTests"
in your test case class. Then you also get to ensure the tests are run
in a specific order as well.



  <class name="MyTest" extends="TestCase">
    <method name="testSomething">
     ...
    </method>

    <method name="testSomethingElse">
     ...
    </method>


  <!-- this method is required to be defined by the user -->
    <method name="addTests">
      this.addTest(testSomething);
      this.addTest(testSomethingElse);
    </method>
</class>


On Fri, Jul 4, 2008 at 8:56 AM, P T Withington <ptw at pobox.com> wrote:
> I modelled this on how junit did it. But maybe we could just make the
> TestCase class add itself to a list in its construct or init method?
>
> On Jul 4, 2008, at 0:46, "Henry Minsky" <hminsky at laszlosystems.com> wrote:
>
>> The TestSuite class in lzunit relies on iterating over all the
>> properties of a TestCase to find its methods who are named "testXXX".
>>
>> It does
>>
>>           var sv = subviews[this.nextCase];
>>           dw("TestSuite.initSuite: subviews[", this.nextCase, "] = ", sv);
>>           if (sv instanceof lz.TestCase)
>>           {
>>               for (var n in sv) {
>>                   var t = sv[n];
>>
>> Which will not do anything useful in swf9, because methods are not
>> properties.
>>
>> If the methods are declared public, then I could use the XML
>> introspection feature of swf9.
>>
>> Or maybe we should have a more portable way to declare testcases, like
>> how lztest makes you
>> add them explicitly..
>>
>>
>>
>>
>> --
>> Henry Minsky
>> Software Architect
>> hminsky at laszlosystems.com
>



-- 
Henry Minsky
Software Architect
hminsky at laszlosystems.com


More information about the Laszlo-dev mailing list