Skip to content

Instantly share code, notes, and snippets.

@nikolay-advolodkin
Last active October 8, 2018 22:16
Show Gist options
  • Save nikolay-advolodkin/abb2886fcd797fc63bed73e89f017c72 to your computer and use it in GitHub Desktop.
Save nikolay-advolodkin/abb2886fcd797fc63bed73e89f017c72 to your computer and use it in GitHub Desktop.
//Must use Nunit
//Must update AssemblyInfo.cs to have this:
//[assembly: Parallelizable(ParallelScope.Fixtures)]
//[assembly: LevelOfParallelism(10)] [assembly: LevelOfParallelism(100)]
[TestFixture]
[Parallelizable]
class ParallelTestsWithBestPractices
{
[Test]
public void Test1()
{
var capabilities = new DesiredCapabilities();
capabilities.SetCapability("platformName", "Android");
capabilities.SetCapability("platformVersion", "7.1.1");
//TODO first you must upload an app to Test Object so that you get your app key
capabilities.SetCapability("testobject_api_key", "0D6C044F19D0442BA1E11C3FF087F6A6");
capabilities.SetCapability("deviceName", "Google Pixel");
capabilities.SetCapability("deviceOrientation", "portrait");
capabilities.SetCapability("name", testName);
capabilities.SetCapability("newCommandTimeout", 90);
var rdcUrl = "https://us1.appium.testobject.com/wd/hub";
//TODO should be interchangeable to run on Windows/Mac
var sauceUser = Environment.GetEnvironmentVariable("SAUCE_USERNAME", EnvironmentVariableTarget.User);
var sauceKey = Environment.GetEnvironmentVariable("SAUCE_ACCESS_KEY", EnvironmentVariableTarget.User);
var sauceUlr =
$"https://{sauceUser}:{sauceKey}@ondemand.saucelabs.com:443/wd/hub";
var driver = new AndroidDriver<IWebElement>(new Uri(rdcUrl), capabilities);
//var logEntries = driver.Manage().Logs.GetLog("driver");
driver.Navigate().GoToUrl("https://www.ultimateqa.com");
Console.WriteLine("");
driver.Quit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment