heuristics to scale your framework
TRANSCRIPT
![Page 1: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/1.jpg)
Heuristics to scale your framework
Prasad Kalgutkar
![Page 2: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/2.jpg)
2
![Page 3: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/3.jpg)
What do I do?
3
Test Mobile Apps (iOS & Android)
Automate in Ruby with Calabash & WATIR
Write scenarios in Cucumber
Test a Mobile website too!
Client Consulting on the way!
![Page 4: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/4.jpg)
Role of Automation
4
On time delivery
Fast Feedbacks
Save time & efforts
Better test coverage
Sanity test builds Accuracy
![Page 5: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/5.jpg)
“ If you automate a mess, you just get an automated mess!
” - Rob Michael
5
![Page 6: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/6.jpg)
Common Challenges
6
➔ Test Data
➔ Add / Modify Libraries
➔ Extensibility
➔ Locators
➔ Debugging
➔ High Maintenance
![Page 7: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/7.jpg)
Let’s Solve it! #1
7
![Page 8: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/8.jpg)
Test Data Management
Keep it simple & understandable
Close to domain
Avoid Excel Sheets
Avoid Fetching from DB
Leverage the tech stack
8
![Page 9: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/9.jpg)
In the Scenario@Test
public void shouldTestLoginForInvalidUser(){
new LoginPage()
.enterUsername(“BadMan”)
.enterPassword(“Wrong”)
.submitLogin()
.checkErrorMessage(“Invalid Credentials”);
}
9
Given I login as “Invalid” with password “Wrong”Then I see an error message as “Invalid Credentials”
<= JUnit
BDD =>
![Page 10: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/10.jpg)
Test HashesWhen I enter “VISA” card details
10
def testCards{
:VISA => {
:NUMBER” => “4000100040001000”
:EXPIRY => “2018”
},
:AMEX => {
:NUMBER => “4111311141113111”
:EXPIRY => “2020”
}
}
![Page 11: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/11.jpg)
Test Data ObjectsWhen I use “gold_medallion” for login
11
{
LoginUser user = UserFactory.getUser(“gold_medallion”);
new LoginPage()
.enterUsername(user.username)
.enterPassword(user.password)
.submitLogin();
}
// “gold_medallion” details defined in a user_data a YAML file...
![Page 12: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/12.jpg)
Let’s Solve it! #2
12
![Page 13: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/13.jpg)
Add / Modify Libraries
Write a driver wrapper utility
driver defines actions
driver defines setup & teardown
driver takes care of waits
13
![Page 14: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/14.jpg)
Sample driverpublic class WebsiteDriver extends BaseDriver{
String DRIVER_KEY;Webdriver driver;
public websitedriver() { DRIVER_KEY = “Web”;driver = new ChromeDriver();
}
public void startURL(String URLString){driver.get(URLString);
}
public void click(WebElement E) {E.click();wait_for_page_load();
} ...}
14
![Page 15: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/15.jpg)
Sample architecture
15
Test Case Layer
Step / Method Implementation
iOSDriver
AndroidDriver
WebDriver
![Page 16: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/16.jpg)
Let’s Solve it! #3
16
![Page 17: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/17.jpg)
Extensibility
Modular code practices
Modular folder structure
Page-Objects or Component-
Objects
Consistency in the
utilities/services 17
![Page 18: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/18.jpg)
Page Objects
18
class MyProfile < BasePagedef initialize
pageId = “unique_locator”
field1 = …field2 = …
end
def editProfile// steps to edit profile
endend
PageRegistry.registerPage(MyProfile)
![Page 19: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/19.jpg)
Element Hierarchy
19
class ElementType
def self.button(locator)return Button.new(locator)
end
def self.dropdown(locator)return
Dropdown.new(locator)end
def self.checkbox(locator)return
Checkbox.new(locator)end
...end
![Page 20: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/20.jpg)
Modular Folders
20
my_test_project- essentials
- data_files- data_models- helpers
- tests- product1- product2
- action_definitions- functionality_based
- framework- page_objects- element_types- tasks
- rake_tasks- shell_scripts
![Page 21: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/21.jpg)
Let’s Solve it! #4
21
![Page 22: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/22.jpg)
Locators!
Uniquely Identifiable
Prefer CSS Selectors over XPaths
Avoid Long locator expressions
ID over class attributes
Segregate them logically
22
![Page 23: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/23.jpg)
Locators that will extend...@submit_button = ElementType.button(
{:web => “#submitButton”,:iOS => “webView
css:’#submitButton’”’,:droid => “webView
css:’#submitButton’”}
23
@coupon_button = ElementType.button({
:web => {:product1 =>
“#applyCouponButton”,:product2 =>
“#enterCouponButton”},...}
![Page 24: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/24.jpg)
Let’s Solve it! #5
24
![Page 25: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/25.jpg)
Debugging & High Maintenance◻Wrap the failure messages
◻if element.nil? raise “Element not found on <Page>”◻unless loader.nil? raise “Timed out waiting for loader to disappear”
25
◻Say NO to Hacks!◻ No Thread.Sleep◻ No Conditional decisions◻ No monkey patching apis
◻Right set of automated tests◻ No to Carousel/Moving elements◻ No to JS alert box◻ No to external links/apps
![Page 26: Heuristics to scale your framework](https://reader036.vdocument.in/reader036/viewer/2022070513/5886762a1a28ab962a8b4a93/html5/thumbnails/26.jpg)
Thank You@KalgutkarPrasad
26