Skip to main content
May 6, 2010
Question

Execute TestRunner on Server

  • May 6, 2010
  • 1 reply
  • 1574 views

I am completely new to Flex and FlexUnit. I am trying to execute a unit test that tests whether a rest webservice call generates the correct output. I am using the FlexUnit Ant task and I deploy the TestRunner.swf to the server where I want to TestRunner to run/execute the test, so that the rest call can be made properly. When I try this from the browser it works perfectly, but when I put the following in the Ant Task I get and error. Can anyone PLEASE help me with this??? What am I doing wrong???

...

<flexunit
   player="flash"
   swf=http://localhost:8080/TestRunner.swf
   toDir="${reports.dir}"
   haltonfailure="false"
   verbose="true"
   localTrusted="true"/>

...

I get this error:

Build Faild: the provided swf property value C:\User\workspace\flexunit\https:\localhost:8080:TestRunner.swf could not be found.

This topic has been closed for replies.

1 reply

Inspiring
May 6, 2010

@bkinlaw - Typically either the stand-alone debug Flash Player or ADL is used to launch test SWFs using the FlexUnit Ant task with a path from the local drive.  That being said, it looks like the stand-alone Flash Player will accept URLs, not only local paths.  We should support this in the Ant task and currently do not; good catch!  I will get this fix into 4.1.

Please note however, that unless you are running FlexUnit 4.1 (which is currently bleeding edge), you will not be able to run your tests in the web browser, instead you should try to use the stand-alone debug Flash Player.  You can find instructions on how to intsall the player @ http://docs.flexunit.org/index.php?title=Ant_Task#Setup_your_environment as well as a guide on getting started with the FlexUnit Ant task.

-Brian

May 7, 2010

Brian,

Thank you sooo much for your reply. The reason I am running my test in the browser is because the rest webservice calls use the flex HTTPService and so the TestRunner has to be deployed and the test have to be run as the application so that is renders the correct web webservice URL. This location is only accessible via HTTPS and the stand alone flash player does not support ssl. Unless I am mistaken, once again I am extremely new to flex.

Inspiring
May 7, 2010

@bkinlaw - I'm unsure about https endpoints, but I'll test this out and if it's the case, I'll put some validation in for it.  As far as testing SWF's that have been deployed to a web server, you may want to consider writing unit tests using mock objects from a framework like mockolate(http://github.com/drewbourne/mockolate) or writing integration tests using stubs instead of the live restful services via a library like flexRpcStubs (http://github.com/blegros/flexRpcStubs).  It's always invaluable to have a set of tests for services to run against a set of stubs vs live services to help verify what's causing a problem, your software or an interface change by the service.  If you want to talk about the how we can do this for your tests, start a new thread and I'd be happy to walk through your code and help with suggestions.

-Brian