Find vstest.console.exe path at runtime

(Luke) #1

I’d like to call vstest.console.exe with custom parameters (namely “LogFileName” which seems to be a new VS17 feature which has not been introduced to the “run VSTest.console” action yet).

I’m aware of the GetOptionsObject() method, but I don’t know which option object to specify and what the name of the property on the options object would be to retrieve the path to vstest.console.exe.

Can someone give me a hint on how to acquire the path? I want to avoid specifying environment variables since the path to vstest.console.exe is varying on many different systems I have to deploy the script to.
Thanks in advance

(Vincent Parrett) #2

Hi Luke

You don’t need to call the vstest.console directly. The VSTest action has a couple of properties that are only exposed via the Action Properties Tab (F12 or F4 depending on your keybindings settings).

The props you are looking for are ExtraCmdLineParamsAtStart and ExtraCmdLineParamsAtEnd - these allow you to control where extra parameters are in the parameter list.

Just for completeness, I’ll show how to access the options :slight_smile:

var opt = GetOptionsObject("VisualStudioDotNet");
if (opt) {
 var location =opt.DevEnv2017Location + 'CommonExtensions\\Microsoft\\TestWindow\\vstest.console.exe';

The above javascript shows how the action gets the location, ie it’s dependant on the VS version selected in the action.

The options/tool location stuff is not well documented, and it’s not easy to use, it is something we hope to change in the future (making it more like agent properties in continua ci).

(Luke) #3

Hi Vincent,

thank you very much for your answer. I was not even aware of the Action Properties Tab.
Several years down the road with FB and still learning :slight_smile: