Monday, May 14, 2018

5 Famous Puzzles asked in QA Interviews

Puzzles asked in QA Interviews

1. How to cut a cake into 8 almost equal slices in three attempts?

2. You have two ropes and a lighter. Each rope has the following property: If you light one end of the rope, it will take one hour to burn to the other end. They don't necessarily burn at a uniform rate. How can you measure a period of 45 minutes?

3. There are 5 lanes on a race track. One needs to find out the 3 fastest horses among total of 25 horses. Find out the minimum number of races to be conducted in order to determine the fastest three

4. You pull out 2 balls, one after another, from a bag which has 20 blue and 13 red balls in total. If the balls are of similar colour, then the balls are replaced with a blue ball, however, if the balls are of different colours, then a red ball is used to replace them. Once the balls are taken out of the bag, they are not placed back in the bag, and thus the number of balls keep reducing. Determine the colour of last ball left in the bag.

5. There are 2 jugs with 4 ltrs and 5 ltrs of water respectively. The objective is to pour exactly 7 ltrs of water in a bucket. How it can be achieved?

Sunday, May 13, 2018

Questions Asked in Interview for Automation Testing Engineer?

Questions Asked in Interview for Automation Testing Engineer?

1. Difference between Throws and throw keyword.

2. How to get and verify the color of dropdown text with Selenium WebDriver.

3. What is Git Life Cycle ?

4. How to click on webelement present in Web Table cell ?

5. Difference between FindByElement and FindByElements ?

6. What is the difference between HashSet and HashMap ?

7. Write a program to verify Prime Number in java?

8. Write a program to print Prime Number between 50 to 100?

9. Write a program to print reverse of string?

10. Write a program to print duplicate number in an Array?

11. Write a program to remove duplicate characters from a String?

12. Write a program to calculate sum of number?

13. Write a program to check palindrome number?

14. Write a program to import data from excel sheet with TestNG @dataProvider? ( by using Apache poi).

15. How to generate Extent Report in TestNG?

16. How to execute only failed test cases with the help of TestNG Listeners - RetryAnalyzer?

17. What is the difference between Interface and Abstract Class ?

18. What is final keyword and Finally block? 

How to verify that Image has been loaded successfully or not with Selenium WebDriver?

How to verify that Image has been loaded successfully or not with Selenium WebDriver?

Solution:-

Today, i will share the way how we can verify that Image has been loaded successfully or not with Selenium WebDriver.

Here, class name is "Testing".

Lets first create the instance of WebDriver :

WebDriver driver;
System.setProperty("webdriver.chrome.driver", "C:/Users/User/Downloads/chromedriver/chromedriver.exe");
driver = new ChromeDriver();
Open the Webpage:
driver.get("http://www.seleniumstack.in/p/images.html");
Next, create a function "checkImageLoaded" to verify Image Load


public void checkImageLoaded(WebElement images) throws Exception{
 
HttpClient client = HttpClientBuilder.create().build();
 
HttpGet request = new HttpGet(images.getAttribute("src"));
 
HttpResponse response = client.execute(request);
  
 
if(response.getStatusLine().getStatusCode()!=200){
  
      System.out.println(images.getAttribute("alt"));

 }
}
Now, create the List of Image Elements of WebPage in main method and call "checkImageLoaded" function.

public static void main(String[] args) throws InterruptedException {

  Testing test = new Testing();
  
    WebDriver driver;

    System.setProperty("webdriver.chrome.driver", "C:/Users/User/Downloads/chromedriver/chromedriver.exe");

    driver = new ChromeDriver();
  
  List images = driver.findElements(By.tagName("img"));
  
  try {
   for(WebElement ImageElement : images){
   if(ImageElement!=null){
   test.checkImageLoaded(ImageElement);
    }
   }
  } catch (Exception e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
 }
That's all. Hope this helps you.

Thanks

Questions Asked in Interview for Manual Testing Engineer?

1. What is Boundary Value Analysis and Equivalence Partitioning ? 2. What is Responsive web design ? 3. What is Globalization Te...