Forum Discussion

mmaniscalco's avatar
mmaniscalco
Occasional Contributor
14 years ago

How to tell when flex app has finished working?

When I click any action/button on the flex app the browser doesn't have any idea if it is done or still working, so waitForPage does not work.  Right now we have a waitForStableCursor function that checks the cursor every couple of seconds to see if it changes from stop watch to pointer.  This is unreliable because every once in a while TestComplete will loose the cursor.  I'm not sure why. 



How do other people know when their flex app has completed its task.  Say updating a database or something?



BTW we are using the FlashInjector.
  • Marc,



    The WaitPage method pauses the execution until a web page is loaded. In your case, the new page is not loaded, so this method does not help.


    Unfortunately, Flex does not offer a universal approach to accomplishing the task you need.

    As far as I understand, you have access to internal methods and properties of your Flex app. In this case, you can check the internal object properties or methods to see whether the test action is completed successfully or not. I'd suggest that you consult with application developers. Perhaps, they will have some suggestions. You can ask developers to create some kind of internal flag that will indicate completion of a database operation or another action. If your application uses RemoteObject for calling methods, you can ask developers to define event handlers for the events that occur when the call fails or succeeds, something like this --


    private var ro:RemoteObject = new RemoteObject();

    ro.addEventListener(ResultEvent.RESULT, getResult);

    ro.addEventListener(FaultEvent.FAULT, serverError);

  • mmaniscalco's avatar
    mmaniscalco
    Occasional Contributor
    Hey Alex,



    Thanks for the reply.  I ended up speaking to one of our flex developers and they created a flag that I can check.  It took me about 3 minutes to rework my existing code to make use of this flag.  from what he told me it was also fairly easy for him to fix because he used the same method as when they make the cursor busy.
  • Hi ,

        

    how to know action is completed successfully or not.please find below developers given flag code

    how to handle flex application has finished the task.how to get flag status through testcomplete tool.which method used to solve the cursor busy.





                           
    case
    ListSearchEvent.TYPE_GET_LISTSEARCHFIELDS:


                                 
    token = listSearchDelegate.getListSearchFields();


                                 
    token.addResponder(new mx.rpc.Responder(resultHandler, faultHandler));








          private function resultHandler(event:ResultEvent):void {


                     
    ListSearchModel.getInstance().listSearchFieldsAC = event.result as
    ArrayCollection;


                     
    ListSearchModel.getInstance().selectedIndex=0;




    private function faultHandler(event:FaultEvent):void {


                     
    Alert.show(ResourceManager.getInstance().getString("resources", "Global.RemoteObjectError.Message") +
    event.message);



    Regards,


    Vijay








     

  • Vijay,


    Unfortunately, I cannot help here. I don't know your application and don't know the purpose of its internal objects and variables. Please ask your developer which "flag" you should analyze. Perhaps, the selectedIndex property of the ListSearchModel object should be 0; and in case of an error, you will see a message box (displayed by Alert.show(...) ).


    To understand how to reach this "flag" from test script (what methods and properties to use), please run your application and explore it in the Object Browser. Again, ask your developers for assistance.