Where we learn technology

Day: 28 November 2017

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 

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