Ocaramba

C# Framework to automate tests using Selenium WebDriver

Github星跟踪图

Ocaramba

Cross-Platform C# Framework to automate tests using Selenium WebDriver

Ocaramba Templates
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.

It provides following features:

  • .NET Framework 4.7.2 and .NET Core 2.2 supported
  • Cross-Platform Windows, Linux and macOS systems supported
  • 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, Headless mode, 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 (only .NET Framework), browser screen shot or screenshot of element - Visual Testing (only .NET Framework), 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 (only .NET Framework)
  • 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.
  • Instruction how to run Ocaramba tests with Docker container, more details here.

For all documentation, visit the Ocaramba Wiki.

Projects examples of using Test Framework :

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

NUnit Example Test:

namespace Ocaramba.Tests.NUnit.Tests
{
    using global::NUnit.Framework;

    using Ocaramba.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 Ocaramba.Tests.PageObjects.PageObjects.TheInternet
{
    using System;
    using System.Globalization;

    using NLog;

    using Ocaramba;
    using Ocaramba.Extensions;
    using Ocaramba.Types;
    using Ocaramba.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

  • Ocaramba NuGet Badge

or download Ocaramba Visual Studio templates Ocaramba Templates

主要指标

概览
名称与所有者Accenture/Ocaramba
主编程语言C#
编程语言C# (语言数: 5)
平台
许可证MIT License
所有者活动
创建于2015-07-09 08:22:12
推送于2025-04-26 08:20:35
最后一次提交2025-04-26 10:20:34
发布数53
最新版本名称4.2.1 (发布于 )
第一版名称2.1.9 (发布于 )
用户参与
星数279
关注者数59
派生数133
提交数2.1k
已启用问题?
问题数65
打开的问题数1
拉请求数200
打开的拉请求数5
关闭的拉请求数261
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?