Hi there!
I'm developing an VS Extension to give information about evolution of the Tests on the several builds, using Visual Studio Premium 2013.
I want to get the selected test from the Test Explorer Tool Window. I've tried the following code:
EnvDTE80.DTE2 _applicationObject = Package.GetGlobalService(typeof(EnvDTE80.DTE2)) as EnvDTE80.DTE2;
if (_applicationObject == null) {
Debug.WriteLine("[VSPackagePackage] DTE Service is null.");
return;
}
UIHierarchy uih = _applicationObject.ToolWindows.GetToolWindow("Test Explorer") as UIHierarchy;
Array selectedItems = (Array) uih.SelectedItems;
// [The Continuity of the Code to Navigate around the Selected Items goes here]On the above code, the problem is that the ToolWindow cannot get the Test Explorer Window, returning null to the UIHierarchy variable.
I've tried to look on the API Reference for Testing Tools for Visual Studio ALM (https://msdn.microsoft.com/en-us/library/dd465178?f=255&MSPPError=-2147217396) and also on the EnvDTE Constants, but i haven't found anything useful.
How can i get the test selected from the test Explorer Window?
Thank you all in advance.