You are on page 1of 6

Selenium Guideline

1. Setup environment
a. Install JDK 6 or later
b. Install Eclipse
c. Install TestNG plugin for Eclipse from
http://testng.org/doc/download.html
d. Download Selenium libraries for Java from
http://www.seleniumhq.org/download/
Selenium Standalone Server: selenium-serverstandalone-x.x.x.jar
Selenium Client and Webdriver: selenium-java-x.x.x.jar
2. How to work with Selenium-TestNG project
a. Configure project
Import Selenium-TestNG:
o From Eclipse, you selects: File->Import-> select
General/Existing Projects into Workspace ->Next>Browser to Selenium folder->Finish
Add the selenium libraries for Selenium-TestNG project
o From Eclipse, right click on Selenium-TestNG->Properties> Select Java Build Path-> Open Libraries tab->Add
External JARS-> browser to selenium libraries
(selenium-server-standalone-x.x.x.jar, seleniumjava-x.x.x.jar) -> OK

b. Structure of Selenium-TestNG project

selenium package
o SeleniumActionBase.java: Including the selenium action
(API) which helps you interact with UI (web element) such
as click, enter, get text,
o SeleniumBrowserBase.java: Including the selenium action
(API) which help you interact with browser (IE, Firefox,
Chrome) such as close browser, navigate, close browser,

testmodule package
o Including the test module that you create such as
TM_CreateIssue.java, TM_Login.java
test-output
o Including the test results after running test module. You
can get more information of test result from this folder
c. How to create a test module
From eclipse, right click on testmodule package->New>Class->Enter class name (e.g: TM_Demo)->Finish. After
finishing, the class look like as image below:

Next, you must add 2 methods which are setup,


tearDown and at least a test method. Following image
below for more details

d. Run/debug test module and get result


In order to run test module, right-click on test module
(TM_Demo)->Run As->TestNG Test

In order to debug test script:


o Toggle breakpoint

o Then right-click on test module (TM_Demo)->Debug As>TestNG Test

Get result: After running the test module, you can refer to
test-output folder to get test result
o The file of test result: // test-output/ index.html

You might also like