Add gauge metrics for Functest reporting dashboard 33/21133/3
authorjose.lausuch <jose.lausuch@ericsson.com>
Wed, 14 Sep 2016 14:16:46 +0000 (16:16 +0200)
committerjose.lausuch <jose.lausuch@ericsson.com>
Wed, 14 Sep 2016 15:51:14 +0000 (17:51 +0200)
JIRA: FUNCTEST-476

Change-Id: Ia39ffa8b39a1085a081d6128871cee20436e051c
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
16 files changed:
utils/test/reporting/functest/img/gauge_0.png [new file with mode: 0644]
utils/test/reporting/functest/img/gauge_100.png [new file with mode: 0644]
utils/test/reporting/functest/img/gauge_16.7.png [new file with mode: 0644]
utils/test/reporting/functest/img/gauge_25.png [new file with mode: 0644]
utils/test/reporting/functest/img/gauge_33.3.png [new file with mode: 0644]
utils/test/reporting/functest/img/gauge_41.7.png [new file with mode: 0644]
utils/test/reporting/functest/img/gauge_50.png [new file with mode: 0644]
utils/test/reporting/functest/img/gauge_58.3.png [new file with mode: 0644]
utils/test/reporting/functest/img/gauge_66.7.png [new file with mode: 0644]
utils/test/reporting/functest/img/gauge_75.png [new file with mode: 0644]
utils/test/reporting/functest/img/gauge_8.3.png [new file with mode: 0644]
utils/test/reporting/functest/img/gauge_83.3.png [new file with mode: 0644]
utils/test/reporting/functest/img/gauge_91.7.png [new file with mode: 0644]
utils/test/reporting/functest/reporting-status.py
utils/test/reporting/functest/scenarioResult.py
utils/test/reporting/functest/template/index-status-tmpl.html

diff --git a/utils/test/reporting/functest/img/gauge_0.png b/utils/test/reporting/functest/img/gauge_0.png
new file mode 100644 (file)
index 0000000..ecefc0e
Binary files /dev/null and b/utils/test/reporting/functest/img/gauge_0.png differ
diff --git a/utils/test/reporting/functest/img/gauge_100.png b/utils/test/reporting/functest/img/gauge_100.png
new file mode 100644 (file)
index 0000000..e199e15
Binary files /dev/null and b/utils/test/reporting/functest/img/gauge_100.png differ
diff --git a/utils/test/reporting/functest/img/gauge_16.7.png b/utils/test/reporting/functest/img/gauge_16.7.png
new file mode 100644 (file)
index 0000000..3e3993c
Binary files /dev/null and b/utils/test/reporting/functest/img/gauge_16.7.png differ
diff --git a/utils/test/reporting/functest/img/gauge_25.png b/utils/test/reporting/functest/img/gauge_25.png
new file mode 100644 (file)
index 0000000..4923659
Binary files /dev/null and b/utils/test/reporting/functest/img/gauge_25.png differ
diff --git a/utils/test/reporting/functest/img/gauge_33.3.png b/utils/test/reporting/functest/img/gauge_33.3.png
new file mode 100644 (file)
index 0000000..364574b
Binary files /dev/null and b/utils/test/reporting/functest/img/gauge_33.3.png differ
diff --git a/utils/test/reporting/functest/img/gauge_41.7.png b/utils/test/reporting/functest/img/gauge_41.7.png
new file mode 100644 (file)
index 0000000..8c3e910
Binary files /dev/null and b/utils/test/reporting/functest/img/gauge_41.7.png differ
diff --git a/utils/test/reporting/functest/img/gauge_50.png b/utils/test/reporting/functest/img/gauge_50.png
new file mode 100644 (file)
index 0000000..2874b9f
Binary files /dev/null and b/utils/test/reporting/functest/img/gauge_50.png differ
diff --git a/utils/test/reporting/functest/img/gauge_58.3.png b/utils/test/reporting/functest/img/gauge_58.3.png
new file mode 100644 (file)
index 0000000..beedc8a
Binary files /dev/null and b/utils/test/reporting/functest/img/gauge_58.3.png differ
diff --git a/utils/test/reporting/functest/img/gauge_66.7.png b/utils/test/reporting/functest/img/gauge_66.7.png
new file mode 100644 (file)
index 0000000..93f44d1
Binary files /dev/null and b/utils/test/reporting/functest/img/gauge_66.7.png differ
diff --git a/utils/test/reporting/functest/img/gauge_75.png b/utils/test/reporting/functest/img/gauge_75.png
new file mode 100644 (file)
index 0000000..9fc261f
Binary files /dev/null and b/utils/test/reporting/functest/img/gauge_75.png differ
diff --git a/utils/test/reporting/functest/img/gauge_8.3.png b/utils/test/reporting/functest/img/gauge_8.3.png
new file mode 100644 (file)
index 0000000..59f8657
Binary files /dev/null and b/utils/test/reporting/functest/img/gauge_8.3.png differ
diff --git a/utils/test/reporting/functest/img/gauge_83.3.png b/utils/test/reporting/functest/img/gauge_83.3.png
new file mode 100644 (file)
index 0000000..27ae4ec
Binary files /dev/null and b/utils/test/reporting/functest/img/gauge_83.3.png differ
diff --git a/utils/test/reporting/functest/img/gauge_91.7.png b/utils/test/reporting/functest/img/gauge_91.7.png
new file mode 100644 (file)
index 0000000..2808657
Binary files /dev/null and b/utils/test/reporting/functest/img/gauge_91.7.png differ
index 0b80fe4..ef567f1 100755 (executable)
@@ -175,6 +175,8 @@ for version in conf.versions:
                 scenario_criteria = conf.MAX_SCENARIO_CRITERIA
 
             s_score = str(scenario_score) + "/" + str(scenario_criteria)
+            s_score_percent = float(
+                scenario_score) / float(scenario_criteria) * 100
             s_status = "KO"
             if scenario_score < scenario_criteria:
                 logger.info(">>>> scenario not OK, score = %s/%s" %
@@ -191,11 +193,13 @@ for version in conf.versions:
                             ";" + installer + ";" + s + "\n")
                     f.write(info)
 
-            scenario_result_criteria[s] = sr.ScenarioResult(s_status, s_score)
+            scenario_result_criteria[s] = sr.ScenarioResult(s_status, s_score,
+                                                            s_score_percent)
             logger.info("--------------------------")
 
         templateLoader = jinja2.FileSystemLoader(conf.REPORTING_PATH)
-        templateEnv = jinja2.Environment(loader=templateLoader, autoescape=True)
+        templateEnv = jinja2.Environment(
+            loader=templateLoader, autoescape=True)
 
         TEMPLATE_FILE = "/template/index-status-tmpl.html"
         template = templateEnv.get_template(TEMPLATE_FILE)
index 743346a..c6c3373 100644 (file)
@@ -9,12 +9,17 @@
 
 
 class ScenarioResult(object):
-    def __init__(self, status, score=0):
+
+    def __init__(self, status, score=0, score_percent=0):
         self.status = status
         self.score = score
+        self.score_percent = score_percent
 
     def getStatus(self):
         return self.status
 
     def getScore(self):
         return self.score
+
+    def getScorePercent(self):
+        return self.score_percent
\ No newline at end of file
index da2213b..96240de 100644 (file)
                         {% for scenario,iteration in scenario_stats.iteritems() -%}
                             <tr class="tr-ok">
                                 <td>{{scenario}}</td>
-                                <td>{%if scenario_results[scenario].getStatus() is sameas "OK" -%}
-                                                                       <img src="../../img/icon-ok.png"> 
-                                                                       {%- else -%}
-                                                                       <img src="../../img/icon-nok.png">
-                                                                       {%- endif %}</td>
+                                <td>{%if scenario_results[scenario].getScorePercent() < 8.3 -%}
+                                        <img src="../../img/gauge_0.png">
+                                    {%elif scenario_results[scenario].getScorePercent() < 16.7 -%}
+                                        <img src="../../img/gauge_8.3.png">
+                                    {%elif scenario_results[scenario].getScorePercent() < 25 -%}
+                                        <img src="../../img/gauge_16.7.png">
+                                    {%elif scenario_results[scenario].getScorePercent() < 33.3 -%}
+                                        <img src="../../img/gauge_25.png">
+                                    {%elif scenario_results[scenario].getScorePercent() < 41.7 -%}
+                                        <img src="../../img/gauge_33.3.png">
+                                    {%elif scenario_results[scenario].getScorePercent() < 50 -%}
+                                        <img src="../../img/gauge_41.7.png">
+                                    {%elif scenario_results[scenario].getScorePercent() < 58.3 -%}
+                                        <img src="../../img/gauge_50.png">
+                                    {%elif scenario_results[scenario].getScorePercent() < 66.7 -%}
+                                        <img src="../../img/gauge_58.3.png">
+                                    {%elif scenario_results[scenario].getScorePercent() < 75 -%}
+                                        <img src="../../img/gauge_66.7.png">
+                                    {%elif scenario_results[scenario].getScorePercent() < 83.3 -%}
+                                        <img src="../../img/gauge_75.png">
+                                    {%elif scenario_results[scenario].getScorePercent() < 91.7 -%}
+                                        <img src="../../img/gauge_83.3.png">
+                                    {%elif scenario_results[scenario].getScorePercent() < 100 -%}
+                                        <img src="../../img/gauge_91.7.png">
+                                    {%- else -%}
+                                        <img src="../../img/gauge_100.png">
+                                {%- endif %}</td>
                                 <td>{{scenario_results[scenario].getScore()}}</td>
                                 <td>{{iteration}}</td>
                             </tr>
                             {% if test.getCriteria() > -1 -%}
                             {{test.getDisplayName() }}
                             {%- endif %}
-                                                       {% if test.getTier() > 3 -%}
+                            {% if test.getTier() > 3 -%}
                             *
                             {%- endif %}
-                             </th>                           
+                             </th>
                             {%- endfor %}
                         </tr>
                         <tr class="tr-weather-weather">
-                            {% for test in items[scenario] -%}                          
+                            {% for test in items[scenario] -%}
                             {% if test.getCriteria() > 2 -%}
                                 <td><img src="../../img/weather-clear.png"></td>
                             {%- elif test.getCriteria() > 1 -%}