Where we learn technology

Month: November 2017 (Page 1 of 2)

Agile Development Interview Questions and Answers

Agile Development Interview Questions and Answers





1) What is Agile? AGILE is a methodology that promotes continuous iteration of development and testing throughout the software development life cycle of the project. Both development and testing activities are concurrent unlike the Waterfall model.———————————————————2) What is Agile Testing? Agile Testing is testing practice that follows the principles of agile software development. Agile testing involves all members of an agile team with special skills and expertise to ensure business value is delivered at frequent intervals.———————————————————3) In what way does the Agile Testing differs from the other Testing Methodologies? Anytime applying Agile Methodology, the testers /developers ensure that the whole process of testing /development is broke into as small steps as possible and just a small unit of code is tested /developed in each of this steps. The team of testers /developers is communicating consistently the results of their work, and change the short term strategy and even the development plan on the go, based on the results of agile testing. Agile Methodology encourages flexible and rapid response to change which should lead to a better end result.———————————————————4) What are the different Methodologies in Agile Testing? There are various methods present in agile testing such as,• Scrum• Crystal Methodologies• DSDM(Dynamic Software Development Method)• Feature driven development(FDD)• Lean software development• Extreme Programming(XP)———————————————————5) What are the benefits of Agile Software Development?Agile methods grew out of the real-life project experiences of leading software professionals who had experienced the challenges and limitations of traditional waterfall development on project after project. The approach promoted by agile development is in direct response to the issue associated with traditional software development – both in terms of overall philosophy as well as specific processes.———————————————————6) What is the Agile Manifesto? The agile software development emphasizes on four core values:• Individual and team interactions over processes and tools• Working software over comprehensive documentation• Customer collaboration over contract negotiation• Responding to change over following a plan———————————————————7) What are some of the key features of Agile Development? Some of the key features of agile development are,• Collective code ownership and freedom to change.• Incremental approach (e.g. user stories are incrementally implemented). Automation (e.g. TDD — Test Driven Development). • Customer focused (for e.g. internal and external users and business analysts are your immediate customers).• Design must be simple.• Designing is an ongoing activity with constant re-factoring to achieve the rules of code simplicity like no duplication, verified by automated tests, separation of responsibilities, and minimum number of classes, methods, and lines.———————————————————8) What is Scrum? Scrum is an innovative approach to getting work done in efficient way. It is iterative & incremental agile software development method. Scrum is basically worked on a self-organizing, cross-functional team. In the overall scrum team there is no team leader who assign the task to team rather whole scrum members work as a team & they decides the task on which they will work on. Also the problem will be resolve by team.———————————————————9) What is Sprint? Sprint is a predefined interval or the time frame in which the work has to be completed and make it ready for review or ready for production deployment. This time box usually lies between 2 weeks to 1 month. In our day to day life when we say that we follow 1 month Sprint cycle, it simply means that we work for one month on the tasks and make it ready for review by the end of that month.———————————————————10) What is Extreme Programming (XP)? Extreme Programming technique is very helpful when there is constantly changing demands or requirements from the customers or when they are not sure about the functionality of the system. It advocates frequent “releases” of the product in short development cycles, which inherently improves the productivity of the system and also introduces a checkpoint where any customer requirements can be easily implemented. ———————————————————11) What is Test Driven Development? Test driven development or TDD is also known as test-driven design. In this method, developer first writes an automated test case which describes new function or improvement and then creates small codes to pass that test, and later re-factors the new code to meet the acceptable standards.———————————————————12) What is a Test Stub? A test stub is a bit of code that replaces an undeveloped or fully developed component within a system being tested. The test stub is built such that it mimics the actual component by generating specific known outputs. The stub can be used as a substitute for the actual (fully developed) component for testing purposes.———————————————————13) What is Feature Driven Development (FDD)? This method is focused around “designing & building” features. Unlike other agile methods, FDD describes very specific and short phases of work that has to be accomplished separately per feature. It includes domain walk-through, design inspection, promote to build, code inspection and design.———————————————————14) What is Lean Software Development? Lean software development method is based on the principle “Just in time production”. It aims at increasing speed of software development and decreasing cost.———————————————————15) What are the Disadvantages of Agile Model? • In case of some software deliverables, especially the large ones, it is difficult to assess the effort required at the beginning of the software development life cycle.• There is lack of emphasis on necessary designing and documentation.• The project can easily get taken off track if the customer representative is not clear what final outcome that they want.• Only senior programmers are capable of taking the kind of decisions required during the development process. Hence it has no place for newbie programmers, unless combined with experienced resources.


Cheers
Naveen AutomationLabs

Please follow and like us:

How To Upgrade from Selenium RC To WebDriver?

How To Upgrade from Selenium RC To WebDriver

The Problem

As the Selenium project continues to evolve, Selenium RC is moving closer to end-of-life. This is especially true with the upcoming release of Selenium 3 where minimal support will be offered for RC.
But how do you approach an upgrade like this? Especially if you have an enormous amount of Selenium RC tests that you rely on?

A Solution

Take Jason Leyba’s advice. He works at Google and oversaw the transition of their tests from Selenium RC to WebDriver. And he posits that it can be done by following 4 simple steps: 
  • Clean up your tests
  • Swap in WebDriver-backed Selenium
  • Use WebDriver for all new features
  • Replace RC usage as tests break
To give you some context, Google’s Selenium tests spawn something on the order of 3 million unique browser sessions per day. And they were able to make this transition happen with minimal disruption. If they were able to make this happen at such a scale, then hopefully this serves as inspiration for you to do the same at your organization.

4 Simple Steps

1. Clean Up Your Tests

“Turns out that tests that are easy to maintain are tests that are easy to migrate.” — Jason Leyba
The best thing you can do to keep your tests clean is to practice good abstractions. In the simplest form this means not referencing Selenium commands directly in your tests — pulling these out into something akin to page objects instead.
2. Swap in WebDriver-backed Selenium

With WebDriver-backed Selenium you get two driver instances to use in your tests — one for Selenium RC and another for WebDriver. This enables you to keep your Selenium RC tests running while simultaneously building out WebDriver functionality as you transition things over.
3. & 4. Improve Things Incrementally

For every new feature you write tests for, use WebDriver. And as your Selenium RC tests break go back and replace the broken bits with WebDriver.
Chip away at this over time and you’ll eventually be upgraded.

Common Pitfalls

There are a handful of pitfalls to be aware of when stepping through this upgrade.

Alert Handling

WebDriver handles JavaScript alerts in a fundamentally different and incompatible way between Selenium RC and WebDriver that won’t work in WebDriver-backed Selenium.
The best way to address this is to port your alert handling from Selenium RC to WebDriver — which is pretty straightforward and should be easy to accomplish assuming you have things well abstracted (re: Step #1 above).
Here is an example of the difference:
// Selenium RC
selenium.chooseCancelOnNextConfirmation();
selenium.click("id=foo");

// WebDriver
webdriver.findElement(By.id("foo")).click();
webdriver.switchTo().alert().dismiss();
Waiting For The Page To Load
There’s no need to explicitly wait for the page to load anymore since WebDriver can implicitly do this for us.
Here’s an example:
// Selenium RC
selenium.open("http://www.google.com");
selenium.waitForPageToLoad();
selenium.typeKeys("name=q", "bears");

// WebDriver
selenium.open("http://www.google.com");
selenium.typeKeys("name=q", "bears");
If you run into timing issues with this newer approach, consider adding an explicit wait for the element you want to interact with.
Getting Text From The Page

It’s an expensive operation (and overkill) to get ALL of the text from the page to make a verification. And it takes longer to execute this in WebDriver.
A better approach is to find the element that has the text you want and check it’s text instead. Alternatively, if you want to search the entire page, it’s better to get the page’s source and parse that.
// Slow and unnecessary
String text = selenium.getBodyText();
assertTrue(text.contains("hello"));

// Targeted and fast
WebElement body = webdriver.findElement(By.tagName("body"));
String text = body.getText();
assertTrue(text.contains("hello"));
Be careful with JavaScript
WebDriver-backed Selenium is not built for performance. It’s meant to be a transitional tool. So things will run slower in it. The worst offender being when you issue JavaScript commands directly to the Selenium Core API. So do your best to avoid things like this.
selenium.getEval(
"selenium.isElementPresent('id=foo') && " +
"selenium.isVisible('id=foo')");
Inertia
It’s worth noting that the hardest part of Google’s transition wasn’t technical. Teams were really slow to adopt WebDriver — even when the tools were readily available, well documented, and easy to use. Jason and his team were able to persevere and succeed through various means (e.g carrot, stick, elbow grease, etc.), but this really slowed their progress.
Outro
If you’re faced with a similar upgrade in your future hopefully this tip has helped prepare you for what lies ahead.
Happy Testing!
Cheers,
Naveen AutomationLabs 
Please follow and like us:

Agile Testing Interview Questions and Answers

Agile Testing Interview Questions and Answers

 
 
 

Agile Testing Interview Questions and Answers will help you prepare for Agile methodology and agile process interviews for testers or developers.

 

Q#1. What is Agile Testing?

Ans. Agile Testing is a practice that a QA follows in a dynamic environment where testing requirements keep changing according to the customer needs. It is done parallel to the development activity where testing team receives frequent small codes from the development team for testing.

 

Q#2. What is the difference between burn-up and burn-down chart?

Ans. Burn-up and burn-down charts are used to keep track the progress of the project.

Burn-up charts represent how much work has been completed in any project whereas Burn-down chart represents the remaining work in a project.

Q#3. Define the roles in Scrum?

Ans. There are mainly three roles that a Scrum team have:

1  Project Owner – who has the responsibility of managing product backlog. Works with end users and customers and provide proper requirement to the team to build the proper product.

2  Scrum Master – who works with scrum team to make sure each sprint gets complete on time. Scrum master ensure proper work flow to the team.

3  Scrum Team – Each member in the team should be self-organized, dedicated and responsible for high quality of the work.

 

Q#4. What is Product backlog & Sprint Backlog?

Ans. Product backlog is maintained by the project owner which contains every feature and requirement of the product.

Sprint backlog can be treated as subset of product backlog which contains features and requirements related to that particular sprint only.

 

Q#5. Explain Velocity in Agile?

Ans. Velocity is a metric that is calculated by addition of all efforts estimates associated with user stories completed in a iteration. It predicts how much work Agile can complete in a sprint and how much time will require to complete a project.

 

Q#6. Explain the difference between traditional Waterfall model and Agile testing?

Ans. Agile testing is done parallel to the development activity whereas in traditional waterfall model testing is done at the end of the development.

As done in parallel, agile testing is done on small features whereas in waterfall model testing is done on whole application.

 

Q#7. Explain Pair Programming and its benefits?

Ans. Pair programming is a technique in which two programmer works as team in which one programmer writes code and other one reviews that code. They both can switch their roles.

Benefits:

1.  Improved code quality: As second partner reviews the

code simultaneously, it reduces the chances of mistake.

2.  Knowledge transfer is easy: One experience partner can

teach other partner about the techniques and codes.

 Q#8. What is re-factoring?

Ans. Modification of the code without changing its functionality to improve the performance is called re-factoring.

 

Q#9. Explain the Iterative and Incremental Development in Agile?

Ans. Iterative Development: Software is developed and delivered to customer and based on the feedback again developed in cycles or release and sprints. Say in Release 1 software is developed in 5 sprints and delivered to customer. Now customer wants some changes, then development team plan for 2nd release which can be completed in some sprints and so on.

Incremental Development:Software is development in parts or increments. In each increment a portion of the complete requirement is delivered.

 

Q#10. How do you deal when requirements change frequently?

Ans. This question is to test the analytical capability of the candidate. Answer can be-

Work with PO to understand the exact requirement to update test cases. Also understand the risk in changing the requirement. Apart from this one should be able to write generic test plan and test cases. Don’t go for the automation until requirements are finalized.

 

 

Q#11. What is a test stub?

Ans. A small code which mimics a specific component in the system and can replace it. Its output is same as the component it replaces.

 

Q#12. What qualities should a good Agile tester have?

Ans.

1  Agile tester should be able to understand the requirements quickly.

2  Agile tester should know Agile concepts and principals.

3  As requirements keep changing, he should understand the risk involve in it.

4  Agile tester should be able to prioritize the work based on the requirements.

5  Communication is must for a Agile tester as it requires a lot of communication with developers and business associates.

 

Q#13. What is difference between Epic, User stories & Tasks?

Ans. User Stories:User Stories defines the actual business requirement. Generally created by Business owner.

Task: To accomplish the business requirements development team create tasks.

Epic: A group of related user stories is called an Epic.

 

Q#14. What is a Task board in Agile?

Ans. Task board is dash board which shows progress of the project. It contains:

1  User Story: which has the actual business requirement.

2  To Do: Tasks that can be worked on.

3  In Progress: Tasks in progress.

4  To Verify: Tasks pending for verification or testing

5  Done: Completed tasks.

 

Q#15. What is Test Driven Development (TDD)?

Ans. It is Test-first development technique in which we add a test first before we write a complete production code. Next we run the test and based on the result refactor the code to fulfill the test requirement.

 

Q#16. How QA can add a value to an agile team?

Ans. QA can provide a value addition by thinking differently about the various scenarios to test a story. They can provide quick feedback to the developers whether new functionality is working fine or not.

 

Q#17. What is Scrum ban?

Ans. It is a software development model which is combination of scrum and kanban. Scrumban is considered for maintenance projects in which there are frequent changes or unexpected user stories. It can reduce the minimum completion time for user stories.

rating system.

 

Q#19. What is Zero sprint in Agile?

Ans. It can be defined as pre step to the first sprint. Activities like setting development environment, preparing backlog etc needs to be done before starting of the first sprint and can be treated as Sprint zero.

 

Q#20. What is Spike?

Ans. There may be some technical issues or design problem in the project which needs to be resolved first. To provide the solution of these problem “Spikes” are created. Spikes are of two types- Functional and Technical.

 

Q#21. Name some Agile quality strategies.

Ans. Some Agile quality strategies are-

1  Re-factoring

2  Small feedback cycles

3  Dynamic code analysis

4  Iteration

5  Bug Bash

 

Q#22. What is importance of daily stand up meeting?

Ans. Daily stand up meeting is essential for any team in which-

1  Team discuss about how much work has been completed.

2  What are the plans to resolve technical issues.

3  What steps need to done to complete the projects etc.

 

Q#23. What is tracer bullet?

Ans. It can be defined as spike with the current architecture or the current set of best practices.

The purpose of a tracer bullet is to examine how an end-to-end process will work and examine feasibility.

 

Q#24. How the velocity of sprint is measured?

Ans. If capacity is measured as a percentage of a 40 hours weeks then completed story points * team capacity

If capacity is measured in man hours then Completed story points / team capacity

 

 

Hope these questions will help you in preparing for agile testing and methodology interview.

 
Cheers!
Naveen AutomationLabs
Please follow and like us:

How To Figure Out What To Test

How To Figure Out What To Test





The Problem

There is a lot to figure out when it comes to automated web testing, but where do you start? And if you’ve already started, how do you know you’re on the right track? And how do you avoid testing everything in every browser without missing important issues?

A Solution

A great way to increase your chances of automated web testing success is to map out a testing strategy. And the best way to do it is to answer these four questions:
  1. How does your business make money?
  2. How do your users use your application?
  3. What browsers are your users using?
  4. What things have broken in the application before?
NOTE: for organizations that don’t deal directly in dollars and cents (e.g. non-profits, federal agencies, etc.) you should focus on how the application generates value for the end user.
After answering these questions you’ll have a firm understanding of the critical functionality and relevant browsers for the application you’re testing. This will help you focus your test automation efforts on the things that matter most. 
You’ll want to keep track of these items somehow — the recommended approach is to use a prioritized backlog.

What To Do With The Answers

Question 1 – Money/Value

Every company’s application makes money (or generates value) through a core set of functionality — a.k.a. a ‘funnel’. Your answers to this question will help you determine what functionality makes up the funnel. This will be your highest priority for test automation.

Question 2 – Usage Data

There can be a big difference between how you think your application is used, and how yours users actually use it. And odds are your application offers a robust set of functionality that grows well beyond the core functionality of the funnel.
Your answers to this question will help you determine what features are highly used and lightly used. Tack the highly used items onto your automation backlog based on order of use below the answers to question 1.

Question 3 – Browsers

Now that you know what functionality is business critical and widely adopted by your users, you need to determine what browsers to focus your automated web testing efforts on. Your usage data will tell you this as well. It will help you determine which browsers you can reasonably avoid testing in (e.g. based on non-existent or low usage numbers). 
Note the top 2 browsers (or 3 depending on your numbers), but focus on the top 1 for now. This is the browser you will start writing your automated tests in.

Question 4 – Risky Bits

To round out the strategy it is best to think about what things have broken in the application before. You might be able to glean some of this information from a defect tracker. But the best information is often in the minds of your colleagues. Ask around and see what they say.
What you come up with will likely read like a laundry list of browser specific issues or functionality that has been flaky or forgotten about in the past. Be sure to check this list against your automation backlog. If you’ve come across something that’s not already in the backlog, add it and put it at the bottom. If it is there, make a note in the backlog item that this has been an issue in the past. And if the issue has happened numerous times and has the potential to occur again, move the item up in the backlog priority.
If issues keep cropping up that are related to a specific browser, compare this browser to your short list from question #3. If it’s a browser that’s not in your list but it’s a small pocket of high value users, track it on the backlog but put it at the bottom.

Now Your Are Ready

Having answered these questions you should now have a prioritized backlog of critical functionality that’s backed up by usage data, a short list of browsers to focus on, and an understanding of the risky parts of your application. With it you can make sure you are on the right track with your test automation (regardless if you’re just getting started with test automation or already have a mature test automation practice).

Outro

Hopefully this strategy will help you focus your testing efforts, avoid wasting time, and increase your confidence in the approach you are taking.
This strategy works best for applications with existing functionality and does not speak directly to testing new functionality that’s being actively developed. That’s not to say that the two couldn’t co-exist. It largely depends on your available resources and pace of development. But in order to reach high quality at speed, you first have to go slow.
Cheers,
Naveen Khunteta
Please follow and like us:

Where To Look for Selenium Information

Where To Look for Selenium Information

The Problem

There is information all around us when it comes to Selenium. But it it can be challenging to sift through it, or know where to look.

A Solution

Here is a list breaking down a majority of the Selenium resources available, and what they’re useful for.

Available Resources

Documentation & Tips

This is the official Selenium project documentation site. It’s a bit dated, but there is loads of helpful information here. You just have to get the hang of how the navigate site to find what you need.
This is where all the good stuff is — mainly, documentation about the various language bindings and browser drivers. If you’re not already familiar with it, take a look. It’s not perfect, but it’s better than the Selenium HQ site for a lot of topics.
Every tip I’ve written is freely available on my tips archive page. There are 70 different Selenium problems and solutions covered.

Blogs

This is where news of the Selenium project gets announced. There’s also the occasional round-up of what’s going on in the tech space (as it relates to testing). Definitely worth a look.
At some point, someone rounded up a large list of blogs from Selenium practitioners and committers. It’s a pretty good list.

Books

This book is by David Burns and it is a thorough resource. It outlines how to use Selenium, top-to-bottom, using Java. It’s a good resource to keep handy.
This a good book that covers more advanced ways to leverage Selenium. While I haven’t had a chance to finish reading it, it’s clear that Gundecha has a very pragmatic approach that will yield great results for any automated testing practice that uses Selenium.
This is the book I wish existed when I first started out. It teaches you the basics of programming needed for automated testing, how to decompose an existing web app, how to write tests so they’re reliable and maintainable, how to package things up into a test harness, and how to automate and scale your tests. I think it’s pretty good, but then again, I wrote it. It’s covers both Java and Ruby.

Meetups

This is an entirely online meetup that is co-run by myself and David Burnswhere we talk about the latest in the Selenium community (e.g., Selenium Conf, the status of Selenium 3, the WebDriver W3C spec, etc.) and answer questions from the community. Videos are recorded and made available (along with notes) on the official Selenium blog.
A listing of all in-person Selenium Meetups are available on Meetup.com. If you’re near a major city, odds are there’s one waiting for you.
If there’s not a Selenium Meetup near you, start one! Sauce Labs has a great write up on how to do it.

Conferences

This is the annual conference where practitioners and Selenium Core Committers gather and share knowledge. All of the talks are top notch, as is the hallway track. If I were to attend just one conference a year, it would be this one.
This is a self-organized Selenium conference that’s held annually in Kiev, Ukraine. It’s a well organized event with some great talks. It’s the most advanced test automation conference I’ve attended. Definitely worth the trip.

Videos

Every year talks from The Selenium Conference are recorded and made freely available online. This is one of the best resources around.
Some Selenium Meetups take it upon themselves to record their talks and publish them afterwards. Here are some of them. They are a great way to see what other pockets of the community are up to (outside of the annual Selenium Conf).
All of the Selenium Hangout Meetups are recorded and made available. A lot of great stuff is discussed in them.

Mailing Lists

The signal to noise ratio in these groups can be challenging at times. But you can occasionally find some insights and answers to your questions.
This list is less about Selenium and more about “testing” (in the checking versus testing sense). It’s a great place to ask for sage advice, and to hang out and listen.

Forums

These are the usual forums where you can go looking for answers to questions you’re facing (in addition to the mailing lists above).

Issues

If you’re running into a specific and repeatable issue that just doesn’t make sense, you may have found a bug in Selenium. You’ll want to check the Selenium Issue Tracker to see if it has already been reported. If not, then create a new issue. But be sure to read this post before you do (so you can be sure that you’ve provided enough information for the Core Committers to work on it).

IRC

The Selenium IRC Chat Channel is arguably the best way to connect with the Selenium community and get questions answered. This is where committers and practitioners hang out day-in and day-out. You can read more about what it is and how to access it here.
The is the single best resource available.

Outro

As you can see there’s a lot out there. But hopefully this list has helped guide you to the best resources for your context.
Happy Testing!
Please follow and like us:

Different Java & Selenium Interview Questions(All Service Based, Product and Start up Companies)

Different Java & Selenium Interview Questions(All Service Based, Product and Start up Companies)



Softway Solutions

JAVA

1.what is constructor?use of constructor in class?
2.why we  need to compile  a program?
3.upcasting in java?
4.polymorphism
5.singleTon class
6.overloading method


Selenium

1.what is testng?use of testng in framework?
2.how to handle alert,file upload popups
3.method overloading in Selenium?
4.access modifiers public,private,protected use in selenium
5.What is POM.XML
6.difference between .xml & .html
7.handling frames in  selenium




Indeecom  Global Services  Interview questions

JAVA

1.what is polymorphism?types of polymorphism?
2.Access Modiefiers(Private,public,protected)
3.Object life cycle architecture?
4.singleTON Class?
5.Innerclass &Anonymous class?
6.how to print without main method “hello”?
7.Method overloading & overriding & Inheritance?

Selenium

1.what is selenium webdriver?advantage of against RC,IDE?
2.How to handle javascript popup?
3.How to handle iframes?
4.how to  hadle filedownload popup?
5.what  is the use of TestngListeners?
6.what is POM.XML?
7.what is ant & use in framework?



HCL -Automation testing and Manual testing
Automation Testing
——————
1. Write a program to print your name in Java?
2. In the above program what does public static void main signify?
3. Write a program to add elements to a list?
4. What datatype can be added to a List?
5. How we can specify datatype of specific type in List?
6. Write a program to iterate through a List?
7. What is the difference between List and Map?
9. In Selenium, what is WebDriver – a class or interface?
10. Why we can’t create instance of WebDriver directly?
11. What is the difference between findElement and findElements? Explain scenario when it is used?
12. Do you know to create a Framework for test execution ?
13. What is the version of Selenium used?
14. In Selenium write code to access FirefoxDriver?


Manual Testing
————–
1. What is the difference between Whitebox and Blackbox testing?
2. What is Agile Methodology? What is Scrum,Sprint?Have you used it?
3. Who will be involved in Agile testing meeting?
4. What is DSR ,WSR?(status reports)
5. Have you done monthly Test plan?
6. Do you know Web testing?
7. Write a program to print to select all columns from Employees table and Departments table where Department name is “Testing”
8. How many years you have in Manual testing,Automation testing?
9. Have you done testing for Redbus application?
10. Write out some positive and negative scenarios to test “Add Friend” feature in Facebook?
11. What is the test design you have used to write test cases?
12. Imagine you are given a Bank Account Login Page. (userid,password,account no, Submit button). List out two positive scenarios to test it?





EBay:

What all collections you have used
What is the approch for HybridFW you used to develop.
Why KeywordDriven framework you have used.
Why Set<Iterator> you have used for handling window Handles
Internal Implementation of HashMap,ArrayList and Set Operator if you know ?
Have you written any Utilities.?
What will PageObject model will consists of ,how do you specify the elements in it.
Where all you have used ArrayList,Set and HashMap in your application.
What kind of dependencies you have added in the Maven and for what
What is your roles and responsibilities for automation.
Explain driver.getWindowHandles() in detail,how it will function.
Explain each usage of collection used in your project



what is smoke testing?
how can you test Mouse?
expline about defect tracking?
differance between sanity & smoke testing?
what is compatibility testing?
What is acceptance testing ?when we do?
difference between bug & defect?s?
what is automation test life cycle?
what is usability testing?



3. write functional test cases for ” you have three field A, B, C and one ok button field can take only two character if by using the fields the triangle is formed then ok button must display valid triangle else invalid triangle.
5. some logical puzzles he asked like :-
a> how to measure 4 lt. if u have 2 container of 5 and 3 lt.
b> 3 bulb and 3 switch puzzle
c> car parking no. puzzle
6. what is the use of cookies and cache.
7. how to remove cookies
9. if you have opened any web application and it is broken means it has changed its layout and other thing which type of testing you will perform to check this

1)Which application you work on : Web Application or Windows Application?
2)WAP on java: fibonacci series, reverse a string, reverse a string using recursion?
3)Maven – What is Maven , Why do we use it and How do we use it
4)what is maven life cycle?
5)What is StringBuffer and StringBuilder
6)Explain Parallel exection using grid ?
7)Give examples of Polymorphism,Abstraction(simple code explaination)
8)why do we use singleton class?
9)Explain your framework
10)what is the use of PageFactory.initElements?Can we implement it using PageFactory.initElements or @FindBy?
11)How do we clean the Maven environment?
12)A particular list of buttons are there?Write the xpath for it?
13)How do you configure testNG?what do you write in the .bat file?


LATEST HAPPIEST MINDS:

Happiest Minds:
 1.Explain your prevoius project, ur role
 2.how u rate ur self in java?
 3.Overloading and Overriding …when u use overLoading and Overriding.
 4.What is singleton and have used singleton concept in ur project ??
 5.What is TestNG framework and what annotations u have worked on.
 6.Write a syntax for the dataprovider in TestNg?
 7.What are the frameworks u are aware of?
 8.What are issues u faced in ur project while automation
 9.Have u followed the agile methodology??What will u do if u find the bug at the end of the sprint and how fast will u make sure that the bug is fixed and verified.
 10.Have u done compatibility testing ?? what all browsers u have used?
 11.How do u run the scripts on other browser like IE,Chrome,write the code
 12.what are exceptions u have handled in selenium webdriver

***************************************************************************************************************************************************
Cognizant Interview Question

1.Wat is the diff b/w WebDriver Listerner and TestNG Listener
2.diff b/w Assert and verify
3.count only the non duplicate words in the string
4.Frame Work and advantage of PageFactory classes
***************************************************************************************************************************************************
HCL Interview Questions

1.which frame work ur using and explain Framework
2.Questions on Nested frames Concept (Scenario given)
3.How ur using Agile Methodology in ur Project?
4.xpath Syntax
**************************************************************************************************************************************************

HCL interview Question
===================================
1st technical
From Java
=============
1.What is the Difference between final,finally,finalize
2.what is the difference between Call by value and call by referance
3.How to find out the length of the string without using length function
4.How to find out the part of the string from a string
5.difference between throw & throws
6.What is binding(Early and Late binding) **

He give Programes
———————————–
1.Reverse a number
2.1,2,3,4,5,65,76,5,,4,33,4,34,232,3,2323,
find the biggest number among these
simple string programe.
what is exception, types of exception

From manual
———————————-
what is the testcase technique
why we write test case.
bug life cycle
what are the different status of bug
what is the different between functional and smoke testing
what is STLC.

from Selenium
=======================================
what is testng and its advantage
how to handle SSl/
how to handle alert
how to take screenshot
give the diagram write a scrpt..
tell me about Project .What are the challenge face during project
what is the difference between RC and webdriver
what is freamwork explain it.
why we use wait statement.

2nd technical
he gives a application & tell to write the scenario
some manual testing concepts.
===================================

CaterPiller

1.Diff b/w final finally and finalize
2.how you will avoid object cloneable
3.wat is synchronize methods
4.wat finalize method will do
5.Quesion on Joints
6.Defect life Cycle
7.wat is Smoke Testing and Regression testing
8.Test case Design Techniques
9.how to run tests parallely in different browsers
10.Explain hashing technique***
11.How u will return multiple values in a method

EF Systems

1.how to run tests parallely in different browsers
2.java program to reverse String
3.pgm to sort array in ascending order
4.diff b/w implicit wait and explicit wait
5.Test case Design Techniques
6.dif b/w delete drop and truncate
7.wat is inheritence polymorphism and encapsulation
8.wat is interface

Happiest Minds

1.Explain ur FramwWork
2.How u will run tests parallely
3.pgm to search ipod in flipkart and sort the results in ascending order based on price
4.give examples for Checked exception and Runtime Exception.
5.Some time application takes 2 sec to load some time 30 sec some times more than 5 min how u will handle this.**
6.wat is maven and wat is ant

COGNIZANT Questions:

1. tell me abt urself
 2. what is stlc
 3. what is test planning
 4. defect life cycle
 5. what is inheritance
 6. method overloading and overriding
 7. framework & framework used in the company
 8. what is Parametisation and how do you use it in TestNG
 9. how do you execute the tests based on priority
 10. what are the annotations
 11. what is the order of executing the annotations
 12. when a test suite is executed in the order
 13. Tell me anything about collections
 14. interfaces
 15. what is the difference between interface and a class
 16. what are arrays and list difference between them
 17. Is parameterisation possible and how(Tell the coding)
 18. how do you check whether a test script is passed or not
 19. if a test case fails how will you log the failure and the exception that caused. how will you report the result to your team lead, prj manager and the customer
 20. what is the framework you are using for logging the bugs
 21. How do you submit all the test scripts, execution results to you TL, PM
 22. what is the process followed in you company
 23. what is the difference between agile methodology and spiral modal
 24. what is requirement traceability matrix
 25. how do hover a link which is present on web page which opens a pop up containing a link.how do you click on the link that is in th pop up
 26. prgm for reading a excel file
 27. how do you initialise a chrome browser
 28. SQl-joins,difference between inner joins and outer joins
 29. i am having a table which consists of student details,id, marks and how do i fetch the second maximum value from the table
 30. I am having two tables one having student id, student name,and the college id and the other table having college id,college name, location now i want to get map these two tables and get the students who are studying in a specific college
 31. i want the count of all the students who belongs to same location
 —interview questions in cognizant

Infosys Interview Questions:

 1.Brief Description
 2.How will you rate yourself in Selenium.
 3.SIDE
 4.How will you handle pop-up.
 5.Which framework you are using in your project & why.
 6.How will you handle java script pop-up.
 7.How will you handle SSL issue
 8.How will you take screenshot.
 9.How will you handle AJAX?Explain it with code.
 10.Explain your framework.
 11.What is STLC,Test Plan & Defect Life Cycle(Procedure to file a defect)
 12.traceability matrix
 13.Selenium Grid concepts with code ?RC
 14.Project Description
 15.Diff between Implicitly Wait and Explicitly Wait
 16. When will you stop testing
 17.Thread 7 Synchronization in java
 18.why you switched three companies in 3 years.

1. What difficulty you faced in Automation?

2. What you do with your code when a new version of browser is launched?
3. What are the features in your automation code?
4. How to integrate HPALM/HPQC with Selenium?
5. How you are sending the emails from framework, as .rar files are blocked in most of the companies?
6. How code review is done for your code?


Erricson:

How selenium will select/click elements on the webpage.
How you will idenity elements.
How your testscript will look for login page.
If you have 10 testscripts,and in each testscript there are 5 TestNGMethods how you will execute.
If you want to verify data you selected in one Testmethod ,is same displayed in the another testmethod/webpage (Ex:Shopping Cart)
What is Axes in the X path
How do you run tests using Testng  (answer:xml)
How do you execute your fraamework from command prompt

java -cp bin;jars/* org.testng.TestNG <suitename>.xml



Tavant:

1) Tell me about ur current project and ur role it?
 2) Java Oops Concepts?
 3) We have two dropdown boxes if we select 1st same will be displaed in 2nd how u test it?
 4) We have a table with different colomns if u click on title it will be sorted how u test it is sorted or not?
 5) u don’t have d.b access if u give data then it will take how u test that data is stored in d.b or not?(Regestration page)
 6) i have 8 marbles of same size and color and same weight excepet one..how u find the odd one.?
 7) how do u find a perticular word in a statement “Hi how ‘are’ you”?
 8) Testng
 9) Jenkins
 10)Grid
 11)parallel execution in diff browers ?
 12) write complete program for..while login it shows “sucess” is displayed or not?
 13)frame work?
 14)defect life cycle.



HCL Interview Questions

 1.which frame work ur using and explain Framework
 2.Questions on Nested frames Concept (Scenario given)
 3.How ur using Agile Methodology in ur Project?
 4.xpath Syntax


Happiest Minds

 1.Explain ur FrameWork
 2.How u will run tests parallely
 3.pgm to search ipod in flipkart and sort the results in ascending order based on price
 4.give examples for Checked exception and Runtime Exception.
 5.Some time application takes 2 sec to load some time 30 sec some times more than 5 min how u will handle this.
 6.wat is maven and wat is ant
    Maven is dependance tool (used to download latest jar from internet before running) ANT is Build tool
 7.In a String remove duplicate words and duplicate characters.
 8.what is checked exception and gve example
  Exception which are verified by the compiler before the compilation and it makes it mandatory to try-catch or throws.
   are checked exception example InvalidFormatException, IOException, InterruptedException
 9.Script to find ipad in flipkart and the results should store in ascending order

  Tavant

  1..write a code for pagination testing.(need to identify one records in a table)
  2.how will u handle frames?
  3.how will u handle calendar popup scenario?
  4.Explain about TestNG.
  5.Explain about POM.
 6.what are the factors should consider before doing automation?

 CaterPiller

  1.Diff b/w final finally and finalize
  2.how you will avoid object cloneable
  3.wat is synchronize methods
  4.wat finalize method will do
  5.Quesion on Joints
  6.Defect life Cycle
  7.wat is Smoke Testing and Regression testing
  8.Test case Design Techniques
  9.how to run tests parallely in different browsers
  10.Explain hashing technique
 11.How u will return multiple values in a method

 EF Systems

  1.how to run tests parallely in different browsers
  2.java program to reverse String
  3.pgm to sort array in ascending order
  4.diff b/w implicit wait and explicit wait
  5.Test case Design Techniques
  6.dif b/w delete drop and truncate
  7.wat is inheritence polymorphism and encapsulation
 8.wat is interface

 Cognizant Interview Question

  1.Wat is the diff b/w WebDriver Listerner and TestNG Listener
     Both are interface but WebDriver listener are triggered when you call webdriver methods like findElement,
     click etc example-afterClickOn; beforeFindBy…. TestNG Listener are triggered when testng methods are executed such as
      onTestFailure onFinish..
  2.diff b/w Assert and verify
  3.count only the non duplicate words in the string
 4.Frame Work and advantage of PageFactory classes

 3D PLM:

 1. difference between smoke testing and adhoc testing.
 2. difference between integration testing and system testing with examples.
 3. write functional test cases for ” you have three field A, B, C and one ok button field can take only two character if by using the fields the triangle is formed then ok button must display valid triangle else invalid triangle.
 4. difference between http and https?
 5. some logical puzzles he asked like :-
 a> how to measure 4 lt. if u have 2 container of 5 and 3 lt.
 b> 3 bulb and 3 switch puzzle
 c> car parking no. puzzle
 6. what is the use of cookies and cache.
 7. how to remove cookies
 8. how to test web application
 9. if you have opened any web application and it is broken means it has changed its layout and other thing which type of testing you will perform to check this


 What is severity and priority in software testing?
  What is Stub?
  What is abstraction ?
  What is Encapsulation in Java and OOPS with Example
  What is Functional Testing? What are the Different Techniques used in it
  Black Box Testing: Types and techniques of BBT
  SQL Questions
  What is the difference between inner and outer join? Explain with example.
  What is the difference between JOIN and UNION?
  What is the difference between UNION and UNION ALL?
  What is the difference between WHERE clause and HAVING clause?
  What is the difference among UNION, MINUS and INTERSECT?
  What is Self Join and why is it required?
  How can we transpose a table using SQL (changing rows to column or vice-versa) ?
  How can we transpose a table using SQL (changing rows to column or vice-versa) ?
  How to select first 5 records from a table?
  What is the difference between ROWNUM pseudo column and ROW_NUMBER() function?
 What are the differences among ROWNUM, RANK and DENSE_RANK?



 ACI Worldwide Interview Questions

  1st Round-Written Test
  Java
  1. What is Polymorphism?
  2. What is Abstraction?
  3. Difference between static and non-static members?
  4. Difference between super and this?
  5. What is a List and Set?
  6. What is Encapsulation?
  7. What is Access Specifies in java?
  8. Diagram and Asked to write Program?

 Selenium

 1. Code to select all the check boxes?
  2. Different Waits in Selenium?
  3. How do you make sure that Checkbox/Radio button is selected or not? Button Enabled or not?
  4. How do you handle drop down list?
  5. Code to select all the options present in multi select list box?
  6. How to perform drag and drop of element and Right clicking on element?
  7. How do you handle Alert popup?
  8. How do you handle element present in Frames? Code to transfer control from frame to main page
  9. How do u setup profile in Firefox browser?
  10. What are Annotations?
  11. Write a code to take screen shot for only failed test scripts?
  12. Write a code to print number of links present on a webpage?
  13. Code for Login page and how do u verify whether it is successfully logged in or not using assert?

 2nd Round – Technical

  1. Introduce yourself?
  2. STLC?
  3. What is Interface and Abstract Class?
  4. Can we create an object of Abstract class?
  5. What are the types of Automation frameworks we have? Can u explain them?
  6. What is a sub Query?
  7. What are Joins?
  8. Queries on Joins and Sub-Query?
  9. What is TestNG? Why we use it in Selenium?
  10. Explain Automation Framework?
  11. Program on Prime Number?
  12. SDLC?
  13. Program to Read and Write data in to Excel Sheet?
  14. How to Right Click in Selenium?
  Manager Round
  1. About Yourself?
  2. Why Testing U r from Electronics Background right?
  3. Qualities of Good Test Engineer?
  4. Challenges in Testing?
  5. Objectives of Developer and Test Engineer?
  6. About Family?
  7. Explain frame Work?



QSG interview questions

1.Tell me about yourself
 2.What is difference between array and string
 3.What are different types you have in Microsoft Office
 4.How do you create table in MS Office
 5.How do you add column to a table
 6.what is framework
 7.write a prgm for sorting a string
 8.Why we go for inheritance
 9.what are different types of annotations expl @Groups
 10.tell abt your s/m configuration





I want to select two different values in two different dropdown list(without using xpath). which has same ID . pls help..

List<WebElement> allListBox = driver.findElements(By.id(“jasa”));
 for(int i=0;i<allListBox.size();i++)
 {
 WebElement listBox=allListBox.get(i);
 Select select=new Select(listBox);
 select.selectByIndex(i);
 }


HappyestMind& Ness


Selenium

1.Write the syntax of drop down
2.What is Webdriver-Java interface
3.What is the current Version of Selinumwebdriver
4.How to get the text value from text box
5.StrinG x=”ABC”;
 String x=”ab”; does it create two objects?
6.write a program to compare the strings
7.Class a
{
}
class b extends a
{
}
A a= new A();
B b=new B();
A a= new B();
B a=new A();
Which is valid and invalid?
8.How to handle differnt type of pop up.(Wnidow,Alerts,Invisiblepopup)
9.How to handle DropDown menu
10. How to handle SSL certificate
11.How to handle Google search text.
12. How to handle dynamic text box which contains the 3 numbers, get
the number and add the three number and add it other text box.
13.How to handle Ajax Objects
8.Explain webdriver architecture
9.Explain File downloading
10.Explain File attachments other that Auto IT
11.Write the syntax for finding the row count in dynamic web table
12.Differnece between class and Interface
13. What type of class is the string class
14.WHAT are the differnt methods that are used along with Xpath
15.Explain Interface
16 Explain Abstract
17.What is selenum grid
18 what is selenium RC
19.Why is key word drivern frame work only choosen,
1. how to handle dynamic object
2. how to work with button which is in div tag and and u have to click
without using xpath
3. JVM is dependent or independent platform

4.how many Test script you write in day
5. describe your framework
6. how to parameterized your junit
7.how to handle ssl security
8. how to handle window pops
9. diffnct between implicit and explicit
10.what are the types of assertion and what are assertion in junit
11.How to handle ssl certificate
12.What is dom concept
13.What is the challenges u have faced during Automation
14What is genrics
15.What is synchronization

Java


1.JVM is dependent or independent platform
2.diffn bwhashmap and hash set, set and linkedlist, arraylist and
vector list , linkedhash set and hashset
3.abstract and interface
4.throw and throws
5.how to split
6.checked and unchecked exception
7.how to work with ajax aplication
8.why sring is immutable
9.wat is the retruntype of getwindowhandles();
10.what are the types of assertion and what are assertion in java
11.differnce between interface and Abstract classes
12.What is static varaible
13.what is volatile
14. what is trainsient
15.what is the differnece between Final,Finalize and finally
16.what is the differnce between Public,private and protected

Hi Guys,

Please find Selenium Webdriver add on for Element –locator-for-webdriver(Dynamic Xpath)

https://addons.mozilla.org/en-US/firefox/addon/element-locator-for-webdriv/


Click on Add to Firefox

Steps:

1) Right click on webelement and select Xpath
 or
 2) Right click on webelement and select Java locators
 3) Click on Xpath and paste it into notepad
 .

Its very useful to you to develop/create Xpaths and writing the Selenium code.
 It saves lot of time

Prowareness Interview Questions

1. If there is a priority bug from production how do you address when the Sprint is in progress?
2. What is the level of involvement of Management in a Scrum team?
3. After a Sprint ends when the planning for next sprint begins?
4. Have you created VBA macros to update status of multiple test cases in QC?
5. I had DB2 exp in resume – so he asked me to write a join query invoving table A & B where only the values from table B be retrieved excluding those rows from B having matching rows in A.
6. What are the challenges you faced while creating framework?
7. Have you used Selenium Grid?
8. Have you run tests in parallel?
9. How will you wait until all the elements in a page gets loaded, the page is completely dynamic and you cannot guess which will be the last element to load.
10. When tests run in parallel how will Webdriver know that it has to work on a particular Browser window only?
11. When you move from one page to another how will you ensure that the proper page is loaded?
12. How will you drag and drop an element in a webpage?
13. If the element for which you are waiting for is not loaded, how will you handle the same?
14. How selenium interacts with Firefox, Chrome and IE (internal aspects)?
15. Have you used Javascript Executor in your scripting?
16. Why is main method Static?
17. Can the main method have return type other than void? (Yes it can, it can have return type int to provide info about successful execution, this info can be used in batch file/shell scripting – interviewers answer)
18. I was given a Unstable system of a Agile toolkit (its like our Jira) and was aked to list down the scenarios for testing Task Creation and editing the same. Also I was asked to find the bugs.
19. For the above scenario (point 18), I was asked to automate Task Creation and drag & drop of task from ‘To Do’ to ‘In Progress’. This has to be done alongside with TestNG framework.
I was given 2hrs for performing point 18 & 19.

Genpact HeadStrong Questions


1. factorial,prime,armstorngnumber,swaping two numbers without temp var–Programs
2. interface,abstraction,encapsulation
3. diff between pagefactory n pageobject model
4. printstacktrace(exception related)
5. diff between string.equals and string1==string2
6. normalisation
7. searching with keyword and copy all the files name into one file
8. how grid works
9. how to debug or fix the issue
10. how to switch from one window to another window
11. mousemover concept
12. explain testNG framework
13. dataprovide,findby annotation
14. how to do exectuion of second method after first method method exectuion only without giving priority
15. what is diff between string,string buffer,string builder
16. diff between method overloading n method overriding
17. exception means? how do u recongnise where to fix in lengthy code if somewhere exception occurs while executing
18. diff between list-iterator and iterator
19. what is hashmap
20. how do u execute testcases using testng
21. how do u run batch execution, which one ur using for tht
22. how to print webtable in same structure on console
23. how do you switch multiple windows
24. how do you switch between tabs
25. How do you find webpage background color
1. How do you write xpath, if last three characters keeps on changing EX : “abc_ _ _”.
2. Pagefactory concepts.
3. Collections, list concepts.
4. Have you involved in Framework developement?
5. How do you fetch data from webtable in a webpage?
6. In a webtable, how do you fetch only last column data?
7. How do you handle dynamic element?
8. What is concrete method?
9. Actions, windowhandle and Select concepts.
10 Are you using any build tool?
11. Grid concepts.
12. How much do you rate yourself in Java out of 5?
13. Which API used to fetch data from excel sheet?
Telephonic Questions of Happiest Minds..
1. When do you abstract class and when do you use interfaces.
2. Have you written / are there any interface in your automation frame work.
3. How do you run Java Script directly in Web Driver.
4, If the customer does not want DOM model of automation, what is your suggestion.
5. tell me about your framework.
6. How flexible is your framework.
7. Few Questions on Serialization, Threads and OOPS concepts.

Mind tree

what framework have you worked and used in automation?
How many methods are there in in your framework libraries?
What all methods in libraries?
How many test scripts are there for your application?
How often do you run your automation test?
what is getAttribute and getText?
what is the time taken to run all your scripts?
what all settings do you do before running your automation test?
How do you pass values to method?
who writes the test cases?
write a script to print the multiples of 5?
How do change the run time property values of the element?
How do handle dynamic elements during run time?
what version of selenium do you use and which is the latest version?
Suppose a webtable is there with three columns such as combo box,name and id.I want to search a particular id and also check the checkbox for that particular id.How would you do that?

FICO company technical questions for Core Java +Selenium

.what is the default package in java ?
2.: why we use interface why not abstract class …what if i implements same method in interface and abstract ….thn ?? any diffrnc??
3. what are inner classes ..name them ?
4.in public static void main(String arr[])… what if i replace public with private ……….. remove static ……..replace void with string
5.in hash map we have (key and value ) pair , can we store inside a value =(key, value ) again ??
5. what are variable scope in java (in class , in method , in static block)
6. what are the oops concept ? explain them each with real world examples
7.
8. what is singleton classes ?
9.what is difference between .equals() , (==) and compare-to();
10. what is the difference between hash code and equals
11.write a program to get substring of string ex: javais good … so result : avais
12.write a program to reverse the string
13. wap for binary search
14.what is the use of package
15. why we use interface and abstract
16.we have 2 interface both have print method , in my class i have implemented the print method , how u wil get to know that i have implemented the first interface and how u will use it .. if u want to use it
17.what is the difference between vector list and arraylist
18. difference between hashmap and hash table, what is synchronization , how it is achieved
19. what is the use of collection, when we use it
20. what is priority queue in collection , what is the use , how u have use in your project
21.where to use hashmap and hashtable
22. where u have use the concept of interface and abstract in your framework

HCL Interview Questions.

1. Code for Login page / how do you find and store the Elements / Locators ?
2. How to use the same Test Script for Localization testing ( for a different language browser / different language settings).
3. Why do we upcast FirefoxDriver to Webdriver ?
4. How do you use @parameter Annotation in TestNg ?
5. How do you use load elements through properties file and run using TestNG ?







For any feedback, feel free to reach me. You can write to me at naveenanimation20@gmail.com

Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:

Follow me on my Facebook Page:
Please follow and like us:

Top 90 Selenium Interview Questions & Answers

Top 90 Selenium Interview Questions & Answers

Selenium Interview Questions & Answers for Freshers and Experienced – Part -1

Selenium Interview Questions & Answers for Freshers and Experienced – Part -2

Selenium Interview Questions & Answers for Freshers and Experienced – Part -3

Selenium Interview Questions & Answers for Freshers and Experienced – Part -4

Selenium Interview Questions & Answers for Freshers and Experienced – Part -5

1. What is Automation Testing?
Automation testing is the process of testing the software using an automation tool to find the defects. In this process, executing the test scripts and generating the results are performed automatically by automation tools. Some most popular tools to do automation testing are HP QTP/UFT, Selenium WebDriver, etc.,
2. What are the benefits of Automation Testing?
·       Saves time and money. Automation testing is faster in execution.
·       Reusability of code. Create one time and execute multiple times with less or no maintenance.
·       Easy reporting. It generates automatic reports after test execution.
·       Easy for compatibility testing. It enables parallel execution in the combination of different OS and browser environments.
·       Low-cost maintenance. It is cheaper compared to manual testing in a long run.
·       Automated testing is more reliable.
·       Automated testing is more powerful and versatile.
·       It is mostly used for regression testing. Supports execution of repeated test cases.
·       Minimal manual intervention. Test scripts can be run unattended.
·       Maximum coverage. It helps to increase the test coverage.
3. What type of tests have you automated?
Our main focus is to automate test cases to do Regression testing, Smoke testing, and Sanity testing. Sometimes based on the project and the test time estimation, we do focus on End to End testing.
4. How many test cases you have automated per day?
It depends on Test case scenario complexity and length. I did automate 2-5 test scenarios per day when the complexity is limited. Sometimes just 1 or fewer test scenarios in a day when the complexity is high.
5. 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
6. Have you created any Framework?
If you are a beginner: No, I didn’t get a chance to create a framework. I have used the framework which is already available.
If you are an experienced tester: Yes, I have created a framework.  Or I have involved in the creation of the framework.
7. Can you explain the Framework which you have used in your Selenium Project?
Here we have clearly explained each component of Framework.
8. Why do you prefer Selenium Automation Tool?
·       Free and open source
·       Have large user base and helping communities
·       Cross browser compatibility
·       Platform compatibility
·       Multiple programming languages support
9. What is Selenium?
Selenium is an open source (free) automated testing suite to test web applications. It supports different platforms and browsers. It has gained a lot of popularity in terms of web-based automated testing and giving a great competition to the famous commercial tool HP QTP (Quick Test Professional) AKA HP UFT (Unified Functional Testing).
Selenium is a set of different software tools. Each tool has a different approach in supporting web based automation testing.
It has four components namely,
i     Selenium IDE (Integrated Development Environment)
ii    Selenium RC (Remote Control) – selenium 1
iii   Selenium WebDriver – selenium 2 & 3
iv  Selenium Grid
10. What is Selenium IDE?
Selenium IDE (Integrated Development Environment) is a Firefox plugin. It is the simplest framework in the Selenium Suite. It allows us to record and playback the scripts. Even though we can create scripts using Selenium IDE, we need to use Selenium RC or Selenium WebDriver to write more advanced and robust test cases.
11. What is Selenese?
Selenese is the language which is used to write test scripts in Selenium IDE.
12. Which is the only browser that supports Selenium IDE to be used?
Firefox
13. What is Selenium RC?
Selenium RC AKA Selenium 1. Selenium RC was the main Selenium project for a long time before the WebDriver merge brought up Selenium 2. Selenium 1 is still actively supported (in maintenance mode). It relies on JavaScript for automation. It supports Java, Javascript, Ruby, PHP, Python, Perl and C#. It supports almost every browser out there.
14. What is Selenium WebDriver?
Selenium WebDriver AKA Selenium 2 is a browser automation framework that accepts commands and sends them to a browser. It is implemented through a browser-specific driver. It controls the browser by directly communicating with it. Selenium WebDriver supports Java, C#, PHP, Python, Perl, Ruby.
15. What is Selenium Grid?
Selenium Grid is a tool used together with Selenium RC to run tests on different machines against different browsers in parallel. That is, running multiple tests at the same time against different machines running different browsers and operating systems.
In simple words, it is used to distribute your test execution on multiple platforms and environments concurrently.
16. When do you 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
17. What are the advantages of Selenium Grid?
It allows running test cases in parallel thereby saving test execution time.
It allows multi-browser testing
It allows us to execute test cases on multi-platform
18. What is a hub in Selenium Grid?
A hub is a server or a central point that controls the test executions on different machines.
19. What is a node in Selenium Grid?
Node is the machine which is attached to the hub. There can be multiple nodes in Selenium Grid.
20. What are the types of WebDriver APIs available in Selenium?
   Firefox Driver
   Gecko Driver
   InternetExplorer Driver
   Chrome Driver
   HTMLUNIT Driver
   Opera Driver
   Safari Driver
   Android Driver
   iPhone Driver
   EventFiringWebDriver
21. Which WebDriver implementation claims to be the fastest?
The fastest implementation of WebDriver is the HTMLUnitDriver. It is because the HTMLUnitDriver does not execute tests in the browser.
22. What are the Programming Languages supported by Selenium WebDiver?
   Java
   C#
   Python
   Ruby
   Perl
   PHP
23. What are the Operating Systems supported by Selenium WebDriver?
   Windows
   Linux
   Apple
24. What are the Open-source Frameworks supported by Selenium WebDriver?
   JUnit
   TestNG
   CUCUMBER
   JBHEAVE
25. What are the Locators available in Selenium?
Different types of locators are:
1   ID –  
2   ClassName –  
3   Name –  
4   TagName –  
5   LinkText –  
6   PartialLinkText –  
7   XPath –  
8   CSS Selector –  
26. What is a XPath?
XPath is used to locate the elements. Using XPath, we could navigate through elements and attributes in an XML document to locate web elements such as textbox, button, checkbox, Image etc., in a web page.
27. What is the difference between “/” and “//” 
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.
28. What is the difference between Absolute Path and Relative Path?
Absolute XPath starts from the root node and ends with desired descendant element’s node. It starts with top HTML node and ends with input node. It starts with a single forward slash(/) as shown below.
/html/body/div[3]/div[1]/form/table/tbody/tr[1]/td/input
Relative XPath starts from any node in between the HTML page to the current element’s node(last node of the element). It starts with a single forward slash(//) as shown below.
//input[@id=’email’]

29. What is the difference between Assert and Verify in Selenium?
1
2
3
4
5
WebDriver driver = new FirefoxDriver();
instead of creating
FirefoxDriver driver = new FirefoxDriver();
1
driver.findElement(By.linkText(Software Testing Material Website”)).click();
1
1
driver.get(“http://www.softwaretestingmaterial.com”);
3  1
4   boolean elePresent = driver.findElement(By.xpath(“xpath”)).isDisplayed();
3  1
4   boolean eleSelected= driver.findElement(By.xpath(“xpath”)).isSelected();
3  1
4   boolean eleEnabled= driver.findElement(By.xpath(“xpath”)).isEnabled();
Assert: In simple words, if the assert condition is true then the program control will execute the next test step but if the condition is false, the execution will stop and further test step will not be executed.
Verify: In simple words, there won’t be any halt in the test execution even though the verify condition is true or false.
For detailed post check the below link.
30. What are Soft Assert and Hard Assert in Selenium?
Soft Assert: Soft Assert collects errors during @Test Soft Assert does not throw an exception when an assert fails and would continue with the next step after the assert statement
Hard Assert: Hard Assert throws an AssertException immediately when an assert statement fails and test suite continues with next @Test
31. What are the verification points available in Selenium?
In Selenium IDE, we use Selenese Verify and Assert Commands as Verification points
In Selenium WebDriver, there is no built-in features for verification points. It totally depends on our coding style. some of the Verification points are
To check for page title
To check for certain text
To check for certain element (text box, button, drop down, etc.)
32. How to launch a browser using Selenium WebDriver?
WebDriver is an Interface. We create Object of a WebDriver Interface.
<2.53 – no geckodriver
3.x – geckodriver for FF
To launch Firefox Driver:WebDriver driver = new FirefoxDriver(); 
To launch Chrome Driver:WebDriver driver = new ChromeDriver();
To launch Internet Explorer Driver:WebDriver driver = new InternetExplorerDriver();
33. Is the FirefoxDriver a Class or an Interface? 
FirefoxDriver is a Java class, and it implements the WebDriver interface.
34. What is the super interface of WebDriver?
SearchContext.
35. Explain the line of code Webdriver driver = new FirefoxDriver(); ?
 ‘WebDriver‘ is an interface and we are creating an object reference of type WebDriver instantiating an object of FirefoxDriver class.
36. We do create a reference variable ‘driver’ of type WebDriver
WebDriver driver = new FirefoxDriver();
instead of creating
FirefoxDriver driver = new FirefoxDriver();
What is the purpose of doing this way?
f we create a reference variable driver of type WebDriver then we could use the same driver variable to work with any browser of our choice such as IEDriver, SafariDriver etc.,
//FirefoxDriver driver = new FirefoxDriver();
ChromeDriver driver = new ChromeDriver();
driver.get(“http://www.google.com”);
WebDriver driver = new FirefoxDriver();
37. What are the different exceptions you have faced in Selenium WebDriver?
   WebDriverException
   TimeoutException
   NoAlertPresentException
   NoSuchWindowException
   NoSuchElementException
   StaleElementReferenceException
   IllegalStateException
38. How To Login Into Any Site If It Is Showing Any Authentication Pop-Up For Username And Password?
To do this we pass username and password with the URL
http://username:password@url
39. What are the types of waits available in Selenium WebDriver?
In Selenium we could see three types of waits such as Implicit Waits, Explicit Waits and Fluent Waits.
   Implicit Waits –  
   Explicit Waits –  
   Fluent Waits –  
   PageLoadTimeOut
   Thread.sleep() – static wait
40. What is Implicit Wait In Selenium WebDriver?
Implicit waits tell to the WebDriver to wait for a certain amount of time before it throws an exception. Once we set the time, WebDriver will wait for the element based on the time we set before it throws an exception. The default setting is 0 (zero). We need to set some wait time to make WebDriver to wait for the required time.
41. What is WebDriver Wait In Selenium WebDriver?
WebDriverWait is applied on a certain element with defined expected condition and time. This wait is only applied to the specified element. This wait can also throw an exception when an element is not found.
42. What is Fluent Wait In Selenium WebDriver?
FluentWait can define the maximum amount of time to wait for a specific condition and frequency with which to check the condition before throwing an “ElementNotVisibleException” exception.
43. How to input text in the text box using Selenium WebDriver?
By using sendKeys() method
WebDriver driver = new FirefoxDriver();
driver.get(“https://www.gmail.com”);
driver.findElement(By.xpath(“xpath”)).sendKeys(“test”);
44. How to input text in the text box without calling the sendKeys()?
// To initialize js object
JavascriptExecutor JS = (JavascriptExecutor)driver;
// To enter username
JS.executeScript(“document.getElementById(‘User’).value=test.com'”);
45. How to clear the text in the text box using Selenium WebDriver?
By using clear() method
WebDriver driver = new FirefoxDriver();
driver.get(“https://www.gmail.com”);
driver.findElement(By.xpath(“xpath_of_element1”)).sendKeys(“Software Testing Material Website”);
driver.findElement(By.xpath(“xpath_of_element1”)).clear();
46. How to get a text of a web element?
By using getText() method
47. How to get an attribute value using Selenium WebDriver?
By using getAttribute(value);
48. How to click on a hyperlink using Selenium WebDriver?
We use click() method in Selenium to click on the hyperlink
driver.findElement(By.linkText(“Software Testing Material Website”)).click();
49. How to submit a form using Selenium WebDriver?
We use “submit” method on element to submit a form
driver.findElement(By.id(“form_1”)).submit();
Alternatively, you can use click method on the element which does form submission
50. How to press ENTER key on text box In Selenium WebDriver?
To press ENTER key using Selenium WebDriver, We need to use Selenium Enum Keys with its constant ENTER.
driver.findElement(By.xpath(“xpath”)).sendKeys(Keys.ENTER);
51. How to pause a test execution for 5 seconds at a specific point?
By using java.lang.Thread.sleep(long milliseconds) method we could pause the execution for a specific time. To pause 5 seconds, we need to pass parameter as 5000 (5 seconds)
Thread.sleep(5000)
52. Is Selenium Server needed to run Selenium WebDriver Scripts?
When we are distributing our Selenium WebDriver scripts to execute using Selenium Grid, we need to use Selenium Server.
53. What happens if I run this command. driver.get(“www.softwaretestingmaterial.com”) ;
An exception is thrown. We need to pass HTTP protocol within driver.get() method.
driver.get(“http://www.softwaretestingmaterial.com”);
54. What is the alternative to driver.get() method to open an URL using Selenium WebDriver?
Alternative method to driver.get(“url”) method is driver.navigate.to(“url”)
55. What is the difference between driver.get() and driver.navigate.to(“url”)?
driver.get(): To open an URL and it will wait till the whole page gets loaded
driver.navigate.get(): To navigate to an URL and It will not wait till the whole page gets loaded
56. Can I navigate back and forth in a browser in Selenium WebDriver?
We use Navigate interface to do navigate back and forth in a browser. It has methods to move back, forward as well as to refresh a page.
driver.navigate().forward(); – to navigate to the next web page with reference to the browser’s history
driver.navigate().back(); – takes back to the previous webpage with reference to the browser’s history
driver.navigate().refresh(); – to refresh the current web page thereby reloading all the web elements
driver.navigate().to(“url”); – to launch a new web browser window and navigate to the specified URL
57. What are the different types of navigation commands?
Refer above question (Can I navigate back and forth in a browser)
58. How to fetch the current page URL in Selenium?
To fetch the current page URL, we use getCurrentURL()
driver.getCurrentUrl();
59. How can we maximize browser window in Selenium?
To maximize browser window in selenium we use maximize() method. This method maximizes the current window if it is not already maximized
driver.manage().window().maximize();
60. How to delete cookies in Selenium?
To delete cookies we use deleteAllCookies() method
driver.manage().deleteAllCookies();
61. What are the ways to refresh a browser using Selenium WebDriver?
There are multiple ways to refresh a page in selenium
   Using driver.navigate().refresh() command as mentioned in the question 45
   Using driver.get(“URL”) on the current URL or using driver.getCurrentUrl()
   Using driver.navigate().to(“URL”) on the current URL or driver.navigate().to(driver.getCurrentUrl());
   Using sendKeys(Keys.F5) on any textbox on the webpage
62. What is the difference between driver.getWindowHandle() and driver.getWindowHandles() in Selenium WebDriver?
driver.getWindowHandle() – It returns a handle of the current page (a unique identifier)
driver.getWindowHandles() – It returns a set of handles of the all the pages available.
63. What is the difference between driver.close() and driver.quit() methods?
Purpose of these two methods (driver.close and driver.quit) is almost same. Both allow us to close a browser but still, there is a difference.
driver.close(): To close current WebDriver instance
driver.quit(): To close all the opened WebDriver instances
64. What is the difference between driver.findElement() and driver.findElements() commands?
The difference between driver.findElement() and driver.findElements() commands is-
   findElement() returns a single WebElement (found first) based on the locator passed as parameter. Whereas findElements() returns a list of WebElements, all satisfying the locator value passed.
   Syntax of findElement()-
   WebElement textbox = driver.findElement(By.id(“textBoxLocator”));
   Syntax of findElements()-
   List <WebElement> elements = element.findElements(By.id(“value”));
   Another difference between the two is- if no element is found then findElement() throws NoSuchElementException whereas findElements() returns a list of 0 elements.
List<WebElement> list = driver.findElements(By.tagName(“a”));
Sop(list.size()); ==40
65. How to find whether an element is displayed on the web page? 
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.
1   isDisplayed()
2   boolean elePresent = driver.findElement(By.xpath(“xpath”)).isDisplayed();
1   isSelected()
2   boolean eleSelected= driver.findElement(By.xpath(“xpath”)).isSelected();
1   isEnabled()
2   boolean eleEnabled= driver.findElement(By.xpath(“xpath”)).isEnabled();
66. How to select a value in a dropdown?
By using Select class
WebElement mySelectElement = driver.findElement(By.name(“dropdown”));
Select dropdown = new Select(mySelectElement);
dropdown.selectByVisibleText(Text);
dropdown.selectByIndex(Index);
dropdown.selectByValue(Value);
67. How to capture Screenshot in Selenium WebDriver?
By using TakesScreenshot Interface
In Selenium 3, we may face few issues while capturing Screenshots. To overcome we use aShot utility. Click on below links to see posts related to the normal way of capturing a screenshot and capturing a screenshot using aShot utility.
68. How to mouse hover on a web element using WebDriver?
By using Actions class
WebElement ele = driver.findElement(By.xpath(“xpath”));
//Create object ‘action’ of an Actions class
Actions action = new Actions(driver);
//Mouseover on an element
action.moveToElement(ele).build().perform();
69. How can we handle web based pop-up?
To handle alerts popups we need to do switch to the alert window and call Selenium WebDriver Alert API methods.
70. How can we handle windows based pop up?
Selenium doesn’t support windows based applications. It is an automation testing tool which supports only web application testing. We could handle windows based popups in Selenium using some third party tools such as AutoIT, SIKULI, Robot class etc.
71. How to handle hidden elements in Selenium WebDriver?
It is one of the most important selenium interview questions.
We can handle hidden elements by using javaScript executor
(JavascriptExecutor(driver)).executeScript(“document.getElementsByClassName(ElementLocator).click();”);
72. How can you find Broken Links in a page using Selenium WebDriver?
73. How to find more than one web element in the list?
// To store the list
List <WebElement> eleList = driver.findElements(By.xpath(“xpath”));
// To fetch the size of the list
int listSize = eleList.size();
//for loop
for (int i=0; i<listSize; i++)
{
                  // Clicking on each link
                  links.get(i).click();
                  // Navigating back to the previous page that stores the links
                  driver.navigate().back();
}
74. How to read a JavaScript variable in Selenium WebDriver?
By using JavascriptExecutor
// To initialize the JS object.
JavascriptExecutor JS = (JavascriptExecutor) webdriver;
// To get the site title.
String title = (String)JS.executeScript(“return document.title”);
System.out.println(“Title of the webpage : ” + title);
75. How do you read test data from excels?
Test data can efficiently be read from excel using JXL or POI API. POI API has many advantages than JXL.
76. Is it possible to automate the captcha using Selenium?
No, It’s not possible to automate captcha and bar code reader.
77. List some scenarios which we cannot automate using Selenium WebDriver?
1. Bitmap comparison Is not possible using Selenium WebDriver
2. Automating Captcha is not possible using Selenium WebDriver
3. We can not read bar code using Selenium WebDriver
4. windows OS based pop ups
5. third party calendars/element
6. Image
7. Word/PDF
78. What is Object Repository in Selenium WebDriver?
Object Repository is used to store element locator values in a centralized location instead of hard coding them within the scripts. We do create a property file (.properties) to store all the element locators and these property files act as an object repository in Selenium WebDriver.
79. How can you use the Recovery Scenario in Selenium WebDriver?
By using “Try Catch Block” within Selenium WebDriver Java tests.
try {
     driver.get(“www.xyz.com”);
}catch(Exception e){
     System.out.println(e.getMessage());
}
80. How to Upload a file in Selenium WebDriver?
There are two cases which are majorly used to upload a file in Selenium WebDriver such as using SendKeys Method and using AutoIT Script.
Browser Button – type =“file”
SendKeys (c:\test\naveen.jpg);
81. How to Download a file in Selenium WebDriver?
By using AutoIT script, we could download a file in Selenium WebDriver.
82. How to run Selenium WebDriver Test from the command line?
Class A{
}
cd c
c: javac A.java
c: java A.java
java org.testng.TestNG C:Users Desktop workspacetestingtestng.xml
83. How to switch between frames in Selenium?
By using the following code, we could switch between frames.
driver.switchTo().frame();
84. How to connect a Database in selenium?
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).
85. How To Resize Browser Window Using Selenium WebDriver?
To resize the browser window to particular dimensions, we use ‘Dimension’ class to resize the browser window.
        //Create object of Dimensions class
        Dimension d = new Dimension(480,620);
        //Resize the current window to the given dimension
        driver.manage().window().setSize(d);
86. How To Scroll Web Page Down Or UP Using Selenium WebDriver?
JavaScript scrollBy() method scrolls the document by the specified number of pixels.
87. How To Perform Right Click Action (Context Click) In Selenium WebDriver?
We use Actions class in Selenium WebDriver to do Right-Click (Context Click) action.
          action.contextClick(driver.findElement(By.xpsjht()).build().perform();
88. How To Perform Double Click Action In Selenium WebDriver?
We use Actions class to do Double click action in selenium.
89. How To Perform Drag And Drop Action in Selenium WebDriver?
We use Actions class to do Drag And Drop Action
90. How To Highlight Element Using Selenium WebDriver?
By using JavascriptExecutor interface, we could highlight the specified element
For any feedback, feel free to reach me. You can write to me at naveenanimation20@gmail.com
Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:
Follow me on my Facebook Page:
Please follow and like us:

Challenges faced using selenium automation testing, and how to solve them.

Challenges faced using selenium automation testing, and how to solve them



1.     Image or text overlapping issue
2.     No facility to deal with Captcha, Bar Code
3.     Doesn’t support any non web based (Like Win 32, Java Applet, Java Swing, .Net Client Server etc) applications
4.     When you compare selenium with QTP, Silk Test, Test Partner and RFT, there are many challenges in terms of maintainability of the test cases
5.     Since Selenium is a freeware tool, there is no direct support if one is in trouble with the support of applications
6.     Bitmap comparison is no t supported by Selenium
7.     Any reporting related capabilities, you need to depend on third party tools
8.     You need to learn any one of the native language like (.Net, Java, Perl, Python, PHP, Ruby) to work efficiently
9.     Difficult to identify dynamic objects
10.  Working with frames
11.  Selenium test playback is slow (IDE)
12.  JavaScript sandbox, Flash, Applets, Silverlight, and HTML 5’s Canvas all present problems in Selenium
13.  Dealing with pop-up windows: Selenium can sometimes fail to record common popups in web apps. To handle any kind of alert popup, you can apply a getAlert function. Before actually running the script, you must import a package that can generate a WebDriver script for handling alerts. The efficient interface brings with it the following commands: void dismiss(), void accept (), getText(), void sendKeys(String stringToSend). The first two basically click on the “cancel” and “OK” buttons respectively on a popup window.
14.  Timeout resulting from synchronization problems: One should ideally use selenium.IsElementPresent(locator) to verify that the object is in a loop with Thread.Sleep
15.  Testing Flash apps: To automate flash apps with Selenium, one can use Flex Monkium. The application source code must be compiled with the swc files generated by Flex Monkium. Then the app and the Selenium IDE are connected, and the tests can be recorded with IDE.
16.  Unexpected error launching Internet Explorer. Browser zoom level should be set to 100% by default for the IE browser to overcome this error
17.  Protected Mode must be set to the same valueerror occurs when trying to run Selenium WebDriver on a fresh Windows machine. This issue can be fixed by using capabilities as below when launching IE
18.  Cross Browser Testing Issues

19.  Ajax Components

Please follow and like us:

TestNG Interview Questions

TestNG Interview Questions
 

1. What is TestNG?
TestNG is a testing framework designed to simplify a broad range of testing needs, from unit testing to integration testing. For more information.
 

2. What are the advantages of TestNG?
·      TestNG provides parallel execution of test methods
·      It allows to define dependency of one test method over other method
·      It allows to assign priority to test methods @Test(priority=1, groups = “Login”)
·      It allows grouping of test methods into test groups
·      It has support for parameterizing test cases using @Parameters annotation
·      It allows data driven testing using @DataProvider annotation
·      It has different assertions that helps in checking the expected and actual results
·      Detailed (HTML) reports
·      Testng Listeners
 

 
3. What are the annotations available in TestNG?
@BeforeTest
@AfterTest
@BeforeClass
@AfterClass
@BeforeMethod
@AfterMethod
@BeforeSuite
@AfterSuite
@BeforeGroups
@AfterGroups
@Test
@DataProvider
@Parameters
 

 
4. Can you arrange the below testng.xml tags from parent to child? 

 
5. How to create and run testng.xml ? 
In TestNG framework, we need to create testng.xml file to create and handle multiple test classes. We do configure our test run, set test dependency, include or exclude any test, method, class or package and set priority etc in the xml file.
View Complete Post
 

 
 
 
6. What is the importance of testng.xml file?
In a Selenium TestNG project, we use testng.xml file to configure the complete test suite in a single file. Some of the features are as follows.
   testng.xml file allows to include or exclude the execution of test methods and test groups
   It allows to pass parameters to the test cases
   Allows to add group dependencies
   Allows to add priorities to the test cases
   Allows to configure parallel execution of test cases
   Allows to parameterize the test cases
 

 
 
7. How to pass parameter through testng.xml file to a test case?
We could define the parameters in the testng.xml file and then reference those parameters in the source files.
x

Create a java test class, say, ParameterizedTest.java and add a test method say parameterizedTest() to the test class. This method takes a string as input parameter. Add the annotation @Parameters(“browser”) to this method.
// TestNG Interview Questions

public class ParameterizedTest {
            @Test
            @Parameters(“browser”)
            public void parameterizedTest(String browser){
                        if(browser.equals(“firefox”)){
                                    System.out.println(“Open Firefox Driver”);
                        }else if(browser.equals(“chrome”)){
                                    System.out.println(“Open Chrome Driver”);
                        }
            }          
}
The parameter would be passed a value from testng.xml, which we will see in the next step.
We could set the parameter using the below syntax in the testng.xml file. 

Here, name attribute represents the parameter name and value represents the value of that parameter.
Practical Example
 

 
8. What is TestNG Assert and list out common TestNG Assertions?
TestNG Asserts help us to verify the condition of the test in the middle of the test run. Based on the TestNG Assertions, we will consider a successful test only if it is completed the test run without throwing any exception.
Some of the common assertions supported by TestNG are
 

   assertEqual(String actual,String expected)
   assertEqual(String actual,String expected, String message)
   assertEquals(boolean actual,boolean expected)
   assertTrue(condition)
   assertTrue(condition, message)
   assertFalse(condition)
   assertFalse(condition, message)
For Complete Post
 

 
9. What is Soft Assert in TestNG?
Soft Assert collects errors during @Test. Soft Assert does not throw an exception when an assert fails and would continue with the next step after the assert statement.
If there is any exception and you want to throw it then you need to use assertAll() method as a last statement in the @Test and test suite again continue with next @Test as it is.
Practical Example
 

 
T1(){
1 sendkeys()
2 HA –passed à 3 else à terminate test case / failed
3 SA — passed
4 SA  — failed à 5
5 SA – passed à 6
6 SA – Failed
 

softAssert.assertAll();
 

 
 
}
 

 
 
 
10. What is Hard Assert in TestNG?
Hard Assert throws an AssertException immediately when an assert statement fails and test suite continues with next @Test
 

 
11. What is exception test in TestNG?
TestNG gives an option for tracing the Exception handling of code. You can verify whether a code throws the expected exception or not. The expected exception to validate while running the test case is mentioned using the expectedExceptions attribute value along with @Test annotation.
 

@Test
t1(expectedExceptions = ElementNotFoundException){
 

}
 

 
 
 
12. How to set test case priority in TestNG?
We use priority attribute to the @Test annotations. In case priority is not set then the test scripts execute in alphabetical order.
// TestNG Interview Questions

package TestNG;
import org.testng.annotations.*;
public class PriorityTestCase{
           
@Test(priority=0)
            public void testCase1() { 
                        system.out.println(“Test Case 1”);
            }
           
@Test(priority=1)
            public void testCase2() {          
                        system.out.println(“Test Case 2”);
            }
}
Output:
Test Case 1

Test Case 2
 
 
13. What is Parameterized testing in TestNG?
Parameterized tests allow developers to run the same test over and over again using different values.
There are two ways to set these parameters:
   using testng.xml – 
   using Data Providers – 
 

 
14. How can we create data driven framework using TestNG?
By using @DataProvider annotation,  we can create a Data Driven Framework.
 

 
// TestNG Interview Questions
@DataProvider(name=”getData”)
            public Object[][] getData(){
                        //Object [][] data = new Object [rowCount][colCount];
                        Object [][] data = new Object [2][2];
                       
                        data [0][0] = “FirstUid”;
                        data [0][1] = “FirstPWD”;
                       
                        data[1][0] = “SecondUid”;
                        data[1][1] = “SecondPWD”;
                       
                        return data;
                       
            }
Practical Example
 

 
 
 
 
15. How to run a group of test cases using TestNG?
TestNG allows you to perform sophisticated groupings of test methods. Not only can you declare that methods belong to groups, but you can also specify groups that contain other groups. Then TestNG can be invoked and asked to include a certain set of groups (or regular expressions) while excluding another set.  This gives you maximum flexibility in how you partition your tests and doesn’t require you to recompile anything if you want to run two different sets of tests back to back.
Groups are specified in your testng.xml file and can be found either under the or tag. Groups specified in the tag apply to all the tags underneath.
 

@Test (groups = { “smokeTest”, “functionalTest” })
public void loginTest(){
System.out.println(“Logged in successfully”);
}
 
 
 
16. How to create Group of Groups in TestNG?
Groups can also include other groups. These groups are called MetaGroups. For example, you might want to define a group all that includes smokeTest and functionalTest. Let’s modify our testng.xml file as follows:
 

  
             
             
  
  
        
          

 
 
17. How to run test cases in parallel using TestNG?
we can use “parallel” attribute in testng.xml to accomplish parallel test execution in TestNG
The parallel attribute of suite tag can accept four values:
 

tests – All the test cases inside tag of testng.xml file will run parallel
classes – All the test cases inside a java class will run parallel
methods – All the methods with @Test annotation will execute parallel
instances – Test cases in same instance will execute parallel but two methods of two different instances will run in different thread.

 
 
 
18. How to exclude a particular test method from a test case execution? 
By adding the exclude tag in the testng.xml

 
    
      
    
       

 
19. How to exclude a particular test group from a test case execution? 
By adding the exclude tag in the testng.xml

   
             
         

 
 
20. How to disable a test case in TestNG ?
To disable the test case we use the parameter enabled = false to the @Test annotation.
@Test(enabled = false)

 
 
21. How to skip a @Test method from execution in TestNG?
By using throw new SkipException()

 
Once SkipException() thrown, remaining part of that test method will not be executed and control will goes directly to next test method execution.
throw new SkipException(“Skipping – This is not ready for testing “);

 
 
22. How to Ignore a test case in TestNG?
To ignore the test case we use the parameter enabled = false to the @Test annotation.
@Test(enabled = false)

 
 
 
 
23. How TestNG allows to state dependencies?
TestNG allows two ways to declare the dependencies.
Using attributes dependsOnMethods in @Test annotations –Using attributes dependsOnGroups in @Test annotations –
 

 
 
 
24. What are the different ways to produce reports for TestNG results?
TestNG offers two ways to produce a report.
Listeners implement the interface org.testng.ITestListener and are notified in real time of when a test starts, passes, fails, etc…
Reporters implement the interface org.testng.IReporter and are notified when all the suites have been run by TestNG. The IReporter instance receives a list of objects that describe the entire test run.
 

 
 
25. What is the use of @Listener annotation in TestNG?
TestNG listeners are used to configure reports and logging. One of the most widely used listeners in testNG is ITestListener interface. It has methods like onTestStart, onTestSuccess, onTestFailure, onTestSkipped etc. We should implement this interface creating a listener class of our own. Next we should add the listeners annotation (@Listeners) in the Class which was created.
 

 
 
26. How to write regular expression In testng.xml file to search @Test methods containing “smoke” keyword.
 

Regular expression to find @Test methods containing keyword “smoke” is as mentioned below.
 
27. What is the time unit we specify in test suites and test cases? 
 

We specify the time unit in test suites and test cases is in milliseconds.
 

 
 
28. List out various ways in which TestNG can be invoked?
TestNG can be invoked in the following ways
   Using Eclipse IDE
   Using maven/ant build tool
   From the command line
   Using IntelliJ’s IDEA
 

 
29. How To Run TestNG Using Command Prompt?
 

C: test
Java c://testing.jar test.java
 

 
30. What is the use of @Test(invocationCount=x)?
The invocationcount attribute tells how many times TestNG should run a test method
@Test(invocationCount = 10)

public void testCase1(){
In this example, the method testCase1 will be invoked ten times
 

 
 
31. What is the use of @Test(threadPoolSize=x)?
The threadPoolSize attribute tells to form a thread pool to run the test method through multiple threads.
Note: This attribute is ignored if invocationCount is not specified
@Test(threadPoolSize = 3, invocationCount = 10) public void testCase1(){

In this example, the method testCase1 will be invoked from three different threads
 

 
32. What does the test timeout mean in TestNG?
The maximum number of milliseconds a test case should take.
@Test(threadPoolSize = 3, invocationCount = 10,  timeOut = 10000)

public void testCase1(){
In this example, the function testCase1 will be invoked ten times from three different threads. Additionally, a time-out of ten seconds guarantees that none of the threads will block on this thread forever.
 

 
 
33. What are @Factory and @DataProvider annotation?
@Factory: A factory will execute all the test methods present inside a test class using a separate instance of the respective class with different set of data.
@DataProvider: A test method that uses DataProvider will be executed the specific methods multiple number of times based on the data provided by the DataProvider. The test method will be executed using the same instance of the test class to which the test method belongs.

For any feedback, feel free to reach me. You can write to me at naveenanimation20@gmail.com

 

Please follow and like us:

Advanced Selenium Webdriver Interview Questions and Answers in Java

Advanced Selenium Webdriver Interview Questions and Answers in Java

Selenium WebDriver – QA

Here is the list of Selenium Interview questions and answers.


How to read data from table? 

You can easily read the data from table using findElements method. 

Find all the table cells using TD tag and then get the text inside each cell by getText() method or innerText property in HTML DOM.


What all browsers and OS are supported by Selenium? 

Selenium supports below browsers.
  1. Internet Explorer
  2. Google Chrome
  3. Firefox
  4. Safari
  5. Opera
  6. Android browser
  7. iPhone Browser
Operating systems supported by Selenium are –
  1. All Windows OS
  2. Linux
  3. Mac (Apple OS)
  4. Android
  5. IOS
Various Synchronization methods in Selenium Webdriver – implicit wait, 
page load timeout, explicit wait?
There are 4 ways we can handle synchronization in Selenium.
  1. Implicit
  2. Explicit using wait and expected conditions
  3. Browser Navigation timeout
  4. Script time out 
How to take screenshot in Selenium? 
Selenium provides an interface called TakesScreenshot which has a method getScreenShotAs which can be used to take a screenshot of the application under test.

How to execute JavaScript in Selenium? How many arguments 
can be passed to executeScript method? 
Selenium webdriver API provides one interface called 
JavascriptExecutor with a method called executeScript. 
This method has 2 main arguments. 
First argument is the javascript code you want to execute on current page and second argument is optional but important. 
We can pass variable number of web elements as an arguments which can be manipulated in javascript code passed in the first argument.

How to handle multiple browser windows and frames?
We can easily work with multiple windows and frames by switching to them. 
We can find all open windows in selenium using getWindowhandles method. 
We can find frame in the web page using name, id or any other method like css or xpath selectors.

How to drag and drop in Selenium Webdriver? 
Selenium webdriver provides Actions class which has many methods to support complex user actions like contextClick, doubleClick, dragAndDrop. 

How to use Selenium Grid?
Selenium grid is used to execute selenium scripts on various environments (OS and browsers) simultaneously and on different machines. 
Hub acts as a central server which sends the execution requests to the other machines called as nodes. 
Hub server and node server must be up and running. 
Node machine must be registered with HUB. Depending upon the webdriver capabilities, HUB routes the request to appropriate node to execute the scripts.

Challenges, issues and limitations of Selenium tool? 

How to handle Captcha? 
We can not handle captcha in Selenium. We can not also automate 
the Adobe Flash contents on webpages. These are some of the limitations of Selenium.
Other common issues are –
  1. Certificate Errors in IE
  2. Protect mode error
  3. Browser zoom error in IE
  4. Canvas image map
  5. Unsupported command line flag – ignore certificates warning in Chrome
What is the page object model in Selenium? 
Page object model is an alternative way to handle automation project.

Write a complex xpath or css expression? Which one is better? 
xpath and css can be used to find any element on the web page.
 Most of the engineers prefer writing xpath expressions as finding r
elative elements is very easy in xpath.

How to upload files using AUTOIT Script, Robot?
We can use AUTOIT/Robot/Sikuli code to handle the window dialogs 
which are not supported by web driver.

Flash automation, silverlight Automation? 
Selenium has no support for these controls. We need to use third party tools to automate these apps.

How to format date and time in Selenium in Java? How to compare dates? 
We can format date in selenium using DateFormat object.

How to append a data to file in Selenium?
We can use File and FileWriter class to work with files in Selenium Webdriver.

Frameworks in Selenium – Data driven, Hybrid, Keyword, 

BDD – Cucumber, TestNG?
Frameworks are used to speed up the automation testing by 
developing the test data, reusable functions and reports.

Database testing in Selenium? 
We can use JDBC driver to connect to any database in Java.

How to work with Excel files in Selenium?

We can use JXL or POI library to work with excel files in Selenium.

Find total time of execution in Selenium? 
If we are using custom library, we can log the start and end time 
of the execution and then find the total execution time by 
subtracting end time from start time.

How to schedule the Test Suite Execution?
We can schedule the test suite execution using CI tools like 
hudson(Jenkins), Bamboo. Alternatively, we can use windows 
scheduler to launch the test execution.

How to send an email stating the execution status to all stakeholders in Selenium? 
We can send mail in Java using javax.mail library.

What is the difference between findElement and findElements?
findElement returns the first matching element. If element is not found, NoElementFoundException is thrown. findElements 
returns the list of matching web elements. 
If no element is found, empty list is returned. Exception is not thrown.

What is the difference between Junit and TestNG. What are the various annotations and features? 
TestNG is the new generation testing framework with lot of new 
useful features as compared to old Junit framework. 
Using TestNG, we can run the tests in parallel.

Automation of Android apps and Android Browsers using Selenium possible?

We can use  Appium and Selendroid tools to automate mobile applications.

How to handle Ajax calls in Selenium?
When working with Ajax calls, we must be very careful to handle StaleElementStateException. This exception occurs 
when we refer to the stale (Old) element on page. 
To handle this error, we need to find the element again after ajax load new elements in the page.

Difference between Selenium and QTP. Competitors to Selenium Webdriver? 
QTP is a licensed tool supporting automation of lot of applications based on .Net, Java, Web and much more. Selenium is a free tool and supports only web application automation testing.

What is desired capabilities?
Capabilities are used to set the values of the browser attributes 
before we launch any browser using selenium web driver.

Version control tools like SVN, GIT? 
We use version control tools like SVN to track the changes to 
the files in a project and work in collaboration.

Build tools – Ant, Maven? 
We use these tools to manage build activities for the Java project.

CI tools – Jenkin, Bamboo? 

These are continuous integration tools helping in quick 
deployment of applications, testing them and reporting the issues in the code before it is too late. 
It helps in getting the application into production quickly and with more quality confidence.

How to identify the frame which does not have Id as well as name? 

We can identify the frame using xpath or css selectors as well.

What is the alternative to sendkeys? 

We can use JavaScriptExecutor to work with html controls.

How to press TAB key in Selenium? 

We can press any keyboard key using Keys class.

What are the Exception that may occur in Selenium Webdriver 

Selenium may throw below exceptions.

  1. InvalidElementStateException
  2. StaleElementReferenceException
  3. ElementNotFoundException
  4. ElementNotVisibleException 

For any feedback, feel free to reach me. You can write to me at naveenanimation20@gmail.com

Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:

Follow me on my Facebook Page:
Please follow and like us:
« Older posts