Forum Discussion

aflorjancic's avatar
aflorjancic
New Contributor
14 years ago

payPal API calls

Hi,



I am writing a test where I create some payPal payments on a test account on PayPal Sandbox page and then I import these payments via wizard into our software. But when I try to import these payments into our software with Test Complete, the importing is not successful - it is always stopped somewhere in the middle. But if I try the same thing manually, the same payPal payments are imported into our system. For importing payments some payPal API calls are used. I am confused why is this happening? Does Test Complete block something or what...?

Thank you advance for your help.

Best regards, Andreja

  • Andreja,


    It's difficult to say what goes wrong without additional information on your project. What browser are you using? What errors do you see in the test log? Perhaps, you can share your test project or script code that fails.


    TestComplete help has topics describing how to search for the cause of an error. Perhaps, they will be of some help: Handling Playback Errors.

  • Hi again,



    thanks for your answer Alex. I will try to explain my problem in more details. So I create some payPal payments on a test acount on

    https://www.sandbox.paypal.com/uk/cgi-bin/merchantpaymentweb?cmd=_account. Then I want to import these payments in our internal application Payments (it is not a web application, but a delphi client for Windows environment). Importing is done through wizard. If I do the same procedure manually, importing of payments is always successful. If I do the same procedure through Test Complete, it is not so. It could happen that importing is stopped on the first step with Pay Pal API error or it could happen that importing is stopped when fetching of transactions is running - our Payment client is not in "not responding state", but you cannot do nothing with it - only kill the process in the Task Manager, there is no errors in Test Complete log . Attached you can find my function for importing payments. In case that importing is successful (a rare case) it takes very long time, whereas the same thing is done very quickly if it is done manually. I know that when importing of Pay Pal payments is running that some Pay Pal API calls run in the background and becuase this strange behaviour is only when I import payments with Test Complete, I am thinking about that there should be something in connection with these API calls and Test Complete - maybe is something blocked with Test Complete or there are maybe some special settings in case of API calls. I do not run this test inside the project for web testing but inside the project for testing Windows apllications because I am testing behaviour of the client for Windows environment. I have also problems if I try to do a refund to Pay Pal payment with Test Complete - it is again done through wizard in our delphi client but with Pay Pal API calls in the background.



    Best regards, Andreja

  • Andreja,


    I looked at the code you attached and, unfortunately, it's difficult to say what can cause the error.

    Does the wizard you are testing function properly? I am asking because of the following code --




    ...

    Aliases.PaymentsClient_A.BankImportWizard.WizardFrame1.cxGroupBox1.cxButton1.ClickButton();

    //Click Next when Transforming is 100%, it waits for cca 8 minutes

    for (d=1; Aliases.PaymentsClient_A.BankImportWizard.FrameWizardBottom1.pnlButtons.btnNext.Enabled == false; d++){

     ...


    If the wizard does not change the Enabled property by the time when the script engine comes to the "for" line, then the waiting loop does not work and your script goes directly to the next script statement (that clicks another button). This situation may be causing problems, so I suggest inserting a short delay after ClickButton:




    ...

    Aliases.PaymentsClient_A.BankImportWizard.WizardFrame1.cxGroupBox1.cxButton1.ClickButton();

    aqUtils.Delay(500);

    ...


    If this does not help, please contact the SmartBear Support Team:

    http://smartbear.com/support/message/?prod=TestComplete

    Please include your test project files along with a description of the problem: run your tests, reproduce the problem, then pack the test project along with test log files and attach the resulting archive. The test log data will help the guys identify problematic script lines.


    One more note:

    You use a loop to wait until the Enabled property becomes true. A simpler option is to use the WaitProperty method. You could try the following code:

     



    ...

    Aliases.PaymentsClient_A.BankImportWizard.WizardFrame1.cxGroupBox1.cxButton1.ClickButton();

    aqUtils.Delay(500);

    if (Aliases.PaymentsClient_A.BankImportWizard.FrameWizardBottom1.pnlButtons.btnNext.WaitProperty("Enabled", true, 500000) == false)

    {

      // Error!

    ...

  • Hi,





    thanks again Alex for your answer. But I am still thinking about that there should be something in connection with these API calls for payPal in the background and Test Complete - maybe is something blocked with Test Complete or there are maybe some special settings in case of API calls. I do not run this test inside the project for web testing but inside the project for testing Windows apllications because I am testing behaviour of the client for Windows environment - maybe I should include some another project item into my project because of this API calls in the background...




    Best regards,  Andreja










  • Andreja,


    I do not run this test inside the project for web testing but inside the project for testing Windows apllications


    The project does not matter, that is, it does not affect the way TestComplete simulates user actions.


    maybe I should include some another project item into my project because of this API calls in the background...


    As far as I know, that does not matter either. Many applications process things in the background, and that does not cause problems.


    At the moment, I can see three possible causes of the problem: TestComplete hangs, your script code hangs (or goes into an infinite loop), or your application hangs.


    To check whether it is TestComplete that hangs, switch to it during the test run (when you think the test hangs) and click editors, menu items or select nodes in the Project Explorer. Most of the actions will be disabled (that is, menu items will be disabled, or you will not be able to change anything in the editors), but the clicks should work: you should be able to see menu items, changes in the cursor position in the script editor, changes of selection in the Project Explorer and so on. If TestComplete does not respond to clicks, it is hanging.


    To determine whether your test is hanging, I suggest posting the d variable to the test log. This way you will see if it exceeds 50. That means the script goes into an infinite loop and you need to change conditions in your script code.


    Unfortunately, it's difficult for me to say what goes wrong in your case. I suggest that you contact the SmartBear Support Team. Please send them your test project along with test log data (as I wrote you earlier). Also, please tell them a bit more about the problem: if it is  TestComplete, your script or your application that hangs.