Adobe recently launched a prererelease version of the Adobe Actionscript Code Coverage Plug-in for Adobe Flash Builder, a tool that helps AS and Flex developers understand what code gets executed while an application is running.
What can I use it for ?
The main use of the plug-in is to tell you how much of code your unit tests cover. Although it's a good practice to add a unit test coverage measurement tool into your continuous integration system and get updated statistics after each commit/build (see FlexMojos), this tool helps you when you are writing your unit tests and want to see which areas of your class you didn't cover yet.
You can also run it on your application, not on the unit tests, and after interacting a bit with the application see which areas of your code are use and which not.
Installation problems
Installing the plugin should be fairly simple. Just copy the .jar file into the plugins folder, add the Code Coverage perspective in Flash Builder and you should be good to go. Just in case it doesn't work for you here are a few things to check.
1. Make sure your flash player is a debug version for the browser you are testing in. You can test that here. If you use Google Chrome and don't have a debugger read this.
2. Check if your application is debuggable. That is usually the case with all the applications that you run from the bin-debug folder, but if you want to enforce this you can set -debug=true as a compilation parameter.
3. Use Flash Builder Premium. In the documentation it says that this plugin can be used only with the Premium version of FB.
4. Look for your mm.cfg file and check if there is an entry for PreloadSwf in there. If the file contains binary data, it is corrupted so delete it and restart the CodeCoverage plugin. If you are not sure that mm.cfg is in the right place (don't use flashlog.txt) you should read here where the proper mm.cfg should be in some cases.
5. The preload swf file needs special security permissions to be able to access local and network files. Normally Flash Builder grants this by adding it in the user's FlashPlayerTrust\flashbuild.cfg. If it's not there, you will have to add it manually. This will give the preload swf the ability to connect to local and network files. Remember to restart the browser when you are done.
6. Check to see if the port is available and if the firewall is not blocking it. The application uses port 9900 by default, so do a netstat -an and make sure that the application is listening. You can also do a telnet connection to that port just to be sure.
If none of the above work try posting it on the forums.
Good practices
The plugin is a bit slow, at least in it's current prerelease 1 phase so it is a good idea to keep it on for a very limited time(just when you need it). It tries to connect to all the applications that run in Flash Player so it will slow down your system and might cause crashes or security errors.
You can find a quick guide on how to use it here: http://butterfliesandbugs.wordpress.com/2010/09/29/code-coverage-plug-in-for-flash-builder-is-available/
Subscribe to:
Post Comments (Atom)
2 comments:
Thanks for this configuration summary.
I can find only the mm.cfg on my computer .. but there is no flashbuild.cfg. Does this file always exist?
I think it exists only if you have Flash Builder installed. If you are using Flex Builder 3 the file will probably be called flexbuilder.cfg, but I am not sure that the plugin works with FB3.
Post a Comment