I have a Visual Studio Unittest-Adapter which is working well for Visual Studio 2013 so far. Tests are extracted using a custom command ctest -N
and thus a implementation of ITestContainerDiscoverer
is needed.
You can check out the project here: https://github.com/micst/CTestTestAdapter
As it seems, Visual Studio 2015 simply ignores the ITestContainerDiscoverer
implementation or at least never instantiates and uses it. If I remove the container discoverer from my project and add the default file extensions .dll
and .exe
to the ITestDiscoverer
, so the VSIX in general is correctly installed and working.
How can I get the ITestContainerDiscoverer
to be executed?
Ok, after some (re)search I managed to solve my problem:
1.
There is one unittest adapter example for XML files out there which works on VS2015, so I was able to track down my problem: http://blogs.msdn.com/b/bhuvaneshwari/archive/2012/03/13/authoring-a-new-visual-studio-test-adapter.aspx
2.
It seems like the signature of the constructor of my ITestContainerDiscoverer was wrong. While my original test container discoverer had a constructor without any parameters, the one used in the XML example used a bunch of parameters. After some testing it seems like you need at least a IServiceProvider as constructor parameter:
public CTestContainerDiscoverer(
[Import(typeof (SVsServiceProvider))] IServiceProvider serviceProvider)
{
No idea why exactly, but I think this solved it. It's actually quite sad how bad the documentation for the unittest adapter interfaces is.