Skip to content

Commit f227963

Browse files
committed
Update boilerplates
1 parent d7f7a94 commit f227963

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

examples/boilerplates/master_class.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''
22
You can use this as a boilerplate for your test framework.
3-
Define your customized library methods here.
3+
Define your customized library methods in a master class like this.
44
Then have all your test classes inherit it.
55
The master class will inherit SeleniumBase methods from BaseCase.
66
'''
@@ -13,7 +13,14 @@ class MasterTestCase(BaseCase):
1313
def setUp(self):
1414
super(MasterTestCase, self).setUp()
1515

16+
def login_to_site(self):
17+
# Add frequently used methods like this in your master class.
18+
# This reduces the amount of duplicated code in your tests.
19+
# If the UI changes, the fix only needs to be applied in one place.
20+
pass
21+
1622
def example_method(self):
23+
# Add your code here.
1724
pass
1825

1926

@@ -25,5 +32,6 @@ def example_method(self):
2532
class MyTests(MasterTestCase):
2633
2734
def test_example(self):
35+
self.login_to_site()
2836
self.example_method()
2937
'''

examples/boilerplates/pom_lib/page_objects.py renamed to examples/boilerplates/page_object_model/page_objects.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'''
22
Example of using the Page Object Model (POM) for tests, using page selectors.
33
Helps make your code more Readable, Maintainable, and Reusable.
4-
Import a file like this in your test files.
4+
Import a file like this at the top of your test files.
55
'''
66

77

@@ -27,7 +27,7 @@ class CheckoutPage(object):
2727
# Now you can do something like this in your test files:
2828
2929
from master_class import MasterTestCase
30-
from pom_lib.page_objects import HomePage, ShoppingPage, CheckoutPage
30+
from page_objects import HomePage, ShoppingPage, CheckoutPage
3131
3232
class MyTests(MasterTestCase):
3333

0 commit comments

Comments
 (0)