Automatically start ASP.MVC project when running test project

坚强是说给别人听的谎言 提交于 2019-12-10 05:37:00

问题


I'm trying to set up a test project for my ASP website. For some tests I want to use selenium to perform end-to-end tests.

Therefor my website has to be running so the tests can access the site.

How can I start my website project when I run tests?


回答1:


Please reference the following links. I believe it is possible, but will be a little tricky. These are detailed and provide information on doing this programmatically.

Starting and stopping IIS Express programmatically

https://www.reimers.dk/jacob-reimers-blog/testing-your-web-application-with-iis-express-and-unit-tests

  • The idea is that you would need to start it and navigate to your particular local app in your browser.
  • Then you will need to get the window handle of the open browser window
  • Then instantiate your Driver object and use the window handle for that instantiation to get Selenium to execute on the open window.


来源:https://stackoverflow.com/questions/25290079/automatically-start-asp-mvc-project-when-running-test-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!