Software Testing Important Interview Question for Fresher and Experience Candidates

Software testing play vital role in software industry find bugs and error before launch software in market.

There is still lot of demand for people with skills relevant to manual testing. Number of MNC Company hire fresher BE/BTECH/MSC/MCA/BCA candidate for software testing with 3 to 4 LPA. This blog help you Build career in software testing. There are all questions important for interview preparation. We also post lot of vacancy in our website www.campusjobs4u.com.


Two main type of testing

1. Manual Testing. (2 LPA to 5LPA)

2. Automation Testing.(3.50 LPA to 7 LPA)

Let’s begin by taking a look at the most frequently asked Automation Testing Interview Questions.

Automation Testing Frequently ask and Very Important Interview Questions and Answer Download Now Only at 21 Rs  and Manual Testing 30 Rs + Free Job Updates still placement 


Automation Testing PDF      Download Here 

Manual Testing PDF             Download Here 


Sample Question 👇

Ques 1) What are the annotations used in TestNG ?

Ans: @Test, @BeforeSuite, @AfterSuite, @BeforeTest, @AfterTest, @BeforeClass, @AfterClass, @BeforeMethod, @AfterMethod.


Ques 2) How do you read data from excel ?

FileInputStream fis = new FileInputStream(“path of excel file”);

Workbook wb = WorkbookFactory.create(fis);

Sheet s = wb.getSheet(“sheetName”);

String value = s.getRow(rowNum).getCell(cellNum).getStringCellValue();


Ques 3) What is the use of xpath ?

Ans- it is used to find the WebElement in web page. It is very useful to identify the dynamic web elements.


Ques 4) What are different types of locators ?

Ans- There are 8 types of locators and all are the static methods of the By class.

By.id(), By.name(), By.tagName(), By.className(), By.linkText(), By.partialLinkText(), By.xpath, By.cssSelector().


Ques 5) What is the difference between Assert and Verify?

Ans- Assert- it is used to verify the result. If the test case fail then it will stop the execution of the test case there itself and move the control to other test case.

Verify- it is also used to verify the result. If the test case fail then it will not stop the execution of that test case.


Ques 6) What is the alternate way to click on login button?

Ans- use submit() method but it can be used only when attribute type=submit.


Ques 7) How do you verify if the checkbox/radio is checked or not ?

Ans- We can use isSelected() method.

Syntax -

driver.findElement(By.xpath("xpath of the checkbox/radio button")).isSelected();

If the return value of this method is true then it is checked else it is not.



Ques 8) How do you handle alert pop-up ?

Ans- To handle alert pop-ups, we need to 1st switch control to alert pop-ups then click on ok or cancle then move control back to main page.

Syntax-

 

String mainPage = driver.getWindowHandle();

Alert alt = driver.switchTo().alert(); // to move control to alert popup

alt.accept(); // to click on ok.

alt.dismiss(); // to click on cancel.

//Then move the control back to main web page-

driver.switchTo().window(mainPage); → to switch back to main page.


Ques 9) How do you launch IE/chrome browser?

Ans- Before launching IE or Chrome browser we need to set the System property.

 

//To open IE browser
System.setProperty(“webdriver.ie.driver”,”path of the iedriver.exe file ”);
WebDriver driver = new InternetExplorerDriver();


 

//To open Chrome browser →
 System.setProperty(“webdriver.chrome.driver”,”path of the chromeDriver.exe file ”);
WebDriver driver = new ChromeDriver();


Ques 10) How to perform right click using WebDriver?

Ans- Use Actions class

 

Actions act = new Actions(driver);
 // where driver is WebDriver type
act.moveToElement(webElement).perform();
act.contextClick().perform();

 

Ques 11) How do perform drag and drop using WebDriver?

Ans- Use Action class

 

  Actions act = new Actions(driver);

  WebElement source = driver.findElement(By.xpath(“ -----”)); 

   //source ele which you want to drag

  WebElement target = driver.findElement(By.xpath(“ -----”)); 

  //target where you want to drop

  act.dragAndDrop(source,target).perform();


Ques 12) Give the example for method 

 overload in WebDriver.

Ans- frame(string), frame(int), 

 frame(WebElement).


Ques 13) How do you upload a file?

Ans- To upload a file we can use sendKeys() method.


driver.findElement(By.xpath(“input field”)).sendKeys(“path

 of the file which u want to upload”);


Ques 14) How do you click on a menu
item
 in a drop down menu?

Ans- If that menu has been created by 

using select tag then we can use the 

methods selectByValue() or selectByIndex() 

or selectByVisibleText(). 

These are the methods of the Select class.

If the menu has not been created by 

using the select tag then we can simply

 find the xpath of that element and click on that to select.


Ques 15) How do you simulate browser 

back and forward ?


 driver.navigate().back();

 driver.navigate().forward();


Ques 16) How do you get the current page
URL ?


driver.getCurrentUrl();


Download Now!! Frequently ask interview question and answer 👆