-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
83 lines (70 loc) · 2.86 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
plugins {
id 'java'
id "com.github.spacialcircumstances.gradle-cucumber-reporting" version "0.1.25"
// id("org.sonarqube") version "4.0.0.2929"
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(15)
}
}
//sonarqube {
// properties {
// property("sonar.projectKey", "myProjectKey")
// property("sonar.organization", "myOrganization")
// property("sonar.host.url", "https://sonarcloud.io")
// }
//
//}
ext {
cucumberVersion = '7.11.2'
junitbomVersion = '5.9.2'
seleniumJavaVersion = '4.24.0'
junitvintageengineVersion = '5.7.2'
hamcrestVersion = '2.2'
webdrivermanagerVersion = '5.8.0'
restassuredVersion = '5.3.0'
jsonpathVersion = '2.7.0'
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
testImplementation(platform("org.junit:junit-bom:$junitbomVersion"))
testImplementation(platform("io.cucumber:cucumber-bom:$cucumberVersion"))
testImplementation "io.cucumber:cucumber-java:$cucumberVersion"
testImplementation "io.cucumber:cucumber-junit:$cucumberVersion"
testImplementation "org.junit.vintage:junit-vintage-engine:$junitvintageengineVersion"
testImplementation "org.hamcrest:hamcrest:$hamcrestVersion"
testImplementation "io.github.bonigarcia:webdrivermanager:$webdrivermanagerVersion"
implementation "org.seleniumhq.selenium:selenium-java:$seleniumJavaVersion" // stable version is 3.141.59
implementation "io.rest-assured:rest-assured:$restassuredVersion"
implementation "com.jayway.jsonpath:json-path:$jsonpathVersion"
}
clean.doFirst {
delete "$projectDir/target/cucumber-reports", "$projectDir/target/cucumber-html-reports", "$projectDir/out"
}
cucumberReports {
outputDir = file("$projectDir/target/")
buildId = '0'
reports = files("$projectDir/target/cucumber-reports/Cucumber_report.json") // report is generated by this location
}
//please use only 1 approach below and comment the unused
//approach_1: set override the os and driver
//tasks.withType(Test).configureEach {
// systemProperties = [
// defaultos : System.getProperty('defaultos', 'mac'),
// defaultbrowserdriver: System.getProperty('defaultbrowserdriver', 'firefox')
// ]
//}
//approach_2: read from gradle.properties
tasks.register('demoTest', Test) {
systemProperties project.properties.subMap(["defaultos", "defaultbrowserdriver"])
systemProperty "cucumber.filter.tags", System.getProperty("cucumber.filter.tags")
// systemProperty "cucumber.options", System.getProperty("cucumber.options") // use for version lower than 6.x
}
//run with gradle cli: open terminal
// gradle demoTest -Pdefaultos=mac -Pdefaultbrowserdriver=firefox -Dcucumber.filter.tags="@ui"
// gradle demoTest -Dcucumber.filter.tags="@api"
// gradle demoTest -Dcucumber.filter.tags="@api or @ui" // run all test either with tag is @api or @ui