Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Experiment 4 / Task No.04

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

Rahul Sharma N268 70471118075 MBA-Tech CSE I

Experiment 4 / Task No.04

A.1 Aim: Practical Usage of automated testing tools and Execution using QTP( example
Web site)

A.2 Prerequisite: Testing theoretical knowledge

A.3 Outcome: How to test the software module/System using a automated


tool.

A.4 Theory: Automated testing tool has to be downloaded and tested


based on any one of the testing types

1.GUI Testing

2.Functional Testing

3.HTML Testing

4.System testing

LogIn Module:
# Generated by Selenium IDE

import pytest

import time

import json

from selenium import webdriver

from selenium.webdriver.common.by import By

from selenium.webdriver.common.action_chains import ActionChains

from selenium.webdriver.support import expected_conditions

from selenium.webdriver.support.wait import WebDriverWait

from selenium.webdriver.common.keys import Keys

from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

class TestBakeryProjectTestingSQATLogIn():

def setup_method(self, method):

self.driver = webdriver.Chrome()

self.vars = {}

def teardown_method(self, method):

self.driver.quit()

def wait_for_window(self, timeout = 2):

time.sleep(round(timeout / 1000))
wh_now = self.driver.window_handles

wh_then = self.vars["window_handles"]

if len(wh_now) > len(wh_then):

return set(wh_now).difference(set(wh_then)).pop()

def test_bakeryProjectTestingSQATLogIn(self):

self.driver.get("http://localhost/project/index.html")

self.driver.set_window_size(1296, 696)

self.vars["window_handles"] = self.driver.window_handles

self.driver.find_element(By.LINK_TEXT, "Menu").click()

self.vars["win1411"] = self.wait_for_window(2000)

self.driver.switch_to.window(self.vars["win1411"])

self.driver.find_element(By.LINK_TEXT, "Log In").click()

self.driver.find_element(By.ID, "emob").click()

self.driver.find_element(By.ID, "emob").send_keys("sharma.rahul075@nmims.edu.in")

self.driver.find_element(By.ID, "pass").click()

self.driver.find_element(By.ID, "pass").send_keys("1234567890")

self.vars["window_handles"] = self.driver.window_handles

self.driver.find_element(By.ID, "submit").click()

self.vars["win7549"] = self.wait_for_window(2000)

self.driver.switch_to.window(self.vars["win7549"])

SignUp Module:
# Generated by Selenium IDE

import pytest

import time

import json

from selenium import webdriver

from selenium.webdriver.common.by import By

from selenium.webdriver.common.action_chains import ActionChains

from selenium.webdriver.support import expected_conditions

from selenium.webdriver.support.wait import WebDriverWait

from selenium.webdriver.common.keys import Keys

from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

class TestBakeryProjectTestingSQAT():

def setup_method(self, method):

self.driver = webdriver.Chrome()

self.vars = {}

def teardown_method(self, method):

self.driver.quit()

def wait_for_window(self, timeout = 2):

time.sleep(round(timeout / 1000))

wh_now = self.driver.window_handles
wh_then = self.vars["window_handles"]

if len(wh_now) > len(wh_then):

return set(wh_now).difference(set(wh_then)).pop()

def test_bakeryProjectTestingSQAT(self):

self.driver.get("http://localhost/project/index.html")

self.driver.set_window_size(1296, 696)

self.vars["window_handles"] = self.driver.window_handles

self.driver.find_element(By.LINK_TEXT, "Menu").click()

self.vars["win115"] = self.wait_for_window(2000)

self.driver.switch_to.window(self.vars["win115"])

self.driver.find_element(By.LINK_TEXT, "Sign Up").click()

self.driver.find_element(By.ID, "fname").click()

self.driver.find_element(By.ID, "fname").send_keys("Rahul")

self.driver.find_element(By.ID, "lname").send_keys("Sharma")

self.driver.find_element(By.ID, "email").send_keys("rahsharma83@gmail.com")

self.driver.find_element(By.ID, "lname").click()

self.driver.find_element(By.NAME, "acc").click()

self.driver.find_element(By.ID, "num").click()

self.driver.find_element(By.ID, "num").send_keys("9654786320")

element = self.driver.find_element(By.CSS_SELECTOR, "label:nth-child(14)")

actions = ActionChains(self.driver)

actions.move_to_element(element).click_and_hold().perform()

element = self.driver.find_element(By.CSS_SELECTOR, "label:nth-child(14)")

actions = ActionChains(self.driver)

actions.move_to_element(element).perform()

element = self.driver.find_element(By.CSS_SELECTOR, "label:nth-child(14)")


actions = ActionChains(self.driver)

actions.move_to_element(element).release().perform()

self.driver.find_element(By.NAME, "acc").click()

self.driver.find_element(By.ID, "email").send_keys("sharma.rahul075@nmims.edu.in")

self.driver.find_element(By.ID, "pass").click()

self.driver.find_element(By.ID, "pass").send_keys("0987654321")

self.driver.find_element(By.ID, "repass").click()

self.driver.find_element(By.ID, "repass").send_keys("0987654321")

self.driver.find_element(By.ID, "submit").click()

You might also like