forked from iriusrisk/bdd-security
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
135 lines (115 loc) · 4.5 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
import net.masterthought.cucumber.ReportBuilder
apply plugin: 'groovy'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'maven'
def cucumberVersion = "1.2.4"
defaultTasks 'test'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.codehaus.gpars:gpars:1.2.1",
"net.masterthought:cucumber-reporting:1.4.0"
}
}
allprojects {
apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
repositories {
mavenCentral()
}
configurations {
cucumberRuntime {
extendsFrom testRuntime
}
}
task cleanReports() {
File reportOutputDirectory = new File("build/reports/cucumber")
reportOutputDirectory.deleteDir()
}
task cucumber() {
dependsOn clean, cleanReports, assemble, compileTestJava
doLast {
javaexec {
main = "cucumber.api.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['--plugin', 'pretty', '--glue', 'net.continuumsecurity.steps', 'src/test/resources/features']
}
generateReport()
}
}
task generateReportTask() {
doLast {
generateReport()
}
}
task buildIt() {
dependsOn assemble, compileTestJava, cleanReports
}
test {
testLogging {
exceptionFormat = 'full'
}
systemProperties = System.properties
dependsOn assemble, compileTestJava, cleanReports
finalizedBy(generateReportTask)
}
//Ensure the cucumber tests are executed as part of the build. Makes for a very pretty output.
build.dependsOn cucumber
def generateReport() {
File reportOutputDirectory = new File("build/reports/cucumber/pretty")
reportOutputDirectory.deleteDir()
def jsonReports = fileTree(dir: "${reporting.baseDir}/cucumber").include '**/*.json'.toString()
List<String> jsonReportFiles = new ArrayList<String>()
jsonReports.each { File file ->
jsonReportFiles.add("${reporting.baseDir}/cucumber/${file.name}".toString());
}
String projectName = "BDD-Security";
boolean skippedFails = false;
boolean pendingFails = false;
boolean undefinedFails = true;
boolean missingFails = true;
boolean runWithJenkins = false;
boolean parallelTesting = false;
net.masterthought.cucumber.Configuration configuration = new net.masterthought.cucumber.Configuration(reportOutputDirectory, projectName);
// optionally only if you need
configuration.setStatusFlags(skippedFails, pendingFails, undefinedFails, missingFails);
configuration.setParallelTesting(parallelTesting);
configuration.setRunWithJenkins(runWithJenkins);
configuration.setBuildNumber("SecTests.1");
ReportBuilder reportBuilder = new ReportBuilder(jsonReportFiles, configuration);
reportBuilder.generateReports();
println("\nReport available on: "+reportOutputDirectory.getCanonicalPath()+"/feature-overview.html")
}
dependencies {
compile group: 'net.masterthought', name: 'cucumber-reporting', version: "1.4.0"
testCompile 'junit:junit:4.11'
testCompile "info.cukes:cucumber-junit:$cucumberVersion"
testCompile "info.cukes:cucumber-java:$cucumberVersion"
testCompile "info.cukes:cucumber-picocontainer:$cucumberVersion"
testCompile 'org.glassfish.jersey.core:jersey-client:2.25.1'
testCompile 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.8.7'
testCompile 'org.glassfish.jersey.media:jersey-media-moxy:2.25.1'
testCompile 'junit:junit-dep:4.11'
testCompile 'org.hamcrest:hamcrest-all:1.3'
testCompile ('org.seleniumhq.selenium:selenium-java:3.5.3') { exclude group: 'junit' }
testCompile 'org.seleniumhq.selenium:selenium-api:3.5.3'
testCompile 'log4j:log4j:1.2.17'
testCompile 'args4j:args4j:2.0.16'
testCompile 'commons-configuration:commons-configuration:1.8'
testCompile 'uk.com.robust-it:cloning:1.9.0'
testCompile 'jline:jline:2.6'
testCompile 'com.googlecode.java-diff-utils:diffutils:1.2.1'
testCompile 'org.codehaus.jackson:jackson-mapper-asl:1.9.12'
testCompile 'commons-jxpath:commons-jxpath:1.3'
testCompile 'org.glassfish.jersey.core:jersey-client:2.25.1'
testCompile 'org.glassfish.jersey.connectors:jersey-apache-connector:2.25.1'
testCompile 'net.htmlparser.jericho:jericho-html:3.3'
testCompile 'edu.umass.cs.benchlab:harlib:1.1.2'
testCompile group: 'org.zaproxy', name: 'zap-clientapi', version: '1.2.0'
testCompile files ("lib/zap-java-api-2.6.0.jar", "lib/nessus-java-client-0.2-SNAPSHOT.jar","lib/jssylze-0.2-SNAPSHOT.jar")
}