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);}[Test]public void OpenAppTest(){driver.StartTransaction("home");driver.Url = "http://ushahidi.demo.neotys.com/";driver.StartTransaction("reports");driver.FindElement(By.Id("mainmenu")).FindElements(By.TagName("a"))[1].Click();driver.StartTransaction("submit");driver.FindElement(By.PartialLinkText("SUBMIT")).Click();}[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");}[TestMethod]public void UpdateTest(){driver.StartTransaction("home");driver.Url = "http://ushahidi.demo.neotys.com/";driver.StartTransaction("reports");driver.FindElement(By.Id("mainmenu")).FindElements(By.TagName("a"))[1].Click();driver.StartTransaction("submit");driver.FindElement(By.PartialLinkText("SUBMIT")).Click();}[ClassCleanup()]public static void EndTest(){driver.Close();driver.Quit();}}}
Home