Daily Usage Issues

Setting an Environment Parameter all grid nodes pick up

Started by Phonesis on 6,987 views

Hi Remco,

We use TeamCity to run an NCrunch grid / distributed processing setup where a single controller machine sends jobs off to the grid nodes.

We use Selenium as these are all web UI tests.

The code in our solution checks for the existence of an environment variable for the Browser choice. This will be "Chrome", or InternetExplorer", etc.

The env var is set via TeamCity using the in built feature of setting the variable on the build agent before the run kicks off.

The problem is the env var doesn't make it as far as the grid nodes, only the controller. The result is the browser is always just Chrome (our default one).

I saw this: https://www.ncrunch.net/documentation/reference_global-configuration_custom-environment-variables

Could this be utilised somehow? We are unsure how we go about implementing it.
Hi, thanks for posting!

The environment variables are intended to be hard-coded to a grid client, and they are then present on any node that is doing work for this client. As such, if you are using this exclusively on your build server, it might be possible to create a custom NCrunch config file for each environment variable setup, then feed this into the console tool for alternative runs. So you would basically have several globalconfig.crunch.xml files, each containing a different environment variable targeting a different browser.

In theory, this would give you want you want, though it would only really be useful for the NCrunch console tool (not so much for the VS client).
Remco wrote:Hi, thanks for posting!

The environment variables are intended to be hard-coded to a grid client, and they are then present on any node that is doing work for this client. As such, if you are using this exclusively on your build server, it might be possible to create a custom NCrunch config file for each environment variable setup, then feed this into the console tool for alternative runs. So you would basically have several globalconfig.crunch.xml files, each containing a different environment variable targeting a different browser.

In theory, this would give you want you want, though it would only really be useful for the NCrunch console tool (not so much for the VS client).



Thanks Remco. We've ended up using a text file on a shared drive with a Browser value stored in it. The code checks for the value on setup and each grid node can access it. It's ok for our needs!
Phonesis wrote:
Thanks Remco. We've ended up using a text file on a shared drive with a Browser value stored in it. The code checks for the value on setup and each grid node can access it. It's ok for our needs!


Brilliant! Good thinking :)
Not directly on topic but we are seriously struggling with IEDriver (the Internet Explorer Selenium driver) and our grid setup. Chrome works great. In order to debug why IEDriver isn't working (seems to load up ok but then fail to interact with page) we'd like to be able to see it running on one of the grid machines but it appears to behave headlessly. This makes it very hard to investigate. Any ideas? Can the grid service run in a sort of console mode where you can see it in action when logged into the machine?
Phonesis wrote:Not directly on topic but we are seriously struggling with IEDriver (the Internet Explorer Selenium driver) and our grid setup. Chrome works great. In order to debug why IEDriver isn't working (seems to load up ok but then fail to interact with page) we'd like to be able to see it running on one of the grid machines but it appears to behave headlessly. This makes it very hard to investigate. Any ideas? Can the grid service run in a sort of console mode where you can see it in action when logged into the machine?


There is a console front-end to the grid node service that is automatically installed with the rest of the grid node. Running NCrunch.GridNode.Console.exe will launch the service inside a console window where it can interact with the desktop under the current user account.
Thanks Remco. I have enabled the console mode but do not see any web driver instances running. The grid service is logged in as Local System (default setting) whereas I am logging into the grid machine on my network account. Is this why or should the console mode still work?
The console tool itself won't show any consideration to the logged in user of the grid node service (it is a separate application entirely). It will always run under the logged in user account.

Because of the way security works under Windows, any test runner EXEs launched by the grid node console tool will be running under the same account as the console tool. This means that your tests should, in theory, be able to interact with the desktop. If you don't see any interaction, this may be because of the how the selenium driver works. Is it possible this may be running on a headless mode of some sort?
Yeah could well be doing that. I'll continue to investigate. Thanks again.

Post a reply

Log in to reply.