I want to know what tests are going to be executed in the current session with vstest, because there are resources that we initialize in AssemblyInitialize that might not need to be if the tests aren't selected.
This can be affected by the commandline arguments - VSTest.Console.exe /Tests: for example.
We’ve tried to do it manually and read the passed args (after using VS 2019 —> Right click —> Run test) using this code:
[AssemblyInitialize]
public static void AssemblyInitialize(TestContext context)
{
var args = Environment.GetCommandLineArgs();
}
But the args is showing it is executing testhost.exe instead.
So the question is, is there a proper way to get the running tests, and if not, is there a way to get the arguments to parse for ourselves?