You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CSF.Screenplay.Docs/docs/dependencyInjection/InjectingServices.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,13 +17,13 @@ Which of these depends upon the nature and paradigm of the test framework.
17
17
For frameworks which are based on **test methods** such as [NUnit], services are typically injected via _method parameter injection_ into the test methods.
18
18
[If Screenplay were to be extended] to work with frameworks such as xUnit or MSTest then this is likely to be the technique used.
19
19
20
-
For frameworks which are based on **binding classes** such as [SpecFlow], services are constructor-injected into binding classes.
20
+
For frameworks which are based on **binding classes** such as [Reqnroll], services are constructor-injected into binding classes.
21
21
22
22
Use dependencies injected in this way to get access to [commonly-used Screenplay services] and anything else required at the root level of your test logic.
23
23
24
24
[NUnit]: https://nunit.org/
25
25
[If Screenplay were to be extended]: ../extendingScreenplay/TestIntegrations.md
Copy file name to clipboardExpand all lines: CSF.Screenplay.Docs/docs/extendingScreenplay/TestIntegrations.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
# Writing new Test framework integrations
2
2
3
3
A way in which Screenplay is available for extension is the integration of Screenplay with other Test frameworks.
4
-
Screenplay currently ships with integrations for [NUnit] and [SpecFlow] but developers are free to integrate it into other frameworks if they wish.
4
+
Screenplay currently ships with integrations for [NUnit] and [Reqnroll] but developers are free to integrate it into other frameworks if they wish.
5
5
Developers who are interested in this may use the source code to these two integrations as inspiration.
6
6
7
7
[NUnit]: https://nunit.org
8
-
[SpecFlow]: https://specflow.org
8
+
[Reqnroll]: https://reqnroll.net/
9
9
10
10
## Requirements
11
11
@@ -33,7 +33,7 @@ Terminologies differ between testing frameworks; the word [Scenario] is used to
33
33
* Failure to do this could lead to memory leaks or unnecesarily high resource usage whilst the [Screenplay] is in-progress
34
34
* The test framework **must** provide access to at least the [`ICast`] and [`IStage`], resolved from the [Scenario]'s dependency injection scope, to the [Scenario] logic
35
35
* The manner of doing this depends entirely on the test framework
36
-
* By way of example, in NUnit this is performed by providing the values of parameters to the test method, in SpecFlow this is performed by resolving step bindng classes from that same DI scope, allowing constructor injection
36
+
* By way of example, in NUnit this is performed by providing the values of parameters to the test method, in Reqnroll this is performed by resolving step bindng classes from that same DI scope, allowing constructor injection
Copy file name to clipboardExpand all lines: CSF.Screenplay.Docs/docs/gettingStarted/reqnroll/index.md
+20-12Lines changed: 20 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,33 @@
1
-
# Screenplay & SpecFlow tutorial
1
+
# Screenplay & Reqnroll tutorial
2
2
3
-
Begin writing SpecFlow tests using Screenplay by following these steps.
3
+
> [!TIP]
4
+
> Are you using the legacy **SpecFlow**?
5
+
> **Reqnroll** is the maintained fork of SpecFlow, so it's recommended you upgrade your projects ASAP.
6
+
>
7
+
> For now, CSF.Screenplay continues to support SpecFlow.
8
+
> Use the [CSF.Screenplay.SpecFlow] package and SpecFlow v3.4.3 or higher instead.
9
+
> The remainder of the instructions below work for either Reqnroll or SpecFlow.
10
+
11
+
Begin writing Reqnroll tests using Screenplay by following these steps.
4
12
Further detail is provided below.
5
13
6
-
1. Ensure that your test project uses [SpecFlow version 3.4.3] or higher
7
-
1. Install the NuGet package **[CSF.Screenplay.SpecFlow]** to the project which will contain your `.feature` files
8
-
1._Optional:_ Add services to dependency injection which will be required by the [Abilities] you intend to use. If required, [use SpecFlow context injection & hooks] to add these to the DI container.
14
+
1. Ensure that your test project uses [Reqnroll version 2.0.0] or higher
15
+
1. Install the NuGet package **[CSF.Screenplay.Reqnroll]** to the project which will contain your `.feature` files
16
+
1._Optional:_ Add services to dependency injection which will be required by the [Abilities] you intend to use. If required, [use Reqnroll context injection & hooks] to add these to the DI container.
9
17
1. Write step binding classes which dependency-inject and use Screenplay's architecture
10
18
11
-
[SpecFlow version 3.4.3]: https://www.nuget.org/packages/SpecFlow/3.4.3
> When using SpecFlow with Screenplay, every Screenplay-using test within a test assembly (thus, within a .NET project) must share the same instance of `Screenplay`.
27
+
> When using Reqnroll with Screenplay, every Screenplay-using test within a test assembly (thus, within a .NET project) must share the same instance of `Screenplay`.
20
28
> This is not expected to be problematic, as all the [`Screenplay`] object does is set-up the Screenplay architecture and dependency injection for the tests.
21
29
22
-
When using Screenplay with SpecFlow, `.feature` files are written as normal.
30
+
When using Screenplay with Reqnroll, `.feature` files are written as normal.
23
31
The only difference in writing your tests is that **Step Binding** classes should inject Screenplay architecture and use it within the bindings.
24
32
25
33
The recommended services to inject into your step binding classes are either [`IStage`] or [`ICast`].
@@ -38,7 +46,7 @@ If you are not using Personas to get actors, then you might also need to inject
38
46
> The implied ability, the performables, persona and `DishwashingBuilder` used in this test, related to washing dishes, are all fictitious.
39
47
> See [the documentation for writing performables] to learn about how these could be written.
40
48
41
-
This example assumes that SpecFlow is writting using [the NUnit runner], and thus [it makes use of NUnit-style assertions].
49
+
This example assumes that Reqnroll is writting using [the NUnit runner], and thus [it makes use of NUnit-style assertions].
42
50
Feel free to replace the assertion _with whichever assertion library you wish to use_.
43
51
44
52
```csharp
@@ -75,5 +83,5 @@ public class WashTheDishesSteps(IStage stage)
75
83
```
76
84
77
85
[the documentation for writing performables]: ../../writingPerformables/index.md
Copy file name to clipboardExpand all lines: CSF.Screenplay.Reqnroll/ScreenplayPlugin.cs
+13-11Lines changed: 13 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -18,15 +18,15 @@
18
18
namespaceCSF.Screenplay
19
19
{
20
20
/// <summary>
21
-
/// The Screenplay plugin for SpecFlow.
21
+
/// The Screenplay plugin for Reqnroll.
22
22
/// </summary>
23
23
/// <remarks>
24
24
/// <para>
25
-
/// This plugin class is the <xref href="IntegrationGlossaryItem?text=test+framework+integration"/> for SpecFlow.
26
-
/// Crucially it adds the Screenplay architecture to the SpecFlow architecture.
25
+
/// This plugin class is the <xref href="IntegrationGlossaryItem?text=test+framework+integration"/> for Reqnroll.
26
+
/// Crucially it adds the Screenplay architecture to the Reqnroll architecture.
27
27
/// </para>
28
28
/// <para>
29
-
/// Becuase this plugin leverages the SpecFlow/BoDi <c>IObjectContainer</c>, it is likely incompatible with other plugins
29
+
/// Becuase this plugin leverages the Reqnroll/BoDi <c>IObjectContainer</c>, it is likely incompatible with other plugins
30
30
/// which integrate with third party Dependency Injection libraries.
31
31
/// </para>
32
32
/// <para>
@@ -38,8 +38,8 @@ namespace CSF.Screenplay
38
38
/// <para>
39
39
/// If you wish to further customise the dependency injection, such as adding injectable services for <xref href="AbilityGlossaryItem?text=abilities"/>
40
40
/// or implementations of <see cref="IPersona"/>, add them to the relevant DI container.
41
-
/// When using SpecFlow's default BoDi container this is described in the following article
Copy file name to clipboardExpand all lines: CSF.Screenplay.Reqnroll/ScreenplaySteps.cs
+10-12Lines changed: 10 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,6 @@
1
-
usingCSF.Screenplay.Actors;
2
-
#if SPECFLOW
1
+
#if SPECFLOW
2
+
usingCSF.Screenplay.Actors;
3
3
usingTechTalk.SpecFlow;
4
-
#else
5
-
usingReqnroll;
6
-
#endif
7
4
8
5
namespaceCSF.Screenplay
9
6
{
@@ -12,6 +9,9 @@ namespace CSF.Screenplay
12
9
/// </summary>
13
10
/// <remarks>
14
11
/// <para>
12
+
/// Note that this class does not exist in the Reqnroll Test Framework Integration. It is irrelevant there.
13
+
/// </para>
14
+
/// <para>
15
15
/// In SpecFlow 3.x, the <c>Steps</c> class has three methods named <c>Given</c>, <c>When</c> & <c>Then</c> which can cause
16
16
/// a naming conflict with the same-named methods of <see cref="PerformanceStarter"/>. If you using the performance starter in
17
17
/// the recommended way, then the methods of these two types can become ambiguous and force the developer to write additional
@@ -22,13 +22,10 @@ namespace CSF.Screenplay
22
22
/// but in a manner which will not cause a name-resolution conflict.
23
23
/// </para>
24
24
/// <para>
25
-
/// Note that in SpecFlow 4.x and up, this problem is irrelevant; there is no gain in using this subclass over the <c>using static</c> technique.
26
-
/// As noted here <see href="https://docs.specflow.org/projects/specflow/en/latest/Bindings/Calling-Steps-from-Step-Definitions.html"/>
27
-
/// and here <see href="https://github.com/SpecFlowOSS/SpecFlow/issues/1733"/> the Give, When & Then methods upon the
28
-
/// SpecFlow <c>Steps</c> class were removed in v4.x. This means that the naming conflict won't be present and that there is no need
29
-
/// for your bindings to derive from this class instead of the official Steps class.
30
-
/// Indeed, Screenplay could be described as a specific implementation of the 'driver pattern', which is noted in the linked Github issue
31
-
/// as a best-practice alternative to calling-steps-from-steps.
25
+
/// Note that in SpecFlow 4.x and up, and Reqnroll, this problem is irrelevant; there is no gain in using this subclass over the <c>using static</c> technique.
26
+
/// The Given, When & Then methods upon the SpecFlow <c>Steps</c> class were removed in v4.x, and never existed in any version of Reqnroll.
27
+
/// This means that the naming conflict won't be present and that there is no need for your bindings to derive from this class instead
28
+
/// of the official Steps class.
32
29
/// </para>
33
30
/// </remarks>
34
31
publicabstractclassScreenplaySteps:Steps
@@ -75,3 +72,4 @@ public abstract class ScreenplaySteps : Steps
0 commit comments