forked from sathishbob/functional-testing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
36 lines (35 loc) · 1.54 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
pipeline {
agent any
tools {
maven "MVN3"
}
stages {
stage('pullscm') {
steps {
git branch: 'main', credentialsId: 'github', url: '[email protected]:sathishbob/functional-testing.git'
}
}
stage('execute test') {
steps {
sh "mvn clean test"
}
post {
success {
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'TestReport', reportFiles: 'TestReport.html', reportName: 'FunctionalTestReport', reportTitles: '', useWrapperFileDirectly: true])
}
}
}
stage('get result') {
environment {
PASS = sh(script: 'cat TestReport/TestReport.html | grep passParent | cut -d \':\' -f2 | cut -d \',\' -f1',returnStdout: true)
FAIL = sh(script: 'cat TestReport/TestReport.html | grep failParent | cut -d \':\' -f2 | cut -d \',\' -f1',returnStdout: true)
}
steps {
echo "Total test case passed is: ${PASS}"
echo "Total test case failled is: ${FAIL}"
slackSend channel: 'notification', message: "Test job completed- passed cases:${PASS} - Failled cases:${FAIL}", tokenCredentialId: 'slack'
emailext body: "Please check console output at $BUILD_URL for more information\n Passed Test case count is: ${PASS} \n Failled Test case count is: ${FAIL} \n", to: "[email protected]", subject: 'JenkinsTraining - $PROJECT_NAME is changed- Build number is $BUILD_NUMBER - Build status is $BUILD_STATUS'
}
}
}
}