Sending object C from class A to class B
- by user278618
Hi,
I can't figure out how to design classes in my system.
In classA I create object selenium (it simulates user actions at website).
In this ClassA I create another objects like SearchScreen, Payment_Screen and Summary_Screen.
# -*- coding: utf-8 -*-
from selenium import selenium
import unittest, time, re
class OurSiteTestCases(unittest.TestCase):
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("localhost", 5555, "*chrome", "http://www.someaddress.com/")
time.sleep(5)
self.selenium.start()
def test_buy_coffee(self):
sel = self.selenium
sel.open('/')
sel.window_maximize()
search_screen=SearchScreen(self.selenium)
search_screen.choose('lavazza')
payment_screen=PaymentScreen(self.selenium)
payment_screen.fill_test_data()
summary_screen=SummaryScreen(selenium)
summary_screen.accept()
def tearDown(self):
self.selenium.stop()
self.assertEqual([], self.verificationErrors)
if __name__ == "__main__":
unittest.main()
It's example SearchScreen module:
class SearchScreen:
def __init__(self,selenium):
self.selenium=selenium
def search(self):
self.selenium.click('css=button.search')
I want to know if there is anything ok with a design of those classes?