Interview-IFocus

 




1st Round : Technical

Duration    : 30 mins

Total Questions : 15


1. Tell me about yourself.
      Ans: as explained.
2. Have you implemented any framework from scratch and explain the folder structure..           (interviewer is impressed by the answer)
     Ans: as explained.
3.  Arraylist and where you have used it in your scripts..
     Ans: 
Set<String> str3 = driver.getWindowHandles();
List<WebElement> elements=driver.findElements(By.tagName("button"));
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("profile.default_content_setting_values.notifications", 2);
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", map);
WebDriver driver = new ChromeDriver(options);
4. In my project I used hashmap for extent reporting.
4. How do you remove duplicate from arrayList.
     Ans: DEMO
5.  Can key be null in hashmaps
     Ans: yes, either key or value can be null. DEMO

6. What is Interface…

Ans: An interface in Java is a template/blueprint of a class. It has static constants and abstract methods.

       The interface in Java is a mechanism to achieve abstraction. There can be only abstract methods in the Java interface, not method body. It is used to achieve abstraction and multiple inheritance in Java.

 When you implement interface to a class the compiler indicates you have to implement the methods of interface in the child class. Thus Interface serves as a blueprint on what to be implemented in the class which implements it.

 7. Interface implementation in your project…….

Ans: Webdriver, WebElement are the interfaces most commonly used in a selenium project. You can give specific examples of your project.

8. Explain Webdriver statement and difference between different other webdriver statements..…

Ans: All the below are correct.

WebDriver driver = new FirefoxDriver();  [[[[Having a reference variable of type WebDriver allows us to assign the driver object to different browser specific drivers. Thus allowing multi-browser testing by assigning the driver object to any of the desired browser]]]]]

FirefoxDriver driver = new FirefoxDriver();

ChromeDriver driver = new ChromeDriver();

9. Exception and how you handled in your projects

Ans: NosuchElement found exception. Handled with the help of waits, sometimes refreshing the page.

Nullpointer exceptions… written try, catch statements to handle it and with the help of throws exception handling. 

10. Appium

Ans: No 

11. Multiple try and single catch…. Is it possible?

Ans: It is not possible.

single catch block for multiple try blocks a compile time error is generated.

error: 'try' without 'catch', 'finally' or resource declarations

try {

^

1 error

 12. RTM….

Ans: Discussed about requirement traceability matrix.

 13. Different Methods you have worked in API…

Ans: get,POST,PUT are the different methods that I have worked on.

 14. Difference between post and put

Ans: Calling the same PUT request multiple times will always produce the same result. In contrast, calling a POST request repeatedly have side effects of creating the same resource multiple times.

 POST means "create new" as in "Here is the input for creating a user, create it for me". PUT means "insert, replace if already exists“

 15. Token expired…….. how do you handle..?

Ans: In my project we have a script which will track the time when the token is created and if the time has passed it will generate a new token before executing another test.

This can vary from project to project you can mention how did you handle in your project in COMMENTS BELOW.

*****************************************************

**

   1. Difference between break and continue

Ans: DEMO

    2. Static… and when do you use it

Ans: The most important reason why static keywords are heavily used in Java is to efficiently manage memory. Generally, if you want to access variables or methods inside a class, you first need to create an instance or object of that class. However, there might be situations where you want to access only a couple of methods or variables of a class and you don’t want to create a new instance for that class just for accessing these members. This is where you can use the static keyword in Java.

    3. Final and finally

Ans: DEMO

final is the keyword and access modifier which is used to apply restrictions on a class, method or variable.

finally is the block in Java Exception Handling to execute the important code whether the exception occurs or not.

 

Final keyword is used with the classes, methods and variables.

Finally block is always related to the try and catch block in exception handling.

(1) Once declared, final variable becomes constant and cannot be modified.
(2) final method cannot be overridden by sub class.
(3) final class cannot be inherited.

(1) finally block runs the important code even if exception occurs or not.
(2) finally block cleans up all the resources used in try block

 

Final method is executed only when we call it.

Finally block is executed as soon as the try-catch block is executed.

It's execution is not dependant on the exception. 

     4. Order of class in testNG and how they are decided.

    Ans: <suite thread-count="2" verbose="10" name="testSuite" parallel="tests">
             <test verbose="2" name="MytestCase" group-by-instances="true">
                 <classes>
                 <class name="com.crazytests.dataproviderissue.TestClass1" />
                 <class name="com.crazytests.dataproviderissue.TestClass2" />
                 </classes>
              </test></suite>

5. API error codes.. what codes will be returned in case of negative tests for a login page…

Ans: I leave it to you, please mention your answers in the comments.


**************************************************

**************************************************

No comments:

Post a Comment