Add per-test KPI support

tests can now use 'tenv.test().set_kpis(some_dict)' to set any kind of
data as KPIs, which will be presented in the junit report.

The representation of KPIs in the xml file doesn't follow the junit
format, mainly because it has no support for per-test properties.

Change-Id: I00e976f65a202e82d440bf33708f06c8ce2643e2
diff --git a/selftest/report_test/expected_junit_output.xml b/selftest/report_test/expected_junit_output.xml
index 5de0edf..9f6185c 100644
--- a/selftest/report_test/expected_junit_output.xml
+++ b/selftest/report_test/expected_junit_output.xml
@@ -1,4 +1,4 @@
-<testsuites errors="2" failures="1" name="trial" tests="10" time="102">
+<testsuites errors="2" failures="2" name="trial" tests="12" time="122">
   <testsuite disabled="0" errors="0" failures="0" hostname="localhost" id="0" name="suiteA" skipped="0" tests="2">
     <testcase classname="suiteA" name="suiteA-0" time="30">
       <system-out>test log file not available</system-out>
@@ -59,4 +59,34 @@
       <property name="ref:orange" value="abcd"></property>
     </properties>
   </testsuite>
-</testsuites>
+  <testsuite disabled="0" errors="0" failures="1" hostname="localhost" id="4" name="suiteE" skipped="0" tests="2">
+    <testcase classname="suiteE" name="suiteE-0" time="12">
+      <failure type="fake_fail_type">fake_fail_message</failure>
+      <system-err>system stderr fake content</system-err>
+      <kpis>
+        <kpi_node name="ueA">
+          <property name="kpiA" value="30"></property>
+          <property name="kpiB" value="foobar"></property>
+          <kpi_node name="yet-another-level">
+            <property name="foo" value="bar"></property>
+          </kpi_node>
+        </kpi_node>
+        <kpi_node name="enbD">
+          <property name="foobar-boolean" value="True"></property>
+        </kpi_node>
+        <property name="somekpi" value="someval"></property>
+      </kpis>
+      <system-out>test log file not available</system-out>
+    </testcase>
+    <testcase classname="suiteE" name="suiteE-1" time="10">
+      <kpis>
+        <property name="abcd" value="abcdval"></property>
+      </kpis>
+      <system-out>test log file not available</system-out>
+    </testcase>
+    <properties>
+      <property name="ref:foobar/potato" value="1234"></property>
+      <property name="ref:orange" value="abcd"></property>
+    </properties>
+  </testsuite>
+</testsuites>
\ No newline at end of file