Host web application in test process

Vethro

New Member
I made some tests with ASP.NET application hosted in IIS Express and the site started in Selenium WebDriver, accordingly to this article. There are such lines in \[code\][TestInitialize]\[/code\] method:\[code\]// Start web applicationstring webAppPath = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..", webAppProjectName));iis = new Process();iis.StartInfo.FileName = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\IIS Express\iisexpress.exe";iis.StartInfo.Arguments = string.Format("/path:\"{0}\" /port:{1}", webAppPath, httpPort);iis.Start();\[/code\]Then I just open \[code\]http://localhost:port\[/code\] in WebDriver (or browser).I want to use test scaffolding (singletones) in web app, so I need to host web app in the same AppDomain, which is running the test, but IIS is a separate process. Can I somehow host web app in the test process? I looked through \[code\]HttpSelfHostServer\[/code\] descriptions, but I didn't found any examples how to run specific web app project that I can open in browser.
 
Back
Top