tag:support.gradlefx.org,2011-05-23:/discussions/problems/152-unittest-compilation-fails-when-using-typemobileGradleFx: Discussion 2016-08-11T02:31:47Ztag:support.gradlefx.org,2011-05-23:Comment/309307172014-01-05T15:27:16Z2014-01-05T15:27:16ZUnitTest compilation fails when using type='mobile'<div><p>It may indeed have something to do with the airmobile-config.xml
and how mobile applications are configured. It's trying to compile
the flexUnit test application with the mobile configuration, which
won't work since the mobile Application class behaves differently
compared to its desktop equivalent.</p>
<p>Maybe you can override this 'configname' property by using the
flexUnit.additionalCompilerOptions property.</p></div>Yennick Trevelstag:support.gradlefx.org,2011-05-23:Comment/309307172014-01-05T18:53:11Z2014-10-06T06:41:03ZUnitTest compilation fails when using type='mobile'<div><p>Alright, I'm trying to do so, but somehow, the
flexUnit.additionalCompilerOptions does not have any effect on the
compilation.</p>
<p>flexUnit {<br>
command = "${flexHome}/bin/adl" player = "air" verbose = true
additionalCompilerOptions = ['-incremental=false',
'-output=/Users/crow'] }</p>
<p>I still get:</p>
<p>test main class file:
/Users/crow/Documents/Development/Gradle/GradleFx-Examples-master/flexunit-air-single-project/build/reports/FlexUnitRunner.mxml<br>
Compiling with mxmlc<br>
+configname=airmobile
-source-path+=/Users/crow/Documents/Development/Gradle/GradleFx-Examples-master/flexunit-air-single-project/src/main/actionscript
-source-path+=/Users/crow/Documents/Development/Gradle/GradleFx-Examples-master/flexunit-air-single-project/src/test/actionscript
-incremental=true
-output=/Users/crow/Documents/Development/Gradle/GradleFx-Examples-master/flexunit-air-single-project/build/reports/TestRunner.swf
/Users/crow/Documents/Development/Gradle/GradleFx-Examples-master/flexunit-air-single-project/build/reports/FlexUnitRunner.mxml
-library-path+=/Users/crow/Documents/Development/Gradle/GradleFx-Examples-master/flexunit-air-single-project/libs/flexunit-4.1.0-8-flex_4.1.0.16076.swc
-library-path+=/Users/crow/Documents/Development/Gradle/GradleFx-Examples-master/flexunit-air-single-project/libs/flexunit-cilistener-4.1.0-8-4.1.0.16076.swc
-library-path+=/Users/crow/Documents/Development/Gradle/GradleFx-Examples-master/flexunit-air-single-project/libs/flexunit-uilistener-4.1.0-8-4.1.0.16076.swc
-library-path+=/Users/crow/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-as3/1.1/87773cab5ece2719d208df07497884a040dd12c3/hamcrest-as3-1.1.swc</p>
<p>What am I doing wrong?</p></div>plank.michaeltag:support.gradlefx.org,2011-05-23:Comment/309307172014-01-05T19:15:08Z2014-01-05T19:15:08ZUnitTest compilation fails when using type='mobile'<div><p>You didn't override the <code>configName</code> flag; in the
output it still says: <code>configname=airmobile</code>.</p>
<p>Try adding <code>configname=air</code> to the
additionalCompilerOptions.</p></div>Maxime Coweztag:support.gradlefx.org,2011-05-23:Comment/309307172014-01-05T20:03:28Z2014-10-06T06:41:03ZUnitTest compilation fails when using type='mobile'<div><p>Sorry for the confusion, I actually had a different
problem...</p>
<p>Anyway, I got the unit tests with the air mobile project working
now with:</p>
<p>flexUnit {<br>
command = "${flexHome}/bin/adl" player = "air" verbose = true
additionalCompilerOptions = [ '+configname=air' ] }</p>
<p>Thanks a lot for your help Maxime and Yennick</p></div>plank.michaeltag:support.gradlefx.org,2011-05-23:Comment/309307172014-01-05T21:21:17Z2014-10-06T06:41:03ZUnitTest compilation fails when using type='mobile'<div><p>Since I now had the exact same problem when using the latest
Flex SDK 4.11, I figured out how to solve the problem, without
overriding the configname property.</p>
<p>The test runner classes seem to require the mx.swc, which is not
included in the compiler configs of the airmobile-config.xml of the
Flex SDK 4.9.1 and also not included in the compiler configs of
Flex SDK 4.11.</p>
<p>So what I did to get it working is adding the mx.swc to the
dependencies:</p>
<p>test group: 'org.hamcrest', name: 'hamcrest-as3', version:
hamcrest_as3_version, ext: 'swc'<br>
test
files(project.file('lib/flexUnitTasks-4.1.0-8.jar').absolutePath,<br>
project.file('lib/flexunit-4.1.0-8-flex_4.1.0.16076.swc').absolutePath,
project.file('lib/flexunit-cilistener-4.1.0-8-4.1.0.16076.swc').absolutePath,
project.file('lib/flexunit-uilistener-4.1.0-8-4.1.0.16076.swc').absolutePath)
test files("${flexHome}/frameworks/libs/mx/mx.swc")</p>
<p>There is no need for the flexUnit.additionalCompilerOptions =
['+configname=air'] anymore.<br>
Now everything seems to work so far :-)</p></div>plank.michaeltag:support.gradlefx.org,2011-05-23:Comment/309307172014-01-05T21:23:31Z2014-01-05T21:23:31ZUnitTest compilation fails when using type='mobile'<div><p>Cool! I'll have a look whether this can be fixed in GradleFx
itself.</p></div>Yennick Trevels