Skip to content

Commit 34c9001

Browse files
committedMar 13, 2018
v1.0.1
1 parent b02c11e commit 34c9001

File tree

18 files changed

+345
-46
lines changed

18 files changed

+345
-46
lines changed
 

‎README.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Maven dependencies for Report Builder:
1717
<dependency>
1818
<groupId>com.rajatthareja</groupId>
1919
<artifactId>reportbuilder</artifactId>
20-
<version>1.0.0</version>
20+
<version>1.0.1</version>
2121
</dependency>
2222

2323
```
@@ -27,6 +27,7 @@ Maven dependencies for Report Builder:
2727
```java
2828

2929
import com.rajatthareja.reportbuilder.ReportBuilder;
30+
import com.rajatthareja.reportbuilder.Color;
3031
import org.json.JSONObject;
3132

3233
import java.io.File;
@@ -49,6 +50,9 @@ class MyClass {
4950
// Set Report Title
5051
reportBuilder.setReportTitle("My Test Report");
5152

53+
// Set Report Color for more visit http://materializecss.com/color.html
54+
reportBuilder.setReportColor(Color.PURPLE);
55+
5256
// Add additional info for Report
5357
reportBuilder.setAdditionalInfo("Environment", "My Environment");
5458

@@ -68,7 +72,7 @@ class MyClass {
6872

6973
**Note:** Java 8 is required.
7074

71-
[View Java Docs](https://oss.sonatype.org/service/local/repositories/releases/archive/com/rajatthareja/reportbuilder/1.0.0/reportbuilder-1.0.0-javadoc.jar/!/index.html) for more details.
75+
[View Java Docs](https://oss.sonatype.org/service/local/repositories/releases/archive/com/rajatthareja/reportbuilder/1.0.1/reportbuilder-1.0.1-javadoc.jar/!/index.html) for more details.
7276

7377
## Report Builder for Ruby
7478

‎css/report.builder.css

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
body {
2+
display: flex;
3+
min-height: 100vh;
4+
flex-direction: column;
5+
}
6+
main {
7+
flex: 1 0 auto;
8+
}
9+
.uppercase {
10+
text-transform: uppercase;
11+
}
12+
i {
13+
vertical-align: middle;
14+
}
15+
.rotate-45 {
16+
-webkit-transform: rotate(-45deg);
17+
-moz-transform: rotate(-45deg);
18+
-ms-transform: rotate(-45deg);
19+
-o-transform: rotate(-45deg);
20+
transform: rotate(-45deg);
21+
}

‎css/report.builder.min.css

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎js/report.builder.js

+216
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
$(document).ready(function () {
2+
$(".passed").addClass("teal lighten-2");
3+
$(".failed").addClass("red lighten-2");
4+
$(".skipped").addClass("amber lighten-2");
5+
$(".undefined").addClass("amber lighten-2");
6+
$(".pending").addClass("amber lighten-2");
7+
8+
var passed = $(".scenario.passed");
9+
var failed = $(".scenario.failed");
10+
var skipped = $(".scenario.skipped");
11+
var undefined = $(".scenario.undefined");
12+
var pending = $(".scenario.pending");
13+
var scenarios = $(".scenario");
14+
15+
var working = $(".feature.working");
16+
var broken = $(".feature.broken");
17+
var incomplete = $(".feature.incomplete");
18+
var features = $(".feature");
19+
20+
passed.prepend("<i class=\"material-icons\">done_all</i>");
21+
failed.prepend("<i class=\"material-icons\">highlight_off</i>");
22+
skipped.prepend("<i class=\"material-icons\">error_outline</i>");
23+
undefined.prepend("<i class=\"material-icons\">error_outline</i>");
24+
pending.prepend("<i class=\"material-icons\">error_outline</i>");
25+
26+
features.each(function () {
27+
var $this = $(this);
28+
var pCount = $this.find(".scenario.passed").length;
29+
var fCount = $this.find(".scenario.failed").length;
30+
var sCount = $this.find(".scenario.skipped").length;
31+
var uCount = $this.find(".scenario.undefined").length;
32+
var ppCount = $this.find(".scenario.pending").length;
33+
if (pCount > 0) {
34+
$this.find(".collapsible-header").append("<span class=\"new badge teal lighten-2\" data-badge-caption=\"Passed\">" + pCount + "</span>");
35+
}
36+
if (fCount > 0) {
37+
$this.find(".collapsible-header").append("<span class=\"new badge red lighten-2\" data-badge-caption=\"Failed\">" + fCount + "</span>");
38+
}
39+
if (sCount > 0) {
40+
$this.find(".collapsible-header").append("<span class=\"new badge amber lighten-2\" data-badge-caption=\"Skipped\">" + sCount + "</span>");
41+
}
42+
if (uCount > 0) {
43+
$this.find(".collapsible-header").append("<span class=\"new badge amber lighten-2\" data-badge-caption=\"Undefined\">" + uCount + "</span>");
44+
}
45+
if (ppCount > 0) {
46+
$this.find(".collapsible-header").append("<span class=\"new badge amber lighten-2\" data-badge-caption=\"Pending\">" + ppCount + "</span>");
47+
}
48+
});
49+
50+
$(".errorList .error").each(function () {
51+
var $this = $(this);
52+
var eCount = $this.find(".failedScenarioList .failedScenario").length;
53+
if (eCount > 0) {
54+
$this.find(".collapsible-header").append("<span class=\"new badge blue lighten-2\" data-badge-caption=\"Scenarios\">" + eCount + "</span>");
55+
} else {
56+
$this.remove();
57+
}
58+
});
59+
60+
$(".tabs .tab").click(function () {
61+
$(".tabs a").removeClass("blue-text").addClass("white-text");
62+
$(this).find('a').removeClass("white-text").addClass("blue-text");
63+
});
64+
65+
var passedCount = passed.length;
66+
var failedCount = failed.length;
67+
var skippedCount = skipped.length;
68+
var undefinedCount = undefined.length;
69+
var pendingCount = pending.length;
70+
var scenariosCount = scenarios.length;
71+
72+
var workingCount = working.length;
73+
var brokenCount = broken.length;
74+
var incompleteCount = incomplete.length;
75+
var featuresCount = features.length;
76+
77+
var metaTableFeatures = $("table#metaDataFeatures tbody");
78+
var metaTableScenarios = $("table#metaDataScenarios tbody");
79+
80+
metaTableFeatures.append("<tr><th>Total Features</th><td>" + featuresCount + "</td></tr>");
81+
metaTableScenarios.append("<tr><th>Total Scenarios</th><td>" + scenariosCount + "</td></tr>");
82+
83+
var featuresDoughnut = document.getElementById("featuresDoughnut").getContext('2d');
84+
var featuresDoughnutCountData = [];
85+
var featuresDoughnutLabels = [];
86+
var featuresDoughnutBackgroundColor = [];
87+
var featuresDoughnutBorderColor = [];
88+
if (workingCount > 0) {
89+
metaTableFeatures.append("<tr><th>Working</th><td>" + ((workingCount / featuresCount) * 100).toFixed(1) + " %</td></tr>");
90+
featuresDoughnutCountData.push(workingCount);
91+
featuresDoughnutLabels.push("Working");
92+
featuresDoughnutBackgroundColor.push('rgba(75, 192, 192, 0.2)');
93+
featuresDoughnutBorderColor.push('rgba(75, 192, 192, 1)');
94+
}
95+
if (brokenCount > 0) {
96+
metaTableFeatures.append("<tr><th>Broken</th><td>" + ((brokenCount / featuresCount) * 100).toFixed(1) + " %</td></tr>");
97+
featuresDoughnutCountData.push(brokenCount);
98+
featuresDoughnutLabels.push("Broken");
99+
featuresDoughnutBackgroundColor.push('rgba(255, 99, 132, 0.2)');
100+
featuresDoughnutBorderColor.push('rgba(255, 99, 132, 1)');
101+
}
102+
if (incompleteCount > 0) {
103+
metaTableFeatures.append("<tr><th>Incomplete</th><td>" + ((incompleteCount / featuresCount) * 100).toFixed(1) + " %</td></tr>");
104+
featuresDoughnutCountData.push(incompleteCount);
105+
featuresDoughnutLabels.push("Incomplete");
106+
featuresDoughnutBackgroundColor.push('rgba(255, 206, 86, 0.2)');
107+
featuresDoughnutBorderColor.push('rgba(255, 206, 86, 1)');
108+
}
109+
var featuresDoughnutData = {
110+
labels: featuresDoughnutLabels,
111+
datasets: [
112+
{
113+
label: '# of Votes',
114+
data: featuresDoughnutCountData,
115+
backgroundColor: featuresDoughnutBackgroundColor,
116+
borderColor: featuresDoughnutBorderColor,
117+
borderWidth: 1
118+
}
119+
]
120+
};
121+
var featuresDoughnutOptions = {
122+
title: {
123+
display: true,
124+
text: 'Features'
125+
}
126+
};
127+
var featuresDoughnutChart = new Chart(featuresDoughnut, {
128+
type: 'doughnut',
129+
data: featuresDoughnutData,
130+
options: featuresDoughnutOptions
131+
});
132+
133+
if (featuresDoughnutCountData.length > 0) {
134+
featuresDoughnutChart.draw();
135+
}
136+
137+
var scenariosDoughnut = document.getElementById("scenariosDoughnut").getContext('2d');
138+
var scenariosDoughnutCountData = [];
139+
var scenariosDoughnutLabels = [];
140+
var scenariosDoughnutBackgroundColor = [];
141+
var scenariosDoughnutBorderColor = [];
142+
if (passedCount > 0) {
143+
metaTableScenarios.append("<tr><th>Passed</th><td>" + ((passedCount / scenariosCount) * 100).toFixed(1) + " %</td></tr>");
144+
scenariosDoughnutCountData.push(passedCount);
145+
scenariosDoughnutLabels.push("Passed");
146+
scenariosDoughnutBackgroundColor.push('rgba(75, 192, 192, 0.2)');
147+
scenariosDoughnutBorderColor.push('rgba(75, 192, 192, 1)');
148+
}
149+
if (failedCount > 0) {
150+
metaTableScenarios.append("<tr><th>Failed</th><td>" + ((failedCount / scenariosCount) * 100).toFixed(1) + " %</td></tr>");
151+
scenariosDoughnutCountData.push(failedCount);
152+
scenariosDoughnutLabels.push("Failed");
153+
scenariosDoughnutBackgroundColor.push('rgba(255, 99, 132, 0.2)');
154+
scenariosDoughnutBorderColor.push('rgba(255,99,132,1)');
155+
}
156+
if (skippedCount > 0) {
157+
metaTableScenarios.append("<tr><th>Skipped</th><td>" + ((skippedCount / scenariosCount) * 100).toFixed(1) + " %</td></tr>");
158+
scenariosDoughnutCountData.push(skippedCount);
159+
scenariosDoughnutLabels.push("Skipped");
160+
scenariosDoughnutBackgroundColor.push('rgba(255, 206, 86, 0.2)');
161+
scenariosDoughnutBorderColor.push('rgba(255, 206, 86, 1)');
162+
}
163+
if (undefinedCount > 0) {
164+
metaTableScenarios.append("<tr><th>Undefined</th><td>" + ((undefinedCount / scenariosCount) * 100).toFixed(1) + " %</td></tr>");
165+
scenariosDoughnutCountData.push(undefinedCount);
166+
scenariosDoughnutLabels.push("Undefined");
167+
scenariosDoughnutBackgroundColor.push('rgba(255, 206, 86, 0.2)');
168+
scenariosDoughnutBorderColor.push('rgba(255, 206, 86, 1)');
169+
}
170+
if (pendingCount > 0) {
171+
metaTableScenarios.append("<tr><th>Pending</th><td>" + ((pendingCount / scenariosCount) * 100).toFixed(1) + " %</td></tr>");
172+
scenariosDoughnutCountData.push(pendingCount);
173+
scenariosDoughnutLabels.push("Pending");
174+
scenariosDoughnutBackgroundColor.push('rgba(255, 206, 86, 0.2)');
175+
scenariosDoughnutBorderColor.push('rgba(255, 206, 86, 1)');
176+
}
177+
var scenariosDoughnutData = {
178+
labels: scenariosDoughnutLabels,
179+
datasets: [
180+
{
181+
label: '# of Votes',
182+
data: scenariosDoughnutCountData,
183+
backgroundColor: scenariosDoughnutBackgroundColor,
184+
borderColor: scenariosDoughnutBorderColor,
185+
borderWidth: 1
186+
}
187+
]
188+
};
189+
var scenariosDoughnutOptions = {
190+
title: {
191+
display: true,
192+
text: 'Scenarios'
193+
}
194+
};
195+
var scenariosDoughnutChart = new Chart(scenariosDoughnut, {
196+
type: 'doughnut',
197+
data: scenariosDoughnutData,
198+
options: scenariosDoughnutOptions
199+
});
200+
201+
if (scenariosDoughnutCountData.length > 0) {
202+
scenariosDoughnutChart.draw();
203+
}
204+
205+
$.when($('#summaryTable').DataTable({
206+
"language": {
207+
"search": "<i class=\"material-icons\">search</i> Search",
208+
"searchPlaceholder": "Search",
209+
"lengthMenu": "Show _MENU_",
210+
"info": "Showing _START_ to _END_ of _TOTAL_ scenarios",
211+
"infoFiltered": "filtered from _MAX_ total scenarios"
212+
}
213+
})).done(function () {
214+
$('select').material_select();
215+
});
216+
});

‎js/report.builder.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.rajatthareja</groupId>
88
<artifactId>reportbuilder</artifactId>
9-
<version>1.0.0</version>
9+
<version>1.0.1</version>
1010

1111
<name>Report Builder</name>
1212
<description>Merge Cucumber JSON reports and build HTML Test Report</description>

0 commit comments

Comments
 (0)
Failed to load comments.