- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在使用 Microsoft WebTest 并希望能够执行类似于 NUnit 的 Assert.Fail()
的操作。我想出的最好办法是 throw new webTestException()
但这在测试结果中显示为 Error
而不是 Failure
。
除了反射(reflection) WebTest
设置一个私有(private)成员变量来指示失败之外,还有什么我错过的吗?
编辑:我也使用了 Assert.Fail()
方法,但是当从 WebTest 中使用时,这仍然显示为错误而不是失败,并且 Outcome
属性是只读的(没有公共(public) setter)。
编辑:好吧,现在我真的很困惑。我使用反射将 Outcome
属性设置为失败,但测试仍然通过了!
这是将 Oucome 设置为失败的代码:
public static class WebTestExtensions
{
public static void Fail(this WebTest test)
{
var method = test.GetType().GetMethod("set_Outcome", BindingFlags.NonPublic | BindingFlags.Instance);
method.Invoke(test, new object[] {Outcome.Fail});
}
}
这是我试图失败的代码:
public override IEnumerator<WebTestRequest> GetRequestEnumerator()
{
this.Fail();
yield return new WebTestRequest("http://google.com");
}
Outcome
被设置为 Oucome.Fail
但显然 WebTest 框架并没有真正使用它来确定测试通过/失败结果。
最佳答案
设置Outcome property 失败:
Outcome = Outcome.Fail;
还有一个 Assert.Fail()
在 Microsoft.VisualStudio.QualityTools.UnitTestFramework 程序集中。
关于c# - 我怎样才能使 WebTest 失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/224467/
我正在使用 VS2017 - 有没有什么方法可以在不安装 VS2017 Enterprise 的情况下让网络测试工作?我只需要 mstest.exe - 而不是 GUI 或 IDE。 最佳答案 不,对
当我尝试使用 webtest 在我的开发服务器上运行 gaeunit 时,出现此错误。 No module named webtest Status: 404 Not Found Conten
我正在使用webtest插件作为grails的功能测试组件。 它可以正常工作,但是非常慢-在测试中,整个应用程序的响应时间很短(每页大于1分钟)。我的感觉是,这是因为当我通过IDE(test-app
在django-webtest ,每个测试 TestCase 子类都带有 self.app,它是 webtest.TestApp 的一个实例,然后我可以通过 self.app.get('/',user
我正在使用 WebTest 测试表单。但是,有些字段是使用 JS 动态创建的,因此这些字段不在 Form 中。当我尝试设置以下字段之一时出现错误: >>> resp.form['new_field']
我有一个 Google App Engine 应用程序,我的请求 hadler 有一个执行身份验证的装饰器。通过 WebTest 我发现 yesterday如何设置登录用户和管理员。 今天我的身份验证
我正在使用 Microsoft WebTest 并希望能够执行类似于 NUnit 的 Assert.Fail() 的操作。我想出的最好办法是 throw new webTestException()
我正在使用 Python 和 Webtest 来测试一个 WSGI 应用程序。我发现处理程序代码中引发的异常往往会被 Webtest 吞噬,然后引发泛型: AppError: Bad response
如果我发送请求,并且我希望响应通过 SignalR 来,是否可以在 Visual Studio 中使用 LoadTest 或 PerformanceTest 进行测试? 最佳答案 简短回答:是的 我已
Azure 上的 Application Insights 允许我上传 .webtest 文件来监控应用程序可用性。我的应用程序是 REST/JSON 服务,因此我的 .webtest 引用从 Ext
我已在此站点中阅读了 Grails 和 Webtest 的文档: http://www.grails.org/plugin/webtest 而且它非常未更新。那里列出的大多数脚本都不起作用。 我正在寻
我无法在Grails 2.3.11上运行webtests。运行grails test-app我得到这个: Error Fatal error running tests: couldn't find
** 更新后 ** 对于 Microsoft Dynamics 环境中的系统和集成测试,我们使用 Visual Studio 2010 Coded UI。我是一个没有经验的 Visual Studio
我为一个看起来运行良好的网站创建了一个网络性能测试。这是一个用于登录和测试导航的简单测试。运行该测试每次都有效。但是当我在 LoadTest 中调用该测试时,问题就出现了。因此,我创建了一个负载测试,
我完全不熟悉使用 Python WebTest 进行功能测试,请多多包涵 我在看 https://webtest.readthedocs.org/en/latest/webtest.html , 所以
我配置了我的 pyramid 应用程序,以便在根据 official tutorial 进行身份验证后将 user 对象附加到 request .到目前为止一切顺利......但是虽然它工作得很好并且
我有一个 .webtest,我打算用它来加载测试将文件上传到网站。我正在使用 Visual Studio 中内置的 WebTest 框架,目的是从 Azure 运行更大规模的测试。 我创建了一个新的网
有谁知道我如何使用 WebTest 测试图像上传。我目前的代码是: form['avatar'] =('avatar', os.path.join(settings.PROJECT_PATH, 'st
我有一个 Azure 资源管理器模板,它是一组嵌套模板的一部分。它创建一个 App Insights 组件、针对禁止请求的网站的警报规则、多步骤 Web 测试以及针对 Web 测试的警报规则。除针对
我有一个 Pyramid 应用程序,它将某些功能锁定为 HTTPS 连接。 服务器前面是 nginx(通常),我使用 PasteDeploy 来检测 HTTPS 连接。从我的环境.ini: [filt
我是一名优秀的程序员,十分优秀!