forked from h2oai/h2o-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
155 lines (139 loc) · 5.68 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
apply plugin: 'java'
//apply plugin: 'groovy'
description = "Unified Test Framework"
repositories {
mavenCentral()
}
dependencies {
testCompile 'junit:junit:[4.8,)'
testCompile 'org.testng:testng:[6.5.1,)'
testCompile "org.uncommons:reportng:1.1.4"
testCompile "com.google.inject:guice:3.0"
testRuntime ("org.easyb:easyb-core:1.4") { transitive = true }
}
task acceptanceStories << {
ant.taskdef(name: "easyb", classname:"org.easyb.ant.BehaviorRunnerTask", classpath: sourceSets.test.runtimeClasspath.asPath)
def reports = "${project.buildDir}/reports"
new File("${reports}/easyb").mkdirs()
ant.easyb( classpath: sourceSets.test.runtimeClasspath.asPath, failureProperty:'easyb_failed' ) {
report( location:"${reports}/easyb/index.html", format:"html" )
behaviors( dir: "../src/test/easyb" ) {
include( name:"**/*.story" )
}
behaviors( dir: "src/test/easyb" ) {
include( name:"**/*.story" )
}
}
ant.fail( if:'easyb_failed', message: 'Failures in easyb stories' )
}
task acceptanceTests(type: Test) {
useTestNG(){
//excludeGroups = ['functional'] as Set
includeGroups = ['acceptance'] as Set
//parallel = 'method'
//threadCount = 4
useDefaultListeners = true
}
options{
// listeners << 'org.uncommons.reportng.HTMLReporter'
listeners << 'org.uncommons.reportng.JUnitXMLReporter'
listeners << 'org.testng.reporters.EmailableReporter'
}
//set different folders for reports on integration tests ...
reports.junitXml.destination = file("${buildDir}/test-results/testng")
reports.html.destination = file("${reporting.baseDir}/testng")
// Add System property to running tests.
systemProperty 'sysProp', 'value'
// Use the following JVM arguments for each test process.
//jvmArgs '-Xms256m', '-Xmx512m'
// Enable debugging mode.
debug = false // a value of true will start waiting for -Xrunjdwp
// Ignore any test failues and don't fail the build.
ignoreFailures = true
// Enable assertions for test with the assert keyword.
enableAssertions = true
//forkEvery = 10
//maxParallelForks = 4
// Disable automatic inspections.
scanForTestClasses = false
// Include test classes.
include '**/*Test.class', '**/*Spec.class'
// Exclude test classes.
exclude '**/Abstract*.class', '**/Run*.class'
//test.testReportDir = file("$buildDir/test-reports")
//test.testResultsDir = file("$buildDir/test-results")
//test.testReport = false
}
task acceptancePython << {
def group = "acceptance"
def rootFolder = project.getRootDir()
def testResults = [rootFolder, "build/test-results/python/test_results.xml"].join(File.separator)
def htmlReports = [rootFolder, "build/reports/python/index.html"].join(File.separator)
new File(testResults).getParentFile().mkdirs()
new File(htmlReports).getParentFile().mkdirs()
assert new File(testResults).getParentFile().exists()
assert new File(htmlReports).getParentFile().exists()
FileTree tree = fileTree("../src/test/python"){
include '**/*.py'
}
def results = [:]
tree.visit{element->
exec {
executable "python"
workingDir rootFolder
def name = element.file.name
testResults = [rootFolder, "build/test-results/python/results_" + name.split("\\.")[0] + ".xml"].join(File.separator)
htmlReports = [rootFolder, "build/reports/python/index_" + name.split("\\.")[0] + ".html"].join(File.separator)
args "$element.file", "--group=${group}", '--with-xunit', "--xunit-file=${testResults}",
"--with-html", "--html-file=${htmlReports}"
}
if ( new File(testResults).exists()){
def xmlContent = new XmlSlurper().parseText(new File(testResults).getText())
if ( Integer.parseInt(xmlContent.attributes()['tests']) > 0 ){
results.put(element.file.name,
[
path: element.file.path,
resultsHtml: htmlReports,
resultsXml: testResults,
tests: xmlContent.attributes()['tests'],
errors: xmlContent.attributes()['errors'],
failures: xmlContent.attributes()['failures'],
skipped: xmlContent.attributes()['skip']
]
)
}
}
}
new File("build/reports/site").mkdirs()
def links = ""
def details = ""
def q = { "\"" + it + "\""}
results.each{k,v->
def href = q(v['resultsHtml'])
def title= q(k)
links += "<a href=${href} title=${title}>$k</a>\n"
details +=
"<pre>" +
"<b>${k}<b/><br />Tests: ${v['tests']}<br />" +
"Failures: ${v['failures']}<br />" +
"Errors: ${v['errors']}<br />" +
"Skipped: ${v['skipped']}" +
"</pre>\n"
}
//ant copy seems to choke on token substitution if binary files are included. need to go in two passes
ant.copy(toDir: "build/reports/site", filtering: true, force: true, overwrite: true){
fileset(dir: "src/test/resources/site"){
include(name: "**/*.html")
}
filterset(){
filter(token: "test_links", value: links)
filter(token: "test_results_details", value: details)
}
}
ant.copy(toDir: "build/reports/site", filtering: true, force: true, overwrite: true){
fileset(dir: "src/test/resources/site"){
include(name: "**/*.*")
exclude(name: "**/*.html")
}
}
}