Skip to content

Reqnroll based BDD framework with focus on automation testing for .NET

License

Notifications You must be signed in to change notification settings

Romfos/AutoTests.Framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

Reqnroll based autotest framework

.github/workflows/test.yml

AutoTests.Framework.Playwright

Main features:

  • C# expression support inside features
  • Test data management framework
  • Model transformation framework
  • Component framework for UI testing
  • Playwright integration

Test example

Feature: CheckoutForm

Scenario: checkout form validation test
    Given navigate to '@Data.Common.HomePageUrl'
    When set following values:
    | Name                  | Value      |
    | checkout > first name | first_name |
    | checkout > last name  | last_name  |
    And click on 'checkout > continue to checkout'
    Then should be visible:
    | Name                              |
    | checkout > username error message |
    And should have following values:
    | Name                              | Value                      |
    | checkout > username error message | Your username is required. |

Requirements

Nuget packages links

How to use

You can find example in Bootstrap.Tests project for UI testing

Basic steps:

  1. Create unit test project
  2. Add additional Reqnroll nuget packages for unit test provider:
Unit test framework Nuget package
MSTest Reqnroll.MsTest
NUnit Reqnroll.NUnit
xUnit Reqnroll.xUnit

Warning

Version of test adapter nuget package should match to Reqnroll package version

  1. Add nuget package

AutoTests.Framework.Playwright

  1. Create reqnroll.json and register framework assemblies. Example:
{
  "$schema": "https://schemas.reqnroll.net/reqnroll-config-latest.json",
  "stepAssemblies": [
    { "assembly": "AutoTests.Framework" },
    { "assembly": "AutoTests.Framework.Components" },
    { "assembly": "AutoTests.Framework.Playwright" }
  ]
}
  1. Create Application class for UI application
internal sealed class BootstrapApplication : IApplication
{
    [Route("checkout")]
    public Checkout? Checkout { get; set; }
}

How to make browser window visible

By default browser will run in headless mode.

If you need to change this behavior just add BeforeTestRun hook inside your test app and override BrowserTypeLaunchOptions like this:

[Binding]
internal sealed class ReqnrollHooks
{
    [BeforeTestRun(Order = 0)]
    public static void BeforeTestRun(IObjectContainer objectContainer)
    {
        objectContainer.RegisterInstanceAs(new BrowserTypeLaunchOptions { Headless = false });
    }
}

How to work with test data

You can create json file in Data subfolder and get access to content in feature to it like:

Feature: CheckoutForm

Scenario: checkout form validation test
    Given navigate to '@Data.Common.HomePageUrl' #return value HomePageUrl from Data\Common.json

You can find example in 'Bootstrap.Tests'