I am trying to implement a custom Test Adapter, all the files are bellow:
- TSTestDiscoverer.cs
- TSTestExecutor.cs
- TSTestContainer.cs
- TSTestContainerDiscoverer.cs
- VsSolutionHelper.csfrom XMLTestDiscoverer source code
Using
vstest.console.exe /listdiscoverers /usevsixextensions:true
I confirmed that the extension is installed and it is listed on the test discoverers.
Running
vstest.console.exe file.ts
I confirmed that both TSTestDiscoverer
and TSTestExecutor
are working correctly.
Now I want to list the tests on Test Explorer, for that I guess I need ITestContainer
and ITestContainerDiscoverer
. I tried to implement both, but something is not working, the Test Explorer does not show any tests...
What did I do wrong? How can I find out what is not working?
I forgot to add an attribute on the class that implements ITestContainerDiscoverer
.
[Export(typeof(ITestContainerDiscoverer))]
Now it is working.
I have found the blog post here http://blogs.msdn.com/b/mathew_aniyan/archive/2012/05/17/content-index-for-unit-test.aspx as very useful. It contains links to most of the MS stuff on unit testing, including the extension building. It also seems to be updated.
The post by the Chutzpah creator, Matthew Manela, is also very useful http://matthewmanela.com/blog/anatomy-of-the-chutzpah-test-adapter-for-vs-2012-rc/
来源:https://stackoverflow.com/questions/17544530/custom-test-adapter-is-not-showing-tests-on-test-explorer