Skip to main content

Unable to successfully run NUnit tests with SpecFlow+ Runner

Answered

Comments

6 comments

  • Jordan Western

    Hi Carter Rohmiller,

    Are you able to send the project to info@specflow.org?

    I believe I understand the issue but the answer would depend on the project specific setup. I feel there might be some ambiguity between 'test frameworks' and 'test runners'

     

    0
  • Carter Rohmiller

    Hello Jordan,

    Yes, I sent a sample project over.

    Thanks,

    Carter

     

     

     

     

    0
  • Jordan Western

    Hi Carter Rohmiller,

    thanks for sending the project, I think the only solution would be to have your NUnit tests in one project, and your specflow tests in another, and the reason is that the tests need to be behind a feature file, not just methods decorated with the NUnit attributes (for the SF runner)

     

    0
  • Carter Rohmiller
    Hi Jordan--

    Thanks for the quick response. I'm a little confused on SpecFlow's integration with NUnit (among other test frameworks) then. How is Nunit supposed to be used with Specflow in this case? You mention the NUnit tests need to be behind a feature file - how is this done or supposed to work? I don't see any specific documentation on this feature so any additional detail here will help us understand this piece much better.
    0
  • Jordan Western

    Hi Carter,

    (Posting this here for the sake of others in case they also have the same question)

    The integration means that your something.feature.cs (the ‘code behind’ file) is generated in such a way that the test is recognisable by your chosen execution engine, in this case, NUnit’s test runner.

    For example, when we build the solution, the .cs file is generated based on which packages you have installed, in this case, NUnit. If we look in the .cs file, you will see tests generated that contain attributes pertaining to which framework you are using, such as this TestFixtureAttribute which belongs to NUnit.Framework –

    This allows the tests to be picked up correctly by your chosen execution engine.

    I suppose in a nutshell, you could say that SpecFlow is parsing the feature files into appropriate tests for your runner of choice.

    Does this help at all?

     

    Thanks, Jordan.

    0
  • Carter Rohmiller

    Ah ok – so this at least clears up what the integration is all about.  Marrying feature files into other runners – seems we were pretty close but glad to get more detail on this!

    In a nutshell, when it comes to other test frameworks in the same solution, we'll have to use their "native" runner for both SpecFlow tests and their tests.  If we choose to use SpecFlow+ Runner for SpecFlow tests, we'll have to separate the projects for each test framework since SpecFlow+ Runner is unable to run tests from other frameworks.

    Thanks Again!

    0

Please sign in to leave a comment.

Powered by Zendesk