这是我对 Asp.Net Web 应用程序的第一次测试。我们有一个由几个模块组成的引擎。我需要在引擎模块中测试类。尽管这些类是 Asp.Net App 的一部分,但它们仅包含业务逻辑。
作为 WebApp 的一部分,我如何单独测试这些类?因为我收到了这个错误
Web 请求“ http://localhost:8936/ ”成功完成,但未运行测试。这可能发生在配置用于测试的 Web 应用程序失败(处理请求时发生 ASP.NET 服务器错误)或没有执行 ASP.NET 页面时(URL 可能指向 HTML 页面、Web 服务或目录列表)。在 ASP.NET 中运行测试需要将 URL 解析为 ASP.NET 页面,并且页面才能正确执行到 Load 事件。请求的响应与测试结果一起存储在文件“WebRequestResponse_BlogManagerBPOConstr.html”中;通常可以使用 Web 浏览器打开此文件以查看其内容。
谢谢
编辑: @Mark,这是设计师生成的测试方法之一
/
// <summary>
///A test for BlogManagerBPO Constructor
///</summary>
// TODO: Ensure that the UrlToTest attribute specifies a URL to an ASP.NET page (for example,
// http://.../Default.aspx). This is necessary for the unit test to be executed on the web server,
// whether you are testing a page, web service, or a WCF service.
[TestMethod()]
[HostType("ASP.NET")]
[AspNetDevelopmentServerHost("D:\\WorkingCopies\\MyProject\\Engine", "/")]
[UrlToTest("http://localhost:8936/")]
public void BlogManagerBPOConstructorTest()
{
BlogManagerBPO target = new BlogManagerBPO();
Assert.Inconclusive("TODO: Implement code to verify target");
}