Menu

redirect test results to log in 9.0.3

abode
2007-06-11
2013-04-17
  • abode

    abode - 2007-06-11

    hi everybody,

    although this forum looks a little orphaned to me, i'll give it a try:
    I posted a problem in the flash forum at: http://www.flashforum.de/forum/showthread.php?p=1652692&posted=1#post1652692

    the question is how to attach a test result to a log - something that used to work in 9.0.2 by TestRunner.addProcessListener(). this is not possible any more as TestRunner has been converted to an Interface.

    on this occasion I read the thread "as3 compliance / as3lib ?" which probably gives the reasons for the lack of traffic in this place and I have to state, that I find it a pity that the two of you (martin and simon) seem to be about to remove from flash development and are not going for as3, though I can partly understand the reasons. personnally I know a few people who work with as2lib and appreciate very well what you accomplished here. so I'll queue up for the "500 hundred people who say: come on guys port the lib to as3!" and hope to make a movement out of it.

    thanks and keep going,
    achim

     
    • Martin Heidegger

      Actually we ported from 0.9.2 to 0.9.3 the testcases from a own event system to the process event system (using our own EventDistributor). Which means now you can add listener by the simple method of "addListener" to the testcase and it will distribute you with "org.as2lib.exec.Process" events (ProcessStartListener(interface), ProcessUpdateListener(interface), etc.). This means your implementation just needs to implement ProcessUpdateListener then you can add it as listener and you get informed after every step.

      yours
      Martin.

      PS.: Maybe you recognized that it took 2 years until you came up with that problem? I don't say that there is no need for a proper library, but the as2lib was not THE way to go ... for a lot of people. Before I don't know how to do better I will not start anything new.

       
      • abode

        abode - 2007-06-11

        @ps: yes - I see what you mean. I consider it a great project anyway.
        @suggestion: thanks a lot - I'll try this out.

         
      • abode

        abode - 2007-06-11

        sorry - I still don't get it...

        TestSuite implements TestRunner
        TestCaseRunner implements TestRunner
        TestRunner provides a addListener() method
        when I try

        myTestSuite:TestSuite = this.getTestSuite
        myTestSuite.addListener( new LoggerTestListener() );

        I get an error:
        **Fehler** (...)\tests\TestBase_04.as: Zeile 76: Das Mitglied ist privat, und der Zugriff darauf ist nicht möglich.
                     TestSuite(curTest).addListener( new LoggerTestListener() );

        I think I tried all variants of
        TestCase.getTestRunner().addProcess(...)
        TestCase.getTestRunner().addListener(...)
        TestSuite.addProcess(...)
        TestSuite.addListener(...)

        and I always either get an "is private" error or an "method not provided" - though both implement this interface.

        thanks in advance,
        achim

         
        • Martin Heidegger

          Okay.

          TestCaseRunner < AbstractProcess < TimeConsumer < EventSupport

          ("<" is for "extends")

          EventSupport has the method "addListener" and no other one overwrites it meanwhile. So lets say it straight "by definition of how I understand AS2" there should be the same method "addListener" in TestCaseRunner as in EventSupport - so much for the runtime.

          TestCase < Process < EventListenerSource

          which means "addListener" which is defined in EventListenerSource should be available as well.

          So what I can see from cvs tag 0.9.3 there should be no problem at all (Since we used the Testcases ourselves with every release this used to work properly).

          My question now: Which environment do you use? Mtasc/Flash8/FlashCS3 (Version?) Win/Mac/... (Version?) it could be of help for me to test it.

           
          • abode

            abode - 2007-06-12

            yepp. this is exactly what I found out when I worked through the doc and the sources. I really did some research on it before I asked and really wondered why this compiles at all - as far as I had understood this is what interfaces were made for...

            I use Win XP and Flash Professional 8.0, but in a few days I will recieve Flash CS3 (Adobe finally managed to deliver...) and then I hope to be able to tell you more. In the meantime I decided to run TestCases manually. This works fine with my own little implementation of LogHandler.

            Thanks,
            Achim

             
      • abode

        abode - 2007-06-12

        just to make sure I made my point clear:

        This is the example taken from the documentation:

        http://api.as2lib.org/0.9.3/org_as2lib_test_unit_TestRunner.html
        Example for adding a Listener to the execution of a TestCase:
        var testCase:TestCase = new MyTestCase();
        var testRunner:TestRunner = testCase.getTestRunner();

        // add a listener to log the events of the test
        testRunner.addListener(new LoggerTestListener());

        // start the execution of the testcase
        testCase.run();

        All I tried was taking the TestRunner from a TestSuite instead of a TestCase.
        As soon as I try to add a Listener the Compiler will assert this method was private.
        Both Classes claim to return the same kind of TestRunner though:

        TestSuite: http://api.as2lib.org/0.9.3/org_as2lib_test_unit_TestSuite.html#getTestRunner
        getTestRunner
        function getTestRunner (
        Void) : TestRunner
        Returns the TestRunner that executes this TestSuite.

        Test:
        http://api.as2lib.org/0.9.3/org_as2lib_test_unit_Test.html#getTestRunner
        getTestRunner
        function getTestRunner (
        Void) : TestRunner
        Returns the TestRunner that executes this Test.

        It works fine with a TestCase and I like the output of LoggerTestListener (which is not in the documentation - why? it's great!).
        Could you provide a simple example how to run a TestSuite and get the Results by LoggerTestListener?

        Thanks and sorry for bothering you,
        achim

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.