Core Java Questions for Automation testing

1)Difference between Static and Non-Static Members?
2)Diffence between Array and ArrayList?
3)How to achieve Multiple Inheritance in Java?
4)What is Polymorphism? What are the different types of   Polymorphism?
5)Diffence between Abstract Class and Interface?
6)What are the different kinds of Access Specifiers?Explain   their visibilty?
7)In which type of Collection Dupplicate values are not   allowed?
8)How to check whether two names or two Strings are equal or   not?
9)What are Annotations?What is the use of Annotations?
10) Why Multiple Inheritance is not supported in Java?
11)What are the different Annotations methods?


1.How to retrieve the data from XML for login page?write a script..

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              DocumentBuilder builder = factory.newDocumentBuilder();

              Document doc = builder.parse("D:\\login.xml");
              String un=doc.getElementsByTagName("un").item(0).getFirstChild().getNodeValue();
              String pwd=doc.getElementsByTagName("pwd").item(0).getFirstChild().getNodeValue();

2.I have 50 test cases out of which i need to run only 1 to 10 testcase how do u handle?

Use testing.xml
Select only 10 testNG class, right click and select convert to TestNG which creates testing.xml
with selected 10 testcases and run it


3.Write the code for retrieving data from database for login Page,where login page consists of Emailid textbox,Password textbox,Login & Reset Button.If password is wrong should reset,else should get login..

Please see the attached JDBC code for getting data from data base and pass them as arguments for the method which does the above steps

4.Write the script so that any textbox should not exceed more than 10 characters?
Question is not clear..

5.How do u automate widgets which changes every millisecond?

Use  explicit wait or jQuery or Java Scripts

6.How to automate videos?
 No possible

7.How to run the tests without a browser or with HTML unit driver in selenium webdriver?
WebDriver driver=new HtmlUnitDriver(true);
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.get("http://demo.actitime.com/login.do");
System.out.println(driver.getTitle());

8.How to run Selenium 1.0 tests in webdriver?

WebDriver driver = new FirefoxDriver();
WebDriverBackedSelenium selenium = new WebDriverBackedSelenium(driver, "http://demo.actitime.com");
selenium.open("/login.do");
selenium.type("name=username", "admin");

9.   How to convert selenium 1.0 tests to webdriver tests?
Same as above

10.   What is webdriver backed selenium?
Same as above



11.   When to use web driver backed selenium?
already code is written in selenium RC and want to use the same code in webdriver


12.   Which version of selenium IDE supports webdriver?
       2.3

13.   How to invoke an application in webdriver?
       WebDriver driver= new FirefoxDriver();
      driver.get(url);

14.   Which of Selenium IDE commands not supported in webdriver?
Nothing is supported

15.   where do u add test tacse
File->add testcase

16.   how do u connect database thro' selenium
No should use java code only

17.   how do u connect database thro' java
Please see the attached JDBC code for getting data from data base

18.   Explain about selenium architecture in your company
Explain the Frame work diagram

19.   How do you handle https website in selenium
       using RC or WebDriver

20.   How do you start selenium server


java -jar selenium-server-standalone-2.34.0.jar -role hub

Copyright © 2017 qatoolsguide.blogspot.com || ALL RIGHTS RESERVED