-
Notifications
You must be signed in to change notification settings - Fork 748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation how to write custom generator/plugin not up to date #1479
Comments
We are working on it. We didn't expect so much plugins out there and that they migrate so fast to SpecFlow 3.0. |
I agree with it. But as far as I understood, app.config should still be usable for NetFramework 4.6 projects, but for Plugins it does not work. |
Note that generator plugins now need at least .NET 4.7.1, also had to find that out the hard way. |
I have the very strong feeling that the fast updates are due to the per default enabled breaking update of the VS SpecFlow extension. At least this is the reason I'm currently working on the update. |
Has someone an idea how to get Specflow to pick up a Runtime plugin in .NET Core only with specflow.json?
Is the syntax correct? If I reference my Plugin project directly it works but as a Nuget package it doesn't. |
You don't configure it anymore. It has to be in the output directory and end with To get it copied via a NuGet package, you need some MSBuild magic. Something like this: https://github.com/techtalk/SpecFlow/blob/master/Plugins/TechTalk.SpecFlow.MSTest.Generator.SpecFlowPlugin/build/SpecFlow.MsTest.props#L5 |
I am getting more confused now. To have the MSTest-Runtime from Specflow, I have to install the Specflow.MSTest nuget package and within this package, the MS-Test Generator from Specflow gets installed automatically via MSBuild. How can I now only use the Runtime with our own Generator? Do I have to package the Specflow Runtime again in our own Nuget package together with our Generator? |
@zplan What are your changes to the MSTest- Generator? Perhaps it makes sense to contribute it back? |
You don't have to reference the SpecFlow.MSTest nuget package in order to use the MSTest generator functionality in your own plugin. The generators are included in the SpecFlow.CustomPlugin nuget package (exactly: in the TechTalk.SpecFlow.Generator assembly), all the generator plugin packages just alter the configuration to tell specflow to use the desired generator. Just have a look at the generator plugins, you'll find out that they are more or less one-liners that set the desired generator plugin name. |
@Cylox Currently the generator plugins only set the unit Test provider. But I want to move the whole generation code for the different frameworks into the plugins. |
@SabotageAndi From a structural perspective of view I think this is the right thing to do. The generator code itself should however still be usable without enforcing the corresponding plugin to be active. Otherwise use cases like those of @zplan and mine where the generator code is extended in our own plugin will be made impossible. |
@SabotageAndi I have wrapped the NUnit test generator inside of my own generator to be able to add [NUnit.Framework.OrderAttribute] to the test methods. Each test method gets an [OrderAttribute] that reflects its position in the .feature file. The aim is to make sure that the scenarios in the feature file are always executed in the order as they are written in the feature file. |
@SabotageAndi I do basically the same as @Cylox . We need to attribute the test methods because they are later on analysed via reflection for specific attributes. @Testdate:12-12-2019 --> The generator just wraps the ms test generator from specflow and and additionally creates MethodAttributes for the TestMethods from the @-Tags. So the generator is not really replaced, just enhanced. |
Writing this documentation is in our next sprint. |
@SabotageAndi I'm using custom plugin "MsTestContext.SpecflowPlugin" to add test context in generated code behind files at compile time and then use "Specflow.Autofac.SpecFlowPlugin" plugin to register dependencies at runtime. Currently it seems like Specflow.Autofac plugin is not updated for Specflow v3. |
@ParagRaut SpecFlow.Autofac is not yet part of SpecFlow. I talked with @gasparnagy to make it part of it. He hasn't yet send the PR to contribute it. |
Hi @gasparnagy, can you please do the needful ? as many of my projects depends on that plugin 😀 |
@ParagRaut I try to do it on Monday |
I have released a v3 compatible version of the SpecFlow.Autofac repo. For long term, track #1533. |
Thanks for quick feedback and contribution @gasparnagy |
PR with first version of documenation is up: #1539 If you find something missing, please let me know. |
PR is merged. Docs is located at https://github.com/techtalk/SpecFlow/blob/master/docs/plugins/Writing%20Plugins%20for%20SpecFlow%203.md or https://specflow.org/documentation/Plugins/ We also created a Gitter channel special for plugin development: https://gitter.im/techtalk/specflow-plugin-dev |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
SpecFlow Version:
Used Test Runner
Visual Studio Version
Are the latest Visual Studio updates installed?
.NET Framework:
Test Execution Method:
Issue Description
The online documentation how to write a custom plugin or a generator is not up to date with the implementation of SpecFlow3. Me and a lot of other user are currently struggling when trying to migrate our custom generator from SpecFlow 2.x to 3.0.
For example: The documentation still contains unitTestProvider in app.config or specflow.json which does not exist anymore in SpecFlow3.
It is currently a mysterious how to migrate our custom plugins and generators. Please update the docu as fast as possible and provide some real life examples. I loved SpecFlow so far but this release together with this unusable docu is really disappointing.
The text was updated successfully, but these errors were encountered: