问题描述
我正在尝试实现自定义测试适配器,所有文件都在下面:
I am trying to implement a custom Test Adapter, all the files are bellow:
- TSTestDiscoverer.cs
- TSTestExecutor.cs
- TSTestContainer.cs
- TSTestContainerDiscoverer.cs
- VsSolutionHelper.cs
- TSTestDiscoverer.cs
- TSTestExecutor.cs
- TSTestContainer.cs
- TSTestContainerDiscoverer.cs
- VsSolutionHelper.cs
使用
vstest.console.exe /listdiscoverers /usevsixextensions:true
我确认已安装该扩展程序,并且该扩展程序已在测试发现程序中列出.
I confirmed that the extension is installed and it is listed on the test discoverers.
运行
vstest.console.exe file.ts
我确认TSTestDiscoverer
和TSTestExecutor
都正常工作.
现在,我想在测试资源管理器"上列出测试,为此,我想我需要ITestContainer
和ITestContainerDiscoverer
.我尝试同时实现这两种方法,但都无法正常工作,测试资源管理器未显示任何测试...
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?
推荐答案
我忘了在实现ITestContainerDiscoverer
的类上添加一个属性.
I forgot to add an attribute on the class that implements ITestContainerDiscoverer
.
[Export(typeof(ITestContainerDiscoverer))]
现在可以正常工作了.
这篇关于自定义测试适配器未在测试资源管理器上显示测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!