[英]How can I make my ASP.NET application run during my automated UI tests?
I have an ASP.NET application (specifically, it's an ASP.NET MVC application). 我有一个ASP.NET应用程序(特别是ASP.NET MVC应用程序)。 I am wanting to write some MSTest tests for it that access it through the browser (using a library such as Selenium or WatiN).
我想为其编写一些MSTest测试,以通过浏览器(使用Selenium或WatiN之类的库)对其进行访问。
In order for my UI tests to work, the ASP.NET application needs to be actually running in a web server so that it can be accessed through the browser. 为了使我的UI测试正常工作,ASP.NET应用程序需要实际在Web服务器中运行,以便可以通过浏览器对其进行访问。 The application could be configured to run on IIS, IIS Express or Visual Studio Development Server.
可以将应用程序配置为在IIS,IIS Express或Visual Studio Development Server上运行。 (I want all three configurations to be supported.)
(我希望所有三个配置都受支持。)
How can I ensure that the ASP.NET application is running on a web server when the tests are run? 测试运行时,如何确保ASP.NET应用程序在Web服务器上运行?
I would suggest using something like SpecsFor.Mvc 我建议使用类似SpecsFor.Mvc的东西
http://specsfor.com/SpecsForMvc/ http://specsfor.com/SpecsForMvc/
It does a lot of the hard work for you. 它为您完成了许多艰苦的工作。 You write integration tests, just like you would write normal unit tests.
您编写集成测试,就像编写普通的单元测试一样。
When you run the tests, SpecsFor.Mvc applies your web config transforms, runs and hosts the app, and kicks off the tests in whichever browser you choose. 运行测试时,SpecsFor.Mvc会应用您的Web配置转换,运行和托管应用程序,并在您选择的任何浏览器中启动测试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.