1

I have a WebApp project that runs normally in debugging. Now I try to run it for UI testing with Selenium:

[TestMethod]
[HostType("ASP.NET")]
[AspNetDevelopmentServerHost(@"D:\WebAppPath", "/")]
[UrlToTest("http://localhost:28319/")]
public void TestMethod1()
{
    Debugger.Break();
}

And the test fails with the error:

The Web request 'http://localhost:28319/' completed successfully without running the test. This can occur when configuring the Web application for testing fails (an ASP.NET server error occurs when processing the request), or when no ASP.NET page is executed (the URL may point to an HTML page, a Web service, or a directory listing). Running tests in ASP.NET requires the URL to resolve to an ASP.NET page and for the page to execute properly up to the Load event. The response from the request is stored in the file 'WebRequestResponse_TestMethod1.html' with the test results; typically this file can be opened with a Web browser to view its contents.

Can I use AspNetDevelopmentServerHost for HTTP hosting, not for unit testing? Is there any other way to programmatically host ASP.NET application (without running external iisexpress.exe process)?

4

0 回答 0