PlayNicely.SpecFlow.Executor
2.3.2-beta-550
dotnet add package PlayNicely.SpecFlow.Executor --version 2.3.2-beta-550
NuGet\Install-Package PlayNicely.SpecFlow.Executor -Version 2.3.2-beta-550
<PackageReference Include="PlayNicely.SpecFlow.Executor" Version="2.3.2-beta-550" />
paket add PlayNicely.SpecFlow.Executor --version 2.3.2-beta-550
#r "nuget: PlayNicely.SpecFlow.Executor, 2.3.2-beta-550"
// Install PlayNicely.SpecFlow.Executor as a Cake Addin #addin nuget:?package=PlayNicely.SpecFlow.Executor&version=2.3.2-beta-550&prerelease // Install PlayNicely.SpecFlow.Executor as a Cake Tool #tool nuget:?package=PlayNicely.SpecFlow.Executor&version=2.3.2-beta-550&prerelease
Play Nicely - SpecFlow Executor
The Play Nicely SpecFlow projects provide Gherkin language bindings to PlayNicely.Executor artefacts. These bindings allow you to define scenarios, including pre-conditions, actions and expected outcomes in domain specific language. Scenarios are designed to support building release tests for Play Nicely npm package based projects.
Getting Started
To start using these bindings in a SpecFlow project, install this package, or
one of the more specific packages, 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.Executor
Or use one of the more specific PlayNicely.SpecFlow packages.
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 assemblies to the file:
{
"stepAssemblies": [
{ "assembly": "PlayNicely.SpecFlow.Executor" }
]
}
You can now use the step definitions and bindings from the package.
Creating Test Scenarios
Test scenarios can be specified using the step definitions defined within this, and the more specific, packages. To create those scenarios, the Gherkin language bindings need to make use of several artefacts from the PlayNicely.Executor projects.
Several hooks and ScenarioContext
extension methods have been defined to simplify this interaction. They ensure a
test environment can be easily configured, and support collection of execution
results, which are used for any testing assertions. They are explained in more
depth here.
ℹ️ Working examples
The PlayNicely.NpmNpx and PlayNicely.Sass projects are real examples of how to set up your projects and configure test scenarios.
Step Definitions
This package provides the following step definitions.
Given
- Given
command (command) is installed
Ensures that command is on the$PATH
in the test environment. - Given
command (command) is uninstalled
If the command is found on the$PATH
, its directory will be removed from the$PATH
in the test environment. This simulates the command being unavailable (uninstalled). For a more complete description of how this works see this page.
When
- When
command (command line) is executed
Executes a process based on the command line provided. The command line is parsed based on the Linux shell rules, \ is the escape character and both " and ' are accepted as quotes.
Then
- Then
the command should [succeed|fail]
Test whether the process exited successfully or not. - Then
the command should return exitcode (exit code)
Test the exit code value returned by the process. - Then
working directory should contain [directory|file|path] (relative/path)
Test to ensure a directory, file, or either exists relative to the test execution working directory. - Then
working directory should not contain [directory|file|path] (relative/path)
Test to ensure a directory, file or either does not exist relative to the test execution working directory. - Then
[stderr|stdout] should contain (text)
Test that the standard error, or output, stream of the process containstext
. - Then
[stderr|stdout] should match (regex)
Test the standard error, or output, stream of the process to ensureregex
matches.
Tags, Hooks and Extensions
This package defines a tag, @test‑environment
, that simplifies creation of
required objects, collection of scenario results and output of any diagnostic
information, in the event of test failure.
⚠️ No tag, no definitions
Without this tag defined on a scenario or feature, many of the step definitions within this project will not be available.
This simplification is achieved using scoped
step definitions, hooks and
ScenarioContext
extension methods.
Test Environment Setup
The Given steps of these packages are scoped with the @test‑environment
tag.
If a feature, or scenario, has been tagged with @test‑environment
, the
Given definitions and the hook EnvironmentBuilderHooks
are in scope. This
ensures that a TestEnvironmentBuilder
object is instantiated before each
scenario and available within the ScenarioContext
dictionary, the Given
steps rely on this object.
The TestEnvironmentBuilder
can be required by any step definition using the
_scenarioContext.RequireEnvironmentBuilder()
extension method.
Execution and Results
The When steps of these packages are also scoped with the
@test‑environment
tag. These steps use the defined TestEnvironmentBuilder
to
build the ITestEnvironment
. With the environment built, a
ITestEnvironmentRunner<T>
is created, and executed against that environment.
ℹ️ Run a process
For this package, it is a basic command line defined process runner.
The ExecutionResultExtensions
class provides extension methods to collect
ExecutionResult
objects (in the ScenarioContext
) and retrieve them from any
Then steps.
The extension methods support the base ExecutionResult
and also any generic
variant of ExecutionResult<T>
.
Failed Test Diagnostics
The ExecutionResultHooks
class is always in scope and runs after every
scenario. If a test fails, and an ExecutionResult
has been collected, the
details of that result will be reported as part of the test output.
Managing Object Lifecycle
The DisposableExtensions
class has extension methods that MarkForDisposal
any
IDisposable
objects created or collected during testing. The DisposalHooks
class will dispose any objects that are MarkForDisposal
after each scenario.
Constants
The SpecFlowConsts
class defines constants for tags and binding order.
ℹ️ Need to be very specific about hook order?
You shouldn't need to worry about these constants, unless you write a package that depends on this one, and you need to ensure the order of the SpecFlow hooks.
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)
- Microsoft.Extensions.DependencyModel (>= 8.0.1)
- PlayNicely.Executor (>= 1.3.2-beta-550)
- SpecFlow (>= 3.9.74)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on PlayNicely.SpecFlow.Executor:
Package | Downloads |
---|---|
PlayNicely.SpecFlow.DotNet
SpecFlow bindings that allow you to run tests by executing dotnet commands against a pre-configured test environment and test case project. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.3.2-beta-550 | 81 | 10/4/2024 |
2.3.2-beta-543 | 92 | 9/28/2024 |
2.3.2-beta-535 | 90 | 9/28/2024 |
2.3.2-beta-529 | 82 | 9/23/2024 |
2.3.2-beta-518 | 102 | 9/21/2024 |
2.3.2-beta-511 | 83 | 9/20/2024 |
2.3.2-beta-509 | 76 | 9/20/2024 |
2.3.2-beta-507 | 73 | 9/20/2024 |
2.3.2-beta-505 | 81 | 9/19/2024 |
2.3.2-beta-501 | 95 | 9/18/2024 |
2.3.2-beta-499 | 96 | 9/18/2024 |
2.3.2-beta-496 | 75 | 9/18/2024 |
2.3.2-beta-494 | 89 | 9/18/2024 |
2.3.2-beta-492 | 97 | 9/18/2024 |
2.3.1 | 124 | 9/17/2024 |
2.3.1-beta-487 | 84 | 9/17/2024 |
2.3.0 | 129 | 9/14/2024 |
2.3.0-beta-479 | 93 | 9/14/2024 |
2.3.0-beta-472 | 107 | 9/14/2024 |
2.2.0-beta-465 | 102 | 9/7/2024 |
2.1.1 | 120 | 6/1/2024 |
2.1.1-beta-450 | 98 | 7/14/2024 |
2.1.1-beta-442 | 97 | 7/12/2024 |
2.1.1-beta-432 | 82 | 7/11/2024 |
2.1.1-beta-418 | 87 | 6/1/2024 |
2.1.1-beta-398 | 79 | 6/1/2024 |
2.1.0 | 141 | 5/8/2024 |
2.1.0-beta-393 | 71 | 5/31/2024 |
2.1.0-beta-382 | 120 | 5/21/2024 |
2.1.0-beta-370 | 107 | 5/8/2024 |
2.1.0-beta-355 | 118 | 5/7/2024 |
2.0.0 | 140 | 5/6/2024 |
2.0.0-beta-349 | 117 | 5/7/2024 |
2.0.0-beta-346 | 129 | 5/7/2024 |
2.0.0-beta-340 | 109 | 5/7/2024 |
2.0.0-beta-323 | 101 | 5/6/2024 |
1.3.0 | 127 | 4/26/2024 |
1.3.0-beta-312 | 94 | 4/26/2024 |
1.2.0 | 152 | 4/14/2024 |
1.2.0-beta-299 | 113 | 4/14/2024 |
1.2.0-beta-296 | 127 | 4/14/2024 |
1.1.1 | 168 | 4/11/2024 |
1.1.1-beta-287 | 113 | 4/11/2024 |
1.1.1-beta-282 | 129 | 4/11/2024 |
1.1.1-beta-280 | 126 | 4/10/2024 |
1.1.1-beta-278 | 94 | 4/10/2024 |
1.1.1-beta-276 | 113 | 4/10/2024 |
1.1.1-beta-274 | 110 | 4/9/2024 |
1.1.1-beta-272 | 114 | 4/9/2024 |
1.1.0 | 135 | 3/21/2024 |
1.1.0-beta-266 | 118 | 3/21/2024 |
1.1.0-beta-260 | 109 | 3/21/2024 |
1.0.1 | 172 | 3/10/2024 |
1.0.1-prerelease-20240301-0... | 122 | 3/1/2024 |
1.0.1-beta-227 | 109 | 3/10/2024 |
1.0.1-beta-221 | 113 | 3/9/2024 |
1.0.1-beta-214 | 109 | 3/9/2024 |
1.0.1-beta-208 | 108 | 3/1/2024 |
1.0.1-beta-206 | 107 | 3/1/2024 |
1.0.0 | 185 | 2/29/2024 |
1.0.0-prerelease-20240229-1... | 103 | 2/29/2024 |
1.0.0-prerelease-20240228-0... | 99 | 2/28/2024 |
1.0.0-prerelease-20240226-1... | 101 | 2/26/2024 |
1.0.0-prerelease-20240225-0... | 96 | 2/25/2024 |
1.0.0-prerelease-20240225-0... | 125 | 2/25/2024 |