Search code examples
testingautomationtestcomplete

If-else in testcomplete


I have application "Application" , which have same autorization service as skype, QQ etc (You must log using yours login/password) I need to test some functionality in settings of this application, so I`m using testcomplete :

  1. I need tu run application
  2. Go to settings
  3. Change something
  4. Save

And its quite simple. But if you are logged of, I need to reproduce such scenario:

  1. run application 1.1. if logged of - log using (testlogin/testpassword)
  2. Go to settings
  3. Change something
  4. Save

How I can reproduce such functionality in TestComplete? I`m newbie with it so I need help :) Thanks


Solution

  • Make your test check whether the login window is displayed. You can do this using one of the Wait* methods. If the login window is displayed then call a test routine/keyword test that will perform a login and then continue the general test flow.

    ...
    var loginWindow = Sys.Process("Application").WaitWinFormsObject("loginDialog", 3000);
    if (loginWindow.Exists) {
      doLogin();
    }
    ...
    function doLogin()
    {
      // perform login
    }