How to implement Test Adapter

2019-08-17 03:12发布

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:

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

0条回答
登录 后发表回答