locked
Accessing NUnit test project outside Visual Studio RRS feed

  • Question

  • HI All,

    We are planning to do test automation using Selinium webdriver integrated with NUnit Test project.

    Is there any tool (except the test explorer in Visual Studio) which we can provide it to the testers to run the test cases ?

    Thanks in Advance,

    Regards,

    Abirami.


    Thursday, October 6, 2016 6:22 AM

Answers

  • Hi Abirami,

    We could use unit3-console.exe command to run your test project. Please refer to the following steps:

    1). Create a class library project and download the following NuGet packages:

    2). Then open the developer Command and navigate to the following path:

    3). Copy the project .dll file, nunit.framework.dll, WebDriver.dll and WebDriver.Support.dll to the tools folder.

    4). Then run your test.

    Here is my test code:

    using System;
    using NUnit.Framework;
    using OpenQA.Selenium.Edge;
    using OpenQA.Selenium.Remote;
    using System.Threading;
    
    namespace Nunit
    {
        [TestFixture]
        public class NunitTest
        {
            [TestCase]
            public void TestCase()
            {
                RemoteWebDriver driver = null;
                try
                {
                    driver = new EdgeDriver();
                    driver.Url = "https://www.bing.com/";
                    var element = driver.FindElementById("sb_form_q");
                    element.SendKeys("webdriver");
                    element.SendKeys(OpenQA.Selenium.Keys.Enter);
                    Thread.Sleep(5000);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
                finally
                {
                    if (driver != null)
                    {
                        driver.Quit();
                    }
                }
            }
        }
    }
    

    Sincerely,

    Oscar


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    • Proposed as answer by Oscar_Wu Tuesday, October 11, 2016 6:01 AM
    • Marked as answer by Oscar_Wu Monday, October 24, 2016 9:54 AM
    Thursday, October 6, 2016 8:19 AM