Reqnroll based autotest framework
Main features:
- C# expression support inside features
- Test data management framework
- Model transformation framework
- Component framework for UI testing
- Playwright integration
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. |
- .NET 8+ (.NET 9 is recommended)
- Visual Studio 2022 or Visual Studio Code
- Reqnroll plugin for Visual Studio 2022 or Cucumber plugin for Visual Studio Code
- https://www.nuget.org/packages/AutoTests.Framework
- https://www.nuget.org/packages/AutoTests.Framework.Components
- https://www.nuget.org/packages/AutoTests.Framework.Playwright
You can find example in Bootstrap.Tests project for UI testing
Basic steps:
- Create unit test project
- 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
- Add nuget package
AutoTests.Framework.Playwright
- 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" }
]
}
- Create Application class for UI application
internal sealed class BootstrapApplication : IApplication
{
[Route("checkout")]
public Checkout? Checkout { get; set; }
}
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 });
}
}
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'