Create FlexUnit Tests Quickly in IntelliJ IDEA

Do you know how to navigate from a class to its test and back again or how to create a FlexUnit test quickly with IntelliJ IDEA 11? Let me tell you.

First of all make sure that flexunit.swc is within your module dependencies:

and just press Ctrl+Shift+T (Cmd+Shift+T on Mac) or select Navigate | Test from main menu:

Options to generate setUp() and tearDown() as well as test method stubs are available in test creation dialog:

And here you are!

Adding more tests is easy as well. Press Alt+Insert (Ctrl+Enter on Mac) and select to generate test method:

Hint: To be sure that test classes and FlexUnit classes won’t occasionally appear in production SWF/SWC follow these two good style suggestions:

  • configure dependency on FlexUnit library with ‘Test’ scope (as shown on the first screenshot)
  • keep test classes in a separate source folder marked as test source folder:

Test with pleasure!

Discover more