0

我有应用程序“应用程序”,它具有与 Skype、QQ 等相同的自动化服务(您必须使用您的登录名/密码登录)我需要在此应用程序的设置中测试一些功能,所以我正在使用 testcomplete:

  1. 我需要你运行应用程序
  2. 前往设置
  3. 改变些什么
  4. 节省

它非常简单。但是,如果您已登录,我需要重现这种情况:

  1. 运行应用程序 1.1。如果记录 - 使用 (testlogin/testpassword) 记录
  2. 前往设置
  3. 改变些什么
  4. 节省

如何在 TestComplete 中重现此类功能?我是新手,所以我需要帮助:)谢谢

4

3 回答 3

3

进行测试检查是否显示登录窗口。您可以使用其中一种Wait*方法来执行此操作。如果显示登录窗口,则调用将执行登录的测试例程/关键字测试,然后继续一般测试流程。

...
var loginWindow = Sys.Process("Application").WaitWinFormsObject("loginDialog", 3000);
if (loginWindow.Exists) {
  doLogin();
}
...
function doLogin()
{
  // perform login
}
于 2013-11-05T11:23:39.997 回答
0

While your answer is totally right, I'd like to know if this is possible:

If the loginWindow does not exist, TC gives an error, is it possible to ignore this error and keep it out of the log besides locking the log or disabling it?

Like in Java or C#:

if(object.Exists)
  do something;
else
  do other thing;

this throws an error in TC and I don't want it to because I'm already checking for the existence of the object...

于 2013-11-05T14:01:05.080 回答
0

You cannot use a method on a object that is not there.

Workaround would be to first check for an object and then to use the Exists method like so..

if (object && object.Exists) {
    // doSomething
} else {
    // doSomethingElse
}
于 2016-02-14T00:56:00.060 回答