How to implement Test Adapter

。_饼干妹妹 提交于 2019-12-11 15:53:25

问题


I'm trying to implement a custom test adapter for a unit testing framework I'm working on. The following sources have provided information to get me started:

  • https://devblogs.microsoft.com/devops/writing-a-visual-studio-2012-unit-test-adapter/
  • https://blogs.msdn.microsoft.com/bhuvaneshwari/2012/03/13/authoring-a-new-visual-studio-unit-test-adapter/
  • https://blogs.msdn.microsoft.com/aseemb/2012/03/03/how-to-make-your-extension-visible-to-the-test-explorer-in-visual-studio-11/
  • http://matthewmanela.com/blog/anatomy-of-the-chutzpah-test-adapter-for-vs-2012-rc/

I've implemented the ITestContainerDiscoverer, ITestContainer, ITestDiscoverer and ITestExecutor interfaces and put the required attributes on them:

  • [Export(typeof(ITestContainerDiscoverer))] on TestContainerDiscoverer
  • [FileExtension(".dll")] on TestDiscoverer
  • [DefaultExecutorUri(TestAdapterConstants.ExecutorUriString)] on TestDiscoverer
  • [ExtensionUri(TestAdapterConstants.ExecutorUriString)] on TestExecutor

For deployment, I tried building the project and then re-opening Visual Studio as well as creating a NuGet Package from the project and installing it into another project in the solution but neither triggered the logic.

I put File.WriteAllText(@"C:\Users\XXXXX\Desktop\TestDisc.txt", "Success"); at the start of both TestContainerDiscoverer.ctor and TestDiscoverer.DiscoverTests but the file is never created.

There is no feedback/errors/other in the Output Window.

I looked at the xUnit source code to try and figure it out but that didn't give me any answers.

The full source code can be viewed here: https://github.com/Sellorio/JazSharp/tree/test-adapter

来源:https://stackoverflow.com/questions/57263266/how-to-implement-test-adapter

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