Thursday, March 19, 2015

SELENIUM WEBDRIVER BROWSER COMMANDS:

SELENIUM WEBDRIVER BROWSER COMMANDS:



Command: driver.get(“URL which need to be open”);
Used for: Open webpage in a browser
Ex: driver.get(“http://jaingourav999.blogspot.com”);
Command: driver.gettitle()
Used for: Get title of current page
Ex: driver.gettitle();
Command: driver.getPageSource()
Used for: Get source of current page
Ex: driver.getpagesource();
Command: driver.getCurrentUrl()
Used for: Get source of current page
Ex: driver. getCurrentUrl ();
Command: driver.navigate.refresh()
Used for: Refresh the current page
Ex: driver.navigate.refresh ();
Command: driver.close()
Used for: Close the current window of browser
Ex: driver.close();
Command: driver.quit()
Used for: quit the browser and all opened browser
Ex: driver.quit();

Tuesday, February 3, 2015

Sample Appium code

Hi Friends, below is the sample code written for opening chrome browser in your Android device. 


import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import io.appium.java_client.AppiumDriver;
import org.junit.After;
import org.junit.Before;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

public class Appiumweb {

private WebDriver driver;

@BeforeMethod
public void setup() throws MalformedURLException
{
//File classpathroute= new File(System.getProperty("user.dir"));
//File appdir=new File (classpathroute,"D://automation//AppiumTest//Application");
//File appDir = new File(classpathroute, "Application");
//File app=new File(appDir, "ApiDemos-debug.apk");
  //capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
   
          DesiredCapabilities capabilities = new DesiredCapabilities();
       capabilities.setCapability("deviceName", "Android");
       capabilities.setCapability("platformName", "Android");
       capabilities.setCapability("platformVersion", "4.4.4");
       capabilities.setCapability("browserName", "Chrome");
       driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilities);

//Note Below code is for opening any Android application in Android device. 
/*  capabilities.setCapability("deviceName","Android");
       capabilities.setCapability("platformVersion", "4.4.2");
       capabilities.setCapability("platformName","Android");
       capabilities.setCapability("app", app.getAbsolutePath());
       capabilities.setCapability("appPackage", "io.appium.android.apis");
       capabilities.setCapability("appActivity", ".ApiDemos");
      driver=new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);*/
     
}

  @Test
   public void apiDemo() throws InterruptedException{
 
  driver.get("http://jaingourav999.blogspot.com");

String pagetitle=driver.getCurrentUrl();
System.out.println("The current page title is"+ pagetitle);
 
 
Thread.sleep(10000l);
   }
 
  @AfterMethod
   public void tearDown() throws Exception {
       driver.quit();
   }
public static void main(String[] args) {
// TODO Auto-generated method stub

}

}

Introduction to Appium

 Purpose:

This blog is written for running the NGE Automation code to Chrome browser of Android device, with the help of Appium.  

About the Appium:

Appium is an open-source tool for automating native, mobile web, and hybrid applications on iOS and Android platforms. Native apps are those written using the iOS or Android SDKs. Mobile web apps are web apps accessed using a mobile browser (Appium supports Safari on iOS and Chrome or the built-in 'Browser' app on Android).

Importantly, Appium is "cross-platform": it allows you to write tests against multiple platforms (iOS, Android), using the same API. This enables code reuse between iOS and Android testsuites.

It supports:
Mac OSX 10.7+ or Windows 7+ or Linux
Android SDK ≥ 16 (SDK < 16 in Selendroid mode)

Below image shows how Appium works:




Prerequisite before starting:

1.       Install Eclipse
2.       Install JAVA JDK, and set the path to windows preference
3.       Configure the Android SDK, and set the path to windows preference. (Instructions give in the doc)
4.       Download Appium, and configured Appium jar (java-client)+GSON jar+Selenium jar files. 


 Install Eclipse
      Download the eclipse.


Installing and configuring the Android SDK
1.       Download the standalon sdk tool from https://developer.android.com/sdk/index.html#Other
2.       By default, the Android SDK does not include everything you need to start developing. The SDK separates tools, platforms, and other components into packages you can download as needed using the Android SDK Manager. So before you can start, there are a few packages you should add to your Android SDK.
       3. To start adding packages, launch the Android SDK Manager in one of the following ways: (Time        consuming process)
          3.1  Windows: Double-click theSDK Manager.exe file at the root of the Android SDK directory.
Set the path on windows of SDK

1. Add the platform-tools\ directory to your Windows path: Ex: ;C:\Development\Android\android-sdk-windows\platform-tools\

2. Set the Android_Home: Ex
;Development\Android\android-sdk-windows\


Configuing installed Android SDK with Eclipse

Launch Eclipse->Windows->Preference->Android->Click on Browse->Locate the installed Android SDK folder.

Launch Appium

1.       Open the downloaded Appium
2.       Double-click on Appium.exe, and launch the Appium server.  



Write code
Run the application:
1.       Connect the Android device.
2.       Run the test suite file.

Monday, February 2, 2015

Open Google chrome browser by selenium

Hi Friends,

Below is the sample code, which will help you to open chrome browser through selenium.

import org.testng.annotations.AfterTest;
import org.testng.annotations.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.BeforeTest;

public class openingChrome {
    public WebDriver driver;

    // Launching Browser
    @BeforeTest
    public void start() {
        System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe");
        driver = new ChromeDriver();
    }

    // Opening webpage
    @Test
    public void openHomepage() {
        driver.get("http://jaingoruav999.blogspot.com");

    }

    // Closing browser
    @AfterTest
    public void teardown()

    {

        driver.quit();
    }
}

Saturday, October 11, 2014

Important Shortcut Keys For Eclipse

Important Shortcut keys for eclipse


During writing of heavy lines of code, or in multiple windows, sometimes programmer get confuses about the debug or run. If you are truly programmer, then you should know about the shortcut keys of your used tool. 

Here i am sharing some very useful shortcut keys for eclipse, which will be helpful to you during the compilation, debugging or running your code.  

Run and Debug

Ctrl+F11
Save and run
F11
Debug
F5
Step into function (Help on debugging)
F6
Next step
F7
Step out
F8
Skip to next breakpoint


Commenting of code

Ctrl+Shift+/
Adding block comment
Ctrl+Shift+\
Remove block comment
Ctrl+/
Comment/Uncomment of any line




Monday, September 22, 2014

QTP Interview Questions

QTP Interview questions:

1. Write a function for addition of three numbers.
2. Write script for finding the difference between two dates.
3. Write function for adding and retrieving data from excel file.
4. What is data drive framework, and keyword driven framework.
5. What is descriptive language in QTP .
6. Example of Split(), Instr(), and mid() functions.
7. Data retrieving from notepad file.
8. What is UFT?
9. Latest version of UFT?
10. Can we perform web application testing through QTP?

Sunday, July 27, 2014

Common interview questions asked in various interviews for QA

Common interview questions asked in various interviews for QA

Many companies prefer that interviewer should have automation testing knowledge along with Manual testing. Below are question asked in various interviews. These will really helpful to you. 

1. Define your current project and your role. 
2. In how many domains you have worked?
3. How your day start in your work.
4. What is scenario and priority. Tell me less sever and more priority issue, or Less prior and more sever issue?
5. What are the advantages of Automation testing over manual testing?
6. What is the difference between verification and validation?
7. Difference between regression testing and retesting?
8. What is the difference between API testing and Unit testing?
9. Knowledge about automation tool, Selenium or QTP.
10. What is the difference between Mobile application testing and Desktop application testing. 
11. What is scrum/Agile methodologies or testing process/Sprint.
12. What are the fields in results columns in TCs sheet. ex: Pass/Fail/Block etc...
13. What is waterfall model, STLC, V-V model.
14. What is SQL. SQL queries, databases like MySql, SQL Server, Oracle etc...
15. About the Bug life cycle, and stages in Bug life cycle.
16. What is CMM. How many levels are there in CMM.
17. What is scenario based testing? What are Test scenerios.
18. What is the difference between retesting and rerun?
19. What are the various test results? ex: Pass, Fail, Blocker etc...
20. What is ETL, Dataware house.
21. Have you ever worked in any automation testing tool. If answer is "Selenium", which framework you used? Which tool you used? Have you used TestNG? What are the shortcut keys for debugging?
22. How do you check redirected URL of each webpages?
23. What is database testing?(Just a definition).
24. What is the entry and exit criteria mean of a project?




Real time scenario
1. If user logged an issue, and developer has fixed that. After fixing of that issue, retesting of issue has to be done by the tester, but issue can not be retest on 3rd step. then that TC would be blockage or fail?

2. Write some scenarios to test Whats app or any chat messenger.