Wednesday 28 August 2013

Selenium IDE And Selenium TestNG with Eclipse Configuration


Selenium-IDE:

Selenium-IDE is the Integrated Development Environment for building Selenium test cases. It operates as a Firefox add-on and provides an easy-to-use interface for developing and running individual test cases or entire test suites. Selenium-IDE has a recording feature, which will keep account of user actions as they are performed and store them as a reusable script to play back. It also has a context menu (right-click) integrated with the Firefox browser, which allows the user to pick from a list of assertions and verifications for the selected location. Selenium-IDE also offers full editing of test cases for more precision and control. Although Selenium-IDE is a Firefox only add-on, tests created in it can also be run against other browsers by using Selenium-RC and specifying the name of the test suite on the command line.


Features:
·                     Easy record and playback
·                     Intelligent field selection will use IDs, names, or XPath as needed
·                     Auto complete for all common Selenium commands
·                     Walk through tests
·                     Debug and set breakpoints
·                     Save tests as HTML, Ruby scripts, or any other format
·                     Support for Selenium user-extensions.js file
·                     Option to automatically assert the title of every page

























Selenium-RC:
Selenium-RC allows the test automation developer to use a programming language for maximum flexibility and extensibility in developing test logic. For instance, if the application under test returns a result set, and if the automated test program needs to run tests on each element in the result set, the programming language’s iteration support can be used to iterate through the result set, calling Selenium commands to run tests on each item.
Selenium-RC provides an API (Application Programming Interface) and library for each of its supported languages: HTML, Java, C#, Perl, PHP, Python, and Ruby. This ability to use Selenium-RC with a high-level programming language to develop test cases also allows the automated testing to be integrated with a project’s automated build environment.

Selenium TestNG with Eclipse Configuration

In order to configure selenium TestNG with Eclipse we need to follow the below steps, I have also mentioned about configuring selenium server in eclipse with the help of which we will be able to see selenium server in console bar within eclipse, the steps are as follows.


Start Eclipse:

·                     Go to path where eclipse application is stored.
·                     Launch eclipse by double clicking the Eclipse icon.
·                     Browse the workspace directory where you want to store all your project contents.
·                     Eclipse is launched now.

Creating New Project:

·                     Goto to File menu select new than click on new project.
·                     From displayed list select JAVA project and click next.
·                     Give the appropriate project name than click next.
·                     Now to add external libraries click on libraries than click add external Jars..
·                     Browse the external Jars and add it.
·                     Click on finish button.




External JARs:

TestNG 5.14.1:
TestNG is a testing framework designed to simply a broad range of testing needs, from unit testing(testing a class in isolation of the others),functional testing,browser-compatibility testing with Selenium-RC to integration testing (testing entire systems made of several classes, several packages and even several external frameworks, such as application servers).
Now lets start implementing it.

First you need to record a script in selenium-ide,just try with a simple script and put some check points(to know how Selenium ide works visit www.mindqonline.com

Now convert your IDE script to any language as selenium supports multiple platforms like junit,TestNG,Python,C#.

Here i have used TestNG because of it's powerfull features like multi threading and annotaions

so convert the IDE script into TestNG format like this:




No comments:

Post a Comment