This document discusses using Microsoft Test Manager (MTM) to run Selenium tests. It provides an overview of MTM and Selenium, including how Selenium automates browsers using language-specific drivers. It also covers requirements for running Selenium tests through MTM, including configuring a test plan and installing necessary drivers on the test agent. The document demonstrates running a sample Selenium test locally and on a Selenium grid through MTM.
2. Today we will cover
1. What is Microsoft Test Manager?
2. What is Selenium?
3. Requirements & Setup
4. Selenium on Test Agent
5. BrowseEmAll on Test Agent
Introduction
3. What is Microsoft Test Manager?
Microsoft Test Manager (MTM) is the test management framework by Microsoft. It
support manual and automated testing side-by-side.
4. Supported by all major browser vendors:
What is Selenium?
Free and open source browser automation framework.
7. What is Selenium?
How does it work?
Your Code Selenium
IEDriver
Edge
Driver
Firefox
Driver
Chrome
Driver
8. What is Selenium?
How does it work?
Your Code Selenium
IEDriver
Edge
Driver
Firefox
Driver
Chrome
Driver
Internet
Explorer
Microsoft
Edge
Firefox
Chrome
9. Supports automation of all major browsers:
What is Selenium?
Which browsers are supported?
10. Selenium language bindings are available for:
• Java
• C#
• Ruby
• Python
• JavaScript
• Perl (third-party)
• PHP (third-party)
What is Selenium?
Which programming languages are supported?
11. • Team Foundation Server
• Microsoft Test Manager
• Microsoft Test Agent
Requirements & Setup
Requirements:
12. • Create new tests in Test Manager
• Map tests to Unit Tests
• Create Environment
• Assign to Test Plan in Test Manager
Requirements & Setup
Configure Test Plan:
14. • Install Java: https://java.com/en/download/
• Install Firefox: https://www.mozilla.org
• Install Google Chrome: https://www.google.com/chrome/browser/desktop/
• Add c:Selenium to your PATH
Selenium on Test Agent
Requirements
15. o Internet Explorer Driver:
• Download (32bit or 64bit) http://www.seleniumhq.org/download/
• Extract to c:Selenium
o Chrome Driver:
• Download https://sites.google.com/a/chromium.org/chromedriver/
• Extract to c:Selenium
o Firefox Driver:
• Download https://github.com/mozilla/geckodriver/releases
• Extract to c:Selenium
Selenium on Test Agent
Installing Drivers
16. Selenium on Test Agent
[TestMethod]
public void GoogleForSelenium()
{
// Launch new instance for Firefox
IWebDriver driver = new FirefoxDriver();
// Navigate to google
driver.Navigate().GoToUrl("http://www.google.com");
// Find the input field for the search query
IWebElement inputField = driver.FindElement(By.Name("q"));
// Add some text to the input field
inputField.SendKeys("Selenium");
// Submit the search
inputField.Submit();
// Google uses JS to render the results page so we need to wait
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
wait.Until(o => o.Title.StartsWith("Selenium", StringComparison.OrdinalIgnoreCase));
// Use asserts like you would in unit tests
Assert.IsTrue(driver.Title.StartsWith("Selenium", StringComparison.OrdinalIgnoreCase));
// close down the browser
driver.Quit();
}
18. o Internet Explorer Driver:
• Download (32bit or 64bit) http://www.seleniumhq.org/download/
• Extract to c:Selenium
o Chrome Driver:
• Download https://sites.google.com/a/chromium.org/chromedriver/
• Extract to c:Selenium
o Firefox Driver:
• Download https://github.com/mozilla/geckodriver/releases
• Extract to c:Selenium
BrowseEmAll on Test Agent
Installing Drivers
19. BrowseEmAll on Test Agent
[TestMethod]
public void GoogleForSeleniumOnGrid()
{
// Launch new instance for Firefox
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), DesiredCapabilities.Firefox());
// Navigate to google
driver.Navigate().GoToUrl("http://www.google.com");
// Find the input field for the search query
IWebElement inputField = driver.FindElement(By.Name("q"));
// Add some text to the input field
inputField.SendKeys("Selenium");
// Submit the search
inputField.Submit();
// Google uses JS to render the results page so we need to wait
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
wait.Until(o => o.Title.StartsWith("Selenium", StringComparison.OrdinalIgnoreCase));
// Use asserts like you would in unit tests
Assert.IsTrue(driver.Title.StartsWith("Selenium", StringComparison.OrdinalIgnoreCase));
// close down the browser
driver.Quit();
}