-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathJenkinsfile
More file actions
91 lines (87 loc) · 2.58 KB
/
Jenkinsfile
File metadata and controls
91 lines (87 loc) · 2.58 KB
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
import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
node {
try {
properties([
parameters([
credentials(credentialType: 'com.browserstack.automate.ci.jenkins.BrowserStackCredentials', defaultValue: '', description: 'Select your BrowserStack Username', name: 'BROWSERSTACK_USERNAME', required: true),
[$class: 'ExtensibleChoiceParameterDefinition',
choiceListProvider: [
$class: 'TextareaChoiceListProvider',
addEditedValue: false,
choiceListText: '''single
parallel
single-local
parallel-local
''',
defaultChoice: 'parallel'
],
description: 'Select the test you would like to run',
editable: false,
name: 'TEST_TYPE']
])
])
stage('Setup') {
cleanWs()
checkout scm
}
stage('Run Test(s)') {
browserstack(credentialsId: "${params.BROWSERSTACK_USERNAME}") {
sh returnStatus:true, script:'''
mkdir -p browserstack_examples_specflowplus/bin/Debug/netcoreapp3.1/BrowserStack/Webdriver/Resources
echo 'DriverType: CloudDriver
BaseUrl: http://localhost:3000
CloudDriverConfig:
HubUrl: https://hub-cloud.browserstack.com/wd/hub
User:
Key:
LocalTunnel:
IsEnabled: true
LocalOptions:
binarypath: /var/lib/jenkins/.browserstack/BrowserStackLocal
CommonCapabilities:
BStackOptions:
projectName: BrowserStack Examples Specflow
buildName: browserstack-examples-specflow
debug: true
networkLogs: true
os: Windows
osVersion: "11"
local: true
Platforms:
- SessionCapabilities:
PlatformOptions:
BrowserVersion: latest
' > browserstack_examples_specflowplus/BrowserStack/Webdriver/Resources/capabilities-local.yml
cp -r browserstack_examples_specflowplus/BrowserStack/Webdriver/Resources/* browserstack_examples_specflowplus/bin/Debug/netcoreapp3.1/BrowserStack/Webdriver/Resources/
/bin/dotnet build
'''
if(TEST_TYPE == "single"){
sh returnStatus:true,script: '''
/bin/dotnet test --filter Category=single
'''
} else if(TEST_TYPE == "single-local") {
sh returnStatus:true,script: '''
export CAPABILITIES_FILENAME=capabilities-local.yml
/bin/dotnet test --filter Category=single
'''
} else if(TEST_TYPE == "parallel-local"){
sh returnStatus:true,script: '''
export CAPABILITIES_FILENAME=capabilities-local.yml
/bin/dotnet test
'''
} else {
sh returnStatus:true,script: '''
/bin/dotnet test
'''
}
}
}
} catch (e) {
currentBuild.result = 'FAILURE'
throw e
} finally {
stage('Publish Results'){
browserStackReportPublisher 'automate'
}
}
}