PlayNicely.SpecFlow.DotNet
2.3.1
See the version list below for details.
dotnet add package PlayNicely.SpecFlow.DotNet --version 2.3.1
NuGet\Install-Package PlayNicely.SpecFlow.DotNet -Version 2.3.1
<PackageReference Include="PlayNicely.SpecFlow.DotNet" Version="2.3.1" />
paket add PlayNicely.SpecFlow.DotNet --version 2.3.1
#r "nuget: PlayNicely.SpecFlow.DotNet, 2.3.1"
// Install PlayNicely.SpecFlow.DotNet as a Cake Addin #addin nuget:?package=PlayNicely.SpecFlow.DotNet&version=2.3.1 // Install PlayNicely.SpecFlow.DotNet as a Cake Tool #tool nuget:?package=PlayNicely.SpecFlow.DotNet&version=2.3.1
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
- 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 (project) is [built|packaged|published]
This attempts to load a project from aTestSuite
, then executedotnet build
(orpack
,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 theproject.WorkingDirectory
contains a directory, file or either at relative/path. - Then
project (project) does not contain [directory|file|path] (relative/path)
Assert that theproject.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'sWorkingDirectory
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'sWorkingDirectory
is used for the assertions. - Then
(errorCode) should be in the list of errors
Assert that theerrorCode
should be in theDotNetExecutionContext.Errors
collection. - Then
target (targetName) should run
Assert that the<Target/>
with the nametargetName
did run as part of the build. - Then
target (targetName) should run (times) times?
Assert thattargetName
ran at leasttimes
number of times. - Then
target (targetName) should not run
Assert that the (MSBuild)<Target/>
with the nametargetName
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 an explanation for defining test case projects in the IDE.
Once defined, use a hook and call extension method _scenarioContext.SetSuite
to set the suite for the subsequent scenario.
Product | Versions 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. |
-
net8.0
- FluentAssertions (>= 6.12.0)
- PlayNicely.Executor.DotNet (>= 1.3.1)
- PlayNicely.SpecFlow.Executor (>= 2.3.1)
- SpecFlow (>= 3.9.74)
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 | 64 | 10/4/2024 |
2.3.2-beta-543 | 98 | 9/28/2024 |
2.3.2-beta-535 | 70 | 9/28/2024 |
2.3.2-beta-529 | 77 | 9/23/2024 |
2.3.2-beta-518 | 86 | 9/21/2024 |
2.3.2-beta-511 | 78 | 9/20/2024 |
2.3.2-beta-509 | 79 | 9/20/2024 |
2.3.2-beta-507 | 77 | 9/20/2024 |
2.3.2-beta-505 | 72 | 9/19/2024 |
2.3.2-beta-501 | 82 | 9/18/2024 |
2.3.2-beta-499 | 71 | 9/18/2024 |
2.3.2-beta-496 | 72 | 9/18/2024 |
2.3.2-beta-494 | 60 | 9/18/2024 |
2.3.2-beta-492 | 82 | 9/18/2024 |
2.3.1 | 117 | 9/17/2024 |
2.3.1-beta-487 | 75 | 9/17/2024 |
2.3.0 | 105 | 9/14/2024 |
2.3.0-beta-479 | 88 | 9/14/2024 |
2.3.0-beta-472 | 85 | 9/14/2024 |
2.2.0-beta-465 | 81 | 9/7/2024 |
2.1.1 | 118 | 6/1/2024 |
2.1.1-beta-450 | 84 | 7/14/2024 |
2.1.1-beta-442 | 81 | 7/12/2024 |
2.1.1-beta-432 | 87 | 7/11/2024 |
2.1.1-beta-418 | 90 | 6/1/2024 |
2.1.1-beta-398 | 91 | 6/1/2024 |
2.1.0 | 132 | 5/8/2024 |
2.1.0-beta-393 | 97 | 5/31/2024 |
2.1.0-beta-382 | 98 | 5/21/2024 |
2.1.0-beta-370 | 96 | 5/8/2024 |
2.1.0-beta-355 | 97 | 5/7/2024 |
2.0.0 | 137 | 5/6/2024 |
2.0.0-beta-349 | 96 | 5/7/2024 |
2.0.0-beta-346 | 98 | 5/7/2024 |
2.0.0-beta-340 | 101 | 5/7/2024 |
2.0.0-beta-323 | 104 | 5/6/2024 |
1.3.0 | 118 | 4/26/2024 |
1.3.0-beta-312 | 99 | 4/26/2024 |
1.2.0 | 115 | 4/14/2024 |
1.2.0-beta-299 | 90 | 4/14/2024 |
1.2.0-beta-296 | 89 | 4/14/2024 |
1.1.1 | 133 | 4/11/2024 |
1.1.1-beta-287 | 99 | 4/11/2024 |
1.1.1-beta-282 | 95 | 4/11/2024 |
1.1.1-beta-280 | 99 | 4/10/2024 |
1.1.1-beta-278 | 87 | 4/10/2024 |
1.1.1-beta-276 | 78 | 4/10/2024 |
1.1.1-beta-274 | 107 | 4/9/2024 |
1.1.1-beta-272 | 98 | 4/9/2024 |
1.1.0 | 124 | 3/21/2024 |
1.1.0-beta-266 | 104 | 3/21/2024 |
1.1.0-beta-260 | 92 | 3/21/2024 |
1.0.1 | 146 | 3/10/2024 |
1.0.1-prerelease-20240301-0... | 113 | 3/1/2024 |
1.0.1-beta-227 | 90 | 3/10/2024 |
1.0.1-beta-221 | 95 | 3/9/2024 |
1.0.1-beta-214 | 90 | 3/9/2024 |
1.0.1-beta-208 | 103 | 3/1/2024 |
1.0.1-beta-206 | 101 | 3/1/2024 |
1.0.0 | 118 | 2/29/2024 |
1.0.0-prerelease-20240229-1... | 110 | 2/29/2024 |
1.0.0-prerelease-20240228-0... | 93 | 2/28/2024 |
1.0.0-prerelease-20240226-1... | 99 | 2/26/2024 |
1.0.0-prerelease-20240225-0... | 128 | 2/25/2024 |
1.0.0-prerelease-20240225-0... | 127 | 2/25/2024 |