Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from fabric.api import *
- from fabric.contrib.console import confirm
- from fabric.decorators import hosts
- import os
- def git_server():
- env.hosts = ['github.com']
- env.user = 'user'
- env.passowrd = 'pass'
- ## Selenium Tests
- ## | run test alone from cmd line with "fab function()"
- ########################################################
- def addEmployer():
- antTask = "addEmployer_git"
- runAntTask(antTask)
- def addEmployee():
- antTask = "addEmployee_git"
- runAntTask(antTask)
- def deleteEmployee():
- antTask = "deleteEmployee_git"
- runAntTask(antTask)
- def editEmployee():
- antTask = "editEmployee_git"
- runAntTask(antTask)
- def viewEmployee():
- antTask = "viewEmployee_git"
- runAntTask(antTask)
- # Run ANT task for Selenium process
- ####################################
- def runAntTask(command):
- os.chdir('\\Work\main\employer_toolkit')
- with settings(warn_only=True):
- result = local('ant %s' % (command), capture=True)
- if result.failed and not confirm("Tests failed. Continue anyway?"):
- abort("Aborting at user request.")
- ## Commit & Push to GitHub
- ###########################
- def deploy(process):
- os.chdir('\\Documents and Settings\markw\GitTest')
- local('git fetch')
- local('git add -A')
- commit = local('git commit -m "Latest Selenium screenshots for %s"' % (process))
- if commit.failed:
- sys.exit("%s files already up to date. Exiting." % process)
- else:
- local('git push --all')
- ## Run Selenium Test & Deploy to Git
- ## | run from cmd line with "fab function()"
- #############################################
- def addEmployerGit():
- process = 'Add Employer'
- addEmployer()
- deploy(process)
- def addEmployeeGit():
- process = 'Add Employee'
- addEmployee()
- deploy(process)
- def deleteEmployeeGit():
- process = 'Delete Employee'
- deleteEmployee()
- deploy(process)
- def editEmployeeGit():
- process = 'Edit Employee'
- editEmployee()
- deploy(process)
- def viewEmployeeGit():
- process = 'View Employee'
- viewEmployee()
- deploy(process)
- def allEmployeeGit():
- process = 'All Employee Tests'
- addEmployee()
- viewEmployee()
- editEmployee()
- deleteEmployee()
- deploy(process)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement