Run Python command with parameters

Note:Pass parameters in Command line

prodDBValidation.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
33
34
35
36
37
38
39
40
from DBJsonGeneration import DBJsonGeneration

from DBValidation import DBValidation

from termcolor import colored, cprint

import colorama

import argparse

colorama.init()


def process(planName,projectName):

g=DBJsonGeneration()

entryList=g.getDBJsonFromTestRail(planName.strip(),projectName.strip())

d=DBValidation()

d.verifyDB(entryList)



parser = argparse.ArgumentParser(description='Production DB validation')

parser.add_argument('--planName', '-plan', help='planName must be necessarily parameter', required=True)

parser.add_argument('--projectName', '-project', help='projectName must be necessarily parameter', required=True)

args = parser.parse_args()



if __name__ == "__main__":

process(args.planName,args.projectName)

print("***Done***")

Run command line:

1
>f:\jenkins_workspace\workspace\XXX\TransactionValidation\Scripts\python f:\jenkins_workspace\workspace\XXX\TransactionValidation\src\prodDBValidation.py -plan  plan123 -project projectName