52

Does MSTest have standalone GUI similar to nUnit that lets me use it and run test without visual studio? What is the official site for MSTest where I can learn more about how to use it?

1

7 Answers 7

40

MSTest can be used without installing Visual Studio. You will need to install Visual Studio Test Agent, which is a free download from Microsoft.

I think this approach is better from a licensing perspective than manually copying MSTest.exe and its dependencies onto the build server.

See this blog for reference: http://blogs.msdn.com/b/anutthara/archive/2009/12/16/running-tests-in-mstest-without-installing-the-vs-ide.aspx

Sign up to request clarification or add additional context in comments.

1 Comment

There are chocolatey packages for both the visualstudio2013testagents and visualstudio2015testagents which should install to the correct locations for your CI system (TeamCity/Jenkins) or other tools to use.
20

It doesn't have a GUI (apart from Visual Studio) but there's a command line tool: MSTest.exe

Here is the official documentation on running MSTest tests.

7 Comments

@mark - but that's a lot of work to get your tests to run on a build server :)
I have a two parts reply. The first part is that you do it onc and the benefit is that the build server remains clean - no VS installed. The second part is that this was the least significant problem we had with mstest. Other problems - inability to have dynamic and combinatorial tests forced us to abandon mstest and adopt MbUnit/Gallio and we have never regretted that decision.
@mark - thanks for sharing your war story. Nice info. I have always felt no reason to move from Nunit to mstest.. but the org. powers think otherwise.
@Gishu - You are welcome. I strongly advise you to convince whoever is in charge to use Gallio/MbUnit. It is a much more mature framework than mstest. Plus its VS addin seamlessly integrates with all the standard VS Test windows, so you can still run all the unit tests from within the IDE. Do not repeat our mistakes.
There's now a console runner.
|
12

You can do this with mstest.exe, but the trick is in getting it to work without installing visual studio. This involves the copying of several files and registry entries. I have blogged about it here.

2 Comments

Nice trick ... the complexity of the process is an argument to write tests in NUnit :)
Thanks, the post is really helpful. You've published the update to that post, which includes batch script to create a 'deployable mstest package', in case someone doesn't notice that on your site, here's the link: mindinthewater.blogspot.com/2011/02/…
5

Use Gallio as your test runner... then its not so much of a drama when you enventually drop MsTest and move to a real test framework.

3 Comments

Gallio still requires MSTest to be installed separately. This doesn't solve the problem at hand.
um, yes it does. "Does MSTest have standalone GUI similar to nUnit that lets me use it and run test without visual studio?" I run tests without VS all the time with Gallio. The question is with regard to VS, not MsTest. Running test outside of VS is much faster and leads you to be CI practices
This is an awesome tool. Works just like NUnit UI.
5

Use VSTest.console.exe part of Microsoft.TestPlatform

Required steps:

  1. Download the test platform from https://www.nuget.org/packages/Microsoft.TestPlatform/
  2. Unzip
  3. In the unzipped folder, copy the \tools\net451\Common7\IDE\Extensions\TestPlatform folder to the machine that has no Visual Studio installed
  4. From cmd.exe run VSTest.console.exe MyTest.dll

More details here:https://learn.microsoft.com/en-us/visualstudio/test/vstest-console-options?view=vs-2017#general-command-line-options

Comments

3

You can also use this tool from codeplex: http://testrunner.codeplex.com...

3 Comments

Doesn't support .NET 4.0 yet. Do you know if there is a similar tool that supports .NET 4.0?
They updated this in 2012 to support tests written in .Net 4.0 :)
The TestRunner project moved to here: github.com/macro187/testrunner
0

Uset "dotnet test", it is compatible with all versions, eg:

'dotnet test yourassembly.dll -l console -v detailed'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.