-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathInitiateTesting.yml
76 lines (68 loc) · 3.14 KB
/
InitiateTesting.yml
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
##############################################################################################################
# #
# InitiateTesting_pipeline.yml : Starts testing for a specific repo on specific stage #
# #
# ####### Inputs ######## #
# branch: (Mandatory) Which branch should be referred for test cases #
# environment: (Mandatory) On which stage should be Test triggered #
# repoName: (Mandatory) Name of the corresponding repository. #
##############################################################################################################
trigger:
- none
variables:
- group: github_group
- group: webMethodsIO_group
- name: repoPath
value: $(gitOwner)/$(repoName)
pool:
vmImage: ubuntu-latest
resources:
repositories:
- repository: projectRepo
type: github
endpoint: github
name: $(repoPath)
ref: $(branch)
steps:
- checkout: projectRepo
submodules: "true"
persistCredentials: "true"
clean: "true"
path: $(repoName)
- checkout: self
submodules: "true"
persistCredentials: "true"
clean: "true"
path: self
- bash: |
cd ../
source=$(echo $(resources.triggeringAlias))
if [ -z "$source" ]; then
source=$(echo $(environment))
cd $(repoName)
fi
echo "##vso[task.setvariable variable=source_type]${source}"
cd ../self
pwd
ls -ltr
echo "##vso[task.setvariable variable=admin_user]`yq -e ".tenant.admin_username" configs/env/${source}.yml`"
echo $(System.DefaultWorkingDirectory)
workingDirectory: '$(System.DefaultWorkingDirectory)'
displayName: 'Get Environment Tenant Details'
- script: |
cd ../$(repoName)
pwd
echo $(source_type)
echo $(admin_user)
echo "newman run ./resources/test/wmio_test.json -e ./resources/test/environments/$(source_type).json --env-var "project=$(repoName)" --env-var "user=$(admin_user)" --env-var "password=$(admin_password)" --reporters cli,junit --reporter-junit-export $(System.DefaultWorkingDirectory)/$(source_type)/results/junitReport.xml
ls -ltr $(System.DefaultWorkingDirectory)/$(source_type)/results/"
newman run ./resources/test/wmio_test.json -e ./resources/test/environments/$(source_type).json --env-var "project=$(repoName)" --env-var "user=$(admin_user)" --env-var "password=$(admin_password)" --reporters cli,junit --reporter-junit-export $(System.DefaultWorkingDirectory)/$(source_type)/results/junitReport.xml
ls -ltr $(System.DefaultWorkingDirectory)/$(source_type)/results/
displayName: 'Run newman'
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/junit*.xml'
searchFolder: '$(System.DefaultWorkingDirectory)/$(source_type)/results'
failTaskOnFailedTests: true
testRunTitle: '$(source_type) Test Run'