LightBDD 2.x logo
LightBDD

LightBDD 2 is here

I’m happy to announce that LightBDD 2 is released and ready to be used.

New platforms and frameworks support

The LightBDD has been reworked to allow support for various platforms and frameworks.
With version 2, the LightBDD packages are targeting both, .NET Framework (>= 4.5) and .NET Standard (>= 1.3) frameworks which allow it to be used in platforms like regular .NET Framework, .NET Core, or even Universal Windows Platform.

New testing framework integrations

The testing frameworks integration projects have been reworked as well to leverage from cross-platform frameworks capability as well as remove LightBDD 1.x integration drawbacks.

A following list of integrations is available with LightBDD 2:

  • LightBDD.NUnit3 – integration with NUnit framework 3x series,
  • LightBDD.NUnit2 – integration with NUnit framework 2x series (to simplify migration from LightBDD 1x),
  • LightBDD.XUnit2 – integration with xUnit framework 2x series,
  • LightBDD.MsTest2 – integration with MsTest.TestFramework, a successor of MsTest.

Asynchronous scenario support

The LightBDD 2 runners are fully supporting async scenario execution.

The example below shows scenario execution for steps returning Task:

[Scenario]
[Label("Ticket-10"), Label("Ticket-11")]
public async Task Successful_payment()
{
    await Runner.RunScenarioAsync(
        Given_customer_has_some_products_in_basket,
        Given_customer_has_enough_money_to_pay_for_products,
        When_customer_requests_to_pay,
        Then_payment_should_be_successful);
}

/* ... */
private async Task Given_customer_has_some_products_in_basket()
{
    /* ... */
}

It is possible also to mix synchronous steps with asynchronous ones with RunScenarioActionsAsync method:

[Scenario]
[Label("Ticket-7")]
[ScenarioCategory(Categories.Sales)]
public async Task Successful_addition()
{
    await Runner.RunScenarioActionsAsync(
        Given_product_is_in_stock,
        When_customer_adds_it_to_the_basket,
        Then_the_product_addition_should_be_successful,
        Then_the_basket_should_contain_the_product,
        Then_the_product_should_be_removed_from_stock);
}

/* ... */
private void Given_product_is_in_stock()
{
    /* ... */
}

private async void When_customer_adds_it_to_the_basket()
{
    /* ... */
}

New configuration mechanism

The LightBDD configuration mechanism has been changed too. In version 2, all the configuration is now done in code, and the framework has been changed to allow more customizations than version 1x.

[assembly: ConfiguredLightBddScope]
namespace LightBDD.Example.AcceptanceTests.NUnit3
{
    class ConfiguredLightBddScopeAttribute : LightBddScopeAttribute
    {
        protected override void OnConfigure(LightBddConfiguration configuration)
        {
            configuration
              .ReportWritersConfiguration()
              .AddFileWriter<PlainTextReportFormatter>("~\\FeaturesReport.txt");
        }
    }
}

More details

For more details, feel free to visit the project home page.
In order to jump quickly into the code, a quick start wiki page may be helpful
Finally, there is also a wiki page describing how to migrate tests between LightBDD major versions.

Happy testing!