Posts

Showing posts from July, 2017

TestNG Annotations Basics

Image
Here are the list of basic TestNG Annotations and there execution order. Annotations  @BeforeSuite The annotated method will be run before all tests in this suite have run. @AfterSuite The annotated method will be run after all tests in this suite have run. @BeforeTest The annotated method will be run before any test method belonging to the classes inside the <test> tag is run.  i.e @Test @AfterTest The annotated method will be run after all the test methods belonging to the classes inside the <test> tag have run. i.e @Test @BeforeClass The annotated method will be run before the first test method in the current class is invoked. @AfterClass The annotated method will be run after all the test methods in the current class have been run. @BeforeMethod The annotated method will be run before each test method. @AfterMethod The annotated method will be run after each test method. @BeforeGroups The list of...

Install TestNg in Eclipse

Image
In this post I will be installing Testng plugin in eclipse. Open eclipse Go to help -> Eclipse Marketplace Search for Testng Click Install for "TestNg for Eclipse" To check if Testng has been installed sucessfully create new java project. Add New Java File. And paste the code. 1 2 3 4 5 6 7 8 9 10 11 import org.testng.annotations.Test ; public class A { @Test public void t1 () { System . out . println ( "Test 1" ); } } In the quick Fix dialog add Testng library. Now Right click java file then Run as -> Test Ng test Now the Test should Execute Successfully. Video Tutorial :

Getting Started With Selenium : Part 2

Image
In the previous post we have setup our selenium environment. Now we can write our first selenium script. 1. In the Project Explorer Right click package 'com' which was created earlier. And create a class Inside it. 3. Now In the editor copy and paste the code. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 package com ; import org.openqa.selenium.By ; import org.openqa.selenium.WebDriver ; import org.openqa.selenium.WebElement ; import org.openqa.selenium.chrome.ChromeDriver ; public class Test1 { public static void main ( String [] args ) throws Exception { System . setProperty ( "webdriver.chrome.driver" , "drivers/chromedriver.exe" ); WebDriver driver = new ChromeDriver (); driver . get ( "http://www.google.com/xhtml" ); Thread . sleep ( 5000 ); // Let the user actually see something! WebElement searchBox = driver . findElement ( By . name ( "q" ))...

Getting Started With Selenium : Part 1

Image
Getting started with selenium is very easy. First you need to have some basic requirement, before you start using selenium. 1.Your favourite programming language. 2.It's Programming IDE 3.Selenium library for language 4.Driver for the browser you want to use. For this tutor I will be using Java,Eclipse and chrome driver. #Download the JDK Download the Java JDK from  Oracle Site Download the Jdk depending upon your OS. #Download the Eclipse Download  Eclipse IDE for Java Developers   (download any latest version). # Download the required library For using using selenium,First you need to get the required library for this tutor we will download the standalone jar. 1. Navigate to URL :  http://www.seleniumhq.org/ 2.Click on Download tab 3.Now download the  Selenium Standalone Server 4.Click on the link which shows the version. like 3.4.0, it will start download of .jar file. #Download the driver Now to run  sel...