C# WebDriver with MbUnit Framework

Set Up C# Webdriver with MbUnit and Gallio:
  1. Download and install Gallio from link ‘http://gallio.org/Downloads.aspx’
  2. Add reference Gallio and  MbUnit ddl files to webdriver project from installed Gallio folder.

Test Script:
       3. Add  class file in your test class file.     
 using MbUnit.Framework;
       4. Below is a sample code for MbUnit framework.
using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using MbUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Support.UI;


namespace SmapleProject
{
    [TestFixture]
    public class Google
    {
        private IWebDriver driver;
        private StringBuilder verificationErrors;
        private string baseURL;
     
       
        [SetUp]
        public void SetupTest()
        {
            driver = new FirefoxDriver();
            baseURL = "https://www.google.co.in/";
            verificationErrors = new StringBuilder();
        }
       
        [TearDown]
        public void TeardownTest()
        {          
            driver.Quit();          
        }
       
        [Test]
        public void GoogleTest()
        {
            driver.Navigate().GoToUrl(baseURL + "/");
            driver.FindElement(By.Id("gbqfq")).Clear();
            driver.FindElement(By.Id("gbqfq")).SendKeys("Testing");
            driver.FindElement(By.Id("gbqfb")).Click();
        }     
    }
}
     5. Build webdriver project.
Execution:   
     6. Open Gallio Icarus console.
   7. Go to "Project > Add File" of Gallio console. Navigate to webdriver project and select generated project ddl file.
   8. All MbUnit tests will display in Gallio console


   9. Select  test  and click on run button. Test execution should be start..
 Report:
  10. After execution report is generated on Gallio console.
  11.  For html report go to “Report > View As > Html." Report is generated as below in html format.


No comments:

Post a Comment

Leave your comments, queries, suggestion I will try to provide solution