Interview Questions Revature

Ace your homework & exams now with Quizwiz!

Explicit Wait

in Selenium is used to tell the WebDriver to wait for certain conditions (expected conditions) or maximum time exceeded before throw "ElementNotVisibleException" exception. It is intelligent kind of wait, but it can be applied only for specified elements. WebDriverWait wait=new WebDriverWait(WebDriverReference,TimeOut);

Collection framework

a single unit of objects. It provides readymade architecture interfaces. It is optional. Interfaces (Set, List, Queue) Classes (ArrayList, Vector, LinkedList)

What main methods you will use for sets?

add(): this will add an element to the set contains(): this will return true if an element is inside of the set remove(): this will remove an element from the set addALLA(): this will add the unique elements from a collection to the set

What main methods you will use for Lists?

add(): this will add an object into the List get(): this will return the object stored at the index position given remove(): this will remove the object provided as an argument from the list size(): this will return the size of the List (# of elements in the List)

Action Class

an ability provided by Selenium for handling keyboard and mouse events. These events includes drag and drop; clicking on multiple elements with the control key and etc.

Stacks

are where methods and variables are stored

assertEqual() vs assertSame()

assertEquals() Asserts that two objects are equal. assertSame() Asserts that two objects refer to the same object. the assertEquals should pass and assertSame should fail, as the value of both classes are equal but they have different reference location.

Collection Interface

below them falls List queues and Sets which extends the collection interface and provides the behaviors implemented in the below classes

Abstract class

class can't be instantiated instance variable/access modifiers concrete methods allowed can only inherit one class

Collection hierarchy

consist of the collection interface at the top of the hierarchy

Interface

contract can't be instantiated public static final variables abstract methods normally (default/static allowed) can implement multiple interfaces

Implicit Wait

directs the Selenium WebDriver to wait for a certain measure of the time before throwing an exception. Once this time is set, WebDriver will wait for the element before the exception occcurs

Write code to send text to a username and login input via Selenium and then confirm the text made it

email.sendKeys("[email protected]"); password.sendKeys("abcdefghlkjl"); login.click(); System.out.println("Login Done with Click");

How to instantiate web elements in Java

initElements(): initElements is a static method in Page Factory class. Using the initElements method, one can initialize all the web elements located by @FindBy annotation....Below are locators that can be used: ClassName. CSS. Name. Xpath. TagName. LinkText. PartialLinkText.

Scope Creep

is Adding additional features or functions of a new product, requirements, or work that is not authorized.

Endurance testing

this is load testing over a long period of time: does your application still work as expected after a week or month of constant use? Sometimes problems won't reveal themselves until the application has been running or an extended period of time

Hallmarks of Agile process

Individuals and interactions over processes and tools Working software over comprehensive documentation Customer collaboration over contract negotiation Responding to change over following a plan

JUnit

A unit testing framework for the Java programming language

There are two types of XPath:

Absolute XPath Relative XPath

Agile vs waterfall

Agile and waterfall are two distinctive methodologies of processes to complete projects or work items. Agile is an iterative methodology that incorporates a cyclic and collaborative process. Waterfall is a sequential methodology that can also be collaborative, but tasks are generally handled in a more linear process.

DevOps and Agile

Agile emphasizes collaboration between developers and product management — DevOps includes the operations team. Agile centers the flow of software from ideation to code completion — DevOps extends the focus to delivery and maintenance.

Amazon Web Services (AWS)

Amazon Web Services (AWS) is one of the more popular cloud service providers in the world, and they have done an excellent job of making their cloud services easily accessible. They utilize a pay-as-you-use model, so that you only pay for the actual resources you use (think storage, computing power, database usage, etc.)

Absolute Xpath

An absolute xpath starts with the / symbol. One drawback with the absolute xpath is that if there is any change in attributes beginning from the root to the element, our absolute xpath will become invalid.

How to send information to elements using Java/Selenium

- in order to send information to elements within java/selenium, you can use the method called SendKeys(). The SendKeys() method allows you to identify the input fields using specific locators like the email and password field for example. But you can also enter values in input boxes using strictly SendKeys().

ArrayList vs LinkedList in Java

Array list and linked list are classes that all implement behaviors from list interfaces and hash sets linked hash sets and tree sets are classes that implement behaviors from sets interfaces

Continuous Deployment

CD (not to be confused with the CD above) is the process by which the entirety of your DevOps pipeline is automated: theoretically, a merge to the main branch of your central repository could, by automation, lead to an update in your production environment without anyone actually touching the source code, the production environment, the test environment, or anything in-between. Because this is such an all-encompassing practice, you typically won't see this implemented unless working on a well-established project that has had the manpower/time to set up the Continuous Deployment pipeline.

Continuous Delivery

CD is the process of implementing automation for steps 2-4: this can be any combination of automating these steps. This particular CD is the term used to describe a level of automation of the DevOps process that is not complete automation of the pipeline. This can be a useful practice if you are just starting work on a project because the time it takes to set up an automated DevOps pipeline can take away from the actual development work on the application. The more established the project is, and the larger the team working on it is, the easier it can be to make your Continuous Delivery practice more and more automated.

Continuous Integration

CI is the process of implementing the Source Code Control step of the develop pipeline. You've done this by using Github as a central repository for group work: this is implementing Continuous Integration.

Where are dependencies located in maven?

Central location. Maven is a code management framework that helps you keep track of dependencies, build targets, report, and documentation from central location which is the POM file. written in xml

Disadvantages of Agile

Critical path and inter-project dependencies may not be clearly defined as in waterfall There is an organizational learning curve cost True agile execution with a continuous deployment pipeline has many technical dependencies and engineering costs to establish

What is cucumber?

Cucumber is a Testing Framework that lets us define the behavior in a testing application. Cucumber lets us define the behavior in a testing application through an English-like language called Gherkin.

How is cucumber part of the automation process?

Cucumber is an automation tool based on Behavior Driven Development BDD which is used to write tests for a web application BDD is a software development process Cucumber is used to execute automated acceptance tests written in the "Gherkin in" language. Gherkin is a domain-specific language for behavior descriptions. Gherkin is business readable

OOP principles

Encapsulation - refers to the bundling of data with the methods that operate on that data. + it Makes sure the object only interacts with the object's public methods. Abstraction-the complexity of how the object works are are hidden Inheritance - subclasses can inherit properties and methods from a parent class. Polymorphism - The ability of an object to take on many different forms; specifically for a method with the same name to have many different implementations.

Advantages of Agile

Faster feedback cycles Identifies problems early Higher potential for customer satisfaction Time to market is dramatically improved Better visibility / accountability Dedicated teams drive better productivity over time Flexible prioritization focused on value delivery

Feature vs Scenario

Feature would describe the current test script which has to be executed. Scenario describes the steps and expected outcome for a particular test case

How did you keep track of work?

GitHub

GitHub Actions

GitHub Actions is a DevOps tool provided by GitHub that allows developers to control their DevOps pipeline all inside of GitHub. Continuous Delivery and Continuous Deployment are both achievable using this system.

§ How would you determine whether a number is even or odd?

If a number is evenly divisible by 2 with no remainder, then it is even. You can calculate the remainder with the modulo operator % like this num % 2 == 0 . If a number divided by 2 leaves a remainder of 1, then the number is odd. You can check for this using num % 2 == 1

Selenium waits

Implicit Wait Explicit Wait Fluent Wait

Joins

Inner Join Returns- that have matching values in both tables Left outer join -returns all records from the left table and the matched records from the right table Right outer join Returns all record from the right table and matched records from the left table Full outer join- returns all record when there is a matching either left or right side.

Interface vs abstract class

Interfaces are like "contracts" that give classes access to the variables and methods they contain: their methods default to public abstract, but interfaces can hold static methods, along with pre-defined methods that are intended to be overwritten.

Disadvantages of waterfall

It is harder to break up and share work because of stricter phase sequences teams are more specialized Risk of time waste due to delays and setbacks during phase transitions Additional hiring requirements to fulfill specialized phase teams whereas agile encourages more cross-functional team composition. Extra communication overhead during handoff between phase transitions Product ownership and engagement may not be as strong when compared to agile since the focus is brought to the current phase.

How would you generate a report of the tests?

JSON- is another format for generating cucumber tests reports The Testing will generate the default report. When you execute testing. xml file and refresh the project. You will get test-output folder in that folder for reporting in Testing. Right click on the emailable report. html and select the option.

Load Testing

Load testing, just one of many valuable testing methods you can use before release to ensure that your application is bug-free and runs seamlessly, is the process of testing whether an application can withstand the load of concurrent users, requests, and data volumes when in use. In other words, load testing is a must for determining if your applications can stand up to real-world use conditions.

Mockito

Mockito is a mocking framework, JAVA-based library that is used for effective unit testing of JAVA applications. Mockito is used to mock interfaces so that dummy functionality can be added to a mock interface that can be used in unit testing.

Performing Testing

Performance testing comes into play after you have validated that your application is functioning correctly. This kind of testing is not to check if things work or not (since you have already done this) but instead it is to check the capabilities of the application. This is what performance testing is all about. It consists of load testing, stress testing, spike testing, and endurance testing amongst others.

Maps

Stores values in a key/value pair and you could access them by their pair for example if you had a list of capital cities by State for example Texas would be key and Value would be Austin. Cannot use duplicate values.

example of polymorphism

Polymorphism uses extends of let's say we are creating a system for Products that has the variables of Product ID and price and we want to have two different type of products such as TV and Phones. We can Extend our product class to Phones and we can create a Phones which we want to add the attribute of Os, memory size, and screen size to the constructor which would be an example of overloading. Objects can behave in different ways depending on their context Method overloading is when you add different parameters to your Method overriding is when a child class changes the implementation of a parent class method

Advantages of waterfall

Requires less coordination due to clearly defined phases sequential processes A clear project phase helps to clearly define dependencies of work. Better focus on documentation of designs and requirements The design phase is more methodical and structured before any software is written

Testing Tools

Selenium, Maven, Postman, Gherkin, Cucumber, JUnit

Sets

Sets are useful for storing unique pieces of data does not maintain order unique elements only not indexable Hashsets are backed by HashMap Set<String>hashset= new Hashset<>(); Treesets maintain order; insertion(removal is slow be of ordering no nulled allowed. Set<string>treeSet = new TreeSet<>();

DevOps (Development and Operations)

Software Development and Operations (DevOps) is a methodology that tries to streamline and automate the development, deployment, and maintenance of code as much as possible. There are 5 general steps to the DevOps process: 1. Source Code Control this is the practice of storing your source code in a central repository accessible to all the developers/testers 2. Building and Testing Automation this is the practice of automating your unit tests as part of your DevOps pipeline and using your passing tests as a check before building your application. 3. Deploying to Staging this is the practice of taking your built application from the previous step and deploying it in a test environment for the purposes of doing your System tests (think E2E tests) 4. Acceptance Testing this is the practice of automating your integration/System tests in an environment that simulates the production environment as closely as possible 5. Deployment of Build this is the practice of moving your application to the production environment and starting it up DevOps and Agile When doing Agile development there are three terms typically used to describe how much/little of the DevOps pipeline has been automated: there is Continuous Integration, Continuous Delivery, and Continuous Deployment.

Collection API

The Collection API is a set of classes and interfaces that support operation on collections of objects. These classes and interfaces are more flexible, more powerful, and more regular than the vectors, arrays, and hashtables if effectively replaces. Example of classes: HashSet, HashMap, ArrayList, LinkedList, TreeSet and TreeMap. Example of interfaces: Collection, Set, List and Map.

@AfterClass

The annotated method will be run after all the test methods in the current class have been run.

@BeforeClass

The annotated method will be run before the first test method in the current class is invoked.

Why make something private

The private keyword helps us use a fully encapsuled classes. Using private will allow us to only be accessed in the class that in the class it's created in. You can achieve full encapsulation by using getter and setters

Relative XPath

The relative xpath starts by referring to the element that we want to identify and not from the root node

Best Selenium Locators

Using ID Locator in Selenium WebDriver is the fastest and the most reliable among all the locators. ID's are supposed to be unique to each element, making the ID locator as a dependable choice.

How to create a constant variable?

Variables can be declared as constants by using the "const" keyword before the datatype of the variable. The constant variables can be initialized once only. The default value of constant variables is zero.

Why make something public

We use the public keyword when we the variable to be accessed by other classes and methods outside of the class we created.

How would you protect data in a database?

You would protect your data in your database by getting penetration test done to ensure your site is not vulnerable to SQL injections. You would also want to ensure your data is held in a secure location and even whitelist certain IPs to be sure those are the only ones that are allowed access.

Page Factory

is a class provided by Selenium WebDriver to support Page Object patterns Testers use @FindBy annotation. The initElements method is used to initialize web elements. @FindBy: annotation used in Page Factory to locate and declare web elements using different locators

Page Object Model (design pattern)

is a design pattern in Selenium that creates an object repository for storing all web elements Also commonly used in Selenium for automating the Test Cases

Functional Testing

is a type of software testing that validates the software system against the functional requirements/specifications. The purpose of Functional tests is to test each function of the software application, by providing appropriate input, verifying the output against the Functional requirements. Functional testing mainly involves black box testing and it is not concerned about the source code of the application.

Feature File

is usually a common file which stores feature, scenarios, and feature description to be tested. The feature file is an entry point, to write, the cucumber tests and used as a live document at the time of testing

Heap

is where all objects are stored in memory as well as strings but they get a special allocation called a string pool

Exception Handling

java throws exceptions when they occur. If no code is provided to handle the exception it will go all the way to the JVM and the JVM will terminate the program. You can handle exceptions as the developer by using try/catch blocks, similar to if/else blocks. This is called handling. You can also "duck" or declare exceptions by adding a throws clause to your method signature. This allows you to throw checked exceptions without catching it in the method The exception handling fundamentals in Java revolve around the five keywords try, catch, finally, throw, and throws

how do you reverse a string

let string= abc let result; For (x=0; x<string.length; x++){ result=result + (string.length)-x) } print result

Fluent Wait

marks the maximum of time for Selenium WebDriver to wait for a certain condition (web element) becomes visible. It also defines how frequently WebDriver will check if the condition appears before throwing the "ElementNotVisibleException"

How would you print all odd numbers in a given range?

package com.candidjava.code; class OddNumber { public static void main(String args[]) { System.out.println("The Odd Numbers are:"); for (int i = 1; i <= 100; i++) { if (i % 2 != 0) { System.out.print(i + " "); } }

Stress testing-

very similar to load testing, this kind of test checks to see how your application can handle weird/unique situations, what if 1000 people tried to log in to the same account at the same time? What if 50 people try to buy the same item at the same time?

Constructors

{}, A constructor in Java is a special method that is used to initialize objects. The constructor is called when an object of a class is created. It can be used to set initial values for object attributes. In Java, a constructor is a block of codes similar to the method


Related study sets

Chapter 4 Types of life policies

View Set

Nucleotide/Nucleic Acids Sapling

View Set

ASE B6 - Damage Analysis (Glossary of Terms)

View Set

HIS 136 Fall 2019 Midterm Review

View Set

Replication, protein synthesis and mutation

View Set

23. Prejudice, Discrimination, and Stereotyping Quiz

View Set