6

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?

Martin Walter
  • 540
  • 5
  • 11
  • I'm guessing you don't have this registered with IIS and you want to start it locally with the IIS express in the compiler? – mutt Aug 13 '14 at 20:29
  • @mutt Thats right. I have a web project and a test project in my solution. I want to start the web project to start in Visual Studio via IIS Express when the tests run. – Martin Walter Aug 14 '14 at 07:30

1 Answers1

5

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.
Dave Anderson
  • 11,836
  • 3
  • 58
  • 79
mutt
  • 783
  • 1
  • 7
  • 11