selenium training in chennai

15
By Creating Experts Contact-8122241286 http://thecreatingexperts.com/selenium- training-in-chennai/

Upload: thecreating-experts

Post on 17-Feb-2017

44 views

Category:

Education


0 download

TRANSCRIPT

By Creating ExpertsContact-8122241286

http://thecreatingexperts.com/selenium-training-in-chennai/

What is TestNG?

•So far we had been doing Selenium tests without generating a proper format for the test results. From this point on, we shall tackle how to make these reports using a test framework called TestNG.•TestNG is a testing framework that overcomes the limitations of another popular testing framework called JUnit. The "NG" means "Next Generation". •Most Selenium users use this more than JUnit because of its advantages. There are so many features of TestNG, but we will only focus on the most important ones that we can use in Selenium.

Advantages of TestNG over JUnitThere are three major advantages of TestNG over JUnit: Annotations are easier to understand Test cases can be grouped more easily Parallel testing is possible

What is Selenium Grid?

•Selenium Grid is a part of the Selenium Suite that specializes on running multiple tests across different browsers, operating systems, and machines in parallel.•Selenium Grid has 2 versions - the older Grid 1 and the newer Grid 2. We will only focus on Grid 2 because Grid 1 is gradually being deprecated by the Selenium Team.•Selenium Grid uses a hub-node concept where you only run the test on a single machine called a hub, but the execution will be done by different machines called nodes.

When to Use Selenium Grid?

You should use Selenium Grid when you want to do either one or both of following:•Run your tests against different browsers, operating systems, and machines all at the same time. This will ensure that the application you are testing is fully compatible with a wide range of browser-O.S combinations.•Save time in the execution of your test suites. If you set up Selenium Grid to run, say, 4 tests at a time, then you would be able to finish the whole suite around 4 times faster.

• As we create software we always wish it should work differently with a different set of data. When it comes to testing the same piece of software, we can't be unfair to test it with just one set of data. Here again, we need to verify that our system is taking all set of combinations which it expected to support.

• Here comes Parameterization in picture. To pass multiple data to the application at runtime, we need to parameterize our test scripts.

• This concept which we achieve by parameterization is called Data Driven Testing .

Type of Parameterization in TestNG-•To make parameterization more clear, we will go through the parameterization options in one the most popular framework for Selenium Webdriver - TestNG.There are two ways by which we can achieve parameterization in TestNG•With the help of Parameters annotation and TestNG XML file.•With the help of DataProvider annotation.

•Cross Browser Testing is a type of functional test to check that your web application works as expected in different browsers.

Why do we need Cross Browser Testing?•Web based applications are totally different from windows applications. A web application can be opened in any browser by the end user. For example some people prefer to open http://twitter.comin Firefox browser, while other's can be using Chrome browser or IE.•In the diagram below you can observe that in IE, the login box of twitter is not showing curve at all corners but we are able to see it in chrome browser.

•File IO is a critical part for any software process. We frequently create a file, open it & update something or delete it in our Computers. Same is the case with Selenium Automation. We need a process to manipulate files with Selenium.

•Java provides us different classes for File Manipulation with Selenium. In this tutorial we are going to learn how can we read and write on excel file with the help of Java IO package and Apache POI library.

•Frameworks help to structure our code and make maintenance easy. Without frameworks we will place all our code and data in same place which is neither re-usable nor readable. Using Frameworks, produce beneficial outcomes like increase code re-usage , higher portability , reduced script maintenance cost etc

There are mainly three type of frameworks created by Selenium WebDriver to automate manual testcases•Data Driven Test Framework•Keyword Driven Test Framework•Hybrid Test Framework

Before we learn about Page Object Model, lets understand -Why POM ?•Starting a UI Automation in Selenium WebDriver is NOT a tough task. You just need to find elements, perform operations on it .•Consider this simple script to login into a websiteWhat is POM?•Page Object Model is a design pattern to create Object Repository for web UI elements.•Under this model, for each web page in the application there should be corresponding page class.•This Page class will find the WebElements of that web page and also contains Page methods which perform operations on those WebElements.

Why do we need reporting ?•When we are using Selenium or any other automation tool, we are performing operations on the web application. But our purpose of automation is not just to exercise the Application Under Test. •We, as an automation tester are supposed to test the application, find bugs and report it to development team or higher management.

Here the reporting gets importance for software testing process

•TestNG Reporting•TestNG library provides a very handy reporting feature. After execution, TestNG will generate a test-output folder at the root of the project. This folder contains two type of Reports-

•If a simple XPath is not able to find a complicated web element for our test script, we need to use the functions from XPath 1.0 library. With the combination of these functions, we can create more specific XPath. Let's discuss a 3 such functions –•Contains•Sibiling•Ancestor

Let's study them in detail -•Contains: By using 'contains' function in XPath, we can extract all the elements which matches a particular text value.•Sibling: Using sibling keyword, we can fetch a web element on the which is related to some other element.•Ancestor: To find an element on the basis of the parent element we can use ancestor attribute of XPath.

To understand extensions, lets first understand the three pillars of selenium IDE

•Action: What operation you are performing on UI Screen•Assessors/Assertion: What verification you do on data you get from UI•Locator Strategy: How can we find the element in UI.

•In this presentation, I have giv en the introduction of webdriver and explained about comparison of selenium RC.•Further topics will be expain in nest presentation.•If you are interested to join in the training reach us-8122241286•Visit us-http://thecreatingexperts.com/selenium-training-in-chennai/