14 May
27 Apr

How to choose automation outsourcing partner?

Below points , you need to consider before giving QA outsource:

User friendly tools support

User friendly language support

cost effective

quality cannot be compromised

On time delivery

Strong in technical

effective communication for automation steps & process

Easy framework

Ease of Maintenance

flexibility and scalability

strong engagement model or good SLA’s

 

 

 

Share this
21 Apr

Appium with Python

Introduction:

Appium is an open source test automation tool for mobile applications. It allows you to test all the three types of mobile applications: native, hybrid and mobile web. It uses JSON wire protocol internally to interact with Android and iOS native apps using the Selenium WebDriver. 

It also allows you to run the automated tests on

  • Real devices
  • Emulators
  • Simulators

How to Download Appium?

Please click “Download Appium” in the below link

https://appium.io/

Install Appium Python Client:

Please follow below link to install Python2.7 and Eclipse editor for creating Python projects.

http://qaprogrammer.com/python-2/

To install Appium Python Client, please follow below link

https://github.com/appium/python-client

How to setup Appium on Android Platform?

Appium supports Android on OS X, Linux and Windows OS. 

In this blog, we will discuss Android on Windows OS.

Download Android SDK from below link

https://developer.android.com/studio/index.html

To install Android SDK follow below video link

 

Connect Android Phone to Windows OS system via USB cable and enable “Developer options” by navigating to Settings/About Phone and tapping build number seven times.You will get a notification saying that you’re now a developer.

Once you are a developer you need to navigate to “Developer options” and enable the USB debugging option.

On Android phone, install “Application Reader” app from Google play store. Application Reader app is used get the app Package and Activity details, which is used for testing the application.

Now open command prompt, navigate to Android SDK tools path and run the command to open Uiautomatorviewer.

To capture a screen, click the “Device Screenshot button” in the uiautomatorviewer tool. The screenshot of the page in your device is captured. You can move over the snapshot in the left-hand panel to see the UI components identified by the uiautomatorviewer.

Start the Appium application by double clicking the .exe file.

Sample Appium Program:

Here is the sample Appium program using Python to get temperature of location using “Weather” app. We need to install weather app before running this code.

# -*- coding: utf-8 -*-

”’

Author : Gandhi Gonugunta

”’

import unittest, time, os

from appium import webdriver

import time

class Android_WeatherApp_Test(unittest.TestCase):

    

    def setUp(self):

        

        desired_caps = {}

        desired_caps[‘platformName’] = ‘Android’

        desired_caps[‘platformVersion’] = ‘6.0’

        desired_caps[‘deviceName’] = ‘MyPhone’

        

        desired_caps[‘appPackage’] = ‘com.macropinch.swan’

        desired_caps[‘appActivity’] = ‘com.macropinch.swan.WeatherActivity2’

        

        self.driver = webdriver.Remote(‘http://localhost:4723/wd/hub’, desired_caps)

    def tearDown(self):

        “Tear down the test”

        self.driver.quit()

    def test_wifi(self):

        self.driver.implicitly_wait(30)

        time.sleep(5)

        print “In Weather App..”

        #city = raw_input(“Enter the city name to be checked: “)

        ## Checking the Weather in Hyderabad Location

        city = “Hyderabad”

        city = city.title()

       getcity = self.driver.find_element_by_xpath(“//android.widget.TextView[@index=’0′]”)

        

        if city not in getcity.get_attribute(‘text’):

            mcity = self.driver.find_element_by_xpath(“//android.widget.TextView[@index=’0′]”)

            mcity.click()

            tempcity = self.driver.find_element_by_xpath(“//android.widget.TextView[@resource-id=’android:id/text1′]”)

            tempcity.click()

            time.sleep(2)

        print “Checking temperature in Hyderabad Area..”

        gettemp = self.driver.find_element_by_xpath(“//android.widget.TextView[@index=’1′]”)

        print “Temp is :”,gettemp.get_attribute(‘text’)

#—START OF SCRIPT

if __name__ == ‘__main__’:

    suite = unittest.TestLoader().loadTestsFromTestCase(Android_WeatherApp_Test)

    unittest.TextTestRunner(verbosity=2).run(suite)

Please edit below lines in the code:

desired_caps[‘platformVersion’] = ‘6.0’   -> Your Android phone platform version(Settings/About Phone)

desired_caps[‘deviceName’] = ‘MyPhone’ -> Your Andriod phone Name

Use Application Reader app to get appPackage & appActivity and edit below two lines,

desired_caps[‘appPackage’] = ‘com.macropinch.swan’

desired_caps[‘appActivity’] = ‘com.macropinch.swan.WeatherActivity2’

 

 

 

 

Share this
21 Apr

Selenium with Python

Introduction:

Selenium automates web browsers.There are other tools which can be used to automate both web applications and windows applications like QTP (Quick Test Professional). As every one aware that QTP is Licensed Tool where as Selenium is Open source tool, download it configure it and enjoy.

History:

Selenium IDE

In 2005, Selenium first came up with record and play back option known as Selenium IDE. It only comes with Firefox plugin.

Selenium RC

It is the second version of Selenium, where user sends commands to proxy server and then pass data to browser.

Pros:

  • Supports all web browsers unlike Selenium IDE.
  • Supports multiple OS.

Cons:

  • Cannot support Android OS & iOS.
  • Doesn’t support rich API.
  • Need to start proxy server.
  • Cannot talk directly to browser. Instead, proxy server takes commands from user and pass it to browser.

Selenium Webdriver

It is the latest version of Selenium, where it directly talks to browser.Unlike Selenium RC, it doesn’t use any proxy server. It was developed in 2009.

Pros:

  • Handle Mouse movements.
  • Support for Android OS and iOS unlike Selenium RC.
  • Can handle rich API.
  • Support multiple browsers.
  • Supports all the latest versions of Firefox.

Cons:

  • Limitation in Browser Support.
  • There is no support for running tests in parallel on a single computer.

Selenium with Python bindings:

In this blog, we will talk on Selenium with Python bindings.

Let’s start by installing Python2.7. Please follow below link to install Python2.7 and Eclipse editor for creating python project.

http://qaprogrammer.com/python-2/

Use below link to install Selenium with Python bindings.

https://pypi.python.org/pypi/selenium

Webdriver for different browsers:

For Chrome browser,

https://chromedriver.storage.googleapis.com/index.html?path=2.29/

For Firefox browser, no need to download Firefox driver. By default, selenium python bindings comes up with firefox driver.

For Opera browser,

https://github.com/operasoftware/operachromiumdriver/

For Safari browser,

https://webkit.org/blog/6900/webdriver-support-in-safari-10/

Please follow below link for different browsers.

http://www.seleniumhq.org/download/

Sample Program:

Here is the sample selenium program in Python to get inbox message count from Gmail account using Firefox browser.

# -*- coding: utf-8 -*-

”’

    Author: Gandhi Gonugunta

”’

#

#IMPORTS

#

import unittest

from selenium import webdriver

from selenium.webdriver.common.keys import Keys

from selenium.common.exceptions import NoSuchElementException

import time

import re

import sys

class Gmail_Login(unittest.TestCase):

    

    def setUp(self):

        self.username = raw_input(“Enter Gmail Username : “)

        self.password = raw_input(“Enter Gmail Password : “)

        self.driver = webdriver.Firefox()

    

    def test_gmail_inbox(self):

        driver = self.driver

        driver.get(“http://www.gmail.com”)

        time.sleep(5)

        

        try:

            search = driver.find_element_by_id(“Email”)

            search.clear()

            search.send_keys(self.username)

            driver.find_element_by_id(“next”).click()

        

            time.sleep(3)

            pswd = driver.find_element_by_xpath(“//input[@id=’Passwd’]”)

            pswd.clear()

        

            pswd.send_keys(self.password)

            driver.find_element_by_xpath(“//input[@id=’signIn’]”).click()

        except NoSuchElementException:

            print “Error: Failed to Login to Gmail Account”

            sys.exit()

        

        time.sleep(5)

        try:

            inbox = driver.find_element_by_partial_link_text(“Inbox”)

            inboxdata = inbox.get_attribute(“title”)

            reobj = re.search(r”Inbox \((.*)\)”,inboxdata)

            if reobj:

                print “##################################”

                print “You have %s inbox messages” %str(reobj.group(1))

                print “##################################”

            else:

                print “Failed to get your inbox messages”

        except NoSuchElementException:

            print “Error: Failed to Login to Gmail Account”

            sys.exit()

        try:

            driver.find_element_by_xpath(“.//*[@id=’gb’]/div[1]/div[1]/div[2]/div[4]/div[1]/a/span”).click()

            time.sleep(2)

            driver.find_element_by_xpath(“.//*[@id=’gb’]/div[1]/div[1]/div[2]/div[4]/div[2]/div[3]/div[1]/a”).click()

            time.sleep(3)

            print “Successfully Logged out from Gmail”

            print “Done”

        except NoSuchElementException:

            print “Error: Failed to Logout from Gmail Account”

            sys.exit()

    

    def tearDown(self):

        self.driver.quit()

        pass

if __name__ == “__main__”:

    unittest.main()

Share this
20 Apr

Python

Introduction:

Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during 1985- 1990.Python can be easy to pick up whether you’re a first time programmer or you’re experienced with other languages.Python is developed under an OSI-approved open source license, making it freely usable and distributable, even for commercial use.

Advantages

Advantages of Python over other languages:

  • Python is a Beginner’s Language. Its code is easy to read and you can do a lot of things just by looking at it.
  • You can execute a lot of complex functionalities with ease, thanks to the standard library.
  • Python supports Object-Oriented style.
  • Supports multiple systems and platforms.
  • You can actually sit at a Python prompt and interact with the interpreter directly to write your programs.
  • You can build GUI applications easily.

Current Stable Versions:

For Python2.7 -> 2.7.13

For Python3 -> 3.6.1

Most of the code will be written in Python2.7 as it supports large number of libraries.

How to download Python2.7 ?

Please use below link to download Python2.7 and download Python2.7.13 or above version.

https://www.python.org/downloads/

eclipse_logo

Eclipse Editor for Python:

To write Python scripts, we use Eclipse editor. 

Download Eclipse editor from below link

http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/neon3

Java_logo_icon

Download latest Java from below link

https://java.com/en/download/

Note:

  • Please download Eclipse and Java software based on your system configuration(32-bit or 64-bit).
  • Both Eclipse and Java software should be same version (either 32-bit or 64-bit).
  • Don’t mix match Eclipse and Java software versions. Eg: Eclipse 32-bit and Java 64-bit will get error.

Installing Eclipse for Python Project:

For creating Python projects, we need to install one time Pydev software plugin to Eclipse.

Pydev_logo

Open Eclipse, Go to “Help” Menu and Click “Install New Software”.

Screen Shot 2017-04-20 at 6.10.10 PM

Click “Add” button and give Name as “Pydev” & Location as “http://pydev.org/updates” and then click “OK”.

Screen Shot 2017-04-20 at 6.15.40 PM

Select “PyDev” option and click “Next”

Screen Shot 2017-04-20 at 6.17.17 PM

Click “Next”

Screen Shot 2017-04-20 at 6.21.33 PM

Now click “I accept the terms of the license agreements” button and click “Finish”.

Screen Shot 2017-04-20 at 6.24.43 PM

Click “Brainwy Software;PyDev;Brainwy” option and click “OK”.

Screen Shot 2017-04-20 at 6.26.33 PM

Restart eclipse by clicking “Yes” button.

Screen Shot 2017-04-20 at 6.29.26 PM

For creating new Python project, select File -> New -> Other

Screen Shot 2017-04-20 at 6.31.18 PM

Select “PyDev Project” and click “Next”.

Screen Shot 2017-04-20 at 6.32.58 PM

For configuring Python interpreter, click on link “Click here to configure an interpreter not listed.” and click “OK”

Screen Shot 2017-04-20 at 6.34.57 PM

Give Project Name and Directory path and click “Finish”

Screen Shot 2017-04-20 at 6.40.25 PM

At this stage, we have successfully created new Python project in Eclipse editor.

What we do at QAProgrammer ?

What We Do

  • Create test plan/test scenarios based on business requirement document.
  • Create test Automation scripts/framework from test plan/test scenarios.
  • Provide test Automation results and reports daily to clients.
  • Find bugs and report them to clients.
  • Update and maintain test Automation scripts.
Share this
09 Apr
09 Apr
09 Apr
09 Apr
09 Apr

© 2015 QA Programmer. All rights reserved.

Show Buttons
Hide Buttons