如何在Watin集成测试中正确检查服务器错误。
|
我正在尝试检测在watin测试期间是否遇到服务器错误。我以为下面的代码可以解决问题,但是在使用中,我在此行的测试执行过程中得到了一个NRE:(Text.Contains(\“ Server Error \”))。
有什么建议在这里做什么?尝试尝试捕获块似乎不是正确的选择。
谢谢。
public class WatinBrowser : IE
{
public WatinBrowser(string url, bool createInNewProcess) : base(url, createInNewProcess)
{
}
public override void WaitForComplete(int waitForCompleteTimeOut)
{
base.WaitForComplete(waitForCompleteTimeOut);
if (Text.Contains(\"Server Error\"))
{
throw new ServerErrorException(\"A server error occured: \" + Text);
}
}
}
public class ServerErrorException : Exception
{
public ServerErrorException(string message): base(message)
{
}
}
没有找到相关结果
已邀请:
1 个回复
樊熄忙暖