0 Replies Latest reply on May 9, 2011 4:17 PM by vinitpatwa

    first flexunit test is always failing with Error Error #1009: Cannot access a property or method of

    vinitpatwa

      Hi,

       

      I have flexunit project which I am trying to run on linux server.

       

      1. I have Tests project.

      2. I am trying to compile it on linux server and creating Tests.swf file and then executing Tests.swf using ant on 64 bit linux server using standalone flash debug player.

      3. Tests project contains 4 tests and first tests always fail with following error,

       

          test:

       

           [flexunit] Validating task attributes ...

           [flexunit] Generating default values ...

           [flexunit] Using default working dir [/mnt/build/VinitFlexUnitBranch/workspace/src/Tests]

           [flexunit] Using the following settings for the test run:

           [flexunit] FLEX_HOME: [/var/lib/flex4.1sdk]

           [flexunit] haltonfailure: [true]

           [flexunit] headless: [false]

           [flexunit] display: [99]

           [flexunit] localTrusted: [true]

           [flexunit] player: [flash]

           [flexunit] port: [1024]

           [flexunit] swf: [/mnt/build/VinitFlexUnitBranch/workspace/bin/Tests.swf]

           [flexunit] timeout: [60000ms]

           [flexunit] toDir: [/mnt/build/VinitFlexUnitBranch/workspace/src/Tests/report]

           [flexunit] Setting up server process ...

           [flexunit] Entry [/mnt/build/VinitFlexUnitBranch/workspace/bin] already available in local trust file at [/home/deploy/.macromedia/Flash_Player/#Security/FlashPlayerTrust/flexUnit.cfg].

           [flexunit] Executing 'gflashplayer' with arguments:

           [flexunit] '/mnt/build/VinitFlexUnitBranch/workspace/bin/Tests.swf'

           [flexunit]

           [flexunit] The ' characters around the executable and arguments are

           [flexunit] not part of the command.

           [flexunit]

           [flexunit] Starting server ...

           [flexunit] Opening server socket on port [1024].

           [flexunit] Waiting for client connection ...

           [flexunit] Client connected.

           [flexunit] Setting inbound buffer size to [262144] bytes.

           [flexunit] Receiving data ...

           [flexunit] Sending acknowledgement to player to start sending test data ...

           [flexunit]

           [flexunit] FlexUnit test pause in suite Tests.Classes.DummyASyncTest had errors.

           [flexunit]

           [flexunit] Stopping server ...

           [flexunit] End of test data reached, sending acknowledgement to player ...

           [flexunit] Closing client connection ...

           [flexunit] Closing server on port [1024] ...

           [flexunit] <testcase classname="Tests.Classes::DummyASyncTest" name="pause" time="8" status="error"><error message="Error #1009: Cannot access a property or method of a null object reference." type="Tests.Classes::DummyASyncTest.pause" ><![CDATA[TypeError: Error #1009: Cannot access a property or method of a null object reference.

           [flexunit] at org.fluint.uiImpersonation.flex::FlexEnvironmentBuilder/buildVisualTestEnvironment()

           [flexunit] at org.fluint.uiImpersonation::VisualTestEnvironmentBuilder/buildVisualTestEnvironment()

           [flexunit] at org.flexunit.internals.runners.watcher::FrameWatcher/getStage()

           [flexunit] at org.flexunit.internals.runners.watcher::FrameWatcher()

           [flexunit] at org.flexunit.internals.runners.statements::StackAndFrameManagement()

           [flexunit] at org.flexunit.runners::BlockFlexUnit4ClassRunner/withStackManagement()

           [flexunit] at org.flexunit.runners::BlockFlexUnit4ClassRunner/withDecoration()

           [flexunit] at org.flexunit.runners::BlockFlexUnit4ClassRunner/methodBlock()

           [flexunit] at org.flexunit.runners::BlockFlexUnit4ClassRunner/runChild()

           [flexunit] at org.flexunit.internals.runners::ChildRunnerSequencer/executeStep()

           [flexunit] at org.flexunit.internals.runners.statements::StatementSequencer/handleChildExecuteComplete( )

           [flexunit] at org.flexunit.internals.runners.statements::StatementSequencer/evaluate()

           [flexunit] at org.flexunit.runners::ParentRunner/run()

           [flexunit] at org.flexunit.runners::Suite/runChild()

           [flexunit] at org.flexunit.internals.runners::ChildRunnerSequencer/executeStep()

           [flexunit] at org.flexunit.internals.runners.statements::StatementSequencer/handleChildExecuteComplete( )

           [flexunit] at org.flexunit.internals.runners.statements::StatementSequencer/evaluate()

           [flexunit] at org.flexunit.runners::ParentRunner/run()

           [flexunit] at org.flexunit.runners::Suite/runChild()

           [flexunit] at org.flexunit.internals.runners::ChildRunnerSequencer/executeStep()

           [flexunit] at org.flexunit.internals.runners.statements::StatementSequencer/handleChildExecuteComplete( )

           [flexunit] at org.flexunit.internals.runners.statements::StatementSequencer/evaluate()

           [flexunit] at org.flexunit.runners::ParentRunner/run()

           [flexunit] at org.flexunit.runner::FlexUnitCore/beginRunnerExecution()

           [flexunit] at org.flexunit.runner::FlexUnitCore/verifyRunnerCanBegin()

           [flexunit] at org.flexunit.token::AsyncCoreStartupToken/sendReady()

           [flexunit] at org.flexunit.runner.notification.async::AsyncListenerWatcher/sendReadyNotification()

           [flexunit] at org.flexunit.runner.notification.async::AsyncListenerWatcher/handleListenerReady()

           [flexunit] at flash.events::EventDispatcher/dispatchEventFunction()

           [flexunit] at flash.events::EventDispatcher/dispatchEvent()

           [flexunit] at org.flexunit.listeners::CIListener/setStatusReady()

           [flexunit] at org.flexunit.listeners::CIListener/dataHandler()

           [flexunit] at flash.events::EventDispatcher/dispatchEventFunction()

           [flexunit] at flash.events::EventDispatcher/dispatchEvent()

           [flexunit] at flash.net::XMLSocket/scanAndSendEvent()]]></error></testcase>

           [flexunit] <endOfTestRun/>

           [flexunit] Analyzing reports ...

           [flexunit]

           [flexunit] Suite: Tests.Classes.DummyASyncTest

           [flexunit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.008 sec

           [flexunit]

           [flexunit] Results :

           [flexunit]

           [flexunit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.008 sec

           [flexunit]

       

          BUILD FAILED

          /mnt/build/VinitFlexUnitBranch/workspace/src/Tests/build.xml:26: FlexUnit tests failed during the test run.

          at org.flexunit.ant.tasks.TestRun.analyzeReports(Unknown Source)

          at org.flexunit.ant.tasks.TestRun.run(Unknown Source)

          at org.flexunit.ant.tasks.FlexUnitTask.execute(Unknown Source)

          at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

          at java.lang.reflect.Method.invoke(Method.java:597)

          at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)

          at org.apache.tools.ant.Task.perform(Task.java:348)

          at org.apache.tools.ant.Target.execute(Target.java:390)

          at org.apache.tools.ant.Target.performTasks(Target.java:411)

          at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)

          at org.apache.tools.ant.Project.executeTarget(Project.java:1368)

          at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)

          at org.apache.tools.ant.Project.executeTargets(Project.java:1251)

          at org.apache.tools.ant.Main.runBuild(Main.java:809)

          at org.apache.tools.ant.Main.startAnt(Main.java:217)

          at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)

          at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

       

          Total time: 1 second

      Exited with status 1

      [deploy]$

       

      4. Everytime I run this, any test which is run first will fail and all other tests will pass.
      My Tests.as file is as below:

      /**

      * Tests.as

      *

      */

      package

      {

      import Tests.XTestSuite;

       

       

      import flash.display.Sprite;

       

      import mx.core.FlexSprite;

       

      import org.flexunit.listeners.CIListener;

      import org.flexunit.listeners.UIListener;

      import org.flexunit.runner.FlexUnitCore;

       

      public class Tests extends Sprite

      {

      public var flexSprite:FlexSprite;

       

          

       

       

      public function Tests()

      {

      onCreationComplete();

      }

       

      public function onCreationComplete() : void {

      var core : FlexUnitCore = new FlexUnitCore();

      core.addListener(new CIListener());

      core.runClasses(Tests.XTestSuite);

       

      }

       

      public function currentRunTestSuite():Array

      {

      var testsToRun:Array = new Array();

      testsToRun.push(Tests.XTestSuite);

       

      return testsToRun;

      }

      }

      }

       

      ---------

       

      XTestSuite try to run 4 flexunit test classes.

       

      one of that flexunit test script class is as below:

       

      package Tests.Classes

      {

      import flexunit.framework.Assert;

      import org.flexunit.Assert;

      import org.flexunit.asserts.assertEquals;

       

       

       

      public class DummyASyncTest

      {

       

       

       

       

      [Test]

      public function pause() : void

      {

      assertEquals(true, true);

      trace("I M in dummy");

      }

       

      }

       

      }

       

       

       

      All other tests are dummy tests which just asserts(true, true).

       

      I am not sure if I doing something wrong or forgot to take care of something.