I want' to create a protractor test adapter for Visual Studio. I have found I can create it with implementing ITestExecutor and ITestDiscoverer.
I follow the Marcel De Vries documentation ( https://xpirit.com/wp-content/uploads/2016/03/Xpirit-magazine-2-Protractor-UI-testing.pdf ) but I can't found how to add my extension in Visual Studio.
It's not work, the command "vstest.console.exe /listdiscoverers /UseVsixExtensions:true" doesn't list my discoverer. And JS tests don't found by VS.
What i'm doing wrong?
The documentation is very poor for creating test adapter for VS. There are many URL that can help to understand how implement UTE with JS automated test :
In summary :
Step 1 :
You can test this primary version without VSix : Go to Visual studio Test extension folder (C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow\\Extensions for VS 2013) and add your DLL and dependencies. Try to launch tests with commands like that in windows command prompt :
cd C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow
vstest.console.exe "c:\test\test.js"
Step 2 :
By default Visual Studio only parse .dll and .exe files. If you want to parse another file type (.lua, .js, ...) you need to create a parser who explicitly browse source files and find all tests.
You need to create implement two Interfaces :
This project ( https://github.com/XpiritBV/ProtractorAdapter ) will be useful to understand how implement that and how adapt your code to subscribe on any changes in your project (Add file, Edit file, Project Load, etc.).
Important : You need to create a VSix project to test that ! If not, Visual Studio don't load your TestContaineDiscoverer.
Important 2 : When you create a VSix file, you need to explain two Assets :
Hope it's help somebody.
If you need to run the test adapter with vstest.console.exe but don't need visual studio integration you will need to do the following:
The above accepted answer and code was very useful for me when figuring out how to create a test adapter. Be aware that if you are creating a VSIX then the asset type UnitTestExtension is not available in the list but seems to work and can be added in the .vsixmanifest file manually.
Additional useful links:
Late to the party, but as of today (2022) I'd suggest to read through the docs mentioned in official MS Visual Studio Test Platform readme .
Also, watching this Exploring the Visual Studio Test Platform episode, altough dated, might help.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.