I am new to Selenium and TFS build. I wrote some UI test cases with Selenium WebDriver, it is running fine in my local environment. Now, I want to run these UI test cases in the TFS build. I did the following to existing build tasks.
- Added a Visual Studio Test Platform Installer
- Added a Visual Studio Test task
The vsTest fails on the below line with error: System.Net.WebException : The underlying connection was closed: The connection was closed unexpectedly.
new DriverManager().SetUpDriver(new ChromeConfig());
I found out that the above line of code tries to check the latest version WebDriver and downloads if not exist from https://chromedriver.storage.googleapis.com. However, on the TFS build server external URL are closed and that could be the reason. Still not sure, I am trying to open this Url on the build server.
[Update] I managed to open googleapis.com Url on the TFS build server. Now a sample test to browse microsoft.com is working but tests for my own website (ex: http://domain or localhost/page.aspx) are still failing. Getting the following error:
OpenQA.Selenium.WebDriverException : unknown error: net::ERR_CONNECTION_REFUSED
(Session info: headless chrome=87.0.4280.66)
Just for information, there is no IIS on the TFS build server. Also, this is an Asp.Net WebForms application.
Do I need to host the website/code on IIS or IIS Express? Just wondering without hosting how will test able to browse it? Sorry for these questions, doing it for the first time and don't have much idea, how to setup everything togather.
Note: I want to do this in build and not in release. Is it feasible to do in the build pipeline? or It must have to be done in the release pipeline? I have configured tests for Chrome in headless mode