Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

How can I get the Test Explorer Tool Window in VS2013?

$
0
0

Hi there!

I'm developing an VS Extension with Visual Studio Professional 2013, to give information about the evolution of tests performance on a Project using TFS Source Control.

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("[VSPackage] 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.

Is there any way to get the Test Explorer Tool Window and get the Selected Test from the Sidebar?

Thank you all in advance.


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>