51Testing软件测试论坛

标题: Coded Ui 和 WatiN 的不同之处 <第一部分> [打印本页]

作者: v_dozhan    时间: 2011-10-20 23:29
标题: Coded Ui 和 WatiN 的不同之处 <第一部分>
本帖最后由 v_dozhan 于 2011-10-20 23:36 编辑

CodedUIWatiN
Whether Open Source NoYes
Supported Languages All .Net LanguageAll .Net Language
Supported BrowsersIE, FireFox 3.XIE,
FF2.X, FF3.X(Need to install jssh-WINNT-3.5.xpi),
Chrome
Automate all major HTML element with easeYesYes Mapping Link:
http://watin.org/documentation/element-class-mapping-table/
Find element by multiple attributesYesYes
Find.ById(); Find.ByIndex();Find.ByLabelText();Find.ByName(); etc.
Native support for Page and Control modelYesYes
Supports AJAX website testingYesYes
Supports creating screenshots of webpages Seem No.Yes
Supports frames (cross domain) and iframesYesYes
Handles popup dialogs like alert, confirm, login etc..YesYes
Supports HTML dialogs(modal and modeless)YesYes
Easy to integrate with your favorite(unit) test toolYesYes
Whether Support Record?Yes, Support IE well. With the tool Coded UI Test Builder. Yes, There is a plug-in WaitN Test Recorder. Current support IE, FireFox
Whether run cases successfully after minimize browser window?No.Yes.
Example-Code:
(How to open a new page?)
#region Open a new page BrowserWindow bw = BrowserWindow.Launch("http://msdn.microsoft.com");bw.Maximized = true;#endregion#region operate controlsHtmlDocument htmlDoc = new
HtmlDocument(bw);HtmlEdit searchEditor = new
HtmlEdit(htmlDoc);searchEditor.SearchProperties[HtmlEdit.PropertyNames.Name] = "query";searchEditor.Text = "Coded UI Sample";HtmlInputButton submit = new
HtmlInputButton(htmlDoc);submit.SearchProperties[HtmlInputButton.PropertyNames.Class] = "SearchButton";Mouse.Click(submit);#endregion#region Add assert statementAssert.IsTrue(bw.Uri.AbsoluteUri.Contains("Coded"),bw.Uri.AbsolutePath);#endregion
IE:
using (Browser msdnHomePage = new
IE("http://msdn.microsoft.com")) {}Firefox3.5: (installed jssh-WINNT-3.5.xpi)FireFox ff = new
FireFox("http://msdn.microsoft.com");ff.TextField(Find.ByName("query")).TypeText("system.xml");
Chrome:





欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2