Selenium Parallel tests execution

Jakub Raczek edited this page Jan 5, 2018 · 15 revisions

Our framework supports parallel test execution in one browser at the same time, how to enable it in your test project depends on selected Unit framework:

With Objectivity.Test.Automation.Tests.NUnit

you have to add the attribute to the test classes ParallelScope.Fixtures indicates that fixtures may be run in parallel with one another.

namespace Objectivity.Test.Automation.Tests.NUnit.Tests
{
    using System.Collections.Generic;

    using global::NUnit.Framework;

    using Objectivity.Test.Automation.Common;
    using Objectivity.Test.Automation.Tests.NUnit.DataDriven;
    using Objectivity.Test.Automation.Tests.PageObjects.PageObjects.TheInternet;

    [TestFixture]
    [Parallelizable(ParallelScope.Fixtures)]
    public class HerokuappTestsNUnit : ProjectTestBase
    {
        [Test]
        public void BasicAuthTest()
        {
            var basicAuthPage =
                new InternetPage(this.DriverContext).OpenHomePageWithUserCredentials().GoToBasicAuthPage();

            Verify.That(
                this.DriverContext,
                () =>
                Assert.AreEqual(
                    "Congratulations! You must have the proper credentials.",
                    basicAuthPage.GetCongratulationsInfo));
        }
    }
}
namespace Objectivity.Test.Automation.Tests.NUnit.Tests
{
    using global::NUnit.Framework;

    using Objectivity.Test.Automation.Tests.PageObjects.PageObjects.TheInternet;

    [TestFixture]
    [Parallelizable(ParallelScope.Fixtures)]
    public class JavaScriptAlertsTestsNUnit : ProjectTestBase
    {
        [Test]
        public void ClickJsAlertTest()
        {
            var internetPage = new InternetPage(this.DriverContext).OpenHomePage();
            var jsAlertsPage = internetPage.GoToJavaScriptAlerts();
            jsAlertsPage.OpenJsAlert();
            jsAlertsPage.AcceptAlert();
            Assert.AreEqual("You successfuly clicked an alert", jsAlertsPage.ResultText);
        }
    }
}

More info about NUnit Framework Parallel Test Execution. Please notice that currently only Fixtures may be run in parallel with NUnit 3, more details here.

With Objectivity.Test.Automation.Tests.MsTest

how set parallel test execution depends on Visual Studio version you using or test runner version. More details can be found here MsTest .runsettings .testsettings.

Please notice that Selenium IEDriver doesn't support test execution in parallel.

Running tests in parallel on different browsers at the same time is possible with Selenium Grid or e.g BrowserStack . More details here

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.