• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

FlexUnit ant - running tests that make server calls

New Here ,
Jul 20, 2011 Jul 20, 2011

Copy link to clipboard

Copied

Hi,

I am using BlazeDS in my project to connect to a Tomcat server. I have configured my services in the services-config.xml file and passed the location of the file as an argument to the compiler in Flash Builder.

I have a few unit tests that make asynchronous server calls. When I run these tests from within Flash Builder, the tests run fine. But when I run the tests via the flexunit ant task, these tests alone time out while the other tests pass. Also, it does seem like the server is not contacted at all as my log messeges in my server side code are not visible.

I tried passing the path to the services-config.xml file and the context root of the application in the mxmlc ant task that compiles my TestRunner.mxml file:

<mxmlc file="${main.src.loc}/flexUnitTests/TestRunner.mxml" output="${bin.loc}/TestRunner.swf">

<library-path dir="${lib.loc}" append="true">

<include name="*.swc" />

</library-path>

<source-path path-element="${basedir}/src" />

<source-path path-element="${basedir}/locale/{locale}" />

<compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>

<compiler.headless-server>true</compiler.headless-server>

<compiler.services>C:\myApp\Source\WebServer\WebContent\WEB-INF\flex\services-config.xml</compiler.services>

<compiler.context-root>myApp</compiler.context-root>

</mxmlc>

No use. My tests still time out. Here is my flexUnit task:

<target name="test" depends="compile">

<!-- Execute FlexUnit tests and publish reports -->

<flexunit

swf="${bin.loc}/TestRunner.swf"

workingDir="${bin.loc}"

toDir="${report.loc}"

haltonfailure="false"

verbose="true"

localTrusted="true"

headless="${headless}">

  <source dir="${basedir}/locale/{locale}" >

     <include name="*.properties" />

  </source>

<library dir="${lib.loc}" />

</flexunit>

I guess I am missing somthing - a way to tell ant about the location of my server or something like that. Please help!

Thanks in advance.

Manoj

TOPICS
FlexUnit

Views

4.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Jul 20, 2011 Jul 20, 2011

or create an alternate services config for testing. it would only be able to resolve the server url if the swf was served from a web server.

Votes

Translate

Translate
Advocate ,
Jul 20, 2011 Jul 20, 2011

Copy link to clipboard

Copied

does the services config contain absolute paths to the server or relative paths to a web server root.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 20, 2011 Jul 20, 2011

Copy link to clipboard

Copied

Thanks for the reply Michael. Here is the code that describes my channel in services-config.xml:

<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
            <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
</channel-definition>

Should I be passing the server.port and server.name keys somehow?

Thanks.

Manoj

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jul 20, 2011 Jul 20, 2011

Copy link to clipboard

Copied

or create an alternate services config for testing. it would only be able to resolve the server url if the swf was served from a web server.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 20, 2011 Jul 20, 2011

Copy link to clipboard

Copied

LATEST

Thank you Michael! You made my day! I added hard-coded versions of those config files separate for testing alone and it worked. Thanks again!

Manoj

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines