File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
'''
2
2
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 .
4
4
Then have all your test classes inherit it.
5
5
The master class will inherit SeleniumBase methods from BaseCase.
6
6
'''
@@ -13,7 +13,14 @@ class MasterTestCase(BaseCase):
13
13
def setUp (self ):
14
14
super (MasterTestCase , self ).setUp ()
15
15
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
+
16
22
def example_method (self ):
23
+ # Add your code here.
17
24
pass
18
25
19
26
@@ -25,5 +32,6 @@ def example_method(self):
25
32
class MyTests(MasterTestCase):
26
33
27
34
def test_example(self):
35
+ self.login_to_site()
28
36
self.example_method()
29
37
'''
File renamed without changes.
Original file line number Diff line number Diff line change 1
1
'''
2
2
Example of using the Page Object Model (POM) for tests, using page selectors.
3
3
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.
5
5
'''
6
6
7
7
@@ -27,7 +27,7 @@ class CheckoutPage(object):
27
27
# Now you can do something like this in your test files:
28
28
29
29
from master_class import MasterTestCase
30
- from pom_lib. page_objects import HomePage, ShoppingPage, CheckoutPage
30
+ from page_objects import HomePage, ShoppingPage, CheckoutPage
31
31
32
32
class MyTests(MasterTestCase):
33
33
You can’t perform that action at this time.
0 commit comments