Skip to content
This repository was archived by the owner on May 22, 2024. It is now read-only.

Commit 47f77b5

Browse files
authored
Update documentation (#5)
1 parent 87472a3 commit 47f77b5

File tree

2 files changed

+59
-61
lines changed

2 files changed

+59
-61
lines changed

README.md

Lines changed: 35 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,51 @@
11
# SpecFlow.DependencyInjection
22

3-
SpecFlow Plugin for Microsoft.Extensions.DependencyInjection
3+
SpecFlow plugin for using Microsoft.Extensions.DependencyInjection as a dependency injection framework.
44

5-
Based on https://github.com/gasparnagy/SpecFlow.Autofac.
5+
Based on https://github.com/gasparnagy/SpecFlow.Autofac ([Apache License 2.0](https://github.com/gasparnagy/SpecFlow.Autofac/blob/master/LICENSE))
66

7-
## TODO
7+
Currently supports:
8+
* [SpecFlow v3.0](https://www.nuget.org/packages/SpecFlow/3.0)
9+
* [Microsoft.Extensions.DependencyInjection v2.2](https://www.nuget.org/packages/Microsoft.Extensions.DependencyInjection/2.2)
810

9-
Todo will move to GitHub Issues once 1.0.0 is released. For now this README will have to suffice.
10-
You can find me (@mbhoek) on https://gitter.im/techtalk/specflow-plugin-dev for questions and feedback.
11+
License: MIT (https://github.com/solidtoken/SpecFlow.DependencyInjection/blob/master/LICENSE)
1112

12-
### Documentation
13+
NuGet: https://www.nuget.org/packages/SolidToken.SpecFlow.DependencyInjection
1314

14-
- [ ] Proper README
15-
- [x] Add LICENSE
16-
- [ ] Make issue tracker available (1.0.0+)
17-
- [ ] Move TODO to TODO+ document?
18-
- Too bad VS does not support TODO+ extension (it's VSCode only)
19-
- [ ] Howto setup services
20-
- [ ] NuGet
21-
- [ ] Azure DevOps
22-
- [ ] GitHub
15+
## Usage
2316

24-
### CI/CD
17+
Install plugin from NuGet into your SpecFlow project.
2518

26-
- [x] Semantic versioning
27-
- GitVersion Build Task
28-
- [x] GitHub workflow (?)
29-
- https://guides.github.com/introduction/flow/
30-
- Can't really get used to this, I prefer gitflow thus far
31-
- Trying to stick to it just to learn
32-
- [x] CI -> Azure Pipelines
33-
- [x] Build using Azure Pipelines
34-
- [x] Smoke Test using the .Tests project
35-
- [ ] CD -> NuGet
36-
- [x] Release a succesful build (gating?)
37-
- [ ] Signed packages
38-
- https://docs.microsoft.com/en-us/nuget/reference/signed-packages-reference
39-
- I'd like to sign the release commits (in git) as well (tags?)
40-
- Signed packages feels like a hassle with the Certification needed (and costs)
41-
- Probably best delayed until it's a really popular package
42-
- [ ] GitHub Releases? How and why?
43-
- [x] Implement GitHub Release from Azure DevOps
44-
- Still feels like you always need a manual step to release (vs GitFlow which allows you to auto-release)
19+
```powershell
20+
PM> Install-Package SolidToken.SpecFlow.DependencyInjection
21+
```
4522

46-
### Code
23+
Create a static method somewhere in the SpecFlow project (recommended to put it into the ```Support``` folder) that returns an Microsoft.Extensions.DependencyInjection ```IServiceCollection``` and tag it with the `[ScenarioDependencies]` attribute. Configure your dependencies for the scenario execution within the method. You also have to register the step definition classes, that you can do by either registering all classes marked with the ```[Binding]``` attribute:
4724

48-
- [x] Add .gitignore
49-
- [ ] Add .editorconfig
50-
- [ ] Add source code quality guidelines
51-
- [x] Add SourceLink
52-
- https://devblogs.microsoft.com/nuget/introducing-source-code-link-for-nuget-packages/
53-
- [x] Set Assembly metadata correctly
25+
```csharp
26+
foreach (var type in typeof(TestDependencies).Assembly.GetTypes().Where(t => Attribute.IsDefined(t, typeof(BindingAttribute))))
27+
{
28+
services.AddSingleton(type);
29+
}
30+
```
5431

55-
### Tests
32+
A typical dependency builder method probably looks like this:
5633

57-
- [ ] Add tests for SpecFlow classes (ScenarioContext, FeatureContext, etc)
58-
- [ ] Add tests for parallel testing
59-
- [ ] Add tests for high-load testing
60-
- Test if we are properly disposing our plumbing code
34+
```csharp
35+
[ScenarioDependencies]
36+
public static IServiceCollection CreateServices()
37+
{
38+
var services = new ServiceCollection();
39+
40+
// TODO: add customizations, stubs required for testing
6141
62-
### Social
42+
foreach (var type in typeof(TestDependencies).Assembly.GetTypes().Where(t => Attribute.IsDefined(t, typeof(BindingAttribute))))
43+
{
44+
services.AddSingleton(type);
45+
}
6346

64-
- [ ] Publish builds/releases on social networks
65-
- [ ] Microsoft Teams
66-
- [ ] Slack
67-
- [ ] Twitter
68-
- [ ] LinkedIn
47+
return services;
48+
}
49+
```
6950

70-
### Issues
71-
72-
- [ ] Determine minimal SpecFlow version to support
73-
- I now got an error that my project has a lower SpecFlow version than this plugin, which then fails
74-
- This is probably solved by a smart grep semver version thingy in package refs
75-
- [ ] Documentation should include that you need to create a Setup Class/Method [ScenarioDependencies]
76-
- [ ] Could also add a "AutoRegisterBindings" (default True) to [ScenarioDependencies]
77-
- This would auto-register all [Bindings] in the same assembly/namespce as the tagged method
51+
Refer to ```SpecFlow.DependencyInjection.Tests``` for a typical implementation.

TODO

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
☐ Make issue tracker available (1.0.0+)
2+
☐ Howto setup supporting services (git repo, ci/cd, nuget repo)
3+
☐ NuGet
4+
☐ Azure DevOps
5+
☐ GitHub
6+
☐ Streamline Release process based on GitHubFlow/Git Releases
7+
Still prefer gitflow but let's stick with it
8+
☐ Code Quality
9+
☐ Add .editorconfig
10+
☐ Add source code quality guidelines
11+
✔ Add SourceLink @done(19-07-01)
12+
https://devblogs.microsoft.com/nuget/introducing-source-code-link-for-nuget-packages/
13+
☐ Tests
14+
☐ Add tests for SpecFlow classes (ScenarioContext, FeatureContext, etc)
15+
☐ Add tests for parallel testing
16+
☐ Add tests for high-load testing
17+
Test if we are properly disposing our plumbing code
18+
☐ Determine minimal SpecFlow version to support
19+
I now got an error that my project has a lower SpecFlow version than this plugin, which then fails
20+
This is probably solved by a smart grep semver version thingy in package refs
21+
✔ Documentation should include that you need to create a Setup Class/Method [ScenarioDependencies] @done(19-07-02)
22+
☐ Could also add a "AutoRegisterBindings" (default True) to [ScenarioDependencies]
23+
This would auto-register all [Bindings] in the same assembly/namespce as the tagged method
24+
☐ Add ProjectUrl and Tags and Icon to NuGet package

0 commit comments

Comments
 (0)