CAPABILITY GENERATOR

LambdaTest DocumentationAutomation Testing ● MSTest with Selenium – Running MSTest Automation Scripts on LambdaTest Selenium Grid

MSTest with Selenium – Running MSTest Automation 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 on LambdaTest.

In this topic you will be learning:

  1. How to run a sample Selenium script with MSTest 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 and Selenium


  • 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.

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

Getting Started With MSTest 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


Let us begin with a simple Selenium Remote Webdriver test first. The C# script with MSTest 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 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 Test


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