Skip to main content

Refer Step Definitions from external package

Comments

11 comments

  • Егор Шохин

    Hello!)
    I use external package with StepDef in my solutions. And I can advise:
    - remove the dll in specflow.json.
     { "assembly": "MyNewProject" }
    - check the value of the BindingAttribute in the step class.
    - check that you have added a reference to the project with steps.

    0
  • Mandviwala, Abdeali

    --- check the value of the BindingAttribute in the step class.

    I cannot change anything in the step class as that is coming from the package itself.

    --- check that you have added a reference to the project with steps.

    The stepdefinition class is part of the package so ideally my new feature files in new project should pick up them as i have added the package reference in my new project.

     
    0
  • Mandviwala, Abdeali

    Binding attribute is also present in the step definition class in the package code...

        [Binding]
        public class CommonSteps

    0
  • Егор Шохин

    As I remember, specflow works with assemblies that have steps. That is, to use both your own and external steps, you need to add assembly to specflow.json. In your case MyNewProject and external package

    1
  • Mandviwala, Abdeali

    How can I add package? Adding assembly is known to me but not sure how to add package in specflow.json file. I have added Package in dependencies in project.

    0
  • Егор Шохин

    Using the nuget package name
    As example, I will install a package named "Example.nupkg" and I will create specflow.json
     "stepAssemblies": [
        { "assembly": "Example" },
      ]

    0
  • Mandviwala, Abdeali

    Ok I will try this tomorrow and keep you posted.

    0
  • Mandviwala, Abdeali

    I again tried today but same issue. Below is my specflow.json file having an entry of Assembly with package name fhirr4specflow.

    I also tried adding a new class with [Binding] attribute and inherited that class from my base class which comes from the above package. But that too is not working. All the test cases are displaying in purple color.

    Please suggest.

    0
  • Andreas Willich

    Mandviwala, Abdeali please check if the assembly with your external step bindings is in the output folder.

    If it is not there, it doesn't matter what you have configured in the specflow.json.

    0
  • Mandviwala, Abdeali

    Yes it is there in the Output folder of my new project (bin\debug). My package name which i am referring is fhirr4specflow and it has a dll fhirr4specflow.dll. This dll is present in the output folder.

    Below is what i have in specflow.json. Not sure what am i missing. I did cleared the temp cache, restarted VS, rebuild the solution.

    "stepAssemblies": [
        { "assembly": "Allure.SpecFlowPlugin" },
        { "assembly": "fhirr4specflow" },
        { "assembly": "fhirr4specflow.dll" }
      ]

    0
  • Mandviwala, Abdeali

    Not sure what exactly the issue was but now with presence of the package it is working fine. Thanks.

    0

Please sign in to leave a comment.

Powered by Zendesk