Custom Test Adapter is not showing tests on Test Explorer

北战南征 提交于 2019-12-08 01:14:39

问题


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?


回答1:


I forgot to add an attribute on the class that implements ITestContainerDiscoverer.

[Export(typeof(ITestContainerDiscoverer))]

Now it is working.




回答2:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!