flexunit gurus,
for our team's junit tests, we've created a custom runner (set with @RunWith) and a TestPhase annotation that lets us distinguish unit tests from functional/component/system tests in the same file. our nightly built runs all tests marked with @TestPhase(target = "UNIT"), whereas our system test invocations additionally invoke the tests annotated with @TestPhase(target = "SYSTEM"). all tests must still be annotated with the @Test annotation. @TestPhase is optional and defaults to "UNIT", and can be set at the class level or method level. to specify the test phase target to run, you supply an environment variable at runtime, e.g. -DtestPhaseTarget=SYSTEM.
i'm trying to think through how i might implement the same with FlexUnit, both to work within Flash Builder and through an ant invocation. i can set the RunWith annotation easy enough, and trust all i'd need to do is ensure that the custom runner is in the Flash Builder library path as well as the <flexunit> ant task's library path. how might i pass the test phase argument to the custom runner? i'm curious both how i'd get the property passed to the runner (i.e. would the <flexunit> ant task inherit all environment properties defined in the build file, would the Flash Builder runner also have access to this property if set in Flash Builder) and how the runner would read the property (i didn't come across a way to read environment variables in action script). is there a recommended runner i should subclass to perform the test method filtering i've described? is there an alternative to implementing my own runner that i should consider? i'd prefer using the same style syntax we've implemented with junit, but if there's a better alternative i'm open to it. of course the simplest alternative is not to write a custom runner at all and to separate unit test code from system test code at a directory level, e.g. separate test/ and functional_test/ dirs. that'll be the fallback if there's not a good way to implement this TestPhase approach with flexunit and actionscript.
thanks.
-mike