PlayNicely.SpecFlow.DotNet 1.1.1-beta-282

This is a prerelease version of PlayNicely.SpecFlow.DotNet.
There is a newer version of this package available.
See the version list below for details.
dotnet add package PlayNicely.SpecFlow.DotNet --version 1.1.1-beta-282                
NuGet\Install-Package PlayNicely.SpecFlow.DotNet -Version 1.1.1-beta-282                
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="1.1.1-beta-282" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PlayNicely.SpecFlow.DotNet --version 1.1.1-beta-282                
#r "nuget: PlayNicely.SpecFlow.DotNet, 1.1.1-beta-282"                
#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.
// Install PlayNicely.SpecFlow.DotNet as a Cake Addin
#addin nuget:?package=PlayNicely.SpecFlow.DotNet&version=1.1.1-beta-282&prerelease

// Install PlayNicely.SpecFlow.DotNet as a Cake Tool
#tool nuget:?package=PlayNicely.SpecFlow.DotNet&version=1.1.1-beta-282&prerelease                

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, 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 -ProjectName "_your-specflow-project_"

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 build 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
  • Given packages under test are output to (directory) and filenames match (pattern) This creates a NuGet package source and mapping, with a best default fallback source.
When
  • When (project) is built This attempts to load a project from a TestSuite, then execute dotnet build on that project.
Then
  • Then project (project) contains directory (directoryPath) Assert that the project.WorkingDirectory contains a directory at directoryPath.
  • Then "project (project) contains file (filePath) Assert that the project.WorkingDirectory contains a file called filePath.
  • Then (errorCode) should be in the list of errors Assert that the errorCode should be in the DotNetExecutionContext.Errors collection.
  • Then target (targetName) should not run Assert that the (MSBuild) <Target/> with the name targetName did not run as part of the build.
  • 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 exactly times number of times.
  • Then the project contains directory (directoryPath) Same as Then project (project) contains directory assertion, except that the project to check is inferred. To infer a project, it must be the only project built.
  • Then the project contains file (filePath) Same as Then project (project) contains file assertion, except that the project to check is inferred. To infer a project, it must be the only project built.

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. Derive from the TestSuite class, set the ResourceNamespaceType, the full name of which is the base name for all test case project resources.

Once derived, use a hook and call extension method ScenarioContext.SetSuite to set the suite for the subsequent scenario.

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. 
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-550 61 10/4/2024
2.3.2-beta-543 95 9/28/2024
2.3.2-beta-535 67 9/28/2024
2.3.2-beta-529 74 9/23/2024
2.3.2-beta-518 83 9/21/2024
2.3.2-beta-511 75 9/20/2024
2.3.2-beta-509 76 9/20/2024
2.3.2-beta-507 74 9/20/2024
2.3.2-beta-505 69 9/19/2024
2.3.2-beta-501 78 9/18/2024
2.3.2-beta-499 68 9/18/2024
2.3.2-beta-496 68 9/18/2024
2.3.2-beta-494 56 9/18/2024
2.3.2-beta-492 78 9/18/2024
2.3.1 114 9/17/2024
2.3.1-beta-487 72 9/17/2024
2.3.0 102 9/14/2024
2.3.0-beta-479 85 9/14/2024
2.3.0-beta-472 82 9/14/2024
2.2.0-beta-465 78 9/7/2024
2.1.1 115 6/1/2024
2.1.1-beta-450 81 7/14/2024
2.1.1-beta-442 78 7/12/2024
2.1.1-beta-432 84 7/11/2024
2.1.1-beta-418 87 6/1/2024
2.1.1-beta-398 88 6/1/2024
2.1.0 129 5/8/2024
2.1.0-beta-393 94 5/31/2024
2.1.0-beta-382 95 5/21/2024
2.1.0-beta-370 93 5/8/2024
2.1.0-beta-355 94 5/7/2024
2.0.0 134 5/6/2024
2.0.0-beta-349 93 5/7/2024
2.0.0-beta-346 95 5/7/2024
2.0.0-beta-340 98 5/7/2024
2.0.0-beta-323 101 5/6/2024
1.3.0 115 4/26/2024
1.3.0-beta-312 94 4/26/2024
1.2.0 112 4/14/2024
1.2.0-beta-299 85 4/14/2024
1.2.0-beta-296 86 4/14/2024
1.1.1 130 4/11/2024
1.1.1-beta-287 96 4/11/2024
1.1.1-beta-282 90 4/11/2024
1.1.1-beta-280 94 4/10/2024
1.1.1-beta-278 84 4/10/2024
1.1.1-beta-276 75 4/10/2024
1.1.1-beta-274 104 4/9/2024
1.1.1-beta-272 95 4/9/2024
1.1.0 121 3/21/2024
1.1.0-beta-266 101 3/21/2024
1.1.0-beta-260 89 3/21/2024
1.0.1 143 3/10/2024
1.0.1-prerelease-20240301-0... 110 3/1/2024
1.0.1-beta-227 87 3/10/2024
1.0.1-beta-221 92 3/9/2024
1.0.1-beta-214 87 3/9/2024
1.0.1-beta-208 100 3/1/2024
1.0.1-beta-206 98 3/1/2024
1.0.0 115 2/29/2024
1.0.0-prerelease-20240229-1... 107 2/29/2024
1.0.0-prerelease-20240228-0... 90 2/28/2024
1.0.0-prerelease-20240226-1... 96 2/26/2024
1.0.0-prerelease-20240225-0... 125 2/25/2024
1.0.0-prerelease-20240225-0... 124 2/25/2024