Let me describe the problem some more... if this isn't the right forum, please let me know which would be the appropriate forum for this...
I have a flex library that has unit tests. When right-cliking on a test class, and clicking "Execute Flex Unit Tests", Flash Builder automatically creates "FlexUnitApplication.mxml" which is the application that runs the flex unit tests.
I need to pass compile time options when FlexUnitApplication.mxml is built. For example, one option I need is "-include-libraries" which includes all the classes in the specified library even if the classes are not explictily referenced; these classes will be referenced dynamicaly at runtime.
Does anyone know how to set these compile time options? I can do it in an ant task but it's so convenient to run a test case within flash builder that I wouldn't want to lose that capability.
If these can be linked against both the FlexUnit app and your own, then just right click on the project, got to properties, Flex Compiler and there is an Additional compiler arguments
If not, it is possible to keep a separate project where the FlexUnit launcher lives and simply reference the source of your original project. That would let you separate the compielr arguments (at least in theory)
I believe another use case is supplying "-define CONFIG::whatever true"
options to the compiler.
(thus use of this immediately scuppers FB-integrated unit testing)
If not possible and there's a feature-request already logged, do say so
we can vote!
Can you get me a project that shows this issue. We use conditional compiler args in FlexUnit 4, so I am not sure why this would break
I have a zip file containing simple projects that illustrate the issue, how should I get it to you?
Is there a way to attach files in this forum?
Here's a simple example of the issue:
In project "SimpleLibrary" I have the following classes / constructors:
public function Hello()
var helloWorldClass:Class = getDefinitionByName("simple.HelloWorld") as Class;
public function HelloWorld()
public function testHello():void
If you right-click and run "Execute FlexUnit Tests" on simple.HelloTest, a FlexUnitApplication.mxml is created and compiled. When it runs, you get the error message: "Variable HelloWorld is not defined" because the class was not pulled in to the swf since it was not explictly referenced.
If I create a separate application project and use the compile time option: "-include-libraries ..\SimpleLibrary\bin\SimpleLibrary.swc" to ensure that all classes are included in the swf, then the application runs fine.
What I need to do is to have the "-include-libraries" compile time option in effect when FlexUnitApplication.mxml is compiled into a swf.
We have other scenarios where the test app needs different compile options than the library. If we can't find a good solution this make the right-click / "Execute FlexUnit Tests" facility of little for us which would be unfortunate since it's very useful.
1 person found this helpful
If you need to have different libraries / compiler options defined when you run your app versus when you run your unit tests, then your only choice is to
use the second option I mentioned before.
You can have two projects, one with your application and one for running unit tests. The unit test project can reference the source path from the original project.
In Flash Builder, there is no such idea as per Application compilation options, only per project. So, the only way to have a separate set of options in Flash Builder is to have two projects, altough they are still allowed to share the same source.
Yes Mike, it makes sense. I wanted to see if there were other options but we'll have to do what you suggested.
Thanks for your help.