diff --git a/SauceExamples/Appium4.NUnit.Scripts/RealDevices/NativeApp/AndroidSimpleTests.cs b/SauceExamples/Appium4.NUnit.Scripts/RealDevices/NativeApp/AndroidSimpleTests.cs
index 1bbf98b6..f376eb2c 100644
--- a/SauceExamples/Appium4.NUnit.Scripts/RealDevices/NativeApp/AndroidSimpleTests.cs
+++ b/SauceExamples/Appium4.NUnit.Scripts/RealDevices/NativeApp/AndroidSimpleTests.cs
@@ -55,11 +55,10 @@ public void Teardown()
{
if (_driver == null) return;
- _sessionId = _driver.SessionId;
_driver.Quit();
//TODO fix this as it doesn't seem to update the status for failed tests
var isTestPassed = TestContext.CurrentContext.Result.Outcome.Status == TestStatus.Passed;
- new SimpleSauce().Rdc.UpdateTestStatus(isTestPassed, _sessionId);
+ new SimpleSauce().Rdc.UpdateTestStatus(isTestPassed, _driver.SessionId);
}
[Test]
diff --git a/SauceExamples/AppiumLatestOnDotNetFramework/RealDevices/NativeApp/iOSRdcTests.cs b/SauceExamples/AppiumLatestOnDotNetFramework/RealDevices/NativeApp/iOSRdcTests.cs
index f144a913..7679ca42 100644
--- a/SauceExamples/AppiumLatestOnDotNetFramework/RealDevices/NativeApp/iOSRdcTests.cs
+++ b/SauceExamples/AppiumLatestOnDotNetFramework/RealDevices/NativeApp/iOSRdcTests.cs
@@ -71,15 +71,11 @@ public void ShouldPassAndSetTestStatusToPass()
[TestCleanup]
public void Teardown()
{
- if (_driver != null)
- {
- _sessionId = _driver.SessionId;
- _driver.Quit();
- }
+ if (_driver == null) return;
var isTestPassed = TestContext.CurrentTestOutcome == UnitTestOutcome.Passed;
-
- new SimpleSauce().Rdc.UpdateTestStatus(isTestPassed, _sessionId);
+ new SimpleSauce().Rdc.UpdateTestStatus(isTestPassed, _driver.SessionId);
+ _driver.Quit();
}
}
}
diff --git a/SauceExamples/DotnetCore/Core.Selenium4.MsTest.Scripts/Core.Selenium4.MsTest.Scripts.csproj b/SauceExamples/DotnetCore/Core.Selenium4.MsTest.Scripts/Core.Selenium4.MsTest.Scripts.csproj
new file mode 100644
index 00000000..25d44442
--- /dev/null
+++ b/SauceExamples/DotnetCore/Core.Selenium4.MsTest.Scripts/Core.Selenium4.MsTest.Scripts.csproj
@@ -0,0 +1,21 @@
+
+
+
+ netcoreapp2.1
+
+ false
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SauceExamples/DotnetCore/Core.Selenium4.MsTest.Scripts/UnitTest1.cs b/SauceExamples/DotnetCore/Core.Selenium4.MsTest.Scripts/UnitTest1.cs
new file mode 100644
index 00000000..f7550d84
--- /dev/null
+++ b/SauceExamples/DotnetCore/Core.Selenium4.MsTest.Scripts/UnitTest1.cs
@@ -0,0 +1,73 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using OpenQA.Selenium;
+using OpenQA.Selenium.Chrome;
+using OpenQA.Selenium.Remote;
+using System;
+using System.Collections.Generic;
+
+namespace Core.Selenium4.MsTest.Scripts
+{
+ [TestClass]
+ public class UnitTest1
+ {
+ /*
+ * How to execute parallel tests at the method level using MsTest
+ *
+ * Make sure that your AssemplyInfo.cs for the project has this property:
+ * [assembly: Parallelize(Workers = 100, Scope = ExecutionScope.MethodLevel)]
+ *
+ * There are recommendations on the web to configure the .runsettings file,
+ * but you do not need it to run in parallel.
+ *
+ * In this example, we can run many Selenium test methods in parallel without any issue
+ */
+ IWebDriver _driver;
+ private string sauceUserName;
+ private string sauceAccessKey;
+ private Dictionary sauceOptions;
+ public TestContext TestContext { get; set; }
+ [TestInitialize]
+ public void Setup()
+ {
+ //TODO please supply your Sauce Labs user name in an environment variable
+ sauceUserName = Environment.GetEnvironmentVariable("SAUCE_USERNAME", EnvironmentVariableTarget.User);
+ //TODO please supply your own Sauce Labs access Key in an environment variable
+ sauceAccessKey = Environment.GetEnvironmentVariable("SAUCE_ACCESS_KEY", EnvironmentVariableTarget.User);
+ sauceOptions = new Dictionary
+ {
+ ["username"] = sauceUserName,
+ ["accessKey"] = sauceAccessKey
+ };
+ var chromeOptions = new ChromeOptions
+ {
+ BrowserVersion = "latest",
+ PlatformName = "Windows 10"
+ };
+ sauceOptions.Add("name", TestContext.TestName);
+ chromeOptions.AddAdditionalOption("sauce:options", sauceOptions);
+
+ _driver = new RemoteWebDriver(new Uri("https://ondemand.saucelabs.com/wd/hub"),
+ chromeOptions.ToCapabilities(), TimeSpan.FromSeconds(30));
+ }
+ [TestMethod]
+ public void TestMethod1()
+ {
+ GoToThenAssert();
+ }
+ private void GoToThenAssert()
+ {
+ _driver.Navigate().GoToUrl("https://www.saucedemo.com");
+ Assert.IsTrue(_driver.Url.Contains("saucedemo.com"));
+ }
+ [TestMethod]
+ public void TestMethod2()
+ {
+ GoToThenAssert();
+ }
+ [TestMethod]
+ public void TestMethod3()
+ {
+ GoToThenAssert();
+ }
+ }
+}
diff --git a/SauceExamples/SauceExamples.sln b/SauceExamples/SauceExamples.sln
index 029615fc..53eedaa5 100644
--- a/SauceExamples/SauceExamples.sln
+++ b/SauceExamples/SauceExamples.sln
@@ -44,6 +44,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SampleApps", "SampleApps",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Appium4.NUnit.Scripts", "Appium4.NUnit.Scripts\Appium4.NUnit.Scripts.csproj", "{51476835-726E-4948-AFE7-B05B0FA42BE6}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DotnetCore", "DotnetCore", "{35920FCA-2547-4818-AC6F-0797CFD85549}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core.Selenium4.MsTest.Scripts", "DotnetCore\Core.Selenium4.MsTest.Scripts\Core.Selenium4.MsTest.Scripts.csproj", "{E507CB7D-4628-47B8-AF47-72EC1EEB345D}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -82,6 +86,10 @@ Global
{51476835-726E-4948-AFE7-B05B0FA42BE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51476835-726E-4948-AFE7-B05B0FA42BE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51476835-726E-4948-AFE7-B05B0FA42BE6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E507CB7D-4628-47B8-AF47-72EC1EEB345D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E507CB7D-4628-47B8-AF47-72EC1EEB345D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E507CB7D-4628-47B8-AF47-72EC1EEB345D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E507CB7D-4628-47B8-AF47-72EC1EEB345D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -98,6 +106,7 @@ Global
{43F0822F-C5D4-44CE-A7BF-4FE6B6C4968C} = {C06B06E4-9DD7-4536-93D9-343944EF4F8D}
{FC693E5B-3A53-49EB-A28B-FB5A584E23C2} = {21DDBE02-10ED-40E3-8F18-05B9845577BC}
{51476835-726E-4948-AFE7-B05B0FA42BE6} = {21DDBE02-10ED-40E3-8F18-05B9845577BC}
+ {E507CB7D-4628-47B8-AF47-72EC1EEB345D} = {35920FCA-2547-4818-AC6F-0797CFD85549}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6019E59C-E9C4-4734-90C4-B49A0CCF0A59}
diff --git a/SauceExamples/Web.Tests/BestPractices/test/LoginFeature.cs b/SauceExamples/Web.Tests/BestPractices/test/LoginFeature.cs
index 9617d7ca..abecf44f 100644
--- a/SauceExamples/Web.Tests/BestPractices/test/LoginFeature.cs
+++ b/SauceExamples/Web.Tests/BestPractices/test/LoginFeature.cs
@@ -6,7 +6,7 @@ namespace Selenium3.Nunit.Framework.BestPractices.test
{
[TestFixture]
[TestFixtureSource(typeof(CrossBrowserData),
- nameof(CrossBrowserData.HeadlessTestData))]
+ nameof(CrossBrowserData.LatestConfigurations))]
[Parallelizable]
public class LoginFeature : BaseTest
{
diff --git a/SauceExamples/Web.Tests/BestPractices/test/LogoutFeature.cs b/SauceExamples/Web.Tests/BestPractices/test/LogoutFeature.cs
index 0aedc0d2..2c524161 100644
--- a/SauceExamples/Web.Tests/BestPractices/test/LogoutFeature.cs
+++ b/SauceExamples/Web.Tests/BestPractices/test/LogoutFeature.cs
@@ -6,7 +6,7 @@ namespace Selenium3.Nunit.Framework.BestPractices.test
{
[TestFixture]
[TestFixtureSource(typeof(CrossBrowserData),
- nameof(CrossBrowserData.HeadlessTestData))]
+ nameof(CrossBrowserData.LatestConfigurations))]
[Parallelizable]
public class LogoutFeature : BaseTest
{
diff --git a/SauceExamples/Web.Tests/BestPractices/test/ProductsPageFeature.cs b/SauceExamples/Web.Tests/BestPractices/test/ProductsPageFeature.cs
index 49db009d..6a03d519 100644
--- a/SauceExamples/Web.Tests/BestPractices/test/ProductsPageFeature.cs
+++ b/SauceExamples/Web.Tests/BestPractices/test/ProductsPageFeature.cs
@@ -6,7 +6,7 @@ namespace Selenium3.Nunit.Framework.BestPractices.test
{
[TestFixture]
[TestFixtureSource(typeof(CrossBrowserData),
- nameof(CrossBrowserData.HeadlessTestData))]
+ nameof(CrossBrowserData.LatestConfigurations))]
[Parallelizable]
public class ProductsPageFeature : BaseTest
{
diff --git a/SauceExamples/Web.Tests/BestPractices/test/ShoppingCartFeature.cs b/SauceExamples/Web.Tests/BestPractices/test/ShoppingCartFeature.cs
index 9eec3af8..0605ba9a 100644
--- a/SauceExamples/Web.Tests/BestPractices/test/ShoppingCartFeature.cs
+++ b/SauceExamples/Web.Tests/BestPractices/test/ShoppingCartFeature.cs
@@ -7,7 +7,7 @@ namespace Selenium3.Nunit.Framework.BestPractices.test
[TestFixture]
[Parallelizable]
[TestFixtureSource(typeof(CrossBrowserData),
- nameof(CrossBrowserData.HeadlessTestData))]
+ nameof(CrossBrowserData.LatestConfigurations))]
public class ShoppingCartFeature : BaseTest
{
public ShoppingCartFeature(string browser, string browserVersion, string osPlatform) :
diff --git a/SauceExamples/Web.Tests/CrossBrowserData.cs b/SauceExamples/Web.Tests/CrossBrowserData.cs
index 2159c719..521c8478 100644
--- a/SauceExamples/Web.Tests/CrossBrowserData.cs
+++ b/SauceExamples/Web.Tests/CrossBrowserData.cs
@@ -25,9 +25,12 @@ public static IEnumerable LatestConfigurations
yield return new TestFixtureData("Chrome", "latest-2", "Windows 7");
//safari
+ //doesn't work
+ //yield return new TestFixtureData("Safari", "latest", "macOS 10.15");
+ yield return new TestFixtureData("Safari", "13.0", "macOS 10.15");
yield return new TestFixtureData("Safari", "latest", "macOS 10.14");
yield return new TestFixtureData("Safari", "latest", "macOS 10.13");
- yield return new TestFixtureData("Safari", "latest-1", "macOS 10.12");
+ yield return new TestFixtureData("Safari", "latest", "macOS 10.12");
//firefox
yield return new TestFixtureData("Firefox", "latest", "macOS 10.13");
@@ -42,7 +45,10 @@ public static IEnumerable LatestConfigurations
//IE
yield return new TestFixtureData("Internet Explorer", "latest", "Windows 10");
yield return new TestFixtureData("Internet Explorer", "latest", "Windows 7");
- yield return new TestFixtureData("Internet Explorer", "10.0", "Windows 7");
+
+ //Doesn't work
+ //yield return new TestFixtureData("Internet Explorer", "latest", "Windows 8");
+ //yield return new TestFixtureData("Internet Explorer", "10.0", "Windows 7");
}
}
diff --git a/SauceExamples/Web.Tests/Selenium3.Nunit.Framework.csproj b/SauceExamples/Web.Tests/Selenium3.Nunit.Framework.csproj
index 8b76f039..be8a7101 100644
--- a/SauceExamples/Web.Tests/Selenium3.Nunit.Framework.csproj
+++ b/SauceExamples/Web.Tests/Selenium3.Nunit.Framework.csproj
@@ -1,8 +1,8 @@
-
-
-
+
+
+
Debug
@@ -41,20 +41,20 @@
4
-
- ..\packages\FluentAssertions.5.5.0\lib\net45\FluentAssertions.dll
+
+ ..\packages\FluentAssertions.5.10.2\lib\net45\FluentAssertions.dll
..\..\..\..\..\..\..\Users\nikolay\.nuget\packages\microsoft.identitymodel.protocols\5.2.0\lib\netstandard1.4\Microsoft.IdentityModel.Protocols.dll
- ..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll
+ ..\packages\MSTest.TestFramework.2.1.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll
- ..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
+ ..\packages\MSTest.TestFramework.2.1.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
-
- ..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll
+
+ ..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll
..\packages\RestSharp.106.10.1\lib\net452\RestSharp.dll
@@ -66,8 +66,8 @@
-
- ..\packages\System.ValueTuple.4.4.0\lib\net461\System.ValueTuple.dll
+
+ ..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll
@@ -121,10 +121,10 @@
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
+
+
+
+
-
+
\ No newline at end of file
diff --git a/SauceExamples/Web.Tests/app.config b/SauceExamples/Web.Tests/app.config
index 000f054b..b954c3f1 100644
--- a/SauceExamples/Web.Tests/app.config
+++ b/SauceExamples/Web.Tests/app.config
@@ -12,7 +12,7 @@
-
+
diff --git a/SauceExamples/Web.Tests/packages.config b/SauceExamples/Web.Tests/packages.config
index 64fa5f95..953dac1e 100644
--- a/SauceExamples/Web.Tests/packages.config
+++ b/SauceExamples/Web.Tests/packages.config
@@ -1,13 +1,13 @@
-
-
-
-
-
+
+
+
+
+
-
+
\ No newline at end of file