@@ -18,7 +18,9 @@ public sealed class FeatureTestMethodAttribute : TestMethodAttribute
1818 /// <param name="onOff">A comma separated string of features to vary between on/off.</param>
1919 /// <param name="on">A comma separated string of features that are always on.</param>
2020 /// <param name="off">A comma separated string of features that are always off.</param>
21- public FeatureTestMethodAttribute ( string ? onOff , string ? on = null , string ? off = null )
21+ /// <param name="displayName">The display name.</param>
22+ public FeatureTestMethodAttribute ( string ? onOff , string ? on = null , string ? off = null , string ? displayName = null )
23+ : base ( displayName )
2224 {
2325 this . OnOff = onOff ;
2426 this . On = on ;
@@ -50,7 +52,7 @@ public static IReadOnlyList<FeatureDefinition> GetFeatures(TestContext context)
5052 return features ;
5153 }
5254
53- return Array . Empty < FeatureDefinition > ( ) ;
55+ return [ ] ;
5456 }
5557
5658 public override TestResult [ ] Execute ( ITestMethod testMethod )
@@ -89,16 +91,16 @@ static string[] Convert(string? arg)
8991
9092 onCombinationValues = onCombinationValues . SelectMany ( o =>
9193 onValues . Select ( onValue =>
92- o . Concat ( new List < FeatureDefinition >
93- {
94+ o . Concat (
95+ [
9496 new ( )
9597 {
9698 Name = feature ,
9799 IsOn = true ,
98100 OffValue = offValue ,
99101 OnValue = onValue ,
100102 } ,
101- } ) ) ) ;
103+ ] ) ) ) ;
102104 }
103105
104106 foreach ( var onCombinationValue in onCombinationValues )
@@ -121,9 +123,23 @@ static string[] Convert(string? arg)
121123 }
122124
123125 var fullMethodName = testMethod . TestClassName + '/' + testMethod . TestMethodName ;
124- ExecutingTestFeatures . TryAdd ( fullMethodName , featureDefinitions . OrderBy ( x => x . Name ) . ToList ( ) ) ;
126+ var sortedFeatures = featureDefinitions . OrderBy ( x => x . Name ) . ToList ( ) ;
127+ ExecutingTestFeatures . TryAdd ( fullMethodName , sortedFeatures ) ;
125128
126129 var result = testMethod . Invoke ( null ) ;
130+
131+ static string GetOnOffValue ( object ? value )
132+ {
133+ return value switch
134+ {
135+ bool b => b ? "on" : "off" ,
136+ _ => value ? . ToString ( ) ?? "null" ,
137+ } ;
138+ }
139+
140+ var featureSet = string . Join ( ", " , sortedFeatures . Select ( x => $ "{ x . Name } : { ( x . IsOn ? $ "{ GetOnOffValue ( x . OnValue ) } " : $ "{ GetOnOffValue ( x . OffValue ) } ") } ") ) ;
141+ result . DisplayName = $ "{ this . DisplayName ?? testMethod . TestMethodName } ({ featureSet } )";
142+
127143 results . Add ( result ) ;
128144
129145 ExecutingTestFeatures . TryRemove ( fullMethodName , out _ ) ;
0 commit comments