-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
57 lines (52 loc) · 1.71 KB
/
Jenkinsfile
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
node() {
def repoURL = 'https://github.com/aalidrissi/cucumber.git'
stage("Prepare Workspace") {
cleanWs()
env.WORKSPACE_LOCAL = sh(returnStdout: true, script: 'pwd').trim()
env.BUILD_TIME = sh(returnStdout: true, script: 'date +%F-%T').trim()
echo "Workspace set to:" + env.WORKSPACE_LOCAL
echo "Build time:" + env.BUILD_TIME
}
stage('Checkout Self') {
git branch: 'main', credentialsId: '', url: repoURL
}
stage('Cucumber Tests') {
withMaven(maven: 'maven35') {
sh """
cd ${env.WORKSPACE_LOCAL}
mvn clean test
"""
}
}
stage('Expose report') {
archive "**/cucumber.json"
cucumber '**/cucumber.json'
}
stage('Import results to Xray') {
def description = "[BUILD_URL|${env.BUILD_URL}]"
def labels = '["regression","automated_regression"]'
def environment = "DEV"
def testExecutionFieldId = 9
def testEnvironmentFieldName = "customfield_11805"
def projectKey = "HLXRAYT"
def xrayConnectorId = '8f3294e8-12e1-4c92-a6cb-85e8b3081a29'
def info = '''{
"fields": {
"project": {
"key": "''' + projectKey + '''"
},
"labels":''' + labels + ''',
"description":"''' + description + '''",
"summary": "Automated Regression Execution @ ''' + env.BUILD_TIME + ' ' + environment + ''' " ,
"issuetype": {
"id": "''' + testExecutionFieldId + '''"
},
"''' + testEnvironmentFieldName + '''" : [
"''' + environment + '''"
]
}
}'''
echo info
step([$class: 'XrayImportBuilder', endpointName: '/cucumber/multipart', importFilePath: 'target/cucumber.json', importInfo: info, inputInfoSwitcher: 'fileContent', serverInstance: xrayConnectorId])
}
}