8 Replies Latest reply: Mar 18, 2013 10:45 AM by 873434 RSS

    listeners firing order messes up testing

    873434
      I have encountered the following issue. I have an interactive Swing application. It basically creates a bunch of graphical objects on a canvas. You pick the kind you want to create from a palette (oval, circle, etc.) and click on the canvas. Everything works as expected. Now I want to record a test using Abbot/Costello testing framework. It is pretty simple. Fire up Costello app, create a new script and start recording events. Let's say I want to record this sequence: click on a palette and drop a graphic on canvas. It is natural to expect that testing app would record a click before the canvas component had a chance to process it and added a new graphic. For various reasons I need to capture the app's state before any changes are made to it, not after. It turns out that my app gets first crack at the click event resulting in creation of a new graphic and only after that my testing app receives the event for recording. At this point it is too late for me, the state has been irretrievably changed and I am basically recording a future state and not the state that preceded it.
      I understand that this is a result of listeners firing in different order. I also understand that Swing makes no guarantees as to the order of firing listeners. Have I reached limits of possible or there is a solution?