Video: Using FlexUnit on WiFi

FlexUnit is a unit-testing framework for Flex and ActionScript 3 applications and libraries. It mimics the functionality of JUnit, which is a Java unit-testing framework, and it comes with a graphical test runner. Now Flash Builder 4.6 includes complete support for FlexUnit, so it's actually integrated directly into our development environment so we can run our tests directly from Flash Builder. If you browse out to flexunit.org, you can get more information on the framework. So for example, I can see all of the features, I can contribute if I like, I can access all of the docs, and you will see the docs are very neatly organized, and you could see everything that's going on.

Watch the Online Video Course Flex 4.6 and AIR 3.0 New Features for Mobile Apps

1h 49mIntermediateJan 30, 2012

Viewers:
in countries
Watching now:

Join James Talbot, as he reviews the new features in Adobe Flex, Flash Builder, and AIR for mobile application developers. This course covers the Spark components for building mobile user interfaces in the Flex SDK, and the AIR support for native extensions, which enable applications to use parts of the host operating systems that were previously unavailable. The course also describes new testing and network monitoring capabilities available with Flash Builder 4.6, and the ability for Android applications to be deployed without relying on a separate runtime.

Using FlexUnit on WiFi

FlexUnit is a unit-testing framework for Flex and ActionScript 3applications and libraries.It mimics the functionality of JUnit, which is a Java unit-testing framework,and it comes with a graphical test runner.Now Flash Builder 4.6 includes complete support for FlexUnit,so it's actually integrated directly into our development environment so we canrun our tests directly from Flash Builder.If you browse out to flexunit.org, you can get more information on the framework.So for example, I can see all of the features, I can contribute if I like, Ican access all of the docs, and you will see the docs are very neatly organized,and you could see everything that's going on.

I can also access a wiki, and of course I can download everything as well.So I can download all of the different tests that I want to use and be able toaccess that all from flexunit.org.What I've done is I have actually created a project for you inside of FlashBuilder that contains all of the FlexUnit tests, so we can actually see how it'sintegrated directly inside a Flash Builder.So open up Flash Builder, click File, choose Import Flash Builder Project, andgo and import your FlexUnit tests right here. Go ahead and click Finish, andyou'll see we have my FlexUnitTurnkey.sdk here. And here's my project and Ican indicate the source and I can see all of my different FlexUnit, so here'smy actual application.

You can see that I've included the unit tests here.So the FlexUnitTests, I have included a math package, a suite package, andthat sort of thing.So, it'll run this utilizing the AIR Debug Launcher and I can set up of coursedifferent device configurations.Now FlexUnit does fully support mobile as well, and you can actually test itright on the device, which can be very useful for debugging, and all you haveto do is connect it to your USB port, or you can connect it over the network via WiFi.And you can utilize a socket connection and the computer's IP address tocommunicate between Flash Builder and the FlexUnit application running on the device.

Now all of this setup is actually detailed in the original Flex course, butagain, you can do this debugging over WiFi.Before we do any of the testing, we actually need to generate a SWF file thatwill be located in the bin-debug folder here.So what I am going to do is I'm just going to run the tests and you are going tosee the first time you do it, it's not going to run.So if I click on Run and I choose Run As, and then I choose FlexUnit Tests--itmight take just a second here--you're going to see the first time since we've imported this it's not going to run.

Okay, it's going to update the build path.Let's just choose a couple of tests here.You also see there are some errors, but that's okay.We are testing our project here. Probably expect some errors.So again, we are going to get an error because that SWF file is not actuallylocated in the bin-debug.So I am going to go ahead and proceed, and you'll see it says file not found, right.It can't actually find the SWF file.So I am going to need to run it one more time to actually get these results.So here I'll just again run the tests again, so I will say Run As >FlexUnitTests, go ahead and choose some of the tests here, don't need to choosethem all, and you should see this time it will run, and we should see that ourFlash Builder tests are being run.

So you can see the execution is in process, and we can get some basic informationdirectly from this file.So again, I can rerun tests, I can cancel running tests, and I can see all of that.You will see that in this case, if I look at the different tests, I could see 72different tests have been run.It passed 62, it failed 1, and there's been 9 errors, and nothing has been ignored.Okay great! So now I can close this window once all those tests have actually run, andyou'll see I can see the results of the tests directly inside of Flash Builderunder the FlexUunit Results.

So this panel lists all the tests within the test run, indicating whether thetest has passed or failed.So I can actually double-click right on the test and it will jump me to thatActionScript, so I can see what's going on.And again, if there was a failure, it would jump me right there and I can alsofilter the results. I can see all of that directly from my panel here in terms ofa FlexUnit result testing.So now this is integrated directly into Flash Builder 4.6 and makes testing ourapplications much, much easier.

There are currently no FAQs about Flex 4.6 and AIR 3.0 New Features for Mobile Apps.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.

Already a member ?

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships.
Learn more

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Thanks for signing up.

We’ll send you a confirmation email shortly.

Sign up and receive emails about lynda.com and our online training library:

new course releases

newsletter

general communications

special notices

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

new course releases

newsletter

general communications

special notices

Here’s our privacy policy with more details about how we handle your information.