summaryrefslogtreecommitdiffstats
path: root/utils/test/reporting/functest
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2016-09-29 15:39:42 +0200
committerjose.lausuch <jose.lausuch@ericsson.com>2016-09-29 17:21:03 +0200
commitb24f036bc4817ec3f8ee29593c93721f826a6264 (patch)
tree8bf0fff668ce1859a7b6d25e53d059426ccc64e3 /utils/test/reporting/functest
parent0b4d1cc2c3acd59f4e2d50785a442f13ed070e70 (diff)
Add a trend line to Functest reporting
And use d3js lib rather than static images JIRA: FUNCTEST-483 Change-Id: I3c372a8e18fc366dfe510ab551596640fb6d9242 Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
Diffstat (limited to 'utils/test/reporting/functest')
-rw-r--r--utils/test/reporting/functest/default.css77
-rwxr-xr-xutils/test/reporting/functest/reporting-status.py7
-rw-r--r--utils/test/reporting/functest/reportingConf.py1
-rw-r--r--utils/test/reporting/functest/template/index-status-tmpl.html96
4 files changed, 66 insertions, 115 deletions
diff --git a/utils/test/reporting/functest/default.css b/utils/test/reporting/functest/default.css
deleted file mode 100644
index 897c3b12b..000000000
--- a/utils/test/reporting/functest/default.css
+++ /dev/null
@@ -1,77 +0,0 @@
-.panel-header-item {
- position: relative;
- display: inline-block;
- padding-left: 17px;
- padding-right: 17px;
-}
-
-.panel-pod-name {
- margin-top: 10px;
- margin-right: 27px;
- float:right;
- padding: 6px;
-}
-
-.panel-default > .panel-heading .badge {
- background-color: #007e88;
- position: relative;
- display: inline-block;
-}
-
-.panel-default > .panel-heading .progress-bar {
- height: 100%;
- position: absolute;
- left: 0;
- top: 0;
- width: 100%;
- background-color: #0095a2
-}
-.panel-default > .panel-heading h4 {
- color: white;
-}
-
-.panel-default > .panel-heading {
- background-color: #00ADBB;
- overflow: hidden;
- position: relative;
- width: 100%;
-}
-
-th{
- text-align: center;
-}
-
-td{
- text-align: center;
-}
-
-.tr-danger {
- background-color: #177870;
- color: white;
-}
-
-.btn-more {
- color: white;
- background-color: #0095a2;
-}
-
-h1 {
- display: block;
- font-size: 2em;
- margin-top: 0.67em;
- margin-bottom: 0.67em;
- margin-left: 0;
- margin-right: 0;
- font-weight: bold;
-}
-
-h2 {
- display: block;
- font-size: 1.5em;
- margin-top: 0.83em;
- margin-bottom: 0.83em;
- margin-left: 0;
- margin-right: 0;
- font-weight: bold;
- color:rgb(128, 128, 128)
-}
diff --git a/utils/test/reporting/functest/reporting-status.py b/utils/test/reporting/functest/reporting-status.py
index 90699bd61..9df699629 100755
--- a/utils/test/reporting/functest/reporting-status.py
+++ b/utils/test/reporting/functest/reporting-status.py
@@ -184,8 +184,13 @@ for version in conf.versions:
scenario_criteria = conf.MAX_SCENARIO_CRITERIA
s_score = str(scenario_score) + "/" + str(scenario_criteria)
- s_score_percent = float(
+ s_score_percent = 0.0
+ try:
+ s_score_percent = float(
scenario_score) / float(scenario_criteria) * 100
+ except:
+ logger.error("cannot calculate the score percent")
+
s_status = "KO"
if scenario_score < scenario_criteria:
logger.info(">>>> scenario not OK, score = %s/%s" %
diff --git a/utils/test/reporting/functest/reportingConf.py b/utils/test/reporting/functest/reportingConf.py
index e1c4b61a8..1c9a2ac9f 100644
--- a/utils/test/reporting/functest/reportingConf.py
+++ b/utils/test/reporting/functest/reportingConf.py
@@ -13,7 +13,6 @@ installers = ["apex", "compass", "fuel", "joid"]
# list of test cases declared in testcases.yaml but that must not be
# taken into account for the scoring
blacklist = ["ovno", "security_scan"]
-# versions = ["brahmaputra", "master"]
versions = ["master", "colorado"]
PERIOD = 10
MAX_SCENARIO_CRITERIA = 50
diff --git a/utils/test/reporting/functest/template/index-status-tmpl.html b/utils/test/reporting/functest/template/index-status-tmpl.html
index 67c23491a..2beb9128e 100644
--- a/utils/test/reporting/functest/template/index-status-tmpl.html
+++ b/utils/test/reporting/functest/template/index-status-tmpl.html
@@ -3,17 +3,65 @@
<meta charset="utf-8">
<!-- Bootstrap core CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
- <link href="default.css" rel="stylesheet">
+ <link href="../../../css/default.css" rel="stylesheet">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
- <script type="text/javascript">
- $(document).ready(function (){
- $(".btn-more").click(function() {
- $(this).hide();
- $(this).parent().find(".panel-default").show();
+ <script type="text/javascript" src="http://d3js.org/d3.v2.min.js"></script>
+ <script type="text/javascript" src="../../../js/gauge.js"></script>
+ <script type="text/javascript" src="../../../js/trend.js"></script>
+ <script>
+ function onDocumentReady() {
+ // Gauge management
+ {% for scenario in scenario_stats.iteritems() -%}
+ var gaugeScenario{{loop.index}} = gauge('#gaugeScenario{{loop.index}}');
+ {%- endfor %}
+
+ // assign success rate to the gauge
+ function updateReadings() {
+ {% for scenario,iteration in scenario_stats.iteritems() -%}
+ gaugeScenario{{loop.index}}.update({{scenario_results[scenario].getScorePercent()}});
+ {%- endfor %}
+ }
+ updateReadings();
+ }
+
+ // trend line management
+ d3.csv("./scenario_history.txt", function(data) {
+ // ***************************************
+ // Create the trend line
+ {% for scenario,iteration in scenario_stats.iteritems() -%}
+ // for scenario {{scenario}}
+ // Filter results
+ var trend{{loop.index}} = data.filter(function(row) {
+ return row["scenario"]=="{{scenario}}" && row["installer"]=="{{installer}}";
+ })
+ // Parse the date
+ trend{{loop.index}}.forEach(function(d) {
+ d.date = parseDate(d.date);
+ d.score = +d.score
});
- })
- </script>
+ // Draw the trend line
+ var mytrend = trend("#trend_svg{{loop.index}}",trend{{loop.index}})
+ // ****************************************
+ {%- endfor %}
+ });
+ if ( !window.isLoaded ) {
+ window.addEventListener("load", function() {
+ onDocumentReady();
+ }, false);
+ } else {
+ onDocumentReady();
+ }
+</script>
+<script type="text/javascript">
+$(document).ready(function (){
+ $(".btn-more").click(function() {
+ $(this).hide();
+ $(this).parent().find(".panel-default").show();
+ });
+})
+</script>
+
</head>
<body>
<div class="container">
@@ -40,41 +88,17 @@
<div class="panel-heading"><h4><b>List of last scenarios ({{version}}) run over the last {{period}} days </b></h4></div>
<table class="table">
<tr>
- <th width="60%">Scenario</th>
+ <th width="40%">Scenario</th>
<th width="20%">Status</th>
+ <th width="20%">Trend</th>
<th width="10%">Score</th>
<th width="10%">Iteration</th>
</tr>
{% for scenario,iteration in scenario_stats.iteritems() -%}
<tr class="tr-ok">
<td><a href={{scenario_results[scenario].getUrlLastRun()}}>{{scenario}}</a></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><div id="gaugeScenario{{loop.index}}"></div></td>
+ <td><div id="trend_svg{{loop.index}}"></div></td>
<td>{{scenario_results[scenario].getScore()}}</td>
<td>{{iteration}}</td>
</tr>