Interview Questions

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Which status codes do you use in your api?

2XX - means successful request and response 4XX - means a client error 5XX - means a server error

How do you handle scroll down in Selenium?

Actions class has page up and page down keys. It also has moveToElement() method which will scroll down until the webElement is visible. Javascript executor also has some methods for scrolling like window.scroll() method and the scrollIntoView method. js.executeScript("arguments[0].scrollIntoView(true)", element);

What does API stand for?

Application Programming Interface

Tell me about your agile ceremonies

Grooming - give points to US Sprint Planning - US prioritize, plan, pick, assign Daily Standup - (time start?, who's involved? how long does it last?) Retro - What went well? What can we improve? Fill out an excel sheet. Everyone speaks Demo -

What do you do while developers are working on the scenarios?

I read through the documentation, taking notes on anything that needs clarification, I then write test steps in the feature files from the end users perspective for the steps I will take when the developers have finished their scenarios. If I am able to complete these before the devs are finished, there is always work to be done in the backlog, or bug tickets of a lower priority/severity that were not completed that I can work on.

How do you handle synchronization issues?

Implicitly wait will wait a specified amount of time to locate any and all webelements in the code. Explicitly wait must create an object and use methods from that object to give conditions on what to wait for, such as 'invisibility of', 'visibility of', or 'title contains'. WebDriverWait wait = new WebDriverWait(Driver.getDriver(), 10) wait.until(ExpectedConditions.visibilityOf());

Why do you use singleton design?

Instance control: Singleton prevents other objects from instantiating their own copies of Singleton object, ensuring that all objects access the single instance. It also saves memory because only one object is created.

What is the most complex test case you wrote?

Most of my test cases are similar in nature and not overly difficult to write. I did have to write an end to end test case in which I wrote in information to create a new student in a class module, sent a post request through API, asserted the outcome, checked the database for the same outcome, checked the response in the API and then asserted it in the UI as a new student. It's not that its too complex, it's just something that we don't do often and can become more time consuming.

Can you locate a webelement by text using css selector?

No. If you wanted to locate using a webelements text, a custom xpath would have to be written.

OOP concepts in Java and how are you using them in your framework?

OOP stands for object oriented programming that organizes software design around data/objects rather than functions and logic. Encapsulation - protects information by preventing direct access to it. Indirect access can be controlled in the way we want the info to be used or read. We use the private access modifier on the variables and a public getter and setter method to give indirect access. Our driver class uses a private constructor to restrict access to it and we call it using a getDriver method. Inheritance - Inheritance is one sub class acquiring properties of another class(super class). It helps save time by writing code once in the parent class and inheriting that code in the child class to be used. I use inheritance with testbase classes to inherit BeforeAll annotations to establish a connection with the API and run reusable methods that will be needed for all child classes like requirement/request specification methods. Polymorphism - Allows one object to have many forms, which can happen through the reference. (reference of itself, reference of any superclass, reference of any interface being implemented). We can downcast our driver to take a screenshot in our hooks class, or to javascript executor to gain access to the scroll methods it offers. The browser types in Selenium use polymorphism with the webdriver interface. Abstraction - is data hiding. Its handling complex code by hiding the details from the user. A good example of this is the feature files in the framework. They do not show the java implementation of the code, those are hidden in the step definitions. Another example is implementing interfaces. Variables and methods can be run without seeing their implementation from the interface. There is also the abstract keyword, which allows methods to be written without implementation and, when called, new implementation can be added to the abstract method.

What dependencies do you use in your framework?

Selenium-Java, Maven-surefire-plugin, Cucumber-Junit, Cucumber-Java, Reporting-plugin

What do you do when you find a bug?

There are a few conditions that will change my answer to this. - First and foremost, I need to be sure that what I have found really is a bug. I want to make sure that I can duplicate the result reliably and I want to double check the documentation to ensure the expected and actual results do not align. - Once I have confirmed this, I will create a bug ticket with a helpful title, a brief but clear description of what is occuring, the expected/actual result, the environment it was found in, and reproducible steps to create the bug with evidence (screenshots or a screencast).

Tell me about a challenge while running the regression suite?

There was a failed test that was assigned to me. It was written by another QA from a long time ago. The failure messages weren't helpful, the conventions we use now were not in place then. It was a challenge to understand what the code was testing and how it was doing so. Normally, I'd go to the QA who wrote it to ask them for some help but they no longer worked at our company.

What selenium webdriver methods do you use?

get("URL") getText() getAttribute() close() quit() navigate().refresh() navigate().back()

What is important in creating a PR?

- A title that clearly defines what the PR is for. - A description of what was done in the PR. (Automation, bug - fix, change of value, etc) - Link the task/US that is connected with the PR.

What information should be in a bug report?

- Brief title - A short description of the bug - environment information - expected outcome - actual outcome - understandable and reproducible step by step instructions on how to reproduce the bug. - Severity and Priority

How can we locate elements using their parent/child in xpath?

/ will take us to the direct child. ex( //tagName[@attribute='value']/directChildtag /.. will take us from child to parent

Difference between == and equals?

== checks to see whether two objects share the same spot in memory while .equals() checks to see if two things are literally the same (so long as you override the .equals() method)

What makes a good test case?

A good test case is easily understandable and, by following its steps, can be successfully tested according to its documentation requirements.

How do you handle a dropdown menu?

A select drop down needs to have a select class object created. Syntax: Select select = new Select (driver.findElement(By Locator)); Then, I can use the Select object with methods that come from the select class. select.selectByValue("Value of attribute") or selectByIndex or selectByVisibleText

How do you use actions class in Selenium?

An actions class object needs to be created to call the actions methods. Actions actions = new Actions (Driver.getDriver()); from there, we can call methods and chain them together to perform advanced mouse and keyboard options. actions.doubleClick(link).perform();

Difference between testNg and Junit?

Both allow us to run test cases. Junit has more features built in, like providing an html report, it allows parallel testing, and is easy for parameterized testing. TestNG can also sequence its order in which it runs.

Difference between unboxing and autoboxing?

Both have to do with wrapping data from form to another (primitive to object or vice versa). Autoboxing is taking primitive data and wrapping it into Object type. Unboxing is taking Object types and wrapping them into primitive type.

difference between class and objects in JAVA?

Class is a blueprint or 'plan' for objects. An object is an instance of a class and will contain all of its methods and variables. Class is declared with the class key word. Objects are created with the new keyword . There is no memory allocation during class creation. Memory is allocated during object creation.

What is the difference between collection and collections?

Collection refers to the interfaces that collect multiple objects into one. Lists, Sets, Queues. Collections is a utility class providing static methods for working with collections. Example. Collections.sort(names)

What is your main responsibility as a QA?

Complete my sprint automation user stories, maintain the daily smoke test, regression testing before release, helping with pull requests, participating in scrum ceremonies

How do you connect your configuration properties file to configuration reader?

Config.properties is just a file that holds keys and values. The configuration reader is in the utilities folder. You first create a private static properties object. Then, in a static block, run the try/catch block. In the try portion, FileInputStream file = new FileInputStream("config.properties"); Then create a public static getProperty method public static String getProperty(String keyword) { return properties.getProperty(keyword);}

How to find data in a web table?

Create a custom locator using xpath. We start locating the <table> element and we go one by one to reach the data we want to find. tr = table row th = table header td = table data ex: //table[@id='table1']//tr *this returns all of the rows inside of table 1

How many environments do you have and which environments do you test?

Dev, QA, Staging, and Production environments

What is a test case?

Documents we create from acceptance criteria. These are the steps that we follow in testing, both manual and automation testing.

How do you handle alerts?

HTML alerts can be inspected and use locators like any other webElement. A Javascript alert will block our page until we tell selenium to focus on the alert. We will switch our driver focus to the alert Alert alert = driver.switchTo().alert(); from there, we can use the alert methods to accept, dismiss, or sendkeys to an alert (info, confirmation, or prompt)

What is hard assert vs soft assert

Hard assertion will not continue with tests when it finds an assertion error. Soft assertion continues with tests even if assertions fail in the middle/beginning

How do you take a screenshot in your framework?

I have a teardown scenario in my hooks class to take a screenshot of each failed scenario. I use scenario class to get certain information from the current scenario such as the name and condition. I downcast my driver type to TakesScreenshot interface and use method getScreenshotAs to store my screenshot in an array of bytes. I attach my screenshot into the report using scenario class object and attach method.

What is your locator strategy/approach?

I will inspect the page to locate the web element and examine its tags and available locators. I will then refresh the page, checking to see if the webelement is dynamic. If it is not, I will use 'id' if it has one as those must be unique. If it has a link, i will use 'linktext' locator. If the above is not applicable, I am comfortable creating my own custom locator using xpath.

Abstract vs. Interface?

Interface can only make constant variables (public static final). A class can implement multiple interfaces. Interfaces can only have abstract methods. Abstract classes can have both implemented and abstract methods. A class can only inherit one abstract class

Feature files

Keywords - Feature Scenario Scenario Outline Given, When, Then, And, But

What are maven artifacts?

Maven artifacts are generated after a maven project build. jar, war, and other executable files. You may also be referring to maven coordinates, which are sometimes called maven artifacts. These are elements we use to identify the artifact. (version, classifier, packaging, etc)

How do you do parallel test execution?

Maven surefire plugin enables parallel testing and its settings can be changed depending on my needs/limitations. In order for my driver class to handle multi-threads, I wrap my WebDriver object with ThreadLocal that creates a copy of driver object per thread. Instead of using driver directly I use driverPool.get() method to get a driver instance from a pool of driver objects. This will provide me with as many drivers as the threads I am running. private static InheritableThreadLocal<WebDriver>driverPool= new InheritableThreadLocal<>(); instead of using 'driver' we use driverPool.get() instead of using driver = new ChromeDriver(), we use driverPool.set(new ChromeDriver()); instead of using driver == null, driverPool.remove();

How is your communication with PO, in what circumstances you communicate with them?

My PO is very friendly and we have a great working relationship, but I try to avoid communication with the PO if I can. They're very busy and have a lot to juggle. It's my responsibility to solve problems. I have a QA lead I can speak to, I can talk to the devs when it applies. I would only go to the PO if there is something that seems critically wrong with the documentation or application.

Does testNG support parallel testing by default?

No. You need to explicitly configure it using a testNG xml configuration file. You set the parallel attribute in the suite tag and then determine the thread count needed. <suite name = "Test Suite" parallel="methods" thread-count="5"

How did you authorize your request in your application? What happens if you don't authorize?

One of the internal projects I worked on used BASIC AUTH, we just provided the username and password for each request to make an authorized request. Most of the projects I worked on use Bearer token with JWT in Authorization header. I have endpoint that I can use to generate this token and pass it to each request in my test. When the credentials are not provided --> 401 When the credentials do not have authorization --> 403

What are the packages in your framework?

Pages, Runners, Step Defs, Utilities

Tell me about Regression/Smoke test

Regression is run before a release, usually every three or four sprints. It involves testing the entire testing suite for the application, including the manual tests. Smoke testing is done on a daily/nightly basis. Its purpose is to ensure that the environment is stable for the days work. It is not an encompassing or extensive test.

API dependencies

Rest-assured, junit.jupiter, jackson.databind, project lombok, jsonschemavalidator

What is the difference between SOAP and REST?

SOAP only uses xml and can take post requests. REST can use both xml and json format, json being the most common. REST can take get, put, patch, and delete requests as well.

How do you handle multiple windows using selenium?

Selenium creates window handles for each window/tab which is an alphanumeric key. the getWindowHandle() method can be used to get the current window handle and it can be set as a variable to be read. All window handles can be gathered using the getWindowHandles() method and putting them in a Set<String>. Then, using a for each loop, we can switch to the window handle we are

String vs StringBuilder vs StringBuffer

String builder is mutable. It's an object that represents a sequence of characters. It is not synchronized. You create a stringbuilder with a new keyword. StringBuilder sb = new StringBuilder("Wooden Spoon"); StringBuffer is much the same as stringbuilder but it is synchronized (thread safe).

Default vs Protected in java

The access level of a default modifier is only within the package. It cannot be accessed from outside the package. The access level of a protected modifier is within the package and outside the package through the child class.

Tell us about your testing process?

The testing process starts at the beginning of the sprint: - Analyze the user stories. the acceptance criteria - Create our test cases, both positive/negative - create a test plan - Test execution - Manually test and pass with no bugs - Start the automation process

How would you get all links on the website using selenium?

To locate all links, I would create a List of webelements by searching for all tagnames 'a' (a tags contain links). syntax: List<WebElement> listOfLinks = driver.findElements(By.tagName("a")); to print them each out, I could make a for loop and for each webElement in the list of webElements, I could as the loop to print out the text using the .getText() method. syntax: for(WebElement each : listOfLinks){ sout("Text of links:" + each.getText());

What does scrum master do in your project?

To make sure we are following the scrum methodologies To make sure we are on task and on time to complete tickets by the sprints end.

How do you handle exceptions?

Try/catch blocks handle exceptions. The try block is the code being executed, which could cause an exception to occur. The catch block is the code that should be run if the defined exception occurs

What is the Maven lifecycle?

Validate: This step validates if the project structure is correct. For example - It checks if all the dependencies have been downloaded and are available in the local repository. Compile: It compiles the source code, converts the .java files to .class, and stores the classes in the target/classes folder. Test: It runs unit tests for the project. Package: This step packages the compiled code in a distributable format like JAR or WAR. Integration test: It runs the integration tests for the project. Verify: This step runs checks to verify that the project is valid and meets the quality standards. Install: This step installs the packaged code to the local Maven repository. Deploy: It copies the packaged code to the remote repository for sharing it with other developers.

When do QA starts testing?

We start testing when the requirements are defined. - We read the requirements, checking for understanding and clarifying any issues. - Test scripts manual/automated are then written and executed

What is the difference between assert and verify?

When an assertion fails, the test fails and stops execution at that point. this is why we have a soft assertion option. When verification fails, test keeps running till the end and the errors are reported at the end.

How do you handle pagination?

When applications divide a large set of data into smaller pages and use things like page size, next page, previous page, etc. Locate the pagination controls (next, previous, etc), after navigating to a page, retrieve the desired content, repeat the process using a while loop. Loop can be broken if 'next' button is null.

How do you connect the pages in your page object model to your automation tests?

When we create a class as a page meant to be used for the POM, we need to create a constructor for the class. PageFactory(from selenium library).initElements(Driver.getDriver(), this) The constructor will initialize the elements on the POM page and then can be used in your selenium test.

Difference between the stack and the heap memory in JAVA?

Whenever an object is created, it is stored in the heap memory. The heap memory also contains the string pool. The stack memory contains references variables in the heap. Stack memory is short lived

How do you handle dynamic tables?

Write custom locators using xpath. We start by locating the table element and go one by one to reach the data we want to find. We stay away from index numbers because they change in a dynamic table. We must find the static part of the data to locate the dynamic part. ex: Email, phone number, id number, etc. From there, we can move left or right of the static cell to find the info. Using preceding-sibling:: td[1] or following-sibling::td[1]

What is the difference between driver.close() and driver.quit()?

driver.close() method will close the current tab/window that the browser is focused on. driver.quit() will close all the windows that were opened for the test and no further lines of codes will be executed.

What are the differences between findelement() and findelements() methods?

findElement() method will return a webElement and will throw a NoSuchElementException if it cannot find a web element with given locator. findelements returns a list of webelements List<WebElement> and will not throw an exception if it can't locate an element.

What is the difference between http and https?

http is hypertext transfer protocol https is hypertext transfer protocol secure https is more secure. These websites use data encryption whereas http does not.

How do you handle iframes?

iFrames are html within html. Selenium will not be able to locate the iframe or any webElements within because its focus is on the base html. So we have to switch our drivers focus to the iframe. Syntax: Driver.getdriver.switchTo().frame(locate web element)

What is the difference between isSelected() and isEnabled() methods and isDisplayed()?

isDisplayed() method will return a boolean if the webElement is shown on the page. isEnabled() method will return a boolean if the webElement is clickable/interactable isSelected()method will return a boolean if the webElement has been selected

Cucumber runner class options

plugins: determines what type of report we want to generate with our project and also where we want to store it. features: provide the path of the features directory and let our project know where to find all the feature files. glue: glue gives path to the package of the step_definitions dryrun: determines if we want to execute the step_definitions or not. if dryrun is true, step defs will not run. it will generate snippets. tags: allow us to create different scenario suites or groups to run

What is cURL?

stands for client URL, is a command line tool for making http request. It lets you talk to a server by specifying the location and the data you want to send. cURL runs on almost every platform


Set pelajaran terkait

Final topics - Concept of Family

View Set

Prin. of Marketing Exam 3 - Chapters 10-14

View Set

fundamentals potential questions

View Set