4646import java .io .IOException ;
4747import java .util .ArrayList ;
4848import java .util .Collection ;
49+ import java .util .HashMap ;
50+ import java .util .Map ;
4951import java .util .Collections ;
5052import java .util .Comparator ;
5153import java .util .List ;
@@ -78,6 +80,7 @@ public class CaseResult extends TestResult implements Comparable<CaseResult> {
7880 private final String skippedMessage ;
7981 private final String errorStackTrace ;
8082 private final String errorDetails ;
83+ private final Map <String , String > properties ;
8184 @ SuppressFBWarnings (value = "SE_TRANSIENT_FIELD_NOT_RESTORED" , justification = "Specific method to restore it" )
8285 private transient SuiteResult parent ;
8386
@@ -129,6 +132,7 @@ public CaseResult(SuiteResult parent, String testName, String errorStackTrace, S
129132 this .duration = 0.0f ;
130133 this .skipped = false ;
131134 this .skippedMessage = null ;
135+ this .properties = Collections .emptyMap ();
132136 }
133137
134138 @ Restricted (Beta .class )
@@ -154,6 +158,7 @@ public CaseResult(
154158
155159 this .skipped = skippedMessage != null ;
156160 this .skippedMessage = skippedMessage ;
161+ this .properties = Collections .emptyMap ();
157162 }
158163
159164 CaseResult (SuiteResult parent , Element testCase , String testClassName , boolean keepLongStdio ) {
@@ -191,6 +196,22 @@ public CaseResult(
191196 Collection <CaseResult > _this = Collections .singleton (this );
192197 stdout = fixNULs (possiblyTrimStdio (_this , keepLongStdio , testCase .elementText ("system-out" )));
193198 stderr = fixNULs (possiblyTrimStdio (_this , keepLongStdio , testCase .elementText ("system-err" )));
199+
200+ // parse properties
201+ Map <String , String > properties = new HashMap <String , String >();
202+ Element properties_element = testCase .element ("properties" );
203+ if (properties_element != null ) {
204+ List <Element > property_elements = properties_element .elements ("property" );
205+ for (Element prop : property_elements ){
206+ if (prop .attributeValue ("name" ) != null ) {
207+ if (prop .attributeValue ("value" ) != null )
208+ properties .put (prop .attributeValue ("name" ), prop .attributeValue ("value" ));
209+ else
210+ properties .put (prop .attributeValue ("name" ), prop .getText ());
211+ }
212+ }
213+ }
214+ this .properties = properties ;
194215 }
195216
196217 static String possiblyTrimStdio (Collection <CaseResult > results , boolean keepLongStdio , String stdio ) { // HUDSON-6516
@@ -613,6 +634,12 @@ public String getErrorDetails() {
613634 return errorDetails ;
614635 }
615636
637+ @ Exported
638+ @ Override
639+ public Map <String , String > getProperties () {
640+ return properties ;
641+ }
642+
616643 /**
617644 * @return true if the test was not skipped and did not fail, false otherwise.
618645 */
0 commit comments