Here’s a couple of things I learned while creating a Visual Studio test adapter that included a custom ITestContainerDiscoverer:
- There is almost no documentation on creating Visual Studio test adapters (and even less on ITestContainerDiscoverer and friends)
- You need to install the Visual Sudio SDK to get the required assemblies for creating test container discoverers (but not for just test adapters)
- You cannot create a test adapter without a test container discoverer if you want to scan non-DLL/EXE files
- Although you can deploy test adapters via NuGet; this does not work for test container discoverers; they must be registered as real Visual Studio extensions
- To have Visual Studio load your test container discoverer, you must add an asset with type “UnitTestExtension” to your VSIX; an option which is not in the list (nor, seemingly, documented)
- Just because you’re in the middle of responding to a request from Visual Studio to get a list of tests; doesn’t mean it won’t ask you AGAIN AT THE SAME TIME on another thread :/
- When building Visual Studio extensions, the entire VSIX output folder is copied into the expirimental instance, not just the files you’d get via the VSIX. This means references to other projects might work fine on your machine, but not on somebody elses!
- The “Run tests after build” function actually means “when test container change”, so even for non-building projects (eg. lua tests), it can work when you save files :)