Examples
Example 1

The NUnit testing framework is used.

using NeoLoadSelenium.neoload;
using NeoLoadSelenium.neoload.wrapper;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Remote;
using System;

namespace NeoLoadSelenium.tests.integration
{
    class IntegrationDesignTest
    {
        NLWebDriver driver;

        [SetUp]
        public void Initialize()
        {
            var webDriver = new FirefoxDriver(NLWebDriverFactory.AddProxyCapabilitiesIfNecessary(new DesiredCapabilities()));
            string projectPath = "C:\\Users\\dregnier\\Documents\\NeoLoad Projects\\v5.3\\Sample_Project\\Sample_Project.nlp";
            driver = NLWebDriverFactory.NewNLWebDriver(webDriver, "SeleniumUserPath", projectPath);
            // Replace <apiKey> with an API Key defined in Controller General Settings REST API or Project Settings if authentication is required.
            Environment.SetEnvironmentVariable("nl.api.key", "<apiKey>");
        }

        [Test]
        public void OpenAppTest()
        {
            driver.StartTransaction("home");
            driver.Url = "http://ushahidi.demo.neotys.com/";
            driver.StopTransaction();

            driver.StartTransaction("reports");
            driver.FindElement(By.Id("mainmenu")).FindElements(By.TagName("a"))[1].Click();
            driver.StopTransaction();

            driver.StartTransaction("submit");
            driver.FindElement(By.PartialLinkText("SUBMIT")).Click();
            driver.StopTransaction();
        }

        [TearDown]
        public void EndTest()
        {
            driver.Close();
            driver.Quit();
        }
    }
}

Example 2

The UnitTesting library is used.

using Microsoft.VisualStudio.TestTools.UnitTesting;
using NeoLoadSelenium.neoload;
using NeoLoadSelenium.neoload.wrapper;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System;

namespace NeoLoadSelenium.tests.integration
{
    [TestClass]
    public class IntegrationDesignTestAlexis
    {
        static NLWebDriver driver;

        [ClassInitialize()]
        public static void Initialize(TestContext testContext)
        {
            var options = new ChromeOptions();
            NLWebDriverFactory.AddProxyCapabilitiesIfNecessary(options);
            var webDriver = new ChromeDriver(@"C:\Users\Administrator\Documents\Visual Studio 2015\Projects", options);
            string projectPath = "C:\\Users\\anouvel\\Documents\\NeoLoad Projects\\v5.3\\Sample_Project\\Sample_Project.nlp";
            driver = NLWebDriverFactory.NewNLWebDriver(webDriver, "SeleniumUserPath");
            // Replace <apiKey> with an API Key defined in Controller General Settings REST API or Project Settings if authentication is required.
            Environment.SetEnvironmentVariable("nl.api.key", "<apiKey>");
        }

        [TestMethod]
        public void UpdateTest()
        {
            driver.StartTransaction("home");
            driver.Url = "http://ushahidi.demo.neotys.com/";
            driver.StopTransaction();

            driver.StartTransaction("reports");
            driver.FindElement(By.Id("mainmenu")).FindElements(By.TagName("a"))[1].Click();
            driver.StopTransaction();

            driver.StartTransaction("submit");
            driver.FindElement(By.PartialLinkText("SUBMIT")).Click();
            driver.StopTransaction();
        }

        [ClassCleanup()]
        public static void EndTest()
        {
            driver.Close();
            driver.Quit();
        }
    }
}