16
Does Toast Trouble you in this Digital Age? Nancy Jerfia Gladson – Test Analyst Surendar Ramanathan Sadagopan – Test Analyst Gopinath Mohanraj – Test Manager

qaistc.comqaistc.com/2017/wp-content/uploads/2017/09/stc-2017... · Web viewAutomatic identification of Toasts during test automation. Two ways of handling this toasts have been provided

  • Upload
    vananh

  • View
    222

  • Download
    0

Embed Size (px)

Citation preview

Page 1: qaistc.comqaistc.com/2017/wp-content/uploads/2017/09/stc-2017... · Web viewAutomatic identification of Toasts during test automation. Two ways of handling this toasts have been provided

Does Toast Trouble you in this Digital Age?

Nancy Jerfia Gladson – Test AnalystSurendar Ramanathan Sadagopan – Test Analyst

Gopinath Mohanraj – Test Manager

Page 2: qaistc.comqaistc.com/2017/wp-content/uploads/2017/09/stc-2017... · Web viewAutomatic identification of Toasts during test automation. Two ways of handling this toasts have been provided

Abstract

The Digital new age is immensely evolving with new technologies and new solutions to the problems faced? The intent of this paper is to provide a solution to the challenges faced while verifying the Toast message developed as part of the mobile automation testing. Usually, the toast message appears and flashes off within seconds. Handling the toasts was a challenge and faced many technical hardships. Element ID’s not found in the UI Automator for Android and Simulator in iOS.

The solution was using Tesseract class available as an open source jar. Integrated Tesseract with Appium to capture the image of the Toast and read the text in the captured image and then test verify the text. The main advantage of using Tesseract is that it will improve the accuracy of the result and performance.

Page 3: qaistc.comqaistc.com/2017/wp-content/uploads/2017/09/stc-2017... · Web viewAutomatic identification of Toasts during test automation. Two ways of handling this toasts have been provided

Problem Statement

Customer expectations have changed in the age of mobile. People spend 17% more time on mobile than they do on desktop. Only 8% of smartphone users engage with more than 10 apps per day, 63% use between 4-10 on daily basis, and 29% use 0-3 apps per day. 50% of people only opted into receiving push notifications from their favorite apps, according to a survey.

Android or iOS applications mostly do not display any sort of alert messages. Toast messages are a quick way of telling the user something. They are short pop-up messages that show for a second or two and then fade away.

Toast is a system property of any android or iOS application. Usually, the toast message appears and flashes off within seconds. Handling the toasts was a challenge and faced many technical hardships.

One of the challenge we faced was Element ID’s for the toast will not be available in the UI Automator for Android and Simulator in iOS. It's possible to catch Messages/Notifications with an Accessibility Service, but this also seemed not to work with android version upgradation.

Page 4: qaistc.comqaistc.com/2017/wp-content/uploads/2017/09/stc-2017... · Web viewAutomatic identification of Toasts during test automation. Two ways of handling this toasts have been provided

SolutionCurrent trends in the age of mobile is moving from alert messages to the display of toast messages. The solution to handle and validate these toast message will be Optical Character Recognition using Tesseract object. Optical Character Recognition, or OCR, is the process of electronically extracting text from images

Below is the folder structure of where the tesseract class and the supporting jars and library files are to be placed,

The folder structure has to be maintained in the above way such that the supportive .dll files and the tess4j jar has to be placed in the lib folder.

• tess4j.jar – This jar is used to call the methods for Optical Character Recognition using Tesseract object.

• tessdll.dll – A library file which needs to be set in the program’s path.• eng.traineddata – This is a compressed data file which contains all the

letters and words in English.

Page 5: qaistc.comqaistc.com/2017/wp-content/uploads/2017/09/stc-2017... · Web viewAutomatic identification of Toasts during test automation. Two ways of handling this toasts have been provided

Syntax for creating OCR :-

Toast Message Validation:-

Option 1:-• Take the toast message displayed screen as a screenshot and send the

screenshot path as screen in instance.doOCR(screen).

Page 6: qaistc.comqaistc.com/2017/wp-content/uploads/2017/09/stc-2017... · Web viewAutomatic identification of Toasts during test automation. Two ways of handling this toasts have been provided

• Check the required toast message is displayed in the image that has been captured. Validate the result.

Option 2:-Using Sikulix

• GUI interaction using screenshots• Used when ID/name is not found in UI Automator or Simulator.• It will check the appearance of the image and if match found, it

will interact with the image accordingly.

Page 7: qaistc.comqaistc.com/2017/wp-content/uploads/2017/09/stc-2017... · Web viewAutomatic identification of Toasts during test automation. Two ways of handling this toasts have been provided

Appium WorkFlow

Page 8: qaistc.comqaistc.com/2017/wp-content/uploads/2017/09/stc-2017... · Web viewAutomatic identification of Toasts during test automation. Two ways of handling this toasts have been provided

Continuous Integration

As a part of Continous Integration we can schedule and do the execution.

• Jobs are triggered once the developers provide the apk file.• Jenkins is going to perform some build jobs taking input from the file.

Page 9: qaistc.comqaistc.com/2017/wp-content/uploads/2017/09/stc-2017... · Web viewAutomatic identification of Toasts during test automation. Two ways of handling this toasts have been provided

• Builds can also be scheduled using Cron pattern• Status mail is sent for each build for specified stakeholders• Useful for weekend execution

Test Results from Jenkins

Page 10: qaistc.comqaistc.com/2017/wp-content/uploads/2017/09/stc-2017... · Web viewAutomatic identification of Toasts during test automation. Two ways of handling this toasts have been provided

Take Away:

1. Automatic identification of Toasts during test automation.

2. Two ways of handling this toasts have been provided

3. Jenkins – Job can be triggered once the developers provide the apk file. Also helps to Schedule a nightly and weekend execution in the absence of resources.

4. Handling the toast message was a challenge that has been addressed here.

Page 11: qaistc.comqaistc.com/2017/wp-content/uploads/2017/09/stc-2017... · Web viewAutomatic identification of Toasts during test automation. Two ways of handling this toasts have been provided

References & Appendix

Appium:-

http://toolsqa.com/mobile-automation/appium/appium-tutorial/

Optical Character Recognition in Android using Tesseract: -

http://opensourceforu.com/2016/08/23297/

Automated Jenkins execution: -

https://www.tutorialspoint.com/jenkins/jenkins_automated_testing.htm

Page 12: qaistc.comqaistc.com/2017/wp-content/uploads/2017/09/stc-2017... · Web viewAutomatic identification of Toasts during test automation. Two ways of handling this toasts have been provided

Author Biography

Nancy Jerfia G - Test Analyst – Automation

Has 3+ years of Experience in Automation Testing in UFT, Selenium and Appium. Involved in Designing New Framework for Automation Projects.

Surendar R S - Test Analyst – Automation

Has 2+ years of Exeperience in Mobile Automation using Appium, also have an experience in Selenium.

Gopinath Mohanraj - Test Manager

Has 11 + Years of Experience in Functional & Automation Testing (Mobile & Web) in Telecom Domain and has knowledge in CRM, Billing Systems and provisioning system. Also, managed and implemented many Open source Tools / Commercial Tools to the organization requirements.

Page 13: qaistc.comqaistc.com/2017/wp-content/uploads/2017/09/stc-2017... · Web viewAutomatic identification of Toasts during test automation. Two ways of handling this toasts have been provided

THANK YOU!