Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a026935
clean up appveyor related files
Oct 29, 2025
d07d2bd
add step title factory tests
Oct 30, 2025
fbfeaa5
add step title factory tests
Oct 30, 2025
3d1a0b4
run tests fighting for configurator in same collection
Oct 30, 2025
32fd607
cleanup ExceptionProcessor
Oct 31, 2025
e3e1409
remove un used property function
Oct 31, 2025
4e471e3
cleanup
Oct 31, 2025
4d7de81
remove unused code. these attributes are defined in this assembly but…
Oct 31, 2025
4e379ec
remove missing doc reference
Oct 31, 2025
dfd7e55
use beta tag for packages built from a branch
Oct 31, 2025
21df381
fix the action script
Oct 31, 2025
03c6ea3
try update gitversion to use beta for non default branches
Oct 31, 2025
fec903e
fix GitVersion.yml
Oct 31, 2025
fe622a4
fixed gitversion
Oct 31, 2025
352bb26
Merge branch 'main' of github.com:TestStack/TestStack.BDDfy into feat…
Oct 31, 2025
b547846
add MeansImplicitUseAttribute back in code
Oct 31, 2025
1153dd0
clean up
Oct 31, 2025
0f56380
revert to keep all Annotations.cs
Nov 1, 2025
39b701f
additional coverage
Nov 1, 2025
71cde21
improving code coverage
Nov 1, 2025
ce88266
publish manual or default branch
Nov 1, 2025
b02f103
change workflow to main line
Nov 1, 2025
65e6f1b
fix gitversion config
Nov 1, 2025
ee49527
additional code coverage
Nov 3, 2025
eb2873a
fix typo in dotnet test command
Nov 3, 2025
9e7e1e4
remove run settings
Nov 3, 2025
0ae45ff
disable diff runner on CI pipeline
Nov 3, 2025
92a407b
fix path scrubber to work with windows and linux
Nov 4, 2025
e8d79ce
fix path scrubber regex
Nov 4, 2025
16f5557
improve path scrubber
Nov 4, 2025
4c23ca6
removed .NET 4 related code
Nov 4, 2025
00438a4
keep backward compatibilty for Humanize method
Nov 4, 2025
7609961
fix mis placed method
Nov 4, 2025
8560692
fix all usages
Nov 4, 2025
616ae39
convert to static property function
Nov 4, 2025
ae4ccfb
Merge branch 'main' into feature/extensibility
SonOfSardaar Dec 11, 2025
ed92c51
Simplify condition for publishing NuGet package
SonOfSardaar Dec 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ jobs:
publish-nuget:
runs-on: ubuntu-latest
needs: build
if: needs.build.outputs.publishNuget == 'true' && (github.event.inputs.runPublish == 'true' || github.ref_name == github.event.repository.default_branch)
if: github.event.inputs.runPublish == 'true' || github.ref_name == github.event.repository.default_branch
environment:
name: Publish
url: https://www.nuget.org/packages/TestStack.BDDfy/
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ obj/
packages/*
PackageBuild/*
Build/*
TestResult.xml
TestResult*
CoverageReport
TestStack.BDDfy.sln.ide/graph
_NCrunch_TestStack.BDDfy/
TestStack.BDDfy.sln.ide/
Expand Down
15 changes: 11 additions & 4 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
mode: ContinuousDelivery
next-version: 8.0.0
assembly-versioning-scheme: MajorMinorPatch
strategies:
- Mainline
branches:
main:
increment: Patch
mode: ContinuousDeployment
regex: ^main$
is-release-branch: true
increment: Patch

other:
mode: ContinuousDelivery
regex: .*
increment: Patch
ignore:
sha: []
sha: []
10 changes: 10 additions & 0 deletions coverage-by-samples.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
dotnet test ./src/Samples/TestStack.BDDfy.Samples/TestStack.BDDfy.Samples.csproj `
--collect:"XPlat Code Coverage" `
--results-directory ./TestResults

reportgenerator `
-reports:./TestResults/**/coverage.cobertura.xml `
-targetdir:./CoverageReport `
-reporttypes:Html

Remove-Item -Recurse -Force ./TestResults
10 changes: 10 additions & 0 deletions coverage-by-tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
dotnet test ./src/TestStack.BDDfy.Tests/TestStack.BDDfy.Tests.csproj `
--collect:"XPlat Code Coverage" `
--results-directory ./TestResults

reportgenerator `
-reports:./TestResults/**/coverage.cobertura.xml `
-targetdir:./CoverageReport `
-reporttypes:Html

Remove-Item -Recurse -Force ./TestResults
10 changes: 10 additions & 0 deletions coverage.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
dotnet test ./src `
--collect:"XPlat Code Coverage" `
--results-directory ./TestResults

reportgenerator `
-reports:./TestResults/**/coverage.cobertura.xml `
-targetdir:./CoverageReport `
-reporttypes:Html

Remove-Item -Recurse -Force ./TestResults
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
![Build Status](https://github.com/TestStack/TestStack.BDDfy/actions/workflows/build.yml/badge.svg)

BDDfy is the simplest BDD framework to use, customize and extend!

A few quick facts about BDDfy:
Expand Down
5 changes: 3 additions & 2 deletions src/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[*.cs]

# Default severity for analyzer diagnostics with category 'Style'
dotnet_analyzer_diagnostic.category-Style.severity = none

# SYSLIB1045: Convert to 'GeneratedRegexAttribute'.
dotnet_diagnostic.SYSLIB1045.severity = none
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,43 @@ public class AccountHasInsufficientFund

// You can override step text using executable attributes
[Given("Given the Account Balance is $10")]
void GivenTheAccountBalanceIs10()
internal void GivenTheAccountBalanceIs10()
{
_card = new Card(true, 10);
}

void And_given_the_Card_is_valid()
internal void And_given_the_Card_is_valid()
{
}

void AndGivenTheMachineContainsEnoughMoney()
internal void AndGivenTheMachineContainsEnoughMoney()
{
_atm = new Atm(100);
}

[When("When the Account Holder requests $20")]
void WhenTheAccountHolderRequests20()
internal void WhenTheAccountHolderRequests20()
{
_atm.RequestMoney(_card, 20);
}

void Then_the_ATM_should_not_dispense_any_Money()
internal void Then_the_ATM_should_not_dispense_any_Money()
{
_atm.DispenseValue.ShouldBe(0);
}

void And_the_ATM_should_say_there_are_Insufficient_Funds()
internal void And_the_ATM_should_say_there_are_Insufficient_Funds()
{
_atm.Message.ShouldBe(DisplayMessage.InsufficientFunds);
}

[AndThen("And the Account Balance should be $20")]
void AndTheAccountBalanceShouldBe20()
internal void AndTheAccountBalanceShouldBe20()
{
_card.AccountBalance.ShouldBe(10);
}

void And_the_Card_should_be_returned()
internal void And_the_Card_should_be_returned()
{
_atm.CardIsRetained.ShouldBe(false);
}
Expand All @@ -56,5 +56,12 @@ public void Verify()
{
this.BDDfy<AccountHolderWithdrawsCash>();
}

[Fact]
public void VerifyLazy()
{
var engine = this.LazyBDDfy<AccountHolderWithdrawsCash>();
engine.Run();
}
}
}
18 changes: 18 additions & 0 deletions src/Samples/TestStack.BDDfy.Samples/CanRunAsyncVoidSteps.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Threading.Tasks;
using TestStack.BDDfy.Configuration;
using Xunit;

namespace TestStack.BDDfy.Samples
{
public class CanRunAsyncVoidSteps
{
[Fact]
internal void Run() => this.BDDfy();
internal void SetUp() => Configurator.AsyncVoidSupportEnabled = false;
internal void TearDown() => Configurator.AsyncVoidSupportEnabled = true;

internal async void GivenNonAsyncStep() => await Task.CompletedTask;
internal async void WhenSomethingHappens() => await Task.CompletedTask;
internal async void ThenAssertSomething() => await Task.CompletedTask;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Shouldly;
using Xunit;
using Xunit.Extensions;

namespace TestStack.BDDfy.Samples.TicTacToe
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using NUnit.Framework;
using Shouldly;

namespace TestStack.BDDfy.Samples.TicTacToe
Expand Down
7 changes: 7 additions & 0 deletions src/TestStack.BDDfy.Tests/Concurrency/TestCollectionName.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace TestStack.BDDfy.Tests.Concurrency
{
internal static class TestCollectionName {
public const string ModifiesConfigurator = "ModifiesConfigurator";
public const string Approvals = nameof(Approvals);
}
}
38 changes: 36 additions & 2 deletions src/TestStack.BDDfy.Tests/Configuration/BatchProcessorsTests.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
using System.Linq;
using System.Collections.Generic;
using System.Linq;
using Shouldly;
using TestStack.BDDfy.Configuration;
using TestStack.BDDfy.Reporters.Diagnostics;
using TestStack.BDDfy.Reporters.Html;
using TestStack.BDDfy.Reporters.MarkDown;
using TestStack.BDDfy.Tests.Concurrency;
using Xunit;

namespace TestStack.BDDfy.Tests.Configuration
{
[Collection(TestCollectionName.ModifiesConfigurator)]
public class BatchProcessorsTests
{
static bool MetroReportProcessorIsActive(IBatchProcessor batchProcessor)
{
return batchProcessor is HtmlReporter && ((HtmlReporter)batchProcessor).ReportBuilder is MetroReportBuilder;
return batchProcessor is HtmlReporter reporter && reporter.ReportBuilder is MetroReportBuilder;
}

[Fact]
Expand Down Expand Up @@ -67,5 +71,35 @@ public void ReturnsHtmlMetroReporterWhenItIsActivated()

Configurator.BatchProcessors.HtmlMetroReport.Disable();
}

[Fact]
public void ReturnsDianosticsReporterWhenItIsActivated()
{
Configurator.BatchProcessors.DiagnosticsReport.Enable();

var processors = Configurator.BatchProcessors.GetProcessors().ToList();

processors.ShouldContain(p=> p is DiagnosticsReporter, 1);

Configurator.BatchProcessors.DiagnosticsReport.Disable();
}

[Fact]
public void ReturnsAdditionalBatchProcessorsWhenAdded()
{
Configurator.BatchProcessors.Add(new FooBatchProcessor());

var processors = Configurator.BatchProcessors.GetProcessors().ToList();

processors.ShouldContain(p => p is FooBatchProcessor, 1);
}

private class FooBatchProcessor : IBatchProcessor
{
public void Process(IEnumerable<Story> stories)
{
throw new System.NotImplementedException();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Reflection;
using Shouldly;
using TestStack.BDDfy.Processors;
using Xunit;

namespace TestStack.BDDfy.Tests.Configuration;

public class ExceptionResolverTests
{
[Fact]
public void WhenTargetInvocationException_ResolveRoot_WhenInnerNotAvailable()
{
var ex = new TargetInvocationException(null);
var resolved = ExceptionResolver.Resolve(ex);
resolved.ShouldBeOfType<TargetInvocationException>();
}

[Fact]
public void WhenNotTargetInvocationException_ResolveRoot_EvenWhenInnerIsAvailable()
{
var ex = new System.InvalidCastException("error", new AmbiguousMatchException());
var resolved = ExceptionResolver.Resolve(ex);
resolved.ShouldBeOfType<InvalidCastException>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
using TestStack.BDDfy.Configuration;
using TestStack.BDDfy.Processors;
using TestStack.BDDfy.Reporters;
using TestStack.BDDfy.Tests.Concurrency;
using Xunit;

namespace TestStack.BDDfy.Tests.Configuration
{
[Collection("ExclusiveAccessToConfigurator")]
[Collection(TestCollectionName.ModifiesConfigurator)]
public class ProcessorPipelineTests
{
[Fact]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using System.Text;
using Shouldly;
using TestStack.BDDfy.Configuration;
using TestStack.BDDfy.Tests.Concurrency;
using Xunit;

namespace TestStack.BDDfy.Tests.Configuration
{
[Collection("ExclusiveAccessToConfigurator")]
[Collection(TestCollectionName.ModifiesConfigurator)]
public class StepExecutorTests
{
private class TestStepExecutor : StepExecutor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
using System.Linq;
using Shouldly;
using TestStack.BDDfy.Configuration;
using TestStack.BDDfy.Tests.Concurrency;
using Xunit;

namespace TestStack.BDDfy.Tests.Configuration
{
[Collection("ExclusiveAccessToConfigurator")]
public class TestRunnerTests
{
public class ScenarioWithFailingThen
Expand All @@ -33,6 +33,9 @@ public void PassingAndThen()
}
}


[Collection(TestCollectionName.ModifiesConfigurator)]

public class When_StopExecutionOnFailingThen_IsSetToTrue
{
[Fact]
Expand Down
1 change: 0 additions & 1 deletion src/TestStack.BDDfy.Tests/Disposer/DisposingScenarios.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Shouldly;
using TestStack.BDDfy.Tests.Exceptions;
using Xunit;
using Xunit.Extensions;

namespace TestStack.BDDfy.Tests.Disposer
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System;
using Shouldly;
using TestStack.BDDfy.Tests.Concurrency;
using Xunit;

namespace TestStack.BDDfy.Tests.Exceptions.OtherExceptions
{
[Collection(TestCollectionName.ModifiesConfigurator)]
public class WhenWhenThrowsException : OtherExceptionBase
{
private void ExecuteUsingFluentScanner()
Expand Down

This file was deleted.

Loading
Loading