我将很快开发AJAX驱动的网页,其中包含从Web服务(WCF)生成的大量内容.
我过去曾经测试过这种东西(并且很容易找到),但是没有这种动态内容.
我正在使用Visual Studio 2008在.NET 3.5中进行开发.我设想在以下测试:
在过去,我在测试浏览器时使用了延迟.我不是特别喜欢那样做,浪费时间.
与使用等待相比,有更好的经验和做法.也许引入回调和函数式编程来运行测试?
注释1.在回顾前3个回复后的更多细节.
1)感谢艾伦,伊兰和马克西德,你的回复让我在赛道上得到答案,希望没有花太多时间.
2)另一个细节,我使用jQuery来运行Ajax,所以这不是在Asp.NET AJAX中构建的.
3)我发现了一篇很好地说明情况的文章.它来自http://adamesterline.com/2007/04/23/watin-watir-and-selenium-reviewed/
3.1) Selenium Sample(这个和下一个,WatiN,代码示例没有显示在原始网页上(在IE或Firefox上)所以我已经提取它们并在这里列出它们.)
public void MinAndMaxPriceRestoredWhenOpenedAfterUsingBackButton(){
OpenBrowserTo("welcome/index.rails");
bot.Click("priceDT");
WaitForText("Price Range");
WaitForText("515 N. County Road");
bot.Select("MaxDropDownList", "$5,000,000");
WaitForText("Prewar 8 Off Fifth Avenue");
bot.Select("MinDropDownList", "$2,000,000");
WaitForText("of 86");
bot.Click("link=Prewar 8 Off Fifth Avenue");
WaitForText("Rarely available triple mint restoration");
bot.GoBack();
Thread.Sleep(20000);
bot.Click("priceDT");
WaitForText("Price Range");
Assert.AreEqual("$5,000,000", bot.GetSelectedLabel("MaxDropDownList"));
Assert.AreEqual("$2,000,000", bot.GetSelectedLabel("MinDropDownList"));}
Run Code Online (Sandbox Code Playgroud)
3.2) WatiN样本
public void MinAndMaxPriceRestoredWhenOpenAfterUsingBackButton(){
OpenBrowserTo("welcome/index.rails");
ClickLink("Price");
SelectMaxPrice("$5,000,000");
SelectMinPrice("$2,000,000"); …Run Code Online (Sandbox Code Playgroud) testing ajax functional-programming callback browser-automation