Installation of Testng plugin in Eclipse

Installing TestNG in Eclipse

Step 1


• Launch Eclipse.
• On the menu bar, click Help.
• Choose the "Eclipse Marketplace..." option.

Step 2

• Click on Next button.

Step 3

• Enter the text as ‘testng’ and click on ‘Go’ button. In the results next to testng you will find an ‘install’ button please click on install button. Note: In my system I already have testng so it shows two options as ‘update’ or ‘uninstall’.

Step 4

Restart Eclipse

Step 5

After restart, verify if TestNG was indeed successfully installed. Click Window > Preferences and see if TestNG is included on the Preferences list.

Usage of Xpath Locator in Selenium WebDriver!!!


In Selenium they are 8 locators which helps in identifying the objects. 

 1. id
 2. name
 3. tagName
 4. className
 5. partialLinkText
 6. linkText
 7. xpath
 8. cssSelector

You Tube to xpath video->

SeleniumWebDriver Xpath Part1

Selenium WebDriver - TestNG @Listener Annotations

@Listeners Annotations in TestNG


A simple ITestListener adapter that stores all the tests that were run. You can retrieve these results with the following methods: getPassedTests() getFailedTests() getSkippedTests().
In addition to that we can reuse the existing methods like onTestSuccess(ITestResult tr),onTestSkipped(ITestResult tr) and onTestFailure(ITestResult tr) of org.testng.TestListenerAdapter Class.
If you extend this class in order to override any of these methods, remember to call their super equivalent if you want this list of tests to be maintained.

Implementation of TestListener Adapter Class

Steps to use TestListener Adapter class

1. First extend the TestListenerAdapterClass.
Example:
public class useListeners extends TestListenerAdapter
2. After that over the methods of onTestSuccess(ITestResult tr),onTestSkipped(ITestResult tr) and onTestFailure(ITestResult tr) in the useListeners class.
3. Use @Listener annotation in the Test Class which contains @Test Annotations.
4. Execute the Test Class using testng.xml or run an Testng Test.
5. For every @Test methods available in the Test Class based on the status of pass/fail/skipped the Listener methods are called.