+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://yelotofu.com/labs/jquery/snippets/outerhtml/
+ *
+ * outerHTML is based on the outerHTML work done by Brandon Aaron
+ * But adds the ability to replace an element.
+ */
+
+(function($) {
+ $.fn.outerHTML = function(s) {
+ return (s)
+ ? this.before(s).remove()
+ : $('').append(this.eq(0).clone()).html();
+ }
+})(jQuery);
\ No newline at end of file
diff --git a/dashboard/jquery/multiprogressbar/jquery.ui.multiprogressbar.css b/dashboard/jquery/multiprogressbar/jquery.ui.multiprogressbar.css
new file mode 100644
index 0000000..91431cd
--- /dev/null
+++ b/dashboard/jquery/multiprogressbar/jquery.ui.multiprogressbar.css
@@ -0,0 +1,18 @@
+@CHARSET "UTF-8";
+
+/*
+ * jQuery UI Multi-Progress Bar 1.1.0
+ * http://github.com/j-ulrich/jquery-ui-multiprogressbar
+ *
+ * Copyright (c) 2012 Jochen Ulrich
+ * Licensed under the MIT license (MIT-LICENSE.txt).
+ */
+
+.ju-multiprogressbar .ui-progressbar-value {
+ float: left;
+}
+
+.ju-multiprogressbar .ju-multiprogressbar-valuetext {
+ margin-top: 0.3em;
+ text-align: center;
+}
\ No newline at end of file
diff --git a/dashboard/jquery/multiprogressbar/jquery.ui.multiprogressbar.js b/dashboard/jquery/multiprogressbar/jquery.ui.multiprogressbar.js
new file mode 100644
index 0000000..91de4c3
--- /dev/null
+++ b/dashboard/jquery/multiprogressbar/jquery.ui.multiprogressbar.js
@@ -0,0 +1,188 @@
+/*jslint white: true vars: true browser: true todo: true */
+/*jshint camelcase:true, plusplus:true, forin:true, noarg:true, noempty:true, eqeqeq:true, bitwise:true, strict:true, undef:true, unused:true, curly:true, browser:true, devel:true, maxerr:100, white:false, onevar:false */
+/*global jQuery:true $:true */
+
+/* jQuery UI Multi-Progress Bar 1.1.0
+ * http://github.com/j-ulrich/jquery-ui-multiprogressbar
+ *
+ * Copyright (c) 2012 Jochen Ulrich
+ * Licensed under the MIT license (MIT-LICENSE.txt).
+ */
+
+/**
+ * @file jQuery UI Multi-Progress Bar
+ * @version 1.0
+ * @copyright 2012 Jochen Ulrich
+ * @license MIT (MIT-LICENSE.txt)
+ */
+
+(function($) {
+ "use strict";
+
+ /**
+ * Constructs a multiprogressbar.
+ * @name multiprogressbar
+ * @public
+ * @function
+ * @memberOf jQuery.ju
+ */
+ $.widget("ju.multiprogressbar",
+
+ /**
+ * @lends jQuery.ju.multiprogressbar.prototype
+ */
+ {
+
+ // Options
+ /**
+ * Default values of the options.
+ * @since 1.0
+ */
+ options: {
+ parts: [{value: 0, barClass: "", text: false, textClass: ""}]
+ },
+
+ /**
+ * Constructor for multiprogressbars.
+ * @private
+ * @author julrich
+ * @since 1.0
+ */
+ _create: function() {
+ var self = this;
+ self.element.progressbar({value: 0, disabled: self.options.disabled}); // Creates one part with width 0%
+ self.element.addClass("ju-multiprogressbar");
+
+ // Use the part generated by jQuery UI progressbar as template for the other parts
+ self._partTemplate = self._getPartElements().outerHTML();
+ self._createParts(self.options.parts);
+ $.extend(self,{
+ created: true
+ });
+ },
+
+ /**
+ * @returns {Object} a jQuery object containing all part elements.
+ * @private
+ * @author julrich
+ * @since 1.0
+ */
+ _getPartElements: function() {
+ return this.element.children(".ui-progressbar-value");
+ },
+
+ /**
+ * (Re)creates the markup of the parts.
+ * @param {Array} parts - Array of part objects defining the properties of the parts to be created.
+ * @fires multiprogressbar#change when the function is called after the creation of the multiprogressbar
+ * (i.e. the event is not fired during the creation).
+ * @fires multiprogressbar#complete when the total progress reaches or exceeds 100%.
+ * @private
+ * @author julrich
+ * @since 1.0
+ */
+ _createParts: function(parts) {
+ var self = this;
+
+ self._getPartElements().remove(); // Remove all existing parts and then rebuild them
+ var first = true;
+ var lastVisibleElement = null;
+ var totalValue = 0;
+ $.each(parts, function(i, part) {
+ var partElement = $(self._partTemplate).appendTo(self.element);
+
+ if (first === false) {
+ partElement.removeClass("ui-corner-left");
+ }
+ if (part.value > 0 && totalValue < 100) {
+ first = false;
+ // Check if the part would exceed the 100% and cut it at 100%
+ part.value = totalValue+part.value > 100 ? 100-totalValue : part.value;
+ partElement.css('width', part.value+"%").show();
+ lastVisibleElement = partElement;
+ totalValue += part.value;
+ }
+ else {
+ // Hide part if the progress is <= 0 or if we exceeded 100% already
+ part.value = 0;
+ partElement.hide();
+ }
+
+ partElement.addClass(part.barClass);
+
+ if (part.text !== undefined && part.text !== null && part.text !== false) {
+ var textForPart;
+ if (part.text === true) {
+ textForPart = Math.round(part.value)+"%";
+ }
+ else if ($.trim(part.text) !== "") {
+ textForPart = part.text;
+ }
+ $('').addClass("ju-multiprogressbar-valuetext").text(textForPart).addClass(part.textClass).appendTo(partElement);
+ }
+ });
+ if (self.created === true) { // Don't trigger "change" when we are creating the progressbar for the first time
+ self._trigger("change", null, {parts: parts});
+ }
+ if (totalValue >= 99.9) {
+ lastVisibleElement.addClass("ui-corner-right");
+ // Trigger complete
+ self._trigger("complete");
+ }
+ },
+
+ /**
+ * Restores the element to it's original state.
+ * @public
+ * @author julrich
+ * @since 1.0
+ */
+ destroy: function() {
+ var self = this;
+ self._getPartElements().remove();
+ self.element.progressbar("destroy");
+ },
+
+ /**
+ * Changes an option.
+ * @param {String} option - name of the option to be set.
+ * @param value - new value for the option.
+ * @private
+ * @author julrich
+ * @since 1.0
+ */
+ _setOption: function(option, value) {
+ var self = this;
+ $.Widget.prototype._setOption.apply( self, arguments );
+
+ switch(option) {
+ case "parts":
+ self._createParts(value);
+ break;
+ case "dummy":
+ break;
+ default:
+ break;
+ }
+ },
+
+ /**
+ * @return {Numeric} the sum of the progress of all visible parts.
+ * Note: When the sum of the progress of the parts exceeds 100, the progress
+ * will be truncated at 100 and the value of successive parts will be set to 0. This means
+ * that this function will always return a value in the range [0,100].
+ * @public
+ * @author julrich
+ * @since 1.0
+ */
+ total: function() {
+ var self = this;
+ var totalValue = 0;
+ $.each(self.options.parts, function(i, part) {
+ totalValue += part.value;
+ });
+
+ return totalValue;
+ }
+ });
+}(jQuery));
\ No newline at end of file
diff --git a/dashboard/jquery/qaf_dashboard.js b/dashboard/jquery/qaf_dashboard.js
index 4b4a23f..05d4bf9 100644
--- a/dashboard/jquery/qaf_dashboard.js
+++ b/dashboard/jquery/qaf_dashboard.js
@@ -48,51 +48,125 @@ var overviewTemplate =
''+
'
'+
'
'+
- '
'+
- '
'+
- '
'+
- '
'+
- '
'+
- '- Duration
'+
- '- ${getDuration(endTime-startTime)}
'+
- '- Skipped
'+
- '${skip}
'+
- '
'+
- '
'+
- '
'+
- '
'+
- '- Total
'+
- '- ${total}
'+
- '- Failed
'+
- '${fail}
'+
- '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ ''+
+ '
'+
+ '
${total}
'+
+ '
Total Test Cases'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ ''+
+ '
'+
+ '
${getDuration(endTime-startTime)}
'+
+ '
Total Duration'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ ''+
+ '
'+
+ '
${pass}
'+
+ '
Passed'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ ''+
+ '
'+
+ '
${skip}
'+
+ '
Skipped'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ ''+
+ '
'+
+ '
${fail}
'+
+ '
Failed'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ //end row
'
'+
'
'+
'
'+
+ '
'+
'
'+
- '
'+
- '
'+
- ''+
- ''+
- '| Test | '+
- 'Duration | '+
- 'Passed | '+
- 'Skipped | '+
- 'Failed | '+
- 'Total | '+
- 'Pass Rate | '+
- '
'+
- ''+
- ''+
- ''+
- '
'+
+ '
'+
+ // '
'+
+ // ''+
+ // ''+
+ // '| Test | '+
+ // 'Duration | '+
+ // 'Passed | '+
+ // 'Skipped | '+
+ // 'Failed | '+
+ // 'Total | '+
+ // 'Pass Rate | '+
+ // ' | '+
+ // '
'+
+ // ''+
+ // ''+
+ // ''+
+ // '
'+
+ // '
'+
+ '
'+
+ '
'+
+ '
'+
+ ''+
+ '
'+
+ ''+
+ ''+
+ '| Test | '+
+ 'Duration | '+
+ 'Passed | '+
+ 'Skipped | '+
+ 'Failed | '+
+ 'Total | '+
+ 'Pass Rate | '+
+ '
'+
+ ''+
+ ''+
+ ''+
+ '
'+
+ '
'+
+ ''+
+ '
'+
+ '
'+
'
'+
''+
'
'+
@@ -100,15 +174,15 @@ var overviewTemplate =
var testOverviewTemplate =
-'
'+
-'| ${name} | '+
-'${getDuration(endTime-startTime)} | '+
-'${pass} | '+
-'${skip} | '+
-'${fail} | '+
-'${total} | '+
-''+
- ' ${calcPassRate(pass,fail,skip)}% '+
+' |
'+
+' | '+
+'${getDuration(endTime-startTime)} | '+
+'${pass} | '+
+'${skip} | '+
+'${fail} | '+
+'${total} | '+
+''+
+ ''+
' | '+
'
';
@@ -227,9 +301,9 @@ var errorAnalysisTemplate =
'
'+
'
'+
'{{each(i, item) $data}}'+
-'
'+
- '
'+
- '
${i}'+
+'
'+
+ '
'+
+ '
${i}'+
'
${item.length}
'+
'
'+
'
'+
@@ -496,20 +570,31 @@ function loaResult(dir) {
}
function loadOverview(dir) {
-
+ var percentage = 0;
+ var multiprogressbar = 0;
$.getJSON(dir + "/meta-info.json", function(data) {
$("#overview-tab-content").show();
$("#overview-tab-content").html('');
$.tmpl(overviewTemplate,data).appendTo("#overview-tab-content");
-
$.each(data.tests, function(i, item) {
$.getJSON(dir + "/" + item + "/overview.json", function(data1) {
data1["name"] = item;
+ percentagePass = calcPassRate(data1.pass,data1.fail,data1.skip);
+ percentageFail = calcFailRate(data1.pass,data1.fail,data1.skip);
+ percentageSkip = calcSkipRate(data1.pass,data1.fail,data1.skip);
+ // if(percentage > 80)
+ // data1["percentageClassName"] ="passrate_col";
+ // else if(percentage > 50 && percentage < 80)
+ // data1["percentageClassName"] ="mediumrate_col";
+ // else
+ // data1["percentageClassName"] ="failrate_col";
+ data1["multiprogressbarid"] = "id" + (multiprogressbar++);
$.tmpl(testOverviewTemplate,data1).appendTo("#tests");
+ calcProgressBar(percentagePass,percentageFail, percentageSkip,data1["multiprogressbarid"]);
});
});
-
+
if (length > 2) {
setTimeout(function() {
$('#result_' + split[2]).click()
@@ -543,27 +628,54 @@ function loadAllMethods(dir) {
}
function drawPIChart(report) {
- var data = [ [ 'Fail', report.fail ], [ 'Pass', report.pass ],
- [ 'Skip', report.skip ] ];
+ var data = [ [ 'Passed', report.pass ], [ 'Failed', report.fail],
+ [ 'Skipped', report.skip ] ];
+ var pass = report.pass / (report.pass + report.fail + report.skip) * 100,
+ fail = report.fail / (report.pass + report.fail + report.skip) * 100
+ skip = report.skip / (report.pass + report.fail + report.skip) * 100;
+ var tl_labels = [
+ ["Passed
" + pass.toFixed(2) + "%"],
+ ["Failed
" + fail.toFixed(2) + "%"],
+ ["Skipped
" + skip.toFixed(2) + "%"]
+ ];
jQuery.jqplot("pichart", [ data ], {
+ title: '
View All Results',
+ gridPadding: {top:5, bottom:0, left:0, right:0},
seriesDefaults : {
// Make this a pie chart.
- renderer : jQuery.jqplot.PieRenderer,
+ renderer : jQuery.jqplot.DonutRenderer,
rendererOptions : {
- seriesColors : [ '#e63c20', '#23a347', '#f3b600' ],
+ seriesColors : [ '#4dbd74', '#e63c20' , '#ffd800' ],
+ startAngle: -90,
// RED GREEN YELLOW
// Put data labels on the pie slices.
// By default, labels show the percentage of the
// slice.
- showDataLabels : true
+ showDataLabels : false,
+ dataLabels: tl_labels,
+ totalLabel: true,
+ edgeTolerance: -100
}
},
legend : {
- show : false,
- location : 'e'
- }
+ show : true,
+ location : 'e',
+ background: '#ffffff',
+ position: 'relative',
+ border: 'none',
+ labels: tl_labels,
+ },
+ grid: {borderColor: 'white', shadow: false, drawBorder: true,background:'transparent'},
+
});
+ $("td.jqplot-table-legend:nth-child(2)","#pichart").width(115);
+ $(".jqplot-title")
+ .css({
+ cursor: "pointer",
+ zIndex: "1"
+ })
+ .click(function(){ loadListAll(); });
}
function loadMethods(cresultRoot, testDir) {
@@ -1160,7 +1272,6 @@ function populateErrorBucket() {
// Make this a pie chart.
renderer : $.jqplot.DonutRenderer,
rendererOptions : {
- sliceMargin : 1,
startAngle : -90,
seriesColors : scolors,
// Put data labels on the pie slices.
@@ -1575,6 +1686,24 @@ function calcPassRate(pass, fail, skip) {
return Math.round(pass / (pass + fail + skip) * 100);
}
+function calcFailRate(pass, fail, skip) {
+ return Math.round(fail / (pass + fail + skip) * 100);
+}
+
+function calcSkipRate(pass, fail, skip) {
+ return Math.round(skip / (pass + fail + skip) * 100);
+}
+
+function calcProgressBar(pass, fail, skip, id) {
+ var rowId = '#' + id;
+ $(rowId).multiprogressbar({
+ parts: [
+ {value: pass,barClass: "progressPass",text : true},
+ {value: skip,barClass: "progressSkip", text : true},
+ {value: fail,barClass: "progressFail", text :true}]
+ });
+}
+
String.prototype.capitalizeFirstLetter = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
};