Forum Discussion

johnnychloride's avatar
johnnychloride
New Contributor
12 years ago

Best Practices when testing windows applications which are started from scripts

We are in the process of testing Test Complete and looking to test some fairly heavy engineering type applications which are 'launched' from scripts (.bat files).

Currently we can successfully test the apps alone with Keywords tests, but if we try to record a test where the app is launched by script, when replaying the Test the script will launch but the app will not.

Can anyone advise on the best process to follow when testing an app configured like this?

4 Replies

  • vajindarladdad's avatar
    vajindarladdad
    Frequent Contributor
    Hi Johny,

    I would recommend to use scripts & not to use Recored and Play method.



    The problem you are facing now is because you have not set Delay between 2 steps.



    The test completed hasexecuted the steps to open the "Tested" application but in reality , it take time to lauch that application (some splash screen will appear first & then the MainWindow of the application) . By the time the "Tested Application" gets really lauched on the screen , the TestComplete executes next statement , which will ultimately fail as the application is not launced completely.



    Johny , I would highly recommend you to create the script and launch the appliction.

    There are some really useful functions that you can use to wait until the particular object get exists.



    If you are stick record and play method , you have to insert Drag and Drop "Delay" statement for better stability of the test.



    TestComplete does work perfectly fine with some really heavy Engineering applications.



    I hope this has been of some help.
  • I've found what appears to be a clue to this issue:

    The scripts use the windows envirnment variable %programfiles% to resolve "C:\Program Files", but in Test Complete, the variable %programfiles%="C:\Program Files (x86)"

    I've tried to reload Environment Variables via Tools/Options/Engines/Tested Applications but these are incorrect ("C:\Program Files (x86)") as well.

    From the Set command from cmd prompt shows the correct value.

    Test Complete is running as the same user.

    How to override a Windows Environment Variable in Test Complete to workaround this issue?


  • Hi Johnny,


     


    Could you please zip your entire project suite folder along with the log of the failed test execution and post it here?


    Also, please let us know what value is specified in the %ProgramFiles% variable in Tools | Options | Engines | Tested Applications.


     

  • Hi to you both and thanks for taking the time to respond to my question.

    I've found the root cause of this issue - there seems to be an issue with the way Windows .bat files resolve the %PROGRAMFILES% Environment Variable when called from another application that is x86 rather than x64 (in my particular environment - virtual, connected with rdp etc etc).

    I could isolate the problem by testing with another scripting solution that had a x86 and a x64 version. Specifically:

    - if a .bat is called from x86 .exe, then the .bat resolves %PROGRAMFILES% as C:\Program Files (x86)

    - if a .bat is called from x64 .exe, then the .bat resolves %PROGRAMFILES% as C:\Program Files - correctly in this case.

    Just running the .bat makes the variable resolve correctly to C:\Program Files.

    So from this I believe the issue is not TestComplete, just Windows in this particular environment :).