Interview Questions And Answers

Interview Question & Answer

Explain the different types of specification based test design technique?

Specification based test design techniques are also referred to as blackbox testing. It involves testing based on the specification of the system under test without knowing its internal architecture. The different types of specification based test design or black box testing techniques are- Equivalence partitioning - Grouping test data into logical groups or equivalence classes with the assumpation that all the data items lying in the classes will have same effect on the application. Boundary value analysis - Testing using the boundary values of the equivalence classes taken as the test input. Decision tables - Testing using decision tables showing application\'s behaviour based on different combination of input values. Cause-effect graph - Testing using graphical representation of input i.e. cause and output i.e. effect is used for test designing. State transition testing - Testing based on state machine model. Use case testing - Testing carried out using use cases.

What are the different levels of the testing?

Testing can be performed at different levels during the development process. Performing testing activities at multiple levels help in early identification of bugs. The different levels of testing are - Unit Testing Integration Testing System Testing Acceptance Testing

Why should Selenium be selected as a test tool?

Selenium is free and open sourcehave a large user base and helping communitieshave cross Browser compatibility (Firefox, chrome, Internet Explorer, Safari etc.)havegreat platform compatibility (Windows, Mac OS, Linux etc.)supports multiple programming languages (Java, C#, Ruby, Python, Pearl etc.) has fresh and regular repository developmentssupports distributed testing
The suite package constitutes of the following sets of tools:
Selenium Integrated Development Environment (IDE) – Selenium IDE is a record and playback tool. It is distributed as a Firefox Plugin. Selenium Remote Control (RC) – Selenium RC is a server that allows user to create test scripts in a desired programming language. It also allows executing test scripts within the large spectrum of browsers. Selenium WebDriver – WebDriver is a different tool altogether that has various advantages over Selenium RC. WebDriver directly communicates with the web browser and uses its native compatibility to automate. Selenium Grid – Selenium Grid is used to distribute your test execution on multiple platforms and environments concurrently.
limitations of Selenium:
Selenium supports testing of only web based applications
Mobile applications cannot be tested using Selenium
Captcha and Bar code readers cannot be tested using Selenium
Reports can only be generated using third party tools like TestNG or Junit.
As Selenium is a free tool, thus there is no ready vendor support though the user can find numerous helping communities.
User is expected to possess prior programming language knowledge.

What are the testing types that can be supported by Selenium?

Selenium supports the following types of testing:
Functional Testing-unit , system
Regression Testing

Bug?

A bug is a fault in a software product detected at the time of testing, causing it to function in an unanticipated manner.

Explain bug lifecycle or the different states of a bug.

A bug goes through the following phases in software development-
New - A bug or defect when detected is in New state
Assigned - The newly detected bug when assigned to the corresponding developer is in Assigned state
Open - When the developer works on the bug, the bug lies in Open state
Rejected/Not a bug - A bug lies in rejected state in case the developer feels the bug is not genuine
Deferred - A deferred bug is one, fix of which is deferred for some time(for the next releases) based on urgency and criticality of the bug
Fixed - When a bug is resolved by the developer it is marked as fixed
Test - When fixed the bug is assigned to the tester and during this time the bug is marked as in Test
Reopened - If the tester is not satisfied with issue resolution the bug is moved to Reopened state
Verified - After the Test phase if the tester feels bug is resolved, it is marked as verified
Closed - After the bug is verified, it is moved to Closed status.

What is the use of testng.xml file?

testng.xml file is used for configuring the whole test suite. In testng.xml file we can create test suite, create test groups, mark tests for parallel execution, add listeners and pass parameters to test scripts. Later this testng.xml file can be used for triggering the test suite.

How can we set priority of test cases in TestNG?

Using priority parameter in @Test annotation in TestNG we can define priority of test cases. The default priority of test when not specified is integer value 0. Example-
@Test(priority=0)
@Test(priority=1)
@Test(priority=2)
@Test(priority=3)
@Test(priority=4)

What are some common assertions provided by testNG?

Some of the common assertions provided by testNG are- assertEquals(String actual, String expected, String message) - (and other overloaded data type in parameters) assertNotEquals(double data1, double data2, String message) - (and other overloaded data type in parameters) assertFalse(boolean condition, String message) assertTrue(boolean condition, String message) assertNotNull(Object object) fail(boolean condition, String message) true(String message)

What is Software Testing?

Software testing is the process of evaluating a system to check if it satisfies its business requirements. It measures the overall quality of the system in terms of attributes like correctness, completeness, usability, performance etc. Basically, it is used for ensuring the quality of software to the stakeholders of the application.

Why is testing required?

We need software testing for following reasons- Testing provides an assurance to the stakeholders that product works as intended. Avoidable defects leaked to the end user/customer without proper testing adds bad reputation to the development company. Defects detected earlier phase of SDLC results into lesser cost and resource utilisation of correction. Saves development time by detecting issues in earlier phase of development. Testing team adds another dimension to the software development by providing a different view point to the product development process.

What is Quality Assurance?

Ans. Quality assurance is a process driven approach which checks if the process of developing the product is correct and conforming to all the standards. It is considered as a preventive measure as it identifies the weakness in the process to build a software. It involves activites like document review, test cases review, walkthroughs, inspection etc.---verification

What is Quality Control?

Quality control is product driven approach which checks that the developed product conforms to all the specified requirements. It is considered as a corrective measure as it tests the built product to find the defects. It involves different types of testing like functional testing, performance testing, usability testing etc.---validation
Verification/static is the process of evaluating the artifacts as well as the process of software development in order to ensure that the product being developed will comply to the standards.Answers the question - \"Are we building the product right?\"/process-oriented.
Validation is the process of validating that the developed software product conforms to the specified business requirements.Answers the question - \"Are we building the right product?\"/Product-Oriented.
Software Development Life Cycle refers to all the activities that are performed during software development, including - requirement analysis, designing, implementation, testing, deployment and maintenance phases.
R-d-c-e-p-m:SDLC
r-plan-d-e-cs:STLC

Explain STLC - Software Testing life cycle.

Software testing life cycle refers to all the activities performed during testing of a software product. The phases include-
-- Requirement analyses and validation - In this phase the requirements documents are analysed and validated and scope of testing is defined.
-- Test planning - In this phase test plan strategy is defined, estimation of test effort is defined along with automation strategy and tool selection is done.
-- Test Design and analysis - In this phase test cases are designed, test data is prepared and automation scripts are implemented.
-- Test environment setup - A test environment closely simulating the real world environment is prepared.
-- Test execution - The test cases are prepared, bugs are reported and retested once resolved.
--Test closure and reporting - A test closure report is prepared having the final test results summary, learnings and test metrics.

What is a test plan?

A test plan is a formal document describing the scope of testing, the approach to be used, resources required and time estimate of carrying out the testing process. It is derived from the requirement documents(Software Requirement Specifications).
scope , inscope , dev , testers , requirements , test schedule , evnvironmant

What is a defect?

A defect is non-conformance with the requirement of the product detected in production (after the product goes live).

What are some of the bug or defect management tools?

Some of the most widely used Defect Management tools are - Jira, Bugzilla, Redmine, Mantis, HP Quality Center etc.

What is defect density?

Defect density is the measure of density of the defects in the system. It can be calculated by dividing number of defect identified by the total number of line of code(or methods or classes) in the application or program.
Low priority-Low severity - A spelling mistake in a page not frequently navigated by users.
Low priority-High severity- Application crashing in some very corner case.
High priority-Low severity - Slight change in logo color or spelling mistake in company name.
High priority-High severity - Issue with login functionality.

What is a critical bug?

A critical bug is a bug that impacts a major functionality of the application and the application cannot be delivered without fixing the bug. It is different from blocker bug as it doesn\'t affect or blocks the testing of other part of the application.

Explain bug lifecycle or the different states of a bug.

A bug goes through the following phases in software development-
New - A bug or defect when detected is in New state.
Assigned - The newly detected bug when assigned to the corresponding developer is in Assigned state.
Open - When the developer works on the bug, the bug lies in Open state.
Rejected/Not a bug - A bug lies in rejected state in case the developer feels the bug is not genuine.
Deferred - A deferred bug is one, fix of which is deferred for some time(for the next releases) based on urgency and criticality of the bugFixed - When a bug is resolved by the developer it is marked as fixed.
Test - When fixed the bug is assigned to the tester and during this time the bug is marked as in Test.
Reopened - If the tester is not satisfied with issue resolution the bug is moved to Reopened state.
Verified - After the Test phase if the tester feels bug is resolved, it is marked as verified.
Closed - After the bug is verified, it is moved to Closed status.
Use case testing - Testing carried out using use cases.

Explain equivalence class partitioning.

Equivalence class partitioning is a specification based black box testing techniques. In equivalence class partitioning, set of input data that defines different test conditions are partitioned into logically similar groups such that using even a single test data from the group for testing can be considered as similar to using all the other data in that group. E.g. for testing a Square program(program that prints the square of a number- the equivalence classes can be-
Set of Negative numbers, whole numbers, decimal numbers, set of large numbers etc.

What is decision table testing?

Decision table testing is a type of specification based test design technique or black box testing technique in which testing is carried out using decision tables showing application\'s behaviour based on different combination of input values. Decision tables are particularly helpful in designing test cases for complex business scenarios involving verification of application with multiple combinations of input.

What is use case testing?

A use case testing is a black box testing approach in which testing is carried out using use cases. A use case scenario is seen as interaction between the application and actors(users).

What is decision testing or branch testing?

Decision testing or branch testing is a white box testing approach in which test coverage is measured by the percentage of decision points(e.g. if-else conditions) executed out of the total decision points in the application.

What are the different types of integration testing?

The different type of integration testing are- Big bang Integration Testing - In big bang integration testing, testing starts only after all the modules are integrated.
Top-down Integration Testing - In top down integration, testing/integration starts from top modules to lower level modules.
Bottom-up Integration Testing - In bottom up integration, testing starts from lower level modules to higher level module up in the heirarchy.
Hybrid Integration Testing - Hybrid integration testing is the combination of both Top-down and bottom up integration testing. In this approach, the integration starts from middle layer and testing is carried out in both the direction

What is alpha testing?

Alpha testing is a type of acceptance testing that is performed end users at the developer site.

What is beta testing?

Beta testing is the testing done by end users at end user\'s site. It allows users to provide direct input about the software to the development company.

How is monkey testing different from adhoc testing?

In case of adhoc testing although there are no predefined or documented test cases still testers have the understanding of the application. While in case of monkey testing testers doesn\'t have any understanding of the application.

What is exploratory testing?

Exploratory testing is a type of testing in which new test cases are added and updated while exploring the system or executing test cases. Unlike scripted testing, test design and execution goes parallely in exploratory testing.

What is load testing?

Load testing is a type of performance testing which aims at finding application\'s performance under expected workload. During load testing we evaluate the response time, throughput, error rate etc parameters of the application.

What is stress testing?

Stress testing is a type of performance testing in which application\'s behaviour is monitored under higher workload then expected. Stress testing is done to find memory leaks and robustness of the application.

What is volume testing?

Volume testing is a type of performance testing in which the performance of application is evaluated with large amount of data. It checks the scalability of the application and helps in identification of bottleneck with high volume of data.

What is usability testing?

Usability testing is the type of testing that aims at determining the ease of using the application. It aims at uncovering the usability defects in the application.

What is Accessibility testing?

Accessibility is the type of testing which aims at determining the ease of use or operation of the application specifically for people with disabilities.

What is compatibility testing?

Testing software to see how compatible the software is with a particular environment - operating system, platform or hardware

What is localisation testing?

Localisation testing is a type of testing in which we evaluate the application\'s customization(localized version of application) in a particular culture, locale or country.

What is globalisation testing?

Globalisation testing is a type of testing in which application is evaluated for its functioning across the world in different cultures, languages, locale and countries.

What is security testing?

Security testing is a type of testing which aims at evaluating the integrity, authentication, authorization, availabilty, confidentiality and non-repudation of the application under test.

What is concurrency testing?

Concurrency testing is a multi-user testing in which an application is evaluated by analyzing application\'s behaviour with concurent users acccessing the same functionality.Locking and delocking is checked .es : file at shared point

What is Automation Testing?

Automation testing or Test Automation is a process of automating the manual process to test the application/system under test. Automation testing involves use to a separate testing tool which lets you create test scripts which can be executed repeatedly and doesn’t require any manual intervention.

Is the FirefoxDriver a Class or an Interface?

FirefoxDriver is a Java class, and it implements the WebDriver interface.

What is the super interface of WebDriver?

SearchContext.

Using Selenium how can you handle network latency ?

To handle network latency you can use driver.manage.pageloadingtime for network latency .

Explain the line of code Webdriver driver = new FirefoxDriver(); ?

Webdriver driver = new FirefoxDriver();
‘WebDriver‘ is an interface and we are creating an object of type WebDriver instantiating an object of FirefoxDriver class.driver is ref name .

How to get an attribute value using Selenium WebDriver?

By using getAttribute(value);

What is Robot API?

Robot API is used for handling Keyboard or mouse events. It is generally used to upload files to the server in selenium automation.
Robot robot = new Robot();
//Simulate enter key action
robot.keyPress(KeyEvent.VK_ENTER);

How to get an attribute value using Selenium WebDriver?

By using getAttribute(value);

What is a Framework?

A framework defines a set of rules or best practices which we can follow in a systematic way to achieve the desired results. There are different types of automation frameworks and the most common ones are:
Data Driven Testing Framework
Keyword Driven Testing Framework
Hybrid Testing Framework

Mention what is Listeners in Selenium WebDriver?

n Selenium WebDriver, Listeners \"listen\" to the event defined in the selenium script and behave accordingly. It allows customizing TestNG reports or logs. There are two main listeners i.e. WebDriver Listeners and TestNG Listeners.

How to handle alerts in selenium?

Alert alert = driver.switchTo().alert();
alert.accept();

Alert alert = driver.switchTo().alert();
//To cancel the alert box
alert.dismiss();

Name an API used for reading and writing data to excel files.

Apache POI API and JXL(Java Excel API) can be used for reading, writing and updating excel files.

How do you perform Automated Testing in your environment?

Automation Testing is a process of executing tests automatically. It reduces the human intervention to a great extent. We use different test automation tools like QTP, Selenium, and WinRunner,HP UFT. These tools help in speeding up the testing tasks.

Name some popular tools for automation testing.

Selenium,QTP AND HP UFT ,Appium for mobile testing.

How many types of Webdriver APIs are available in Selenium?

AndroidDriver,
ChromeDriver,
EventFiringWebDriver,
FirefoxDriver,
HtmlUnitDriver- headless driver which has no UI and is fastest of all
InternetExplorerDriver,
IPhoneDriver,
IPhoneSimulatorDriver,
RemoteWebDriver.

Highlight the role of QA in project development.

Reduce the defects and errors Preventing defects from occurring Maintain the system quality as per the specifications Test the projects on failure parameters to check its fault tolerance.

For Database Testing in Selenium Webdriver what API is required?

For Database Testing in Selenium Webdriver, you need JDBC (Java Database Connectivity) API. It allows you to execute SQL statements.

What are the benefits of Automation Testing?

Benefits of Automation testing are:
Supports execution of repeated test cases
Aids in testing a large test matrix
Enables parallel execution
Encourages unattended execution
Improves accuracy thereby reducing human generated errors
Saves time and money

What is an Xpath?

Xpath is used to locate a web element based on its XML path. XML stands for Extensible Markup Language and is used to store, organize and transport arbitrary data. It stores data in a key-value pair which is very much similar to HTML tags. Both being markup languages and since they fall under the same umbrella, Xpath can be used to locate HTML elements.
The fundamental behind locating elements using Xpath is the traversing between various elements across the entire page and thus enabling a user to find an element with the reference of another element.

What is the difference between “/” and “//” in Xpath?

Single Slash “/” – Single slash is used to create Xpath with absolute path i.e. the xpath would be created to start selection from the document node/start node.
Double Slash “//” – Double slash is used to create Xpath with relative path i.e. the xpath would be created to start selection from anywhere within the document.

How do I launch the browser using WebDriver?

The following syntax can be used to launch Browser:
WebDriver driver = new FirefoxDriver();
WebDriver driver = new ChromeDriver();
WebDriver driver = new InternetExplorerDriver();

How can you find if an element in displayed on the screen?

WebDriver facilitates the user with the following methods to check the visibility of the web elements. These web elements can be buttons, drop boxes, checkboxes, radio buttons, labels etc.
isDisplayed()
isSelected()
isEnabled()
Syntax:
isDisplayed():
boolean buttonPresence = driver.findElement(By.id(“gbqfba”)).isDisplayed();
isSelected():
boolean buttonSelected = driver.findElement(By.id(“gbqfba”)).isDisplayed();
isEnabled():
boolean searchIconEnabled = driver.findElement(By.id(“gbqfb”)).isEnabled();

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

close(): WebDriver’s close() method closes the web browser window that the user is currently working on or we can also say the window that is being currently accessed by the WebDriver. The command neither requires any parameter nor does is return any value.
quit(): Unlike close() method, quit() method closes down all the windows that the program has opened. Same as close() method, the command neither requires any parameter nor does is return any value.

How to assert title of the web page?

//verify the title of the web page
assertTrue(“The title of the window is incorrect.”,driver.getTitle().equals(“Title of the page”));

How to capture screenshot in WebDriver?

@Test
public void test() throws IOException {
// Code to capture the screenshot
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
// Code to copy the screenshot in the desired location
FileUtils.copyFile(scrFile, new File(\"C:\\\\CaptureScreenshot\\\\google.jpg\"));
} }

When should I use Selenium IDE?

Selenium IDE is the simplest and easiest of all the tools within the Selenium Package. Its record and playback feature makes it exceptionally easy to learn with minimal acquaintances to any programming language. Selenium IDE is an ideal tool for a naïve user.

What is Selenese?

Selenese is the language which is used to write test scripts in Selenium IDE.

What is Same origin policy and how it can be handled?

The problem of same origin policy disallows to access the DOM of a document from an origin that is different from the origin we are trying to access the document.
Origin is a sequential combination of scheme, host and port of the URL. For example, for a URL http:// http://www.softwaretestinghelp.com/resources/, the origin is a combination of http, softwaretestinghelp.com, 80 correspondingly. Thus the Selenium Core (JavaScript Program) cannot access the elements from an origin that is different from where it was launched. For Example, if I have launched the JavaScript Program from “http://www.softwaretestinghelp.com”, then I would be able to access the pages within the same domain such as “http://www.softwaretestinghelp.com/resources” or “http://www.softwaretestinghelp.com/istqb-free-updates/”. The other domains like google.com, seleniumhq.org would no more be accessible.
So, In order to handle same origin policy, Selenium Remote Control was introduced.

When should I use Selenium Grid?

Selenium Grid can be used to execute same or different test scripts on multiple platforms and browsers concurrently so as to achieve distributed test execution, testing under different environments and saving execution time remarkably.

How can we get a text of a web element?

Get command is used to retrieve the inner text of the specified web element. The command doesn’t require any parameter but returns a string value. It is also one of the extensively used commands for verification of messages, labels, errors etc displayed on the web pages.
Syntax:

How to select value in a dropdown?

Value in the drop down can be selected using WebDriver’s Select class.
Syntax:
selectByValue:
Select selectByValue = new Select(driver.findElement(By.id(“SelectID_One”)));
selectByValue.selectByValue(“greenvalue”);
selectByVisibleText:
Select selectByVisibleText = new Select (driver.findElement(By.id(“SelectID_Two”)));
selectByVisibleText.selectByVisibleText(“Lime”);
selectByIndex:
Select selectByIndex = new Select(driver.findElement(By.id(“SelectID_Three”)));
selectByIndex.selectByIndex(2);

What are the different types of navigation commands?

Following are the navigation commands:
navigate().back() – The above command requires no parameters and takes back the user to the previous webpage in the web browser’s history.
Sample code:
driver.navigate().back();
navigate().forward() – This command lets the user to navigate to the next web page with reference to the browser’s history.
Sample code:
driver.navigate().forward();
navigate().refresh() – This command lets the user to refresh the current web page there by reloading all the web elements.
Sample code:
driver.navigate().refresh();
navigate().to() – This command lets the user to launch a new web browser window and navigate to the specified URL.
Sample code:
driver.navigate().to(“https://google.com”);

How to click on a hyper link using linkText?

driver.findElement(By.linkText(“Google”)).click();
The command finds the element using link text and then click on that element and thus the user would be re-directed to the corresponding page.
The above mentioned link can also be accessed by using the following command.
driver.findElement(By.partialLinkText(“Goo”)).click();
The above command find the element based on the substring of the link provided in the parenthesis and thus partialLinkText() finds the web element with the specified substring and then clicks on it.

How to handle frame in WebDriver?

An inline frame acronym as iframe is used to insert another document with in the current HTML document or simply a web page into a web page by enabling nesting.
Select iframe by id
driver.switchTo().frame(“ID of the frame“);
Locating iframe using tagName
driver.switchTo().frame(driver.findElements(By.tagName(“iframe”).get(0));
Locating iframe using index
frame(index)
driver.switchTo().frame(0);
frame(Name of Frame)
driver.switchTo().frame(“name of the frame”);
frame(WebElement element)
Select Parent Window
driver.switchTo().defaultContent();

When do we use findElement() and findElements()?

findElement(): findElement() is used to find the first element in the current web page matching to the specified locator value. Take a note that only first matching element would be fetched.we can get it in webelement .
Syntax:
WebElement element = driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));
findElements(): findElements() is used to find all the elements in the current web page matching to the specified locator value. Take a note that all the matching elements would be fetched and stored in the list of WebElements.
Syntax:
List elementList = driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));

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

close(): WebDriver’s close() method closes the web browser window that the user is currently working on or we can also say the window that is being currently accessed by the WebDriver. The command neither requires any parameter nor does is return any value.
quit(): Unlike close() method, quit() method closes down all the windows that the program has opened. Same as close() method, the command neither requires any parameter nor does is return any value.

How can we handle web based pop up?

WebDriver offers the users with a very efficient way to handle these pop ups using Alert interface. There are the four methods that we would be using along with the Alert interface.
void dismiss() – The accept() method clicks on the “Cancel” button as soon as the pop up window appears.
void accept() – The accept() method clicks on the “Ok” button as soon as the pop up window appears.
String getText() – The getText() method returns the text displayed on the alert box.
void sendKeys(String stringToSend) – The sendKeys() method enters the specified string pattern into the alert box.
Syntax:
// accepting javascript alert
Alert alert = driver.switchTo().alert();
alert.accept();

How can we handle windows based pop up?

How can we handle windows based pop up? Selenium is an automation testing tool which supports only web application testing, that means, it doesn’t support testing of windows based applications. However Selenium alone can’t help the situation but along with some third party intervention, this problem can be overcome. There are several third party tools available for handling window based pop ups along with the selenium like AutoIT, Robot class etc.

How to mouse hover on a web element using WebDriver?

WebDriver offers a wide range of interaction utilities that the user can exploit to automate mouse and keyboard events. Action Interface is one such utility which simulates the single user interactions.
Thus, In the following scenario, we have used Action Interface to mouse hover on a drop down which then opens a list of options.
Sample Code:
1
// Instantiating Action Interface
2
Actions actions=new Actions(driver);
3
// howering on the dropdown
4
actions.moveToElement(driver.findElement(By.id(\"id of the dropdown\"))).perform();
5
// Clicking on one of the items in the list options
6
WebElement subLinkOption=driver.findElement(By.id(\"id of the sub link\"));
7
subLinkOption.click();

How to mouse hover on a web element using WebDriver?

WebDriver offers a wide range of interaction utilities that the user can exploit to automate mouse and keyboard events. Action Interface is one such utility which simulates the single user interactions.
Thus, In the following scenario, we have used Action Interface to mouse hover on a drop down which then opens a list of options.
Sample Code:
1
// Instantiating Action Interface
2
Actions actions=new Actions(driver);
3
// howering on the dropdown
4
actions.moveToElement(driver.findElement(By.id(\"id of the dropdown\"))).perform();
5
// Clicking on one of the items in the list options
6
WebElement subLinkOption=driver.findElement(By.id(\"id of the sub link\"));
7
subLinkOption.click();

How to retrieve css properties of an element?

The values of the css properties can be retrieved using a get() method:
Syntax:
driver.findElement(By.id(“id“)).getCssValue(“name of css attribute”);
driver.findElement(By.id(“id“)).getCssValue(“font-size”);

What is TestNG and how is it better than Junit?

There are various advantages that make TestNG superior to JUnit. Some of them are:
Added advance and easy annotations
Execution patterns can set
Concurrent execution of test scripts
Test case dependencies can be set

Can WebDriver test Mobile applications?

WebDriver cannot test Mobile applications. WebDriver is a web based testing tool, therefore applications on the mobile browsers can be tested.

Mention what is IntelliJ?

Intellij is an IDE that helps you to write better and faster code for Selenium. Intellij can be used in the option to Java bean and Eclipse

What is page object model in Selenium?

Page Object Model is a Design Pattern which has become popular in Selenium Test Automation. It is widely used design pattern in Selenium for enhancing test maintenance and reducing code duplication. Page object model (POM) can be used in any kind of framework such as modular, data-driven, keyword driven, hybrid framework etc. A page object is an object-oriented class that serves as an interface to a page of your Application Under Test(AUT). The tests then use the methods of this page object class whenever they need to interact with the User Interface (UI) of that page. The benefit is that if the UI changes for the page, the tests themselves don’t need to change, only the code within the page object needs to change. Subsequently, all changes to support that new UI is located in one place.

How to Upload a file in Selenium WebDriver?

either by using send keys with input type = \'file\'
There are two cases which are majorly used to upload a file in Selenium WebDriver such as using SendKeys Method and using AutoIT Script.

How to connect a Database in selenium?

JDBC As we all know Selenium WebDriver is a tool to automate User Interface. We could only interact with Browser using Selenium WebDriver.
We use JDBC Driver to connect the Database in Selenium (While using Java Programming Language).

What is desired capabilities?

In Selenium we use desired capabilities to handle SSL certificates in chrome browser
We need to create an instance of DesiredCapabilities
DesiredCapabilities desiredCapability = DesiredCapabilities.chrome();
desired capabilities are used for chrome , for firefox we use firefox options

What is fundamental difference between XPath and css selector?

The fundamental difference between XPath and css selector is using XPaths we can traverse up in the document i.e. we can move to parent elements. Whereas using CSS selector we can only move downwards in the document.

What are the four parameter you have to pass in Selenium?

Four parameters that you have to pass in Selenium are Host
Port Number
Browser
URL

Explain how you can switch between frames?

To switch between frames webdrivers [ driver.switchTo().frame() ] method takes one of the three possible arguments
A number: It selects the number by its (zero-based) index
A number or ID: Select a frame by its name or ID
Previously found WebElement: Using its previously located WebElement select a frame
After wards again shift to parent frame by
driver.switchto.defaultcontetnt();

What is the difference between getWindowhandles() and getwindowhandle() ?

getwindowhandles(): It is used to get the address of all the open browser and its return type is Set
getwindowhandle(): It is used to get the address of the current browser where the control is and return type is string
for(String STR : handles(){
driver.switchTo.handle()}

Explain how you can handle frames using Selenium 2.0 ?

To bring control on HTML frame you can use “SwitchTo” frame method-
driver.switchTo().frame(“frameName”);
To specify a frame you can use index number
driver.switchTo().frame(“parentFrame.4.frameName”);
This would bring control on frame named- “frameName” of the 4th sub frame names “parentFrame”

Explain using Webdriver how you can perform double click ?

You can perform double click by using Syntax- Actions act = new Actions (driver); act.doubleClick(webelement);

How can we locate elements using their text in XPath?

Using the text() method -
xPathExpression = //*[text()=\'username\']
by.xpath[contains(@text=\'XXXX\')]

List out the test types that are supported by Selenium?

For web based application testing selenium can be used
The test types can be supported are
a) Functional, Learn More about Functional Testing.
b) Regression
For post release validation with continuous integration automation tool could be used
a) Jenkins
b) Hudson
c) Quick Build
d) CruiseCont
e)Bamboo
F)CI

What is heightened privileges browsers?

The purpose of heightened privileges is similar to Proxy Injection, allows websites to do something that are not commonly permitted. The key difference is that the browsers are launced in a special mode called heightened privileges. By using these browser mode, Selenium core can open the AUT directly and also read/write its content without passing the whole AUT through the Selenium RC server

Explain what is Datadriven framework and Keyword driven?

Datadriven framework: In this framework, the test data is separated and kept outside the Test Scripts, while Test Case logic resides in Test Scripts. Test data is read from the external files ( Excel Files) and are loaded into the variables inside the Test Script. Variables are used for both for input values and for verification values.
Keyworddriven framework: The keyword driven frameworks requires the development of data tables and keywords, independent of the test automation. In a keyword driven test, the functionality of the application under test is documented in a table as well as step by step instructions for each test.

In Selenium IDE how you can generate random numbers and dates for test data ?

Math.random()

Explain what can cause a Selenium IDE test to fail?

When a locator has changed and Selenium IDE cannot locate the element.br/> When element Selenium IDE waiting to access did not appear on the web page and the operation timed out.
When element Selenium IDE was trying to access was not created

To enter values onto text boxes what is the command that can be used?

To enter values onto text boxes we can use command sendkeys() .

What are some commonly encountered exceptions in selenium?

NoSuchElementException - When no element could be located from the locator provided.
ElementNotVisibleException - When element is present in the dom but is not visible.
NoAlertPresentException - When we try to switch to an alert but the targetted alert is not present.
NoSuchFrameException - When we try to switch to a frame but the targetted frame is not present.
NoSuchWindowException - When we try to switch to a window but the targetted window is not present.
UnexpectedAlertPresentException - When an unexpected alert blocks normal interaction of the driver.
TimeoutException - When a command execution gets timeout.
InvalidElementStateException - When the state of an element is not appropriate for the desired action.
NoSuchAttributeException - When we are trying to fetch an attribute\'s value but the attribute is not correct
WebDriverException - When there is some issue with driver instance preventing it from getting launched.

How to do drag and drop in selenium?

Actions action= new Actions(driver);
Action dragAndDrop = action.clickAndHold(SourceElement)
.moveToElement(TargetElement)
.release(TargetElement)
.build(); dragAndDrop.perform();

What are the limitations of Selenium?

Following are the limitations of Selenium:
Selenium supports testing of only web based applications
Mobile applications cannot be tested using Selenium
Captcha and Bar code readers cannot be tested using Selenium
Reports can only be generated using third party tools like TestNG or Junit.
As Selenium is a free tool, thus there is no ready vendor support though the user can find numerous helping communities.
User is expected to possess prior programming language knowledge.

What is the difference between equals() and == ?

Equals() method is defined in Object class in Java and used for checking equality of two objects defined by business logic. “==” or equality operator in Java is a binary operator provided by Java programming language and used to compare primitives and obj

What is multiple inheritance? Is it supported by Java?

If a child class inherits the property from multiple classes is known as multiple inheritance. Java does not allow to extend multiple classes.
The problem with multiple inheritance is that if multiple parent classes have a same method name, then at runtime it becomes difficult for the compiler to decide which method to execute from the child class.
Therefore, Java doesn’t support multiple inheritance. The problem is commonly referred as Diamond Problem.

What are constructors in Java?

Constructor refers to a block of code which is used to initialize an object. It must have the same name as that of the class. Also, it has no return type and it is automatically called when an object is created.
There are two types of constructors:
Default constructor
Parameterized constructor

Why java is not 100% Object-oriented?

Java is not 100% Object-oriented because it makes use of eight primitive datatypes such as boolean, byte, char, int, float, double, long, short which are not objects.

Can we have try without catch block?

Yes, we can have try-finally statement and hence avoiding catch block.

What is default constructor?

No argument constructor of a class is known as default constructor. When we don’t define any constructor for the class, java compiler automatically creates the default no-args constructor for the class. If there are other constructors defined, then compiler won’t create default constructor for us.

What is this keyword?

this keyword provides the reference to the current object and it’s mostly used to make sure that object variables are used, not the local variables having the same name.

What does super keyword do?

super keyword can be used to access super class method when you have overridden the method in the child class. We can use super keyword to invoke superclass constructor in child class constructor but in this case, it should be the first statement in the constructor method.

What is inner class in java?

We can define a class inside a class and they are called nested classes. Any non-static nested class is known as inner class. Inner classes are associated with the object of the class and they can access all the variables and methods of the outer class.

What are Wrapper classes?

Primitive Data types <=> Objects and vice versa Java wrapper classes are the Object representation of eight primitive types in java. All the wrapper classes in java are immutable and final.

Can an interface implement or extend another interface?

Interfaces don’t implement another interface, they extend it. Since interfaces can’t have method implementations, there is no issue of diamond problem. That’s why we have multiple inheritance in interfaces i.e an interface can extend multiple interfaces.

What is an interface?

Interfaces provide a way to achieve abstraction in java and used to define the contract for the sub classes to implement.

Can we declare a class as static?

We can’t declare a top-level class as static however an inner class can be declared as static. If inner class is declared as static, it’s called static nested class.
The static nested class is same as any other top-level class and is nested for only packaging convenience.

What is static keyword?

static keyword can be used with methods also. A static method can access only static variables of class and invoke only static methods of the class.
static keyword can be used with class level variables to make it global .

What is final keyword?

Final keyword is used with Class to make sure no other class can extend it, for example String class is final and we can’t extend it.
We can use the final keyword with methods to make sure child classes can’t override it.
final keyword can be used with variables to make sure that it can be assigned only once. However the state of the variable can be changed.

What is Java Package and which package is imported by default?

Java package is the mechanism to organize the java classes by grouping them. The grouping logic can be based on functionality or modules based.
java.lang package is imported by default and we don’t need to import any class from this package explicitly.

What is the importance of main method in Java?

Syntax : public static void main(String args[]).
Java main method is public and static so that Java runtime can access it without initializing the class. The input parameter is an array of String through which we can pass runtime arguments to the java program.

What is the difference between JDK and JVM?

Java Development Kit (JDK) is for development purpose and JVM is a part of it to execute the java programs. JVm converts the byte code to machine readable code .
JRE doesn’t contain any development tools like java compiler, debugger etc. If you want to execute any java program, you should have JRE installed.

What is JVM and is it platform independent?

Java Virtual Machine (JVM) is the heart of java programming language. JVM is responsible for converting byte code into machine readable code. JVM is not platform independent, thats why you have different JVM for different operating systems.

To generate pdf reports mention what Java API is required?

To generate pdf reports, you need Java API IText.

What are the Java IDE’s?

Eclipse and NetBeans are the IDE’s of JAVA.

What are the features in JAVA?

Oops concepts
Object-oriented
Inheritance
Encapsulation
Polymorphism
Abstraction
Platform independent
High Performance:Java uses Just In Time compiler to enable high performance. JIT is used to convert the instructions into bytecodes.

What is Multiple Inheritance?

If a class implements multiple interfaces, or an interface extends multiple interfaces then it is known as multiple inheritance.

What are the different access modifiers available in Java?

Access modifiers are subdivided into four types such as Default, Public, Private, Protected.
public: The scope of public access modifier is everywhere. It has no restrictions. Data members, methods and classes that declared public can be accessed from anywhere.
protected: The scope of protected access modifier is within a package and also outside the package through inheritance only.
private: The scope of private access modifier is only within the classes
Default: The scope of default access modifier is limited to the package only. If we do not mention any access modifier, then it acts like a default access modifier.

What is Encapsulation in Java?

Encapsulation is a mechanism of binding code and data together in a single unit. Let’s take an example of Capsule. Different powdered or liquid medicines are encapsulated inside a capsule. Likewise in encapsulation, all the methods and variables are wrapped together in a single class.

What is Abstract Class in Java?

Abstract classes may or may not include abstract methods
If a class is declared abstract then it cannot be instantiated.
If a class has abstract method then we have to declare the class as abstract class
When an abstract class is subclassed, the subclass usually provides implementations for all of the abstract methods in its parent class.

What are the types of Polymorphism?

There are two types of Polymorphism in Java
-overloading
-overriding

What is Java?

Java is a programming language and computing platform first released by Sun Microsystems in 1995. There are lots of applications and websites that will not work unless you have Java installed, and more are created every day. Java is fast, secure, and reliable.Java is a object oriented programming language. Everything in Java is an Object and is platform independent .

What is Junit?

Junit is a unit testing framework introduced by Apache. Junit is based on Java.

What are Junit annotations?

Following are the Junit Annotations:
@Test: Annotation lets the system know that the method annotated as @Test is a test method. There can be multiple test methods in a single test script.
@Before: Method annotated as @Before lets the system know that this method shall be executed every time before each of the test method.
@After: Method annotated as @After lets the system know that this method shall be executed every time after each of the test method.
@BeforeClass: Method annotated as @BeforeClass lets the system know that this method shall be executed once before any of the test method.
@AfterClass: Method annotated as @AfterClass lets the system know that this method shall be executed once after any of the test method.
@Ignore: Method annotated as @Ignore lets the system know that this method shall not be executed.

What is the use of Background keyword in Cucumber?

Background keyword is used to group multiple given statements into a single group. This is generally used when the same set of given statements are repeated in each scenario of the feature file.

What symbol is used for parameterization in Cucumber?

Pipe symbol (|) is used to specify one or more parameter values in a feature file.

What is the purpose of Examples keyword in Cucumber?

Examples keyword is used to specify values for each parameter used in the scenario. Scenario Outline keyword must always be followed by the keyword Examples.

Provide an example of step definition file in Cucumber.

Step definition corresponding to the step “Open Chrome browser and launch the application” may look like the code mentioned below:
@Given(\"^Open Chrome browser and launch the application$\")
public void openBrowser()
{
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get(\"www.facebook.com\");
}

What is the purpose of Cucumber Options tag?

Cucumber Options tag is used to provide a link between the feature files and step definition files. Each step of the feature file is mapped to a corresponding method on the step definition file.
Below is the syntax of Cucumber Options tag:
@CucumberOptions(features=\"Features\",glue={\"StepDefinition\"})

How can Cucumber be integrated with Selenium WebDriver?

Cucumber can be integrated with Selenium webdriver by downloading the necessary JAR files. Given below are the list of JAR files that are to be downloaded for using Cucumber with Selenium web driver:cucumber-core-1.2.2.jar
cucumber-java-1.2.2.jar
cucumber-junit-1.2.2.jar
cucumber-jvm-deps-1.0.3.jar

What are the features of TestNG and list some of the functionality in TestNG which makes it more effective?

TestNG is a testing framework based on JUnit and NUnit to simplify a broad range of testing needs, from Unit Testing to Integration Testing. And the functionality which makes it efficient testing framework are
Support for annotations
Support for data-driven testing
Flexible test configuration
Ability to re-execute failed test cases