I have 2 classes in python and both of them extend the unittest.TestCase class. Hence I have 2 test cases. These test cases (classes) are:
class Test_ID_94017(unittest.TestCase):
ex = Excel()
def setUp(self):
self.driver = Browser().createBrowserDriver()
self.driver.maximize_window()
self.driver.implicitly_wait(15)
self.ex.setUpASheetInExcel('Login')
def test_CCPD_Regression001_PER_Custom_Check(self):
ccp = CCPLogin(self.driver)
loginDetails = self.ex.getLoginDetailsForATestCaseFromExcel('Login', '94017')
ccp.login(loginDetails[0], loginDetails[1], loginDetails[2])
wait = WebDriverWait(self.driver, 20)
wait.until(lambda driver:self.driver.title.startswith('Harland Clarke'))
self.assertIn("Harland Clarke Checks Online Catalog", self.driver.title, "Failed on CHECKS ONLINE CATALOG PAGE")
Home().clickOrderButton(self.driver)
PersonalHurdle().clickProceedWithNoChangeLink(self.driver)
pc = ProductConfig()
pc.confirmAddress(self.driver, False)
pc.clickContinueButton(self.driver)
wait.until(lambda driver:self.driver.title.startswith('Customize Your Check'))
self.assertIn("Customize Your Check", self.driver.title)
try:
updateButtonHidden = self.driver.find_element_by_xpath(CustomizeYourCheckPage.UPDATE_BUTTON)
self.assertIn("hidden", updateButtonHidden.get_attribute('style'))
except NoSuchElementException:
assert 0, "Can't find hidden button"
self.driver.find_element_by_xpath(CustomizeYourCheckPage.SECOND_FONT).click()
updateButtonVisible = self.driver.find_element_by_xpath(CustomizeYourCheckPage.UPDATE_BUTTON)
self.assertIn("visible", updateButtonVisible.get_attribute('style'))
CustomizeYourCheck().clickAddToCartButton(self.driver)
time.sleep(5)
OrderExtraTodayPopup().clickNoThanksButton(self.driver)
wait.until(lambda driver:self.driver.title.startswith('Shopping Cart'))
assert "Shopping Cart" in self.driver.title
sc = ShoppingCart()
sc.selectItemQuantity(self.driver)
sc.clickProceedToCheckoutButton(self.driver)
wait.until(lambda driver:self.driver.title.startswith('Checkout'))
self.assertIn("Checkout", self.driver.title)
wait.until(lambda driver:self.driver.find_element_by_xpath(CheckoutStep1Page.SELECT_SHIPPING_METHOD_LINK).is_displayed())
self.driver.find_element_by_xpath(CheckoutStep1Page.SELECT_SHIPPING_METHOD_LINK).click()
time.sleep(10)
ShippingMethod().selectAShippingMethod(self.driver)
cs1 = CheckoutStep1()
cs1.enterEmailAddress(self.driver, "praveen@email.com")
cs1.clickProceedToOrderSummary(self.driver)
wait.until(lambda driver:self.driver.title.startswith('Order Summary'))
self.assertIn("Order Summary", self.driver.title)
OrderSummary().clickSubmitOrderButton(self.driver)
wait.until(lambda driver:self.driver.title.startswith('Order Confirmation'))
self.assertIn("Order Confirmation", self.driver.title)
OrderConfirmation().clickLogoutLink(self.driver)
wait.until(lambda driver:self.driver.find_element_by_css_selector(LogoutPopupWindow.YES_BUTTON).is_displayed())
self.driver.find_element_by_css_selector(LogoutPopupWindow.YES_BUTTON).click()
def tearDown(self):
self.driver.close()
AND
class Test_ID_94018(unittest.TestCase):
ex = Excel()
def setUp(self):
self.driver = Browser().createBrowserDriver()
self.driver.maximize_window()
self.driver.implicitly_wait(15)
self.ex.setUpASheetInExcel('Login')
def test_CCPD_Regression002_PER_Std_Check(self):
ccp = CCPLogin(self.driver)
loginDetails = self.ex.getLoginDetailsForATestCaseFromExcel('Login', '94018')
ccp.login(loginDetails[0], loginDetails[1], loginDetails[2])
wait = WebDriverWait(self.driver, 15)
wait.until(lambda driver:self.driver.title.startswith('Harland Clarke'))
self.assertIn("Harland Clarke Checks Online Catalog", self.driver.title, "Failed on CHECKS ONLINE CATALOG PAGE")
PersonalHurdle(self.driver).clickProceedWithNoChangeLink()
pc = ProductConfig(self.driver)
pc.confirmAddress(False)
pc.clickContinueButton()
wait.until(lambda driver:self.driver.title.startswith('Customize Your Check'))
self.assertIn("Customize Your Check", CustomizeYourCheckPage)
CustomizeYourCheck(self.driver).clickAddToCartButton()
OrderExtraTodayPopup(self.driver).clickNoThanksButton()
wait.until(lambda driver:self.driver.title.startswith('Shopping Cart'))
assert "Shopping Cart" in self.driver.title
sc = ShoppingCart(self.driver)
sc.selectItemQuantity()
sc.clickProceedToCheckoutButton()
wait.until(lambda driver:self.driver.title.startswith('Checkout'))
self.assertIn("Checkout", self.driver.title)
wait.until(lambda driver:self.driver.find_element_by_xpath(CheckoutStep1Page.SELECT_SHIPPING_METHOD_LINK).is_displayed())
self.driver.find_element_by_xpath(CheckoutStep1Page.SELECT_SHIPPING_METHOD_LINK).click()
time.sleep(10)
ShippingMethod(self.driver).selectAShippingMethod()
cs1 = CheckoutStep1(self.driver)
cs1.enterEmailAddress("praveen@email.com")
cs1.clickProceedToOrderSummary()
wait.until(lambda driver:self.driver.title.startswith('Order Summary'))
self.assertIn("Order Summary", self.driver.title)
OrderSummary(self.driver).clickSubmitOrderButton()
wait.until(lambda driver:self.driver.title.startswith('Order Confirmation'))
self.assertIn("Order Confirmation", self.driver.title)
OrderConfirmation(self.driver).clickLogoutLink()
wait.until(lambda driver:self.driver.find_element_by_css_selector(LogoutPopupWindow.YES_BUTTON).is_displayed())
self.driver.find_element_by_css_selector(LogoutPopupWindow.YES_BUTTON).click()
def tearDown(self):
self.driver.close()
**Problem is when I try to run it in Eclipse through PyUnit, only the first test case executes, passes and gives me the result. The second test case does not execute at all. I remember, it was executing both the test cases earlier but I'm not sure why it is not executing both of them now. Please advice. Need help here as I am blocked now!
***This is my first attempt at Daniweb and I am not sure if I am posting my doubt at the correct forum. Please bear with me*