-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipeline.py
33 lines (28 loc) · 1.23 KB
/
pipeline.py
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
__author__ = "Vivek Ganesan"
import os
import subprocess
class Pipeline:
"""
Pipeline CLASS:
To be triggered by jenkins pipeline.
- Get tag name to execute only the particular tag in feature file
- Get environment for feature file to be executed
"""
def __init__(self):
self.ENV_VARS = ['TEST_ENV', 'TAGS']
self._test_env = os.environ['TEST_ENV'] if 'TEST_ENV' in os.environ else 'UAT'
self._tags = os.environ['TAGS'] if os.environ['TEST_ENV'] is not "none" else None
self.command_Sh = ""
def behave_setup(self):
print("Tag name : {}".format(self._tags))
print("Test env : {}".format(self._test_env))
if self._tags is None:
command_Sh = "-D instance={} -f allure_behave.formatter:AllureFormatter -o allure-results feature".format(self._test_env.strip())
else:
command_Sh = "-D instance={} --tags={} -f allure_behave.formatter:AllureFormatter -o allure-results feature".format(self._test_env.strip(),self._tags.strip())
return command_Sh
if __name__ == '__main__':
pipe = Pipeline()
print(pipe.behave_setup())
print("Calling behave runner_behave.sh")
subprocess.call(['./runner_allure.sh',pipe.behave_setup()])