Tuesday, May 30, 2017

Writing text in internet explorer while using element.sendKeys("abc") is very slow.


You can change to the 32-bit version, but in 64 bit IE is required then you can try this solution:

Internet Options -> Security -> Check "Enable Protected Mode" for all zone
Go to Advanced -> Security -> Check "Enable Enhanced Protected Mode"

=> No more snail typing on 64 bit IE (xD)

Thursday, March 16, 2017

What is test automation framework and it's basic framework types ?

A test automation framework is a combination of guidelines, coding standards, concepts, practices, processes, project hierarchies, reporting mechanism, test data, to support automation testing. A tester follows these guidelines while automating applications to take advantage of various productive results.

There are many types of test automation frameworks available in the market, and the most popular ones are listed here. Each one of these frameworks has their individual characteristics and features.
Let us now examine some of the popular frameworks and understand their pros, cons, and usability recommendations:

# Keyword-driven framework
In the keyword-driven framework, testers create various keywords and associate different actions or functions with each of these keywords. Function library contains the logic to read the keywords and call and perform the associated actions. Generally, test scenarios are written in excel sheets. The driver script reads the scenario and performs test execution. This is used in situations where the testers who create test scripts have less programming expertise, whereas framework creation is done by automation experts

# Hybrid framework
The hybrid automation framework is created by combining distinct features of two or more frameworks. This enhances the strengths of the different frameworks and mitigates their weaknesses. It is highly robust, flexible, and more maintainable. However, this requires strong technical expertise to design and maintain.

# Behavior-driven development framework
Behavior-driven development (BDD) framework automates validations in an easily readable and understandable format to business analysts, developers, testers, etc. Such frameworks do not
necessarily require the user to be acquainted with any programming language. There are different tools available for BDD like Cucumber, JBehave, and more which work along with other test automation tools. This framework is more suitable for applications using agile methodology and where user stories and early automation are required. It focuses on the behavior of the system rather than the implementation aspect of the system. The traceability between requirements and scripts is maintained throughout, and test scripts are easy to understand for the business users.

Sunday, November 6, 2016

What are the differences in between Download Speed, Upload Speed and Ping ?

The download speed is how fast you can pull data from the server to you. Most connections are designed to download much faster than they upload, since the majority of online activity, like loading web pages or streaming videos, consists of downloads. Download speed is measured in megabits per second (Mbps).

The upload speed is how fast you send data from you to others. Uploading is necessary for sending big files via email, or in using video-chat to talk to someone else online (since you have to send your video feed to them). Upload speed is measured in megabits per second (Mbps).

The ping is the reaction time of your connection–how fast you get a response after you've sent out a request. A fast ping means a more responsive connection, especially in applications where timing is everything (like video games). Ping is measured in milliseconds (ms).

Wednesday, September 23, 2015

Simple selenium with python example

'''
Created on Sep 22, 2015

@author: Prashant Chauhan

'''

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Firefox()
driver.get('http://www.python.org')
assert "Python" in driver.title
elem = driver.find_element_by_name("q")
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source
driver.close()

Python setup with selenium in eclipse

22092015

1. Install Eclipse any version.
2. Download and install JDK 7 or later
3. Download and install Python 2.7 or 3.5
4. Download the Selenium-2.47.3-py2-none-any.whl
5. Set the path for Java and Python Like :
    a. C:\python27\scripts
    b. %JAVA_HOME%/bin
6. Open command prompt and run :
    pip install -U selenium
7. Then you can see the result install selenium successfully the go further.
8. Install some more software in eclipse like:
    a. PyDev and PyDev Extension
    b. http://pydev.org/updates
    Then
    i: Trust the certificate.
    ii: Restart the eclipse
9: Now set the interpreter to the eclipse for creating projects.

10. Please run the simple program and enjoy.

Thanks:
Prashant Chauhan

Saturday, October 19, 2013

Smoke Vs Sanity Vs Regression Beautiful Example

We can consider a River Analogy to understand the difference between Smoke Testing, Sanity Testing and Regression Testing better. Before moving to the analogy, lets consider the very basic definition of three of these testing:
  • Smoke Testing: Testing all (wide) areas related to new feature, not deeply. Determines if we should go for further testing.
  • Sanity Testing: Testing narrow areas related to new feature, deeply.
  • Regression testing: Testing all areas related to new feature, deeply.
If we consider a river, for instance, which has, for instance 1000 feet width, and contains “dusts” in its water (which can be considered as “bugs” in software), the goal for the corresponding three types of tests should be as follows:



For Regression Testing: to find out all the dusts that are available on surface and under the water in all over the river.

"Testing all areas related to the new features deeply."


For Smoke Testing: to find out the dusts in all over the surface of the river, which not includes the dusts under water.

"Testing all (Wide) areas related to the new features, Not deeply. It determines if we should do further testing."


For Sanity Testing: to find out the dusts in a specific width (for instance left side 200 feet), which not only includes the dusts on surface, but also includes the dusts under water, till the last depth of the river.

"It is same as regression testing but here you make a risk judgement call and compromise part of your testing."


Thursday, August 1, 2013

Automate the Calendar component in Selenium WebDriver using JAVA.

package TestOpt;

import java.util.Calendar;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

interface Xpaths
{
/*
* This inteface contains all the xpath's that are used in the program
*/
String calendarPopUpButtonxPath = "//*[@id='j_id354:j_id355PopupButton']";
String monthIncrementerxPath = "//*[@id='j_id354:j_id355Header']/table/tbody/tr/td[4]/div";
String monthDecrementerxPath = "//*[@id='j_id354:j_id355Header']/table/tbody/tr/td[2]/div";
String dayxPathPart1 = "//*[@id='j_id354:j_id355DayCell";
String dayxPathPart2 = "']";
String dayZeroxPath = "//*[@id='j_id354:j_id355DayCell0']";
String applyButtonxPath = "//*[@id='j_id354:j_id355Footer']/table/tbody/tr/td[6]/div";
}

interface Months
{
int JANUARY   = 1,
FEBRUARY  = 2,
MARCH     = 3,
APRIL     = 4,
MAY       = 5,
JUNE      = 6,
JULY      = 7,
AUGUST    = 8,
SEPTEMBER = 9,
OCTOBER   = 10,
NOVEMBER  = 11,
DECEMBER  = 12;
int MAX_DAY_IN_A_MONTH = 31;
}

public class AutomateJsfCalendar implements Xpaths,Months
{
/**Months
* @param args
*/
static int targetDay     = 0,
          targetMonth   = 0,
          targetYear    = 0;
static int currentDay    = 0,
          currentMonth  = 0,
          currentYear   = 0;
static int jumpMonthsBy  = 0,
              index = 0;

static boolean increment = true;
public static void main(String[] args)
{
WebDriver driver = new FirefoxDriver();
driver.navigate().to("http://livedemo.exadel.com/richfaces-demo/richfaces/calendar.jsf");
driver.manage().timeouts().implicitlyWait(15L, TimeUnit.SECONDS);
driver.manage().window().maximize();
WebElement element = driver.findElement(By.xpath(calendarPopUpButtonxPath));
element.click();
//At this point, jsf calendar component is displayed.
//Today's date is 30/03/2013. Let us say we want to set the date as 15/07/2013
String dateToSet = "15/07/2013";

GetTargetDateMonthAndYear(dateToSet);
GetCurrentDateMonthAndYear();
CalculateHowManyMonthsToJump();
for(int i=0;i<jumpMonthsBy;i++)
{
if(increment)
element = driver.findElement(By.xpath(monthIncrementerxPath));
else
element = driver.findElement(By.xpath(monthDecrementerxPath));
element.click();
try
{
//sleep will let you see the automation happening.
Thread.sleep(1000);
} catch (InterruptedException e)
{
e.printStackTrace();
}
}
CalculateCorrectDayIndex(driver);
String completePath = dayxPathPart1 + index + dayxPathPart2;

element = driver.findElement(By.xpath(completePath));
element.click();
element = driver.findElement(By.xpath(applyButtonxPath));
element.click();

  //driver.quit();
}//end of main..
/*
*This method will bisect the target date and upadates  targetDay, targetMonth & targetYear variables.
*/
static void GetTargetDateMonthAndYear(String dateString)
{
int firstIndex = dateString.indexOf("/");
int lastIndex = dateString.lastIndexOf("/");
String month = dateString.substring(0, firstIndex);
targetDay = Integer.parseInt(month);
String day = dateString.substring(firstIndex+1, lastIndex);
targetMonth = Integer.parseInt(day);
String year = dateString.substring(lastIndex+1, dateString.length());
}
/*
* This method will fetch current date and updates currentDay, currentMonth & currentYear variables.
*/
static void GetCurrentDateMonthAndYear()
{
Calendar cal = Calendar.getInstance();
currentDay   = cal.get(Calendar.DAY_OF_MONTH);
currentMonth = cal.get(Calendar.MONTH)+1;//+1 because month values starts from 0. January = 0.
currentYear  = cal.get(Calendar.YEAR);
}
/*
* This method decides how many time this ">" element on the calendar component needs to be clicked to reach target month.
*/
static void CalculateHowManyMonthsToJump()
{
if((targetMonth - currentMonth) > 0 )
{
jumpMonthsBy = (targetMonth - currentMonth);
}
else
{
jumpMonthsBy = (currentMonth - targetMonth);
increment = false;
}
}

/*
* This calculates the current index that holds the targetDay value that we need to click in the calendar control.
*/
static void CalculateCorrectDayIndex(WebDriver driver)
{
int tempMonth = targetMonth - 1;
if(tempMonth == 0)
{
//if target month is January, control will come inside.
tempMonth = DECEMBER;
}
WebElement element = driver.findElement(By.xpath(dayZeroxPath));
String str = element.getText();
int dayValueAtZeroIndex = Integer.parseInt(str);

if(dayValueAtZeroIndex == 1)
{
index = targetDay - 1;
}
else
{
switch(tempMonth)
{
case JANUARY:
case MARCH:
case MAY:
case JULY:
case AUGUST:
case OCTOBER:
case DECEMBER:
{
index = ((MAX_DAY_IN_A_MONTH - dayValueAtZeroIndex) + targetDay);
break;
}
case FEBRUARY:
{
/*
* Separate case is needed for feb because Feb contains only 28(MAX_DAY_IN_A_MONTH - 3) days.
*/
index = (((MAX_DAY_IN_A_MONTH - 3) - dayValueAtZeroIndex) + targetDay);
break;
}
default:
{
//Control will come here for months that consists of 30(MAX_DAY_IN_A_MONTH - 1) days.
index = (((MAX_DAY_IN_A_MONTH - 1) - dayValueAtZeroIndex) + targetDay);
break;
}
}
}
}
}//end of class.