C# Framework to automate tests using Selenium WebDriver
Clone or download
Latest commit 3d4b3d2 Sep 13, 2018
Permalink
Failed to load latest commit information.
.nuget Set DownloadNuGetExe to true Dec 9, 2016
.nuspec Added reference to System.Configuration for NUnit package Jul 12, 2018
.vs/config Revert "new release 3.0.2" Nov 30, 2016
Objectivity.Test.Automation.Common.Documentation Revert "Updated WebDriver to version 3.14" Sep 13, 2018
Objectivity.Test.Automation.Common Revert "Updated WebDriver to version 3.14" Sep 13, 2018
Objectivity.Test.Automation.Tests.Angular Revert "Updated WebDriver to version 3.14" Sep 13, 2018
Objectivity.Test.Automation.Tests.CloudProviderCrossBrowser Revert "Updated WebDriver to version 3.14" Sep 13, 2018
Objectivity.Test.Automation.Tests.Features Revert "Updated WebDriver to version 3.14" Sep 13, 2018
Objectivity.Test.Automation.Tests.MsTest Revert "Updated WebDriver to version 3.14" Sep 13, 2018
Objectivity.Test.Automation.Tests.NUnit Revert "Updated WebDriver to version 3.14" Sep 13, 2018
Objectivity.Test.Automation.Tests.PageObjects Revert "Updated WebDriver to version 3.14" Sep 13, 2018
Objectivity.Test.Automation.Tests.Xunit enabled RunCodeAnalysis for all subprojects Jul 10, 2018
Objectivity.Test.Automation.UnitTests Fixed unit test project Sep 13, 2018
scripts Added powershell script for updating App.config file Dec 18, 2017
.gitignore Fixed unit test project Sep 13, 2018
CustomDictionary.xml fixed small build issue Jul 6, 2017
LICENSE Revert "new release 3.0.2" Nov 30, 2016
README.md Update README.md Aug 3, 2018
TestFramework.sln Updated README.md file Jun 27, 2018
appveyor.yml Update appveyor.yml Aug 29, 2018
fxcop-sonarqube.tests.ruleset Revert "new release 3.0.2" Nov 30, 2016
stylecop.json Revert "new release 3.0.2" Nov 30, 2016

README.md

Objectivity.Test.Automation

C# Framework to automate tests using Selenium WebDriver

Build status Build status Coverage Status AppVeyor tests BrowserStack Status Build Status

Test Framework was designed in Objectivity to propose common way how people should create Selenium WebDriver tests.

Project API documentation can be found here: http://objectivityltd.github.io/Test.Automation

It provides following features:

  • Ready for parallel tests execution, more details here
  • Possibility to use MSTest, NUnit or xUNIT framework
  • Specflow ready
  • Written entirely in C#
  • Contains example projects how to use it
  • Allows to use Chrome, Firefox, Safari or Internet Explorer
  • Overrides browser profile preferences, pass arguments to browsers, installs browser extensions, loading default firefox profile, more details here
  • Extends Webdriver by additional methods like JavaScriptClick, WaitForAjax, WaitForAngular, etc., more details here
  • Automatically waits when locating element for specified time and conditions,GetElement method instead of Selenium FindElement, more details here
  • Page Object Pattern
  • Support for SeleniumGrid, Cross browser parallel test execution with SauceLab, TestingBot and Browserstack more details here, Advanced Browser Capabilities and Options more details here
  • More common locators, e.g: "//*[@title='{0}' and @ms.title='{1}']", more details here
  • Several methods to interact with kendo controls, more details here
  • Verify - asserts without stop tests, more details here
  • Measures average and 90 Percentile action times, more details here
  • DataDriven tests from Xml, Csv and Excel files for NUnit and Xml, Csv for MSTest with examples, more details NUnit, MsTest
  • Possibility to take full desktop, browser screen shot or screenshot of element - Visual Testing, save page source, more details here
  • Logging with NLog, EventFiringWebDriver logs, more details here
  • Files downloading (Firefox, Chrome), more details here
  • Possibility to send SQL or MDX queries
  • Possibility of debugging framework installed from nuget package, more details here.
  • AngularJS support, more details here.
  • Possiblity to check for JavaScript errors from browser, more details here.

For all documentation, visit the Test.Automation Wiki.

Projects examples of using Test Framework :

  • Objectivity.Test.Automation.Tests.Angular for AngularJS
  • Objectivity.Test.Automation.Tests.Features for Specflow
  • Objectivity.Test.Automation.Tests.MsTest for MsTest
  • Objectivity.Test.Automation.Tests.NUnit for NUnit
  • Objectivity.Test.Automation.Tests.xUnit for xUnit
  • Objectivity.Test.Automation.Tests.PageObjects for Page Object Pattern
  • Objectivity.Test.Automation.Common.Documentation.shfbproj for building API documentation
  • Objectivity.Test.Automation.Tests.CloudProviderCrossBrowser for cross browser parallel test execution with BrowserStack\SauceLabs\TestingBot\SeleniumGrid
  • Objectivity.Test.Automation.UnitTests for unit test of framework

NUnit Example Test:

namespace Objectivity.Test.Automation.Tests.NUnit.Tests
{
    using global::NUnit.Framework;

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

    [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);
        }
    }
}

NUnit Example Page Object:

namespace Objectivity.Test.Automation.Tests.PageObjects.PageObjects.TheInternet
{
    using System;
    using System.Globalization;

    using NLog;

    using Objectivity.Test.Automation.Common;
    using Objectivity.Test.Automation.Common.Extensions;
    using Objectivity.Test.Automation.Common.Types;
    using Objectivity.Test.Automation.Tests.PageObjects;

    public class InternetPage : ProjectPageBase
    {
        private static readonly Logger Logger = LogManager.GetCurrentClassLogger();

        /// <summary>
        /// Locators for elements
        /// </summary>
        private readonly ElementLocator
            linkLocator = new ElementLocator(Locator.CssSelector, "a[href='/{0}']");

        public InternetPage(DriverContext driverContext) : base(driverContext)
        {
        }

        public JavaScriptAlertsPage GoToJavaScriptAlerts()
        {
            this.Driver.GetElement(this.linkLocator.Format("javascript_alerts")).Click();
            return new JavaScriptAlertsPage(this.DriverContext);
        }
    }
}

Where to start?


Checkout the code or get it from nuget.org

  • Objectivity.Test.Automation.Common.NUnit NuGet Badge
  • Objectivity.Test.Automation.Common.Features NuGet Badge
  • Objectivity.Test.Automation.Common.MsTest NuGet Badge
  • Objectivity.Test.Automation.Common.xUnit NuGet Badge