Thursday, 3 December 2015

Automation Framework

htmlreport.py
************************************************************************
import unittest
import HTMLTestRunner
import os
from tests import SprintTests

dir = os.getcwd()

search_tests = unittest.TestLoader().loadTestsFromTestCase(SprintTests)

smoke_tests = unittest.TestSuite([search_tests])

outfile = open(dir + "\TestReport_Feature.html", "w")

runner = HTMLTestRunner.HTMLTestRunner(
    stream=outfile,
    title='Test Report',
    description='Feature Sanity'
    )

runner.run(smoke_tests)
*************************************************************************

tests.py

*************************************************************************
from random import randint
import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from sshtunnel import SSHTunnelForwarder
import MySQLdb
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
import autoit
                                                       
class SprintTests(unittest.TestCase):
   
    def setUp(self):

       
        self.driver = webdriver.Firefox()
        self.driver.get("https://abcd.html")
        self.driver.implicitly_wait(30)
        self.driver.maximize_window()
       
       
    def test_Amount_Orderid_CardDetails_checks(self):
        ## amount -ive
        #self.driver.get("https://abc.html")
        print "Sub test: Amount negative"
       
    def tearDown(self):
              self.driver.quit()
      
       
if __name__ == '__main__':
    unittest.main(verbosity=2)
*************************************************************************
       

No comments:

Post a Comment