0% found this document useful (0 votes)
13 views5 pages

Phaneendra Questions

The document provides an overview of software testing concepts, including definitions of software testing, automation testing, test data creation, and the bug life cycle. It covers tools and frameworks like Selenium, TestNG, and Cucumber, as well as Java programming principles such as OOP concepts and exception handling. Additionally, it includes practical examples and code snippets for testing scenarios and basic programming tasks.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views5 pages

Phaneendra Questions

The document provides an overview of software testing concepts, including definitions of software testing, automation testing, test data creation, and the bug life cycle. It covers tools and frameworks like Selenium, TestNG, and Cucumber, as well as Java programming principles such as OOP concepts and exception handling. Additionally, it includes practical examples and code snippets for testing scenarios and basic programming tasks.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

1) What is software testing?

Testing the software to identify defects and ensure it meets the requirements.

2) What is Automation Testing


It is a testing technique where the testers use the specialized tools to execute the test
cases automatically.

3) What is test data, and how do you create it?


Set of data used by testers in the test cases to determine whether an application is
working correctly or not.
We create test data by
Understanding the application
Identify all possible test scenarios
Automated test data generation tools

4) What is Bug life cycle?

New, Assigned, Open, Fixed, Retesting, and verifying, closed or reopened

5) What is Selenium and difference between the Grid and WebDriver


 Selenium is a open source automation testing tool used for testing the web
based applications across different browsers and platforms
 It enables testers to write the automated test scripts in various programming
languages like java, python etc

WebDriver is the main component of the Selenium use to interact with the browsers

Grid is used for running parallel tests across different machines and browsers

6) What are the different types of waits in Selenium

There are 3 different types of waits in selenium

1) implicit wait :- tells selenium to wait for a certain amount of time to find the
element,
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10))
2) explicit wait :- waits for a specific condition to met before proceeding with the
code execution.

WebDriverWait mywait = new WebDriverWait(driver,


Duration.ofSeconds(10));

WebElement ele =
mywait.until(ExpectedConditions.visibilityOfElementLocated(By.id(“”)));

3) fluent wait :- advanced type of explicit wiat, here we can ignore specific exceptions
Wait<WebDriver> fluentWait = new FluentWait<>(driver)
.withTimeout(Duration.ofSeconds(15))
.pollingEvery(Duration.ofSeconds(2))
.ignoring(NoSuchElementException.class);

WebElement element = fluentWait.until(driver ->


driver.findElement(By.id("elementID")));
element.click();

7) What are a locator and the different types of locators?


Locator s are used to identify and interact with an element on the webpage
There are few different types of locators available
i) id
ii) name
iii) className
iv) linkText
v) partialLinkText
vi) tagName
vii) Xpath
viii) Cssselector

8) What is the difference between close() and quit()?


close():- closes only the current window on the browser
quit() :- closes all browser windows and ends the WebDriver Session

9) What is the framework

A framework is a set of tools, protocols, libraries for creating and executing the test
cases
By using the framework we can reuse the code, reduce script maintenance etc.

10) What is TestNG?


 TestNG is a automation framework which is inspired from Junit and Nunit but
comes with additional features
 In TestNG NG stands for Next Generation
 We need TestNG framework because WebDriver has no mechanism for
generating reports, parallel testing etc. By using the TestNG framework we can
achieve this
 we use the @Test annotation to run the test cases

11) What is page object model?

1) Page Object Model is a design pattern used in selenium


2) In POM each web page is considered as a Java class and all the UI elements
and methods interacting with them are defined within that class.
3) The purpose of the pom is to separate the UI elements and actions from the
test logic.
4) we can use the locators and page factory class to implement the page object
model

12) What is page Factory?


 A class provided by the selenium WebDriver to support the POM design
pattern
 In page factory testers use the @FindBy annotation to locate the web
elements using different locators.
 initElements() method to initialize the web elements

13) What are the Oops in java?


 Object :- any entity that has state and behavior is called object ex :- pen, chair
 Class :-a class is a blueprint from which we can create an object.
 Abstraction :-Hiding the internal implementation and showing functionality to
the user is know n as abstraction. we use the abstract classes, and interface to
achieve the abstraction
 Inheritance:- when the child class get the properties and behavior of parent
class is called inheritance,
 polymorphism, :- if 1 task performs in different ways is known as
polymorphism, we use the method overloading, and overriding to achieve the
polymorphism
 Encapsulation :- combining code and data together into a single unit ins know
as encapsulation.

14) Modifiers in Java?


 Access modifiers are used to set the accessibility of classes, variables, methods
etc.
 there are few type of access modifiers:-
i) default – visible only within the package
ii) private – visible only in the class
iii) protected – visible within the package or subclass
iv) public – visible everywhere

15) What is exception handling in java


 Sometime there will be some problem in our code that will stop the execution of
a program so it is important to handle these exceptions.
 we can handle the exceptions in 3 different ways
1) try…catch block – we write the code which we think have the problem in the try
block and when an exception occurs it will be caught by the catch block
2) finally block :- finally block is optional and always executed no matter whether
there is an exception or not
3) throw and throws keyword :- the throw keyword is used to explicitly throw a
single exception, throws keyword is used to declare the type of exception that may
occur in the method and used in the method declaration.

16) What is the difference between Finally and final difference

 finally :- a block of code that will always executed whether an exception occurs
or not in the try-catch block
 final :- is a keyword used to declare class or variable or method to
unchangeable.

17) What is cucumber and give example


 Cucumber is a tool that supports the Behavior Driven Development
 it is a way to write the test cases in a simple English text using Gherkin
language
 Test cases are described in cucumber feature file and the feature file should
have extension .feature.
Scenario :- Successful login with valid credentials
Given user navigates to the website
When user opens the login page
And user enters the username and password
Then login must be successful.

18) what is hooks in cucumber


Hooks are a block of code that run before or after a scenario or step
There are 3 different types of hooks
1) Scenario hooks :- these hooks run before or after each scenario,
typically used for setting up or cleaning up the test environment.
2) Step hooks :- These hooks run before or after each step in a scenario.
Useful when certain actions need to occur for specific steps.
3) Conditional hooks :- Execute certain code based on conditions .
19) What is git and github

 Github is a web based platform that uses Git for version control, github allows
the users to store repositories, track issues and bugs etc.

 Git is a version control system that helps developers to track changes in files
and collaborate on projects. It is a tool used to manage code changes locally and
keep history of the modifications.

20) Write a simple script for the login functionality of gmail

WebDriver driver=new ChromeDriver();


driver.manage().window().maximize();
driver.get("https://www.browserstack.com/users/sign_in");
WebElement username=driver.findElement(By.id("user_email_Login"));
WebElement password=driver.findElement(By.id("user_password"));
WebElement login=driver.findElement(By.name("commit"));
username.sendKeys("[email protected]");
password.sendKeys("your_password");
login.click();

21) Write a program to find the largest number in array.

public class Large


{
public static void main (String[] args)
{
int arr[] = {25,14,3,210}
int largest = arr[0];
for(int eachnum : arr)
{
if(largest<eachnum)
{
largest = num;
}
}

You might also like