forked from znsio/teswiz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.sample
103 lines (86 loc) · 3.01 KB
/
build.gradle.sample
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
import java.text.SimpleDateFormat
buildscript {
ext {
gradleVersion = '8.3'
teswizVersion = '0.0.90'
}
repositories {
mavenLocal()
}
}
plugins {
id "java"
id "idea"
id "maven-publish"
}
version '0.0.1'
project.ext.log4jProperties = "src/test/resources/log4j2.properties"
repositories {
mavenLocal()
maven { url 'https://jitpack.io' }
}
configurations {
cucumberRuntime {
extendsFrom testImplementation
}
}
compileJava { options.encoding = "UTF-8" }
dependencies {
implementation("com.github.znsio:teswiz:${project.teswizVersion}") {
transitive = false
}
}
static def getCurrentDatestamp() {
Date today = new Date()
SimpleDateFormat df = new SimpleDateFormat("MM-dd-yyyy")
return df.format(today)
}
static def getCurrentTimestamp() {
Date today = new Date()
SimpleDateFormat df = new SimpleDateFormat("HH-mm-ss")
return df.format(today)
}
tasks.register('run', JavaExec) {
doFirst {
def logDirectory = "target/" + getCurrentDatestamp() + "/" + getCurrentTimestamp()
println "Using LOG_DIR: $logDirectory"
System.setProperty "LOG_DIR", "$logDirectory"
environment "APPLITOOLS_LOG_DIR", "$logDirectory/applitools_logs"
def isRunInCI = Boolean.parseBoolean(System.getenv("RUN_IN_CI"))
println "isRunningInCI: $isRunInCI"
def configFile = System.getenv("CONFIG")
if(null == configFile || !file(configFile).exists()) {
println("CONFIG file not provided, or does not exist")
println("Run the test by providing the CONFIG file not provided, or does not exist")
assert file(configFile).exists()
}
// You can also specify which config file to use based on the value of RUN_IN_CI as shown below
//
// def isRunInCI = Boolean.parseBoolean(System.getenv("RUN_IN_CI"))
// println "isRunningInCI: $isRunInCI"
// def configFile = isRunInCI
// ? "./configs/theapp/theapp_pcloudy_config.properties"
// : "./configs/theapp/theapp_local_config.properties"
// configFile = System.getenv("CONFIG") ? System.getenv("CONFIG") : configFile
systemProperties = System.properties as Map<String, ?>
def runnerArgs = [
"${configFile}",
"<pathToStepDef>",
"<pathToFeaturesDir>"
]
args = runnerArgs
println("Debug mode: " + System.getProperty('debug', 'false'))
// attach debugger
// example: ./gradlew run -Ddebug=true
if (System.getProperty('debug', 'false') == 'true') {
println("In debug mode")
jvmArgs '-Xdebug', '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,' +
'address=*:5005'
}
}
mainClass = "com.znsio.teswiz.runner.Runner"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
}
wrapper {
gradleVersion = project.gradleVersion // version from gradle.properties
}