In this post, I want to talk about the settings switch and what do we do when a user has passed testsettings file in vstest.console command-line.
Vstest.console runner exposes a command-line switch called /settings in which it accepts both runsettings file as well as test settings file. But the test platform APIs (ITestPlatform, ITestRunRequest, TestRunCriteria etc) on which vstest.console is built does not understand/accept the testsettings xml at all and accepts only runsettings xml. To make the testsettings value work in command-line, we automatically generate a runsettings xml on the fly when a user passes a testsettings file and pass that generated runsettings xml to the test platform APIs. Here is how the generated xml looks like: –
<?xml version="1.0" encoding="UTF-8"?>
<!– The test settings file path can also be relative to the runsettings file.
This runsettings xml is then used to create the TestRunCriteria object (TestRunCriteria runCriteria = new TestRunCriteria(sources, 1, false, runsettingsXml) and that’s how the whole flow of test settings work in vstest.console.