PlayNicely.SpecFlow.DotNet 2.3.2-beta-564

This is a prerelease version of PlayNicely.SpecFlow.DotNet.
dotnet add package PlayNicely.SpecFlow.DotNet --version 2.3.2-beta-564
                    
NuGet\Install-Package PlayNicely.SpecFlow.DotNet -Version 2.3.2-beta-564
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PlayNicely.SpecFlow.DotNet" Version="2.3.2-beta-564" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PlayNicely.SpecFlow.DotNet" Version="2.3.2-beta-564" />
                    
Directory.Packages.props
<PackageReference Include="PlayNicely.SpecFlow.DotNet" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PlayNicely.SpecFlow.DotNet --version 2.3.2-beta-564
                    
#r "nuget: PlayNicely.SpecFlow.DotNet, 2.3.2-beta-564"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PlayNicely.SpecFlow.DotNet@2.3.2-beta-564
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PlayNicely.SpecFlow.DotNet&version=2.3.2-beta-564&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=PlayNicely.SpecFlow.DotNet&version=2.3.2-beta-564&prerelease
                    
Install as a Cake Tool

Play Nicely - SpecFlow DotNet

This package extends the Play Nicely SpecFlow bindings for dotnet testing. It provides step definitions for NuGet package sources and mappings, dotnet [build|pack|publish], and testing the output of that process, including what errors occurred, if any.

Getting Started

To start using these bindings in a SpecFlow project, install this package as a dependency. Then add or update the specflow.json so that the project picks up the bindings.

With this done, you can use the bindings to specify your scenarios.

Install the package

From the Package Manager Console:

Install-Package PlayNicely.SpecFlow.DotNet

Add or Update specflow.json

For SpecFlow to pick up the bindings from external assemblies, they have to be configured in the project's specflow.json file. If the project doesn't already have it, add the item to the root of your SpecFlow project.

Add the external assembly to the file:

{
    "stepAssemblies": [
        { "assembly": "PlayNicely.SpecFlow.DotNet" }
    ]
}

You can now use the step definitions and bindings from Play Nicely.

Creating Test Scenarios

A typical test scenario involves setting up (NuGet) package sources and mappings, performing a dotnet command and then asserting the execution result context, for dotnet related build properties, e.g. projects built, targets run, errors that occurred, etc.

Step Definitions

This package provides the following step definitions for use in test scenarios.

Given
When
  • When project (project) is [built|packaged|published]
    This attempts to load a project from a TestSuite, then execute dotnet build (or pack, publish respectively) on that project.
  • When project (project) is [built|packaged|published] to (directory)
    Same as above but explicitly specifies the output directory -o directory.
Then
  • Then project (project) contains [directory|file|path] (relative/path)
    Assert that the project.WorkingDirectory contains a directory, file or either at relative/path.
  • Then project (project) does not contain [directory|file|path] (relative/path)
    Assert that the project.WorkingDirectory does not contain a directory, file or either at relative/path.
  • Then the project contains [directory|file|path] (relative/path)
    Similar assertion to a named project, except it is expected that only one project is part of this execution. That project's WorkingDirectory is used for the assertions.
  • Then the project does not contain [directory|file|path] (relative/path)
    Similar assertion to a named project, except it is expected that only one project is part of this execution. That project's WorkingDirectory is used for the assertions.
  • Then (errorCode) should be in the list of errors
    Assert that the errorCode should be in the DotNetExecutionContext.Errors collection.
  • Then target (targetName) should run
    Assert that the <Target/> with the name targetName did run as part of the build.
  • Then target (targetName) should run (times) times?
    Assert that targetName ran at least times number of times.
  • Then target (targetName) should not run
    Assert that the <Target/> with the name targetName did not run as part of the build, pack or publish.

Test Suites

dotnet tests typically require a number of pre-defined test (csproj) projects. The When (project) is built step requires a way to load these test projects, to do that a test suite needs to be defined. Create a concrete class that implements ITestSuite interface, or derive from TestSuite and set the ResourceNamespaceType, the full name of which is the base name for all test case project resources.

ℹ️ Defining test case projects
See here for a detailed explanation of how to define test case projects in the IDE.

Once created, use a hook and call extension method _scenarioContext.SetSuite to set the suite for the subsequent scenarios.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.3.2-beta-564 27 9/25/2025
2.3.2-beta-550 109 10/4/2024
2.3.2-beta-543 133 9/28/2024
2.3.2-beta-535 106 9/28/2024
2.3.2-beta-529 114 9/23/2024
2.3.2-beta-518 124 9/21/2024
2.3.2-beta-511 119 9/20/2024
2.3.2-beta-509 121 9/20/2024
2.3.2-beta-507 119 9/20/2024
2.3.2-beta-505 115 9/19/2024
2.3.2-beta-501 133 9/18/2024
2.3.2-beta-499 108 9/18/2024
2.3.2-beta-496 124 9/18/2024
2.3.2-beta-494 101 9/18/2024
2.3.2-beta-492 124 9/18/2024
2.3.1 182 9/17/2024
2.3.1-beta-487 109 9/17/2024
2.3.0 145 9/14/2024
2.3.0-beta-479 120 9/14/2024
2.3.0-beta-472 117 9/14/2024
2.2.0-beta-465 116 9/7/2024
2.1.1 158 6/1/2024
2.1.1-beta-450 118 7/14/2024
2.1.1-beta-442 116 7/12/2024
2.1.1-beta-432 122 7/11/2024
2.1.1-beta-418 122 6/1/2024
2.1.1-beta-398 122 6/1/2024
2.1.0 173 5/8/2024
2.1.0-beta-393 132 5/31/2024
2.1.0-beta-382 131 5/21/2024
2.1.0-beta-370 132 5/8/2024
2.1.0-beta-355 130 5/7/2024
2.0.0 177 5/6/2024
2.0.0-beta-349 130 5/7/2024
2.0.0-beta-346 131 5/7/2024
2.0.0-beta-340 134 5/7/2024
2.0.0-beta-323 140 5/6/2024
1.3.0 155 4/26/2024
1.3.0-beta-312 136 4/26/2024
1.2.0 157 4/14/2024
1.2.0-beta-299 123 4/14/2024
1.2.0-beta-296 119 4/14/2024
1.1.1 160 4/11/2024
1.1.1-beta-287 132 4/11/2024
1.1.1-beta-282 132 4/11/2024
1.1.1-beta-280 129 4/10/2024
1.1.1-beta-278 118 4/10/2024
1.1.1-beta-276 113 4/10/2024
1.1.1-beta-274 139 4/9/2024
1.1.1-beta-272 130 4/9/2024
1.1.0 159 3/21/2024
1.1.0-beta-266 123 3/21/2024
1.1.0-beta-260 125 3/21/2024
1.0.1 180 3/10/2024
1.0.1-prerelease-20240301-0... 143 3/1/2024
1.0.1-beta-227 110 3/10/2024
1.0.1-beta-221 128 3/9/2024
1.0.1-beta-214 126 3/9/2024
1.0.1-beta-208 144 3/1/2024
1.0.1-beta-206 134 3/1/2024
1.0.0 155 2/29/2024
1.0.0-prerelease-20240229-1... 140 2/29/2024
1.0.0-prerelease-20240228-0... 124 2/28/2024
1.0.0-prerelease-20240226-1... 130 2/26/2024
1.0.0-prerelease-20240225-0... 158 2/25/2024
1.0.0-prerelease-20240225-0... 166 2/25/2024