Q. Jenkins

Integrate Automation framework with Build using Jenkins. ‘Jenkins’ is a tool which is used for continuous integration testing. Please follow the below steps to configure the Jenkins with your Automation Framework- Step1- click on this link :http://jenkins-ci.org/...

read more

Q. Roles and Responsibilities of a tester

Identify Test cases for Automation. Developing methods for repeating steps. Writing scripts, executing test cases and debugging. Prepare automation scripts in Selenium WebDriver. Designing Automation Framework and Implementing Automation Framework. Regression Testing,...

read more

Q. Manual Test cases for Pen

Write Test Cases of Pen Start from here- 1st we need to understand the requirement against which pen was created. Our test scenarios should be based on these factors like – type of pen (ball point, ink or felt tip), functionality of the pen, Compatibility,...

read more

Q. Agile Methodolgy

Agile development model is also a type of Incremental model. Software is developed in incremental, rapid cycles. This results in small incremental releases with each release building on previous functionality. Advantages- Customer satisfaction by rapid, continuous...

read more

Q. SDLC (Software development life cycle)

SDLC-(Software development life cycle)- SDLC are the different stages of developing a software or it is a step by step procedure to develop a s/w. 1-Requirement → 2-Feasibility study → 3-design (high level design, low level design) → 4-coding → 5-testing →...

read more

Q. STLC-(Software test life cycle)

STLC-(Software test life cycle)-  It is a step by step procedure to test a software. It consists of all the different phases or stages of testing the application and it is a part of SDLC. It consists of various phases- System Study → Test Plan → Test Cases → RTM/CRM →...

read more

Q. BLC/DLC-(Bug/defect/thread life cycle)

BLC/DLC-(Bug/defect/thread life cycle) : Bug Status [new/open] (TE) → [Assign](lead) → [fixed] (developer) → [Re-Test] (TE) as well as test the impacted area (regression in BLC) → if pass then [close] else if fail then [re-open] and again go to assign. As soon as we...

read more

Q. How to get the current date and time?

import java.util.*; class GetCurrentDateAndTime {    public static void main(String args[])    {       int day, month, year;       int second, minute, hour;       GregorianCalendar date = new GregorianCalendar();       day = date.get(Calendar.DAY_OF_MONTH);      ...

read more

Q. Factorial of a number

import java.util.Scanner; public class Factorial{     public static void main(String[] args){         Scanner in = new Scanner(System.in);         System.out.println("Enter the number whose factorial you want: ");         int n = in.nextInt();         int f =1;    ...

read more

Q. How to get the prime numbers between a given range?

import java.util.ArrayList; import java.util.Scanner; public class GetPrimeNumbers{     public static void main(String[] args){         Scanner in = new Scanner(System.in);         System.out.println("Enter a number from which you want prime number: ");         int p1...

read more

Q. Check if a number is prime or not?

A number is prime if it is not divisible by any other number except itself.  import java.util.Scanner; public class PrimeNumber{     public static void main(String[] args){         Scanner in = new Scanner(System.in);         System.out.println("Enter a number greater...

read more

Q. Check if a number is Armstrong or not.

A number is armstrong if the sum of the cubes of digit of number is equal to the number. ex- 407 = 4*4*4 + 0*0*0 + 7*7*7  import java.util.Scanner; public class ArmstrongNum{     public static void main(String[] args){         Scanner in = new Scanner(System.in);    ...

read more

Q. Floyd Triangle

Floyd Triangle is like 1 2 3 4 5 6 7 8 9 10 ------------ Code- import java.util.Scanner; public class FloydTriangle{     public static void main(String[] args){         Scanner in = new Scanner(System.in);         System.out.println("Enter the number of rows which you...

read more

Q. How to reverse a String or Palindrome of String?

import java.util.Scanner; public class PalindromeString{     public static void main(String[] args){         Scanner in = new Scanner(System.in);         System.out.println("Enter the string which you want to check whether that is palindrome or not: ");         String...

read more

Q. Linear Search

import java.util.Scanner; public class LinearSearch{     public static void main(String[] args){         Scanner in = new Scanner(System.in);         System.out.println("Enter the size of the array which should be greater than zero else it will throw...

read more

Q. Binary Search

import java.util.Arrays; import java.util.Scanner; public class BinarySearch{     public static void main(String[] args){         Scanner in = new Scanner(System.in);         System.out.println("Enter the size of the array which should be greater than zero else it...

read more

Q. Addition of Matrix

import java.util.Scanner; public class AddMatrix {     public static void main(String[] args) {         Scanner in = new Scanner(System.in);         System.out.println("Note: Rows and columns number for both matrix should be same then only it can be added.");        ...

read more

Q. How to check String array is sorted or not?

import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class SortString {     public static void main(String[] args) {         Scanner in = new Scanner(System.in);         System.out.println("Enter the inputs name and when you want to...

read more

Q. Identify a number is well ordered or not?

Note- A number is well ordered if all digits are in ascending order ex- 123456789. Not well ordered number - ex- 2341 (because here 1 is coming after 4 so it is not well ordered.) Code- import java.util.ArrayList; import java.util.Arrays; import java.util.List; import...

read more

Q. Multiplication Of Table

import java.util.Scanner; public class MultiplicationOfTable{     public static void main(String[] args){         Scanner in = new Scanner(System.in);         System.out.println("Enter a number whose table you want: ");         int n = in.nextInt();                 ...

read more

Q. Verify a number is Even/Odd

import java.util.Scanner; public class EvenOdd{     public static void main(String[] args){         Scanner in = new Scanner(System.in);         System.out.println("Enter a number which you want to check whether that is even or odd");         int n = in.nextInt();    ...

read more

Q. Method overloading

Method Overloading         Developing the same method with different argument list is called as method overloading. The argument list should differ in either of below 3 ways- Type of arguments should be different. Number of argument should be different. Position of...

read more

Q. Constructors, and basic concept of java file.

How to save a java file-          A java file/program can have number of classes and we can save the file with any of the class name. The compilation will go fine and compiler will create the class file for all the classes in the program.          Now one can run any...

read more

Q. Explanation about class execution in Java.

Explanation of Java class execution- When java class is executed, the following steps will happen- Memory gets allocated for the execution. The allocated memory is divided into stack area and heap area. stack is an implementation of first in and 1st out, which is used...

read more

Q. Static, non-static members, object and class

*Actual way of calling static members (variables and methods) is className.staticMemberName. ex- 1) public class StaticMembers {     public static void main(String[] args) {         System.out.println("## program starts ##");         System.out.println("Addition of...

read more

Q. Variable in Java

Program is a collection of 1) data(variables) 2) methods (operation). What is the variable ? Ans- Variable is used to store data, such as a number, or a string of characters. Basically it is used to store some value(Data). Ex- int i = 5; So here i is a variable which...

read more

Q. Installation of JDK

Installation of JDK- go to Google - download latest version of JDK and install it. http://www.oracle.com/technetwork/java/javase/downloads/index.html After installation, go to -> my computer -> C drive -> program files(x86)/program files -> search for Java...

read more

Q. Understanding Core Java

Why selenium ? It can be used for many OS (almost all the OS). Supports many programming language. Ex- Java, Python, C# and Ruby etc. It's an open source as well as very effective. Test script execution is much faster than QTP. Easy to learn and understand. What is...

read more

Q. Use of all locators

import java.util.List; 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; public class AllLocators {     public static void...

read more

Q. Login Logout Yahoo

Here is the code to login and logout in yahoo.com. Here its fetching the userid and password from excel sheet. import java.awt.AWTException; import java.io.FileInputStream; import java.io.IOException; import java.util.concurrent.TimeUnit; import...

read more

Q. Login/logout scenario for linkedin

Please give the your user id and password in highlighted place. 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; import...

read more

Q. Substrings of a String

import java.util.Scanner; public class SubStringOfString{     public static void main(String[] args){         Scanner in = new Scanner(System.in);         System.out.println("Enter the string for which you want substring: ");         String s = in.next();             ...

read more

Q. Use of Actions class

public class ClickCnChildMenu{     public static void main(String[] args) {         WebDriver driver=new FirefoxDriver();         driver.get("http://new.mypomanager.com/Account/Login");         driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);        ...

read more

Q. How to switch to window then frame?

This is to login for HDFC credit card. import java.util.Iterator; import java.util.Scanner; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class...

read more

Q. How to handle multiple windows?

import java.util.Iterator; import java.util.concurrent.TimeUnit; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class Naukari {     public static void main(String[] args) {         WebDriver driver = new FirefoxDriver();...

read more

Q. How to scroll down and up in any web page?

Note- window.scrollBy(forUp,forDown). Here in this method forUp, you can give any value depends on how much you want to scroll up but before that you have to scroll down so that there would be some space to scroll up. Ex-  import java.util.concurrent.TimeUnit; import...

read more

Q. How to use dragAndDrop() method?

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; import org.openqa.selenium.interactions.Actions; public class Dropdrag {...

read more

Q. WebDriverWait

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; import org.openqa.selenium.support.ui.ExpectedConditions; import...

read more

Q. Static Block

Main method will always execute, after execution of all the static blocks which are there in the class. Ex- public class StaticBlock{     public static void main(String[] args){         System.out.println("Main method will always execute, after execution of all the...

read more

Q. How to upload the file?

import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class FileUpload {     public static void main(String[] args) {         WebDriver driver = new...

read more

Q. How to delete cookies?

import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class Cookies {     public static void main(String[] args) {         WebDriver driver = new FirefoxDriver();         driver.get("https://www.google.co.in/");        ...

read more

Q. How to handle alert pop-up?

First switch the control to alert pop then accept or dismiss the alert according to your requirement. Then again switch back to main page to perform other operations. Below are the steps- WebDriver driver - new FirefoxDriver();...

read more

Q. How to handle frame?

Switch to window then frame then again switch back to frame and window. (complex example) Note- Please do the manual steps first and see how the flow going then try with the script. Manual Steps- 1) open google 2) type in search box 'times of india' 3) click on 1st...

read more

Q. How to handle calendar popup or date picker?

Note- 1st click on the calendar button then click on the date which you want to select. Here in the below example, it will always select the current date , you can pass any date which you want to select as per your requirement.  import java.util.Calendar; import...

read more

Q. How to type in next line in a text box?

Note- use \n to move the control to next line. ex- 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; public class TextBox...

read more

Q. How do you handle https website in selenium ?

By changing the setting of FirefoxProfile.   ex- public class HTTPSSecuredConnection {             public static void main(String[] args){                         FirefoxProfile profile = new FirefoxProfile();                        ...

read more

Q. How to print Alphabets?

public class PrintAlphabet{     public static void main(String[] args){                  for(char i='a'; i<='z'; i++){             System.out.print(i+", ");         }         } } Output a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z,...

read more

Q. Transpose of Matrix

import java.util.Scanner; public class TransposeOfMatrix {     public static void main(String[] args) {         Scanner in = new Scanner(System.in);         System.out.println("enter the number of rows: ");         int r = in.nextInt();        ...

read more

Q. How to automate captcha?

Captcha which could be automated. 1- Captcha which could be automated-This is the example from-  http://www.indianrail.gov.in/pnr_Enq.html import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import...

read more

Q. SVN(Sub Version) -Test Script repository

SVN is a repository (Test Script repository). Usually SVN server is installed in lab server and to this server, Access will be given to Automation Test Engineer. Steps to download SVN server-Step1- open this link - http://www.visualsvn.com/server/download/ Step2-...

read more

Q. How to swap numbers without using 3rd variable?

import java.util.Scanner; public class Swapping{     public static void main(String[] args){         Scanner in = new Scanner(System.in);         System.out.println("Enter the 1st number: ");         int x = in.nextInt();         System.out.println("Enter the 2nd...

read more

Q. Automation Test Life Cycle (ATLC)

Automation Test Life Cycle (ATLC) Following steps are followed in an Automation Process → Test Tool Selection → Define scope of automation → Planning, Design and development → Test Execution → Maintenance Test tool selection Test Tool selection largely depends on the...

read more

Q. How to use ‘Groups’ in TestNG?

import org.testng.annotations.AfterGroups; import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; public class GroupsInTestNG {     @BeforeGroups({"secondGroup","firstGroup"})     public void executeBeforeGroup(){        ...

read more

Q. How to add TestNG to the project?

1) Go to eclipse. 2) Help 3) Eclipse Marketplace 4) In Find, search for TestNG 5) Install 'TestNG for Eclipse' 6) Then Right click on your project and Navigate to Build Path then click on Add Libraries 7) Select TestNG and click on next and finish it. 8) That's all....

read more