Skip to main content

MSTest Framework: Running MSTest Selenium Scripts on LambdaTest Selenium Grid

LambdaTest offers support with Selenium WebDriver to help you instantly execute your automation test scripts. LambdaTest is a cloud-based, cross browser testing tool offering a Selenium grid consisting 2000+ browsers and browser versions running on real operating systems to pace up automation testing of your web-app or website. In this topic, you will learn how to automate your website testing using Selenium with MSTest framework on LambdaTest.

In this topic you will be learning:

  1. How to run a sample Selenium script with MSTest framework on LambdaTest Automation.
  2. How to specify which browsers to run the test on.
  3. How to run your test cases in parallel to reduce build times.
  4. How to test your locally hosted pages
  5. How to leverage LambdaTest’s Advanced capabilities.

Prerequisites For Running MSTest Selenium Scripts#

  • Make sure you work with latest version of C#.
  • Download and Install Selenium WebDriver from the official website.
  • .Net framework to deliver guidelines while developing a range of application using C#.
  • Download Selenium WebDriver Language Binding for C# and extract them to appropriate folder.
  • A .NET Core SDK of 2.1 or greater version.
  • You would also need LambdaTunnelbinary file for testing your locally hosted or privately hosted projects using MSTest Selenium.

Follow our documentation on LambdaTest tunnel to know it all. OS specific instructions to download and setup tunnel binary can be found at the following links.

Download the binary file of:

Getting Started With MSTest Selenium and LambdaTest#

The first step in using LambdaTest platform is to understand LambdaTest’s Selenium Grid capabilities. Our Selenium Grid uses remote webdriver instead of normal Selenium client browser drivers so if you are migrating from locally run Selenium, you would have to invoke LambdaTest Selenium remote webdriver. Next you need to specify in your code, which browser, browser versions, operating systems, and resolution you wish to run your test on, along with defining LambdaTest specific capabilities. You can checkout LambdaTest Capabilities Generator tool to understand more about how you can define running browser environments and leverage advanced LambdaTest capabilities.

First Test With MSTest Framework#

Let us begin with a simple Selenium Remote Webdriver test first. The C# script with MSTest Selenium below tests a simple to-do application with basic functionalities like mark items as done, add items in list, calculate total pending items etc. You can also find this at GitHub.

Here is a code based for the same on MSTest framework a C# specific test automation framework.

You can use the Platform Configuration to specify the desired capabilities for any browser/platform combination you want for your test.


The Selenium Webdriver test would open a URL, mark the first two items in the list as done, add an item in the list, and return the total number of pending item. Your results would be displayed on the test console (or command-line interface if you are using terminal/cmd) and on LambdaTest dashboard. LambdaTest dashboard will help you view all your text logs, screenshots and video recording for your entire Selenium tests.

Execute The Tests using MSTest Framework#

You would need to execute the below command in your terminal/cmd.

Last updated on