How to run selenium tests in Microsoft test manager How to run selenium tests in Microsoft test manager selenium selenium

How to run selenium tests in Microsoft test manager


MTM does allow to automate the test.We can browse a test case in Visual Studio and attach the executable to the test case (Created in MTM). Later we have to link the build to the test plan as well for the execution of the automated test. Test code should be developed as a test project (CodedUI or Unit test) if not done so the test manager will not detect the method to be tested.


For MTM to run automated tests with Selenium you need to associate the test with a Test Case in MTM. Currently MTM only supports MS Tests so you would need to build a wrapper for each of your selenium tests.

Solution #1: I would build the wrapper with a T4 template that generated the required MS Test stubs that call my Selenium tests.

You would then need to have a Test Case in TFS with the MS Test 'automation' associated with it.

Solution #2: You can use the "tcm import" command line tool to generate and keep your Test Cases in sync with the automation.

Now that you have all of the bits configured you can go ahead and call the generated tests from MTM and you hit the issue that @richard mentioned.

Solution #3: You can configure an Environment in MTM where you are going to collect the data and automate the trigger of the test run. This can be done as part of the Build, or better as part of your binary Pipeline in Release Management (http://nakedalm.com/execute-tests-release-management-visual-studio-2013/)

While there are a lot of hoops to get all setup I have found this to be a fairly robust way to execute the automation. It would be a lot easier if MTM supported other test frameworks, but that is not the case just now.


MTM doesn't run automated tests. It's a tool designed for manual testers. The only automation it offers is the record/replay of actions that a tester has recorded.

If you want to automatically run Selenium tests then look at running NUnit as part of the build process, just make sure the build agent is running as an interactive processes not a service so that Selenium can access the desktop and run a browser.

Alternatively you could look at using a headless browser such as XBrowser or HTMLUnit (though you'll need to use the Selenium2 remote driver)