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))]
onTestContainerDiscoverer
[FileExtension(".dll")]
onTestDiscoverer
[DefaultExecutorUri(TestAdapterConstants.ExecutorUriString)]
onTestDiscoverer
[ExtensionUri(TestAdapterConstants.ExecutorUriString)]
onTestExecutor
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