vitali-s / Selenium.Automation.Framework

The frameworks provides clear conventions and separation of concerns along with selenium web driver extensions. The main goal is to build stable and easy to use framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Selenium Automation Framework

Frameworks provides base infrastrcutre for your acceptances tests. That will help to reduce start time and allows to separation of concerns from the very beggining.

The framework are available via nuget package: TODO

The default structure of the project:

  • Features
  • Models
  • Scenarios
  • TestData
  • Views

QuickStarts:

  • Load nuget package
  • Create base test class, for example:
   [TestFixture]
   public abstract class BaseAutomationTest : AutomationTest
   {
       public TestContext TestContext { get; set; }

       [SetUp]
       public void TestInitialize()
       {
           StartTest();
       }

       [TearDown]
       public void TearDown()
       {
           EndTest(() => NUnit.Framework.TestContext.CurrentContext.Result.Status == TestStatus.Failed);
       }
   }
  • Create View:
   public class RepositoryView : View
   {
       public Element Description
       {
           get { return FindElement(By.ClassName("repository-description")); }
       }

       protected override By BaseBy
       {
           get { return By.ClassName("repohead"); }
       }
   }
  • Create Scenario:
public class SearchRepositoryScenario : Scenario
   {
       public RepositoryItemView Search(SearchRepositoryModel searchRepositoryModel)
       {
           var homeView = View<DefaultNavigationBarView>();

           homeView.Search.Type(searchRepositoryModel.Name);

           homeView.Search.PressEnter();

           var searchResults = Resolve<SearchResultsView>();

           RepositoryItemView view = searchResults.Repositories
               .Where(repository => repository.Name != null)
               .FirstOrDefault(repository => repository.Name.Text == searchRepositoryModel.Name);

           view
               .Should()
               .NotBeNull();

           return view;
       }
   }
  • Create Feature:
   [TestFixture]
   public class RepositoriesReviewFeatureTest : BaseAutomationTest
   {
       [Test]
       public void Search_For_Automation_Framework_Repository()
       {
           Scenario<SearchRepositoryScenario>()
               .Search(Model<SearchRepositoryModel>());
       }
   }

About

The frameworks provides clear conventions and separation of concerns along with selenium web driver extensions. The main goal is to build stable and easy to use framework.

License:MIT License


Languages

Language:C# 89.6%Language:PowerShell 8.6%Language:Shell 1.8%