Please add an IComparer<T> argument to CollectionAttribute.ctor() #2928
Replies: 2 comments
-
Well, I see a few problems. First, the things that can be in constructor arguments is very limited. You could put a type there (that would presumably be required to implement Second, how would you resolve the situation where multiple CollectionAttribute instances reference to different comparers? Which comparer wins? Third, I don't honestly see how this is simpler than just implementing |
Beta Was this translation helpful? Give feedback.
-
Hello, thank you for an answer.
The issue is - ITestCaseOrderer can sort only methods within ONE class and cannot sort all test methods together. And ITestCollectionOrderer cannot sort classes but can only sort collections by their names. My test cases must be ordered by classes, and some classes must be run first. I think it's not too smart idea to add to each class (of 25 ones at the moment) a CollectionAttribute with alphabetically sorted abracadabras as the names. Possibly, you can suggest it? For example, add IComparer in CollectionAttribute ctor(), as I already said, or add any method which can be invoked BEFORE launching of OrderTestCollections() which can forcibly change CollectionAttributes on the used classes, or add new CollectionAttribute, or add new custom priority attribute to each class and put it into different collection, or add new interface that can be implemented, like as ITestClassOrderer, or something similar. |
Beta Was this translation helpful? Give feedback.
-
Currently, Collections can be sorted only by name because CollectionAttribute ctor has no other arguments.
I ask you to add a new constructor for it which will have both name and user-defined IComparer arguments (where T is the test class to which CollectionAttribute is applied) to improve the ability to sort collections in ITestCollectionOrderer implementations.
And maybe it would be nice to add a public property CollectionAttribute.Name to make it possible to access this Name in OrderTestCollections() method.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions