I was able to successfully set up ant build target to set up and run my unit test. now I'm wondering if it is possible to get Flash Builder to use ant build when it runs unit test. By that, I mean I want Flash Builder to run my ant build when I click on Run->Run->Flex UnitTests and display the result in the FlexUnit Result view. Is this possible?
Yes and no.
As far as I know, there is no way to reconfigure Flash Builder to call an ant task instead of its internal logic when you click the Run FlexUnit Tests button. However, the FlexUnit Result panel is actually always listening for results.
So, if you execute your ant task from within builder, you can use the XMLListener which was the prototype for Adobe's code to communicate back to builder. So, if your code adds the XMLListener to the core, it will attempt to communicate with the flexunit results display when running. So long as builder is open and ready, it should get the results.
1 caveat. The XMLListener was written long ago and was the original prototype we wrote for Adobe. I know they have done a few things internally and it is possible the code has diverged. (They have not shared their derivative work back, so unless someone decompiles it we won't know). It will likely work fine, but if they did make any changes to the expected results, it could be an issue.
XMLListener worked correctly. That's probably good enough. Now I can get back to testing