Posts

Cucumber With Ruby & Capybara

Feature File: Feature: Automate Flipkart website Scenario: Login for Flipkart   Given I open browser and navigate to flipkart website   Then I click on login Link  Then I enter Email Id  Then  I enter Password   Then I click on Login Button   Then I mouse over the user   Then I click on Logout Step Definition File Given(/^I open browser and navigate to flipkart website$/) do   visit 'http://www.flipkart.com' end Then(/^I click on login Link$/) do     find(:xpath, "//a[@href='https://www.flipkart.com/account/login?from=header']").click end Then(/^I enter Email Id$/) do      fill_in 'login_email_id', :with => 'xxx@gmail.com' end Then(/^I enter Password$/) do   fill_in 'login_password', :with => 'password' end Then(/^I click on Login Button$/) do   click_button 'Login'   sleep(10) end Then(/^I mouse over the user$/) do  element...

My Research on Cucumber

Introduction# Cucumber is a functional test automation tool for lean and agile teams. It supports behaviour-driven development, specification by example and agile acceptance testing.The language that Cucumber understands is called Gherkin. You can use it to automate functional validation in a form that is easily readable and understandable to business users, developers and testers. This helps teams create executable specifications, that are a goal for development, acceptance criteria and functional regression checks for future changes. In this way, Cucumber allows teams to create living documentation, a single authoritative source of information on system functionality that is always up-to-date.   AN EXAMPLE: Feature: Search courses   In order to ensure better utilization of courses   Potential students should be able to search for courses   Scenario: Search by topic     Given there are 240 courses which do not have the ...

Selenium :- How to Open Chrome Browser

import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class chrome1 {  public static void main(String[] args)  {   System.setProperty("webdriver.chrome.driver","C:\\Chrome\\chromedriver.exe"); //path of        chromeDriver.exe file   WebDriver driver = new ChromeDriver();   driver.get("http://google.com");  } }             

TestNG vs. JUnit4

Image
 TestNG vs. JUnit4 JUnit 4 and TestNG are both very popular unit test framework in Java. Both frameworks look very similar in functionality. Which one is better? Which unit test framework should one choose in Java project? Here is the quick snapshot of features comparison:

Parallel Execution using TestNG

For Parallel execution ,we will be working on 3 different components as below: A Factory class that will create WebDriver instances  A Manager class that can be accessed to retrieve a WebDriver instance A TestNG listener that will be responsible for instantiating the WebDriver instance automatically First we will create a Factory class which will create and return the desired webdriver object: package execution.parallel; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.ie.InternetExplorerDriver; class LocalDriverFactory {      static WebDriver createInstance(String browserName) {          WebDriver driver = null ;          if (browserName.toLowerCase().contains( "firefox" )) {...

Verifying ToolTip Using Selenium webdriver

public String GetToolTipText() throws InterruptedException{    builder.clickAndHold(driver.findElement(By.className("locator here"))).build().perform();    Thread.sleep(2000);    return driver.findElement(By.xpath("locator of tooltip")).getText();  }

Selenium - How to switch to Web Dialog window & back to Parent Browser Window

Steps are as follows -            1.    Before clicking the link, get the handle id of the browser window.                  String BrowserParent = driver.getWindowHandle();            2.  After clicking the link;                  String str = driver.getWindowHandle();                  driver.switchTo().window(st); // switch to child browser            3.      Once the operation on the web dialog box is completed.                        driver.switchTo().window(BrowserParent);