Use file layout to group NUnit tests by Category
Hi,
I am trying to use ReSharper's file layout feature to reorder my NUnit classes according to the following rule :
- [Setup] first
- then, [Test]
- finally, [Up] then [Down]
The sort works perfectly, relying on attributes types to group the entries. Now, if I have several tests regarding the same category (NUnit.Framework.CategoryAttribute), I would like to be able to group them together first, sort them inside of this group, then sort all the categories (and uncategorized tests if any, coming first or last I do not care).
Is there a way to create a group dynamically based on an attribute ? In this case, the attribute is used like this :
[Category("Tests regarding that"]
[Test]
public void TestThat(){}[Category("Tests regarding that"]
[Test]
public void TestThatError(){}
I would even take a solution involving the use of a regex if needed.
Thank you !
Please sign in to leave a comment.
Hi Serge Aradj!
I am afraid I barely catch the idea you proposing.
How I understood the process for now:
But you specify the order of categories in the layout constructor.. Do you mean to sort attribute groups in alphabetic eg order based on attribute/category value?
Do you mean to automatically create a file-layout pattern with grouped by attribute objects?
Hi !
You understood my need quite well Alexander ! I would like to sort methods based not only on their own name but also on the value of one of their attributes.
For example, I would like this randomly sorted file
To end up sorted by Category, then by method name, like so :
Hi Serge Aradj!
Such functionality is indeed yet to implement in ReSharper.
In order to address the question, I have created a feature request in our tracker.
Please vote or left a comment to give this feature more chances to be added in upcoming releases.
Thank you for the input, and have a nice day!
Hi Alexander, I just did :) !
Thank you for submitting my feature request !