2

I have been able to run Selenium test locally on my test machine using a simple webdriver setup such as IWebDriver driver = new FirefoxDriver(); driver.Url = "http://www.testedApp.com"; and running the tests through Microsoft.VisualStudio.TestTools.UnitTesting;, but when I deploy the test through Team Foundation Server vnext Build step "Test: Run Functional Tests" https://www.visualstudio.com/en-gb/docs/build/steps/test/run-functional-tests I get various errors that all seem to relate back to not being able to create a driver in the first place.

I am deploying the selenium tests onto remote machines (either windows Server 2008 R2 or 2012) that have the application to be tested already installed. It doesn't seem to matter if I put the url to driver.Url = "http://www.testedApp.com"; or driver.Url = "http://www.localhost/testedApp.com"; the machine (which looks to still be running from the TFS server machine, not the machine I have deployed the tests onto) appears to be failing at timeouts which led me to this answer on Stack Overflow

Selenium Error - The HTTP request to the remote WebDriver timed out after 60 seconds

After trying all the options there, looking further, I discovered the Selenium Server and RemoteWebdriver (the RemoteWebdriver actually being in my error very deep down)

I am also running the test agent on the remote machine under an Administrator account, so would assume the UI access wouldn't be a problem, but the error also persists if I am using Phantomjs as a browser.

So, I guess my real question is, in order to run a test successfully on a remote machine from the TFS machine, will I need to install and run a Selemium Server (and therefore create my drivers through a RemoteWebdriver)?

If so, would this Selenium Server go on the TFS machine, or the remote machine I am attempting to run the tests on?

Community
  • 1
  • 1
toltec7
  • 51
  • 5

2 Answers2

2

I just wanted to update this with my solution.

I managed to get the vnext Build step "Test: Run Functional Tests" working without using remoteWebDriver or running a Selenium Server with nodes.

I had all the correct trust levels and ports opened, my problem was that I didn't realise that I needed to have the agent running the tests being Authenticated with a PAT Token (in other words, it requires ssl to operate successfully) (DOH!)

I also ran into a problem where the domain policy kept resetting the Group Policy for autologon to 0, which I have got around by running a script to reset before I kick the tests off.

Hope this helps somebody else.

And I apologise in advance if my question initially led to some false assumptions.

But, needless to say, I am grateful that I am not required to maintain the selenium servers (or Octopus deploy), and that Vnext build is adaptable enough to handle this all in house.

Vnext still has a way to go to become completely adaptable to my needs, but it is a great start (imo)

toltec7
  • 51
  • 5
1

You will need a selenium server or node on every machine running a browser.

Steve Harris
  • 344
  • 1
  • 6
  • Thanks for the confirmation Steve. If I could bug for further advice, I was planning to run this on several machines using a separate vnext build for each one in order to easier maintain the disparate machine settings, but looking at the Grid documentation, it seems that you start one up and run the multiple machines from that? Would it be viable (or a waste of resources) to run multiple 'Grids' on different ports, and only one machine from each? Or should I try and find a better way to run all the different machines and their tests from the one build? – toltec7 Mar 26 '17 at 10:33
  • If you can create distinct capabilities on each of the machines then one grid will suffice and you can request the desired capabilities. You may need custom capabilities for your distinctions and this blog post may help: https://rationaleemotions.wordpress.com/2014/01/19/working-with-a-custom-capability-matcher-in-the-grid/ – Steve Harris Mar 26 '17 at 20:14