Skip to content

Order of Fixture Execution #345

Closed

Description

@CharliePoole

In additon to ordering test cases as envisioned by #170, we will probably want to provide for ordering of test fixtures. See discussion at https://groups.google.com/forum/#!topic/nunit-discuss/u2wKj0gTSko

Activity

  1. added this to the milestone on Feb 21, 2015
  2. Sebazzz commented on Mar 19, 2015

    @Sebazzz

    I'd vote for this. This is very useful for integration tests and actually the only reason I use MSTest for that.

  3. modified the milestones: , on Dec 4, 2015
  4. modified the milestone: on Jun 24, 2016
  5. NecroFilja commented on Jul 4, 2016

    @NecroFilja

    Are there any workarounds?
    Generally what is default sort order of testfixtures/suites and any way to inject inside of it?

  6. CharliePoole commented on Jul 4, 2016

    @CharliePoole
    MemberAuthor

    In the past they were sorted alphabetically. You can experiment to see if that's still true since its really just a side effect. You have to take the full namespace into account.

  7. CharliePoole commented on Jul 4, 2016

    @CharliePoole
    MemberAuthor

    If course, if you're a developer you can always volunteer to implement this, under guidance if needed.

  8. Sebazzz commented on Jul 4, 2016

    @Sebazzz

    @NecroFilja You could add set the Order property on an ITest by creating a attribute implementing IBeforeTest. However, the ordering is only applied within namespace. You'd need to implement a custom ITestAssemblyBuilder, however, the default implementation can't currently bey overwritten. I wrote a short piece about implementing test fixture ordering.

  9. 31 remaining items

  10. rprouse commented on Aug 7, 2017

    @rprouse
    Member

    @jadarnel27 I have invited you to the Contributors team. Once you accept, we will be able to assign this issue to you, but feel free to start in the meantime, it is all yours 😄

  11. jadarnel27 commented on Aug 7, 2017

    @jadarnel27
    Contributor

    Thanks, guys! Expect a pull request in the near future 😄

  12. added this to the 3.8 milestone on Aug 17, 2017
  13. mikkelbu commented on Aug 17, 2017

    @mikkelbu
    Member

    @jadarnel27 Thanks for the contribution 👍

  14. jadarnel27 commented on Aug 18, 2017

    @jadarnel27
    Contributor

    Glad I could do it! Thanks to all of you for making me feel welcome.

  15. katyabilokur commented on Nov 23, 2017

    @katyabilokur

    Hi.
    I found this issue discussion and it seems the one I need so much.
    I have Telerik Testing Framework + Selenium tests in different classes. One class is one separate test. I need to be able to run my tests in a specific order.

    This issue has been discussed for a long time but I couldn't find any solution to it.
    Did anyone implement it already by any chance?
    From the previous answers, it seems like the fix is pretty simple. Could you tell me exactly what should be changed in that line of code? I will build it for myself then.

    Thank you.

  16. Sebazzz commented on Nov 23, 2017

    @Sebazzz
  17. CharliePoole commented on Nov 23, 2017

    @CharliePoole
    MemberAuthor

    This issue was closed as done but it's unclear just what was done. Probably only the easy part of the solution.

    Can somebody link the PR to this issue?

  18. mikkelbu commented on Nov 23, 2017

    @mikkelbu
    Member

    The PR is #2365 (it is also linked to this issue, see just below this comment #345 (comment))

    And as far as I can recall it was just the implementation of the following

    What's needed to implement:

    • Allow the Order attribute on classes
    • Nothing else as far as I can see!

    taken from #345 (comment).

  19. CharliePoole commented on Nov 23, 2017

    @CharliePoole
    MemberAuthor

    @kotiku Looking at the PR, I'm pretty sure that this is fixed.

    Note that we made this issue be about simple ordering and not more complex dependencies.

  20. jadarnel27 commented on Nov 23, 2017

    @jadarnel27
    Contributor

    @kotiku just to add to what Charlie said, this was introduced in version 3.8 of NUnit, so make sure you are on that version or later in order to order test fixtures (you could only order individual tests prior to 3.8).

  21. katyabilokur commented on Nov 27, 2017

    @katyabilokur

    Hi everyone. Thank you for provided information and references.
    Order class attribute does what I need. I have to keep my tests under one namespace to have Order applied but can overcome this. Great job, thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions