Skip to main content
July 12, 2010
Question

How do I test a combobox within an mxml file?

  • July 12, 2010
  • 1 reply
  • 509 views

Hi,

I would like to test a combobox via flexunit by mimicing a user clicking on a certain value and validating that other objects in that mxml file change accordingly.    I tried setting the selectedItem in the combobox and the change event doesn't fire.  Please advise.   Using Flexunit 4.  Can someone provide a code snippet that would show how to use Flexunit to test a combobox?

Thanks..

-Steve

This topic has been closed for replies.

1 reply

Participating Frequently
July 12, 2010

Steve,

You can do this, however, this isn't really what FlexUnit is intended to do. This type of test is more likely a functional test than a unit. I like to think of it as a pyramid with unit at the base, integration in the middle and functional at the top.

I would recommend looking at a tool like FlexMonkey, which actually builds on some of our code, to provide this level of functionality. That said, if you really want to do this in FlexUnit, your problem is the even you are listening for. Flex doesn't dispatch a change event for programmatic changes. Change events only happen as a result of user interaction (Mouse or Keyboard). If you want to do something with a programmatic change, valueCommit is the event you need to watch,

Mike