Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
outputs:
semver: ${{ steps.gitversion.outputs.semVer }}
fullsemver: ${{ steps.gitversion.outputs.fullSemVer }}
Expand All @@ -34,12 +34,12 @@ jobs:
fetch-depth: 0 # Required for GitVersion

- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v4.1.0
uses: gittools/actions/gitversion/setup@v4.5.0
with:
versionSpec: '6.x'
versionSpec: '6.7.x'

- name: Determine Version
uses: gittools/actions/gitversion/execute@v4.1.0
uses: gittools/actions/gitversion/execute@v4.5.0
id: gitversion

- name: Format NuGet version
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ If you prefer to use the official `JetBrains.Annotations` NuGet package instead


This is only the tip of iceberg. Absolutely everything you do with BDDfy is extensible and customizable.
You might see full documentation of BDDfy on the [TestStack documentation website](http://bddfy.teststack.net/).
You might see full documentation of BDDfy on the [Read The Docs](https://teststackbddfy.readthedocs.io).
Oh and while you are there don't forget to checkout other cool projects from [TestStack](http://www.teststack.net/).

## Authors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ public class BuyingTrainFareWithExamples
{
#pragma warning disable 649
// ReSharper disable once InconsistentNaming
private Fare fare;
private BuyerCategory _buyerCategory;
private readonly Fare fare;
private readonly BuyerCategory _buyerCategory;
#pragma warning restore 649
Money Price { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace TestStack.BDDfy.Samples
{
public class CanRunAsyncSteps
public class CanRunAsyncVoidSteps
{
private object _sut;

Expand All @@ -32,7 +32,7 @@ private static async Task<object> CreateSut()
}

[Fact]
public void Run()
public void RunTestWithAsyncVoidSteps()
{
var engine = this.LazyBDDfy();
var exception = Should.Throw<Exception>(engine.Run);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal void Then_the_namespace_is_used_in_the_report()
}

[Fact]
public void Execute()
public void RunTestWithoutAStory()
{
this.BDDfy();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ namespace TestStack.BDDfy.Tests.Arguments
{
public class ArgumentsProvidedForGiven
{
private readonly List<int> _andGivenInput1 = new();
private List<int> _andGivenInput2 = new();
private List<int> _andGivenInput3 = new();
private readonly List<int> _andGivenInput1 = [];
private readonly List<int> _andGivenInput2 = [];
private readonly List<int> _andGivenInput3 = [];

private int _givenInput3;
private int _givenInput2;
Expand Down Expand Up @@ -54,7 +54,7 @@ void ThenSeveralSetsOfArgumentsArePassedInProperly()
}

[Fact]
public void Execute()
public void RunTestWithArgumentsProvidedForGiven()
{
this.BDDfy();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void ThenArgumentsAreSentToThenPart(int argument1, string argument2)
}

[Fact]
public void Execute()
public void RunTestWithArgumentsProvidedForThen()
{
this.BDDfy();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace TestStack.BDDfy.Tests.Arguments
{
public class MultipleArgumentsProvidedForTheSameStep
{
private readonly List<int> _inputs = new();
private readonly List<int> _inputs = [];

[RunStepWithArgs(1)]
[RunStepWithArgs(2)]
Expand All @@ -25,7 +25,7 @@ void ThenTheMethodIsCalledOncePerArgument()
}

[Fact]
public void Execute()
public void RunTestWithMultipleArgumentsProvidedForTheSameStep()
{
this.BDDfy();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public void TearDownThis()
}
}

Engine _engine;
private Scenario _scenario;
readonly Engine _engine;
private readonly Scenario _scenario;

Step GivenStep
{
Expand Down
4 changes: 2 additions & 2 deletions src/TestStack.BDDfy.Tests/Processors/TestRunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public void InitializesScenarioWithExampleBeforeRunning()

var sut = new TestRunner();
Func<object, object> action = o => actualValue = ExampleValue;
var steps = new List<Step> { new(action, new StepTitle("A Step"), true, ExecutionOrder.Initialize, true, new List<StepArgument>()) };
var steps = new List<Step> { new(action, new StepTitle("A Step"), true, ExecutionOrder.Initialize, true, []) };

var scenarioWithExample = new Scenario("id", this, steps, "Scenario Text", exampleTable, new List<string>());
var scenarioWithExample = new Scenario("id", this, steps, "Scenario Text", exampleTable, []);
var story = new Story(new StoryMetadata(typeof(TestRunnerTests), new StoryNarrativeAttribute()), scenarioWithExample);

sut.Process(story);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace TestStack.BDDfy.Tests.Reporters.Html
{
public class HtmlReporterTests
{
private TestableHtmlReporter _sut;
private readonly TestableHtmlReporter _sut;
private const string OutputPath = @"C:\Reports";
private const string ReportData = "Report Data";
private const string CustomStylesheet = "some custom css in here!";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace TestStack.BDDfy.Tests.Reporters

public class ReportModelMapperTests
{
private List<Story> _stories;
private readonly List<Story> _stories;

public ReportModelMapperTests()
{
Expand Down
68 changes: 34 additions & 34 deletions src/TestStack.BDDfy.Tests/Reporters/ReportTestData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ public IEnumerable<Story> CreateMixContainingEachTypeOfOutcomeWithOneScenarioPer

var stories = new List<Story>
{
new(storyMetadata1, new Scenario(typeof(HappyPathScenario), GetHappyExecutionSteps(), "Happy Path Scenario [for Happiness]", new List<string>())),
new(storyMetadata1, new Scenario(typeof(SadPathScenario), GetFailingExecutionSteps(), "Sad Path Scenario [for Happiness]", new List<string>())),
new(storyMetadata1, new Scenario(typeof(SadPathScenario), GetInconclusiveExecutionSteps(), "Inconclusive Scenario [for Happiness]", new List<string>())),
new(storyMetadata1, new Scenario(typeof(SadPathScenario), GetNotImplementedExecutionSteps(), "Not Implemented Scenario [for Happiness]", new List<string>())),
new(testThatReportWorksWithNoStory, new Scenario(typeof(HappyPathScenario), GetHappyExecutionSteps(), "Happy Path Scenario [with no story]", new List<string>())),
new(testThatReportWorksWithNoStory, new Scenario(typeof(SadPathScenario), GetFailingExecutionSteps(), "Sad Path Scenario [with no story]", new List<string>())),
new(testThatReportWorksWithNoStory, new Scenario(typeof(SadPathScenario), GetInconclusiveExecutionSteps(), "Inconclusive Scenario [with no story]", new List<string>())),
new(testThatReportWorksWithNoStory, new Scenario(typeof(SadPathScenario), GetNotImplementedExecutionSteps(), "Not Implemented Scenario [with no story]", new List<string>())),
new(storyMetadata1, new Scenario(typeof(HappyPathScenario), GetHappyExecutionSteps(), "Happy Path Scenario [for Happiness]", [])),
new(storyMetadata1, new Scenario(typeof(SadPathScenario), GetFailingExecutionSteps(), "Sad Path Scenario [for Happiness]", [])),
new(storyMetadata1, new Scenario(typeof(SadPathScenario), GetInconclusiveExecutionSteps(), "Inconclusive Scenario [for Happiness]", [])),
new(storyMetadata1, new Scenario(typeof(SadPathScenario), GetNotImplementedExecutionSteps(), "Not Implemented Scenario [for Happiness]", [])),
new(testThatReportWorksWithNoStory, new Scenario(typeof(HappyPathScenario), GetHappyExecutionSteps(), "Happy Path Scenario [with no story]", [])),
new(testThatReportWorksWithNoStory, new Scenario(typeof(SadPathScenario), GetFailingExecutionSteps(), "Sad Path Scenario [with no story]", [])),
new(testThatReportWorksWithNoStory, new Scenario(typeof(SadPathScenario), GetInconclusiveExecutionSteps(), "Inconclusive Scenario [with no story]", [])),
new(testThatReportWorksWithNoStory, new Scenario(typeof(SadPathScenario), GetNotImplementedExecutionSteps(), "Not Implemented Scenario [with no story]", [])),
new(storyMetadata2, GetScenarios(true, true)),
new(storyMetadata3, GetScenarios(false, true)),
};
Expand Down Expand Up @@ -118,26 +118,26 @@ private Scenario[] GetScenarios(bool includeFailingScenario, bool includeExample
}
return new List<Scenario>
{
new(exampleId, typeof(ExampleScenario), GetExampleExecutionSteps(), "Example Scenario", exampleTable.ElementAt(0), new List<string>()),
new(exampleId, typeof(ExampleScenario), exampleExecutionSteps, "Example Scenario", exampleTable.ElementAt(1), new List<string>())
new(exampleId, typeof(ExampleScenario), GetExampleExecutionSteps(), "Example Scenario", exampleTable.ElementAt(0), []),
new(exampleId, typeof(ExampleScenario), exampleExecutionSteps, "Example Scenario", exampleTable.ElementAt(1), [])
}.ToArray();
}

return new List<Scenario>
{
new(typeof(HappyPathScenario), GetHappyExecutionSteps(), "Happy Path Scenario", new List<string>()),
new(typeof(SadPathScenario), sadExecutionSteps, "Sad Path Scenario", new List<string>())
new(typeof(HappyPathScenario), GetHappyExecutionSteps(), "Happy Path Scenario", []),
new(typeof(SadPathScenario), sadExecutionSteps, "Sad Path Scenario", [])
}.ToArray();
}

private Scenario[] GetOneOfEachScenarioResult()
{
var scenarios = new List<Scenario>
{
new(typeof(HappyPathScenario), GetHappyExecutionSteps(), "Happy Path Scenario", new List<string>()),
new(typeof(SadPathScenario), GetSadExecutionSteps(), "Sad Path Scenario", new List<string>()),
new(typeof(SadPathScenario), GetInconclusiveExecutionSteps(), "Inconclusive Scenario", new List<string>()),
new(typeof(SadPathScenario), GetNotImplementedExecutionSteps(), "Not Implemented Scenario", new List<string>())
new(typeof(HappyPathScenario), GetHappyExecutionSteps(), "Happy Path Scenario", []),
new(typeof(SadPathScenario), GetSadExecutionSteps(), "Sad Path Scenario", []),
new(typeof(SadPathScenario), GetInconclusiveExecutionSteps(), "Inconclusive Scenario", []),
new(typeof(SadPathScenario), GetNotImplementedExecutionSteps(), "Not Implemented Scenario", [])
};

// override specific step results - ideally this class could be refactored to provide objectmother/builder interface
Expand All @@ -162,9 +162,9 @@ private List<Step> GetHappyExecutionSteps()
{
var steps = new List<Step>
{
new(null, new StepTitle("Given a positive account balance"), true, ExecutionOrder.Assertion, true, new List<StepArgument>()) {Duration = new TimeSpan(0, 0, 0, 0, 5), Result = Result.Passed},
new(null, new StepTitle("When the account holder requests money"), true, ExecutionOrder.Assertion, true, new List<StepArgument>()) {Duration = new TimeSpan(0, 0, 0, 0, 5), Result = Result.Passed},
new(null, new StepTitle("Then money is dispensed"), true, ExecutionOrder.Assertion, true, new List<StepArgument>()) {Duration = new TimeSpan(0, 0, 0, 0, 5), Result = Result.Passed},
new(null, new StepTitle("Given a positive account balance"), true, ExecutionOrder.Assertion, true, []) {Duration = new TimeSpan(0, 0, 0, 0, 5), Result = Result.Passed},
new(null, new StepTitle("When the account holder requests money"), true, ExecutionOrder.Assertion, true, []) {Duration = new TimeSpan(0, 0, 0, 0, 5), Result = Result.Passed},
new(null, new StepTitle("Then money is dispensed"), true, ExecutionOrder.Assertion, true, []) {Duration = new TimeSpan(0, 0, 0, 0, 5), Result = Result.Passed},
};
return steps;
}
Expand All @@ -173,9 +173,9 @@ private List<Step> GetExampleExecutionSteps()
{
var steps = new List<Step>
{
new(null, new StepTitle("Given a <sign> account balance"), true, ExecutionOrder.Assertion, true, new List<StepArgument>()) {Duration = new TimeSpan(0, 0, 0, 0, 5), Result = Result.Passed},
new(null, new StepTitle("When the account holder requests money"), true, ExecutionOrder.Assertion, true, new List<StepArgument>()) {Duration = new TimeSpan(0, 0, 0, 0, 5), Result = Result.Passed},
new(null, new StepTitle("Then money <action> dispensed"), true, ExecutionOrder.Assertion, true, new List<StepArgument>()) {Duration = new TimeSpan(0, 0, 0, 0, 5), Result = Result.Passed},
new(null, new StepTitle("Given a <sign> account balance"), true, ExecutionOrder.Assertion, true, []) {Duration = new TimeSpan(0, 0, 0, 0, 5), Result = Result.Passed},
new(null, new StepTitle("When the account holder requests money"), true, ExecutionOrder.Assertion, true, []) {Duration = new TimeSpan(0, 0, 0, 0, 5), Result = Result.Passed},
new(null, new StepTitle("Then money <action> dispensed"), true, ExecutionOrder.Assertion, true, []) {Duration = new TimeSpan(0, 0, 0, 0, 5), Result = Result.Passed},
};
return steps;
}
Expand All @@ -184,9 +184,9 @@ private List<Step> GetSadExecutionSteps()
{
var steps = new List<Step>
{
new(null, new StepTitle("Given a negative account balance"), true, ExecutionOrder.Assertion, true, new List<StepArgument>()) {Duration = new TimeSpan(0, 0, 0, 0, 5), Result = Result.Passed},
new(null, new StepTitle("When the account holder requests money"), true, ExecutionOrder.Assertion, true, new List<StepArgument>()) {Duration = new TimeSpan(0, 0, 0, 0, 5), Result = Result.Passed},
new(null, new StepTitle("Then no money is dispensed"), true, ExecutionOrder.Assertion, true, new List<StepArgument>()) {Duration = new TimeSpan(0, 0, 0, 0, 5), Result = Result.Passed},
new(null, new StepTitle("Given a negative account balance"), true, ExecutionOrder.Assertion, true, []) {Duration = new TimeSpan(0, 0, 0, 0, 5), Result = Result.Passed},
new(null, new StepTitle("When the account holder requests money"), true, ExecutionOrder.Assertion, true, []) {Duration = new TimeSpan(0, 0, 0, 0, 5), Result = Result.Passed},
new(null, new StepTitle("Then no money is dispensed"), true, ExecutionOrder.Assertion, true, []) {Duration = new TimeSpan(0, 0, 0, 0, 5), Result = Result.Passed},
};
return steps;
}
Expand All @@ -195,9 +195,9 @@ private List<Step> GetFailingExecutionSteps()
{
var steps = new List<Step>
{
new(null, new StepTitle("Given a negative account balance"), true, ExecutionOrder.Assertion, true, new List<StepArgument>()),
new(null, new StepTitle("When the account holder requests money"), true, ExecutionOrder.Assertion, true, new List<StepArgument>()),
new(null, new StepTitle("Then no money is dispensed"), true, ExecutionOrder.Assertion, true, new List<StepArgument>()),
new(null, new StepTitle("Given a negative account balance"), true, ExecutionOrder.Assertion, true, []),
new(null, new StepTitle("When the account holder requests money"), true, ExecutionOrder.Assertion, true, []),
new(null, new StepTitle("Then no money is dispensed"), true, ExecutionOrder.Assertion, true, []),
};

SetAllStepResults(steps, Result.Passed);
Expand All @@ -220,9 +220,9 @@ private List<Step> GetInconclusiveExecutionSteps()
{
var steps = new List<Step>
{
new(null, new StepTitle("Given a negative account balance"), true, ExecutionOrder.Assertion, true, new List<StepArgument>()) {Duration = new TimeSpan(0, 0, 0, 0, 5)},
new(null, new StepTitle("When the account holder requests money"), true, ExecutionOrder.Assertion, true, new List<StepArgument>()) {Duration = new TimeSpan(0, 0, 0, 0, 5)},
new(null, new StepTitle("Then no money is dispensed"), true, ExecutionOrder.Assertion, true, new List<StepArgument>()) {Duration = new TimeSpan(0, 0, 0, 0, 5)},
new(null, new StepTitle("Given a negative account balance"), true, ExecutionOrder.Assertion, true, []) {Duration = new TimeSpan(0, 0, 0, 0, 5)},
new(null, new StepTitle("When the account holder requests money"), true, ExecutionOrder.Assertion, true, []) {Duration = new TimeSpan(0, 0, 0, 0, 5)},
new(null, new StepTitle("Then no money is dispensed"), true, ExecutionOrder.Assertion, true, []) {Duration = new TimeSpan(0, 0, 0, 0, 5)},
};

SetAllStepResults(steps, Result.Passed);
Expand All @@ -237,9 +237,9 @@ private List<Step> GetNotImplementedExecutionSteps()
{
var steps = new List<Step>
{
new(null, new StepTitle("Given a negative account balance"), true, ExecutionOrder.Assertion, true, new List<StepArgument>()) {Duration = new TimeSpan(0, 0, 0, 0, 5)},
new(null, new StepTitle("When the account holder requests money"), true, ExecutionOrder.Assertion, true, new List<StepArgument>()) {Duration = new TimeSpan(0, 0, 0, 0, 5)},
new(null, new StepTitle("Then no money is dispensed"), true, ExecutionOrder.Assertion, true, new List<StepArgument>()) {Duration = new TimeSpan(0, 0, 0, 0, 5)},
new(null, new StepTitle("Given a negative account balance"), true, ExecutionOrder.Assertion, true, []) {Duration = new TimeSpan(0, 0, 0, 0, 5)},
new(null, new StepTitle("When the account holder requests money"), true, ExecutionOrder.Assertion, true, []) {Duration = new TimeSpan(0, 0, 0, 0, 5)},
new(null, new StepTitle("Then no money is dispensed"), true, ExecutionOrder.Assertion, true, []) {Duration = new TimeSpan(0, 0, 0, 0, 5)},
};

SetAllStepResults(steps, Result.Passed);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ private void MethodTaking__ExampleInt__(int exampleInt)

public int WrongType { get; set; }
public int Prop1 { get; set; }
private string _prop2 = null;
private string multiWordHeading = null;
private readonly string _prop2 = null;
private readonly string multiWordHeading = null;
public ExecutionOrder Prop_3 { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace TestStack.BDDfy.Tests.Scanner.FluentScanner
{
public class AmbiguousHeaderMatchTests
{
private int _count = 0;
private readonly int _count = 0;

[Fact]
public void ThrowsWhenMultipleHeadersMatchParameterName()
Expand Down
Loading
Loading