vendredi 27 juillet 2018

How do I set up selenium based tests in C# in visual studio?

I am new to testing using selenium. I want to know how I can create a test in visual studio which tests if the user navigates to a webpage. What packages/dependencies do I need? what sort of project file do I need to open in visual studio i.e normal project in .NET or xUnit testing project etc. I am using a MAC.

below is something I tried to create but for some reason it did not work. Am I doing something wrong? I clicked on build and it said successful. Then I clicked on run but the test didnt do anything.

imageDescription

using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Support;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Chrome;

using OpenQA.Selenium.Support.UI;

namespace test
{
    [TestFixture()]
    public class Test
    {



        [Test()]
        public void TestCase()
        {
            IWebDriver driver = new ChromeDriver("/Users/andrew/Desktop/test/chromedriver");

            //Navigate to google page
            driver.Navigate().GoToUrl("http:www.google.com");

        }
    }
}

Aucun commentaire:

Enregistrer un commentaire