I have some automated tests written in nunit and selenium. How can I call the dll to execute from Microsoft test Manager. as I couldnt figure out how to run automated tests from MTM. is it possible.
3 Answers
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.

- 545
- 5
- 20
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.

- 23,409
- 5
- 46
- 69
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)

- 12,456
- 3
- 46
- 62
-
Thank you so much. It really clarifies me alot. Only one thing left then what is the role of test agents. Are they necessary to run selenium tests as part of build process or do we just need build agent in order to run scripts. – sam Feb 10 '12 at 08:28
-
1Microsoft Test Manager can queue up automated test runs from the associated automation with the manual test cases (which makes them automated instead of manual.) I'm not sure if Selenium exposes a Visual Studio Test type but you could always build a wrapper class using the Visual Studio Test framework that executes a specific Selenium test. – Ed Blankenship Feb 10 '12 at 23:37
-
2Hey Ed, I don't really count manually triggering tests with automation the same as running automated tests. There's something about humans being involved that stops it being automated for me :-) @sam That said, as Ed suggests, you could use the coded UI tests to wrap Selenium tests, but it would mean using MSTest not NUnit. I've got a blog entry showing how you can do this using Watin, not Selenium, at http://www.richard-banks.org/2010/11/how-to-use-codedui-tests-watin-and-mtm.html if it helps. – Richard Banks Feb 14 '12 at 09:10
-
I agree with Ed Richard. You can trigger the running of MTM Tests from a Build or from Release Management. – MrHinsh - Martin Hinshelwood Nov 27 '14 at 09:55