by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Prab
    @TotalTest

    Hi team, I've created a specflow plugin and was hoping to push to nuget.org
    However I get a id conflict error, I can't see any other package with the same name so I'm guessing it's because my package starts with 'SpecFlow.'?

    Am I able to get permission to use this? My propose package name is 'SpecFlow.Variants'

    Andreas Willich
    @SabotageAndi
    We reserved the Id's some time ago: https://specflow.org/2017/nuget-packages-reserved-id-naming-conventions/
    If you name the package SpecFlow.Contrib.Variants you should be able to upload
    Prab
    @TotalTest
    Excellent, thanks Andreas
    Andreas Willich
    @SabotageAndi
    @TotalTest I saw that you also wrote us an email. I will ignore it now. Ok?
    We have a docu page with plugins: https://specflow.org/documentation/Available-Plugins/
    You could add your plugin to it
    Prab
    @TotalTest
    Yep please ignore that. Thanks I will look at doing that.
    Daniel Labudek
    @dlabudek_gitlab
    Hi, how can I change[NUnit.Framework.TestFixtureAttribute()] in *feature.cs?
    What should I add to
    Initialize(GeneratorPluginEvents generatorPluginEvents, GeneratorPluginParameters generatorPluginParameters,
    UnitTestProviderConfiguration unitTestProviderConfiguration)
    Unfortunatelly there is no real documentation that will help me. Thanks.
    goblinmaks
    @goblinmaks
    @dlabudek_gitlab for this case you should rewrite your-own NUnit3TestGeneratorProvider. What of reason to change TestFixtureAttribute() for your case ?
    Daniel Labudek
    @dlabudek_gitlab
    I'm running test in parallel and TestFixtureAttribute should allow me to control what tests can be run with each other in parallel. Right know tests in different feature files can be run in parallel but this is not enough. I want to allow only test in different folders to run in parallel.
    Daniel Labudek
    @dlabudek_gitlab
    I find out that TestFixtureAttribute is set in public void SetTestClass(). SO I should probably override this method, but how can I do it? I do not understand the plugin logic.
    Prab
    @TotalTest

    Hi Team, I'm trying to upgrade my custom plugin to SpecFlow 3. I have followed the examples project and article found here: https://specflow.org/2019/updating-plugins-for-specflow-3/

    I have it mostly done but run into a problem when I add a dependency to my plugin project. I've added Newtonsoft.Json or System.Text.Json, the project build and packs ok.

    But when I add my plugin via nuget to a different project I get the following error for System.Text.Json (the same happens if I use Newtonsoft instead).

    [SpecFlow] System.IO.FileNotFoundException: Could not load file or assembly 'System.Text.Json, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
    File name: 'System.Text.Json, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
    at SpecFlow.Contrib.Variants.VariantsPlugin.CustomizeDependencies(Object sender, CustomizeDependenciesEventArgs eventArgs)
    at TechTalk.SpecFlow.Generator.Plugins.GeneratorPluginEvents.RaiseCustomizeDependencies(ObjectContainer container, SpecFlowProjectConfiguration specFlowProjectConfiguration)
    at TechTalk.SpecFlow.Generator.GeneratorContainerBuilder.CreateContainer(SpecFlowConfigurationHolder configurationHolder, ProjectSettings projectSettings, IEnumerable`1 generatorPlugins)
    at SpecFlow.Tools.MsBuild.Generation.GenerateFeatureFileCodeBehindTask.Execute()

    Visual studio is reporting the file SpecFlow.Tools.MsBuild.Generator.Generation.targets line 93 is there the error originates.

    Any help would be greatly appreciated.

    Andreas Willich
    @SabotageAndi
    @TotalTest did you pack the dependency into the nuget package of your plugin?
    Prab
    @TotalTest

    Hi Andreas, I did yes and have tried many things with no luck. I have published a pre release version on nuget if you wanted to take a look:
    https://www.nuget.org/packages/SpecFlow.Contrib.Variants/3.0.0-pre

    Thanks

    Andreas Willich
    @SabotageAndi
    @TotalTest the newtonsoft.json assembly is not part of the nuget package
    image.png
    for generator plugins you have to ship it within the package
    but you don't need the dependency on the package itself
    Prab
    @TotalTest

    How do I include that? It doesn't seem that the Newtonsoft.Json dll is in the \bin\Debug\netstandard2.0 directory (once built) so it can't be copied to the build directory, like the customplugin dll can.

    So essentially the below doesn't seem to work for standard (final two lines):

    <files>
    <file src="build\**\*" target="build"/>
    <file src="bin\$config$\net471\SpecFlow.Contrib.Variants.SpecFlowPlugin.*" target="build\net471"/>
    <file src="bin\$config$\netstandard2.0\SpecFlow.Contrib.Variants.SpecFlowPlugin.dll" target="build\netstandard2.0"/>
    <file src="bin\$config$\netstandard2.0\SpecFlow.Contrib.Variants.SpecFlowPlugin.pdb" target="build\netstandard2.0"/>

    <file src="bin\$config$\net471\Newtonsoft.Json.*" target="build\net471"/>
    <file src="bin\$config$\netstandard2.0\Newtonsoft.Json.dll" target="build\netstandard2.0"/>
    </files>

    Prab
    @TotalTest

    I managed to figure it out, for standard there is a .deps file in the built output, include this file in the package. For framework just include the dependant dll

    <file src="bin\$config$\net471\Newtonsoft.Json.*" target="build\net471"/>

    <file src="bin\$config$\netstandard2.0\SpecFlow.Contrib.Variants.SpecFlowPlugin.*" target="build\netstandard2.0"/>

    Josh Keegan
    @JoshKeegan
    Hi, the official specflow plugins are versioned along with specflow itself, e.g. both specflow and specflow.xunit are currently on 3.1.89.
    Is there a reason for this & should unofficial packages do the same, or depend on a range of specflow versions?
    Andreas Willich
    @SabotageAndi
    @JoshKeegan The reason is, that we publish all packages at once, also when there were no changes in them. It would be too much confusing having multiple packages which have a different latest version.
    Andreas Willich
    @SabotageAndi

    What "unofficial" packages do with their version is up to them. We don't have here any suggestions.
    I would suggest, that you limit your dependency on the supported Major.Minor version number. Reason is, that when we change the plugin interface, we increase the minor version.

    There are some plugins out on nuget, that only have SpecFlow >=1.9 as dependency. The user can add these nuget packages, but they will not work, because the plugin interface changed a lot since 1.9. https://www.nuget.org/packages/Baseclass.Contrib.SpecFlow.Selenium.NUnit/1.3.2-tn40support2 is an example for it.

    Josh Keegan
    @JoshKeegan
    Thanks Adreas, that makes sense :)
    Gemma Buckley
    @midgetgem
    Hi, I have a custom generator plugin, added to my C# project with a package reference, but how do I configure the plugin? I want to add an entry that will be picked up when GeneratorPluginParameters is passed into the IGeneratorPlugin Initialize method. Should I be adding an entry to the app.config, or the specflow.json file? Thanks in advance
    drosenba
    @drosenba
    I asked on Stakcoverflow: https://stackoverflow.com/questions/61258555/how-to-create-a-plugin-for-specflow-feature-level-templates , but did not get any response. Maybe this is a better channel to look for some guidance/direction. Also, is it yet possible to create plugins for SpecFlow.NetCore? The docs say "Runtime plugins need to target .NET Framework 4.5 and .NET Standard 2.0."
    drosenba
    @drosenba
    It's not even clear to me whether I need to create a Generator plugin or a Runtime plugin (or both). There is no description as to the purpose of these plugin types.
    Vamsi TP
    @vamsitp
    @SabotageAndi - Is there a sample that shows the usage of a generator-plugin once it's packaged as a Nuget? Do we just need to add a nuget reference to the generator-plugin in the actual test-project, or do we have a way to specify what generators to use within the nuget? Will all the classes that implement the IGeneratorPlugin interface automatically kick in?
    Andreas Willich
    @SabotageAndi
    @vamsitp there is no ordering or additional configuration. You add the NuGet PackageReference to the test project and that was ist. all IGeneratorPlugin implementations with the marker attribute are called
    Pavel Anihimovsky
    @pavelanihimovsky
    Hi, I'm working on runtime plugin for tool that allows to collect information about test executions (https://github.com/aquality-automation/aquality-tracking) and I faced with an issue. The issue relates to Scenario Outline. I have to create separate test for each Example in this tool. If I use scenarioContext.ScenarioInfo.Title I get the same name for all tests of Scenario Outline, but I want to get something like this as name of test in this tool Feature name: Scenario name: {example_number}. Please let me know is it possible to get Examples of Scenario Outline in runtime and how or something else that can help me with this?
    Andreas Willich
    @SabotageAndi
    @pavelanihimovsky With SpecFlow 3.3 you can get the parameters of a ScenarioOutline. PR is here: SpecFlowOSS/SpecFlow#1988
    Pavel Anihimovsky
    @pavelanihimovsky
    @SabotageAndi Thanks
    Clément MARTY
    @AdCodicem
    Hi! I just created a dependency injection plugin for Specflow which use the Microsoft.Extensions.DependencyInjection nuget : https://github.com/Back-To-The-Coding/SpecFlow.Microsoft.DependencyInjection
    I wondered if I can link my plugin in the Specflow wiki ?
    Also it's basically my first contribution to an open source project :)
    Andreas Willich
    @SabotageAndi
    @Back-To-The-Coding sure, we have a page for that: https://specflow.org/documentation/Available-Plugins/
    in the bottom is a link to the wiki page to edit it
    Clément MARTY
    @AdCodicem
    Thank you @SabotageAndi !
    Clément MARTY
    @AdCodicem
    I just saw that somebody has already developped a similar plugin, so I won't add mine to not fragment the plugin list.
    How do I haven't seen it earlier ? ^^"
    Andreas Willich
    @SabotageAndi
    @Back-To-The-Coding Please add your plugin to the page. Choice is always good. I have no idea if the other plugin is active developed or which SpecFlow version it is supporting.
    Marc Müller
    @marc-mueller
    Good morning! I'm currently a little bit lost since I haven't found it in the documentation or in a sample. Maybe somebody could give me a hint. We are using Specflow 3 with MSTest v2. We need to change the code behind file generation that the test method uses a custom attribute instead of the [TestMethod] attribute. How do I do that? Writing a generator plugin and register a custom MSTest generator? Do I have to write the generator from scratch? I does not look like I can simply change the attribute type of the existing one, right? Thanks your your help!
    That should work, but I never tried it.
    Btw, why do you need another attribute than [TestMethod] on the methods?
    Marc Müller
    @marc-mueller

    Hi @SabotageAndi , thanks a lot for your fast feedback. Do I need to create a nuget package for the plugin or can I register it just with a project dependency?

    The reason why is a good question ;-). We basically use the test for functional testing of the system. But there is a new additional requirement that we need to also verify the correctnes of the system under load where we are executing the same tests during multiple hours over and over. To just reuse the existing test dlls for that, we created a custom TestMethod attribute where we run the same test according to the load test configuration multiple times over a period of time. So having a custom attribute, we can use the test assemblies for both testing purposes and just set a flag in the runsettings during test execution.

    Marc Müller
    @marc-mueller
    I built a custom nuget package, but something is still missing. It defaults to nunit generation currently. I also registered the new generator type, but it did not help
     public class GeneratorPlugin : IGeneratorPlugin
        {
            public void Initialize(GeneratorPluginEvents generatorPluginEvents, GeneratorPluginParameters generatorPluginParameters, UnitTestProviderConfiguration unitTestProviderConfiguration)
            {
                unitTestProviderConfiguration.UseUnitTestProvider("custommstest");
                generatorPluginEvents.RegisterDependencies += GeneratorPluginEvents_RegisterDependencies;
            }
    
            private void GeneratorPluginEvents_RegisterDependencies(object sender, RegisterDependenciesEventArgs e)
            {
                e.ObjectContainer.RegisterTypeAs<CustomMsTestV2GeneratorProvider, IUnitTestGeneratorProvider>("custommstest");
            }
        }
    Sonu Davidson
    @sonudavidson
    [image.png]
    image.png
    image.png
    Hi,
    I'm using SpecFlow 3 with NUnit 3 and I'm adding a custom NUnit attribute "ScenarioContent" to each example of a Scenario Outline.
    The code behind the feature is generated looks like this
    While the background code is generated correctly, but the NUnit 3 result XML file generated by the test runner doesn't link my property to the example <test-case> but to the <test-suite>
    image.png
    Sonu Davidson
    @sonudavidson
    Appreciate if anyone can point me what I am doing wrong or where is it going wrong!