开发者

How to create Test cases in Automation tool TestComplete

How can I create test cases according to my requirement.

Example: I have a form开发者_运维百科 with many fields. There is one field name Father's Name, now I want that the user should insert only string in this field, no numeric values should be accepted.

I wanna carry out such cases and do testing using the tool. How can I do this in TestComplete?


So, you want to validate that the tested application correctly handles the situation when forbidden characters are entered in the field, right? If so, then the exact solution depends on what the application does when a forbidden character is entered:

1) The app shows an error box. In this case, make your test enter a forbidden char and check for the error box existence using the appropriate Wait* method (WaitWindow, WaitNamedChild, etc.). Short example from the top of my head (did not run the code):

var TextToEnter="First 123Name";
EditBox.Keys(TextToEnter);

// As a rule, validationg is performed when the focus changes
EditBox.Keys("[Tab]");

var ErrorBox = MainWnd.WaitNamedChild("wndErrorDlg", 5000);

if (ErrorBox.Exists)
  Log.Message("Succeeded - the error box is shown");
else
  Log.Error("Failed - no error box detected");

2) The app does not show any error, but just ignores the forbidden chars making them not to appear in the edit box. In this case, just compare the actual text against the expected text. Something like this:

var TextToEnter="First 123Name";
var TextToExpect="First Name";

EditBox.Keys(TextToEnter);

if (EditBox.wText == TextToExpect)
  Log.Message("Succeeded");
else
  Log.Error("Failed");

I hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜