-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
96 lines (80 loc) · 2.35 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
import java.text.SimpleDateFormat
import java.util.Date
apply plugin: 'java'
sourceCompatibility = 1.7
targetCompatibility = 1.7
def getCurrentTimestamp ()
{
Date today = new Date ()
SimpleDateFormat df = new SimpleDateFormat ("dd_MMM_yyyy_hh_mm_aa")
return df.format (today)
}
ext{
//set true to enable to compile using aspectj
compileUsingAspect = false
testResultsDir = 'test-results'
runTime = getCurrentTimestamp()
resultOutputDir = String.valueOf(testResultsDir)+'/'+runTime
// set suiteFile, default is 'config/testrun_config.xml'
if (!project.hasProperty('suiteFile')) {
suiteFile = 'config/testrun_config.xml'
}
}
//Add repository here
repositories {
jcenter()
maven {
url "https://qmetry.github.io/qaf/dist/"
}
}
//Add dependencies here
dependencies {
compile 'com.qmetry:qaf:2.1.10'
compile 'com.qmetry:qaf-support:2.1.10'
}
//for compilation using aspectj
if(compileUsingAspect){
compileTestJava.deleteAllActions()
compileTestJava << {
ant.taskdef(
resource: 'org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties',
classpath: configurations.testCompile.asPath )
ant.iajc(
source: sourceCompatibility,
target: targetCompatibility,
destDir: sourceSets.test.output.classesDir.absolutePath,
fork: 'true',
sourceRootCopyFilter: '**/*.java,**/*.aj',
aspectpath: configurations.testCompile.asPath )
{
sourceroots {
sourceSets.test.java.srcDirs.each {
dir -> pathelement(location: dir.absolutePath)
}
}
}
}
}
//run test
test{
useTestNG(){
useDefaultListeners = true
outputDirectory file(resultOutputDir)
suites suiteFile
//System properties for report
systemProperty 'org.uncommons.reportng.xml-dialect','testng'
systemProperty 'org.uncommons.reportng.escape-output',false
systemProperty 'log4j.configuration','file:///'+projectDir+'/resources/log4j.properties'
systemProperty 'json.report.root.dir',testResultsDir
systemProperty 'outputDir',resultOutputDir
systemProperty 'test.results.dir',resultOutputDir+'/html'
systemProperty 'json.report.dir',resultOutputDir+'/json'
systemProperty 'selenium.screenshots.dir',resultOutputDir+'/img'
systemProperty 'selenium.screenshots.relative.path','../img'
systemProperties System.properties
}
testLogging{
showStandardStreams = true
exceptionFormat = 'full'
}
}