Search code examples
c#selenium-webdrivercommand-prompt

How to run Selenium C# tests on Command Prompt?


I have some C# tests, and I want to run these tests from Command Prompt.

How can I run these tests?

Please help me.


Solution

  • If you are using Visual Studio 2012, then you will use vstest.console.exe to run the tests like Visual Studio, for example:

    C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe UnitTests.dll /logger:trx

    The VSTest.Console.exe documentation is here.

    Otherwise, you will use mstest on the command line if Visual Studio 2010:

    C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\mstest.exe

    The MSTest.exe documentation is here.

    The same applies when running Selenium tests; there is nothing special about them as far as running from the command line is concerned.