get max from automation

36
06/28/2022 1 GET MAX FROM YOUR AUTOMATED TESTS Nitin Mukhija - Director Of Engineering In Test PayU India Pvt. Ltd.

Upload: babudevanandam

Post on 06-Apr-2017

164 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Get Max From Automation

05/02/20231

GET MAX FROM YOUR AUTOMATED TESTSNitin Mukhija

- Director Of Engineering In Test PayU India Pvt. Ltd.

Page 2: Get Max From Automation

05/02/20232

FYI

Page 3: Get Max From Automation

05/02/20233

Hopefully this will not happen, so lets get started…

Page 4: Get Max From Automation

05/02/20234

Why Automate?

• Manual is slow• Faster feedback on Continuous Integration –

24*7 testing• Repetitive manual regression tests are

boring and make testers lose focus• Manual testers focus on testing new features• Allows for faster upgrades and refactoring• Consistency and Documentation• Higher test coverage – multiple data

combinations

Page 5: Get Max From Automation

05/02/20235

Let’s see an example of poorly written automation…

Page 6: Get Max From Automation

05/02/20236

Automation Design• Example of a bad code Hardcoded

Browser

Hardcoded Environment

Hardcoded Timeout

Page 7: Get Max From Automation

05/02/20237

Automation Design• Example of a bad code

Hardcoded Object

Identifiers

Hardcoded Test Data

Hardcoded Selenium

Constructs

Repeated Business

Logic

Page 8: Get Max From Automation

05/02/20238

Automation Design• Non-Actionable Report – High Failure Investigation Cost

Manually run again to repro. Can’t log bugs from report

No Screenshot / Page HTML

Insufficient Logging

Page 9: Get Max From Automation

05/02/20239

Unplanned Automation

Page 10: Get Max From Automation

05/02/202310

Let’s see the things you can do to get MAX from your automation…

Page 11: Get Max From Automation

05/02/202311

Tip #1:- Choose Right Design• Example – Layered Architecture• Hotel Book Web App

Page 12: Get Max From Automation

05/02/202312

Layered Architecture• Automation Libs• Framework Core• Page Objects• Business Logic Helpers• Test Cases

Page 13: Get Max From Automation

05/02/2023

Page Object

Action On Page

Mandatory to Return next

Page after click

UI Elements of Page

Page Name

13

Page 14: Get Max From Automation

05/02/202314

Layered ArchitectureSample layered design:-• Automation Libs• Framework Core• Page Objects• Business Logic Helpers• Test Cases

Page 15: Get Max From Automation

05/02/202315

Business Logic Helpers

Combine Page

Actions to

build business

Logic

Login

Search

Book

Page 16: Get Max From Automation

05/02/202316

Layered Architecture• Automation Libs• Framework Core• Page Objects• Business Logic Helpers• Test Cases

Page 17: Get Max From Automation

05/02/202317

Neat Test Case

Extensively use Business Logic

Helpers

Easy to read & interpret manual

test case

TC Description

Page 18: Get Max From Automation

05/02/202318

Layered Architecture• Automation Libs• Framework Core• Page Objects• Business Logic Helpers• Test Cases

Page 19: Get Max From Automation

05/02/202319

Automation Libs• Selenium, QTP, etc.• All external third party jars

Framework Core• Wrapper around various

external libraries

Class DescriptionLog Log reportingHelper Various utility methodsDataBase Methods to interact with database Popup Methods to handle popups, alerts on the pageTestData Reader

Methods to read from test data sheet

Browser Methods to do operations on your Browser/PageElement Methods to do operations on Elements of the Page

Page 20: Get Max From Automation

05/02/202320

Tip #1:- Right Design- Benefits• Reduce Maintenance cost• Business logic at one place• Reusable code• Localized changes – Data and Object Repo• Easy to understand test cases• Easy to change underlying automation lib

Page 21: Get Max From Automation

05/02/202321

Tip #2:- Configurable• Don’t hardcode – Load at runtime

– Environment URL’s– Browser Name– Platform– ObjectWaitTime– Database credentials– Any other param which drives the execution

Page 22: Get Max From Automation

05/02/202322

Tip #3:- Data Driven• Run same test case with different data combinations

Read login credentials from Excel

Test Data Excel Row Number

Page 23: Get Max From Automation

05/02/202323

Tip #4:- Parallel Execution

• Write non-interfering atomic test cases

• Standard Win7 can run 12 parallel browsers – execution time reduced to 1/12th

Faster Execution = Faster Feedback

Page 24: Get Max From Automation

05/02/2023 24

Page 25: Get Max From Automation

05/02/202325

Tip #5:- Rich Reports

Hyperlinks of Page Screenshot

& HTML

Uniform logging of TC steps in

Green/Red/Black logs

Failure Page URL

Log bugs by just reading logs, even manual tester can do!

TC Description

Page 26: Get Max From Automation

05/02/202326

Allure Reporting Failure Grouping

Page 27: Get Max From Automation

05/02/202327

Custom Listeners

• Logging of unhandled exceptions• Cleanup tasks• Soft Asserts

Page 28: Get Max From Automation

05/02/202328

Tip #6:- Customized email results• Host Test Results on a web server - Reports

history• Email Results - Customized Subject

Pass Percentage

Area Owner

Page 29: Get Max From Automation

05/02/202329

Consolidated Results

Page 30: Get Max From Automation

05/02/202330

Tip #7:- Measure Automation Accuracy

# of test cases failed due to Dev code issue Vs

# of test cases failed due to automation code issue

Page 31: Get Max From Automation

05/02/202331

Tip #8:- Measure Code Coverage

Sample PHP Code

Coverage Report

Page 32: Get Max From Automation

05/02/202332

Tip #9:- Automated Deployments

• Using Docker - Build production like, testing environment on the fly

• Jenkins job to:-– Deploy application code automatically– Run Automation

• A Step towards Continuous Delivery

Page 33: Get Max From Automation

05/02/202333

TestLink - TCM

Test Cases

Test Plans

Test Builds

Reports

Execution Engine

Fetch Git Code & Compile

TestLink Integration Module

Get Test Cases To Run

Launch & Drive Execution

Retrieve Results/Exceptions

Push Test Results & Email (ReportNG)

Layered Automation Suite

Test Cases (TestNG)

Business Logic

Page Objects

Framework Core

Selenium Webdriver

Tip #10:- Continuous Integration

Page 34: Get Max From Automation

05/02/202334

That’s strange, not even a single Oxygen mask dropped!!

Page 35: Get Max From Automation

05/02/202335

Questions & Answers

Page 36: Get Max From Automation

05/02/202336

Thank You!!!

https://in.linkedin.com/in/nitinmukhija@nitin_mukhija