Blogs

Best practices and trends in technology

Tips and Tricks While Using Selenium IDE

Mar 09, 2015

Selenium IDE is a Firefox Add-on developed originally by Shinya Kasatani as a way to use the original Selenium Core code without having to copy Selenium Core onto the server. Selenium Core is the key JavaScript modules that allow Selenium to drive the browser. It has been developed using JavaScript so that it can interact with DOM (Document Object Model) using native JavaScript calls. There are a few facts that one should keep in mind while creating any scenario based script using Selenium:

  • Tests should have a starting point.
  • Tests should not rely upon any other tests to run.
  • Test should only be testing one thing at a time.

Although these rules apply to any form of test automation but they need to be adhered specially when creating tests using a user interface. To start selenium IDE, start Mozilla Firefox > tools / web developer drop > selenium IDE. Once loaded the IDE is ready to record the testing event (make sure the record button is engaged). Following are the steps to be followed to create a script:

  • In record mode, navigate to starting point for example: www. Sample.com.
  • Perform the action to be tested.
  • Stop recording and play the test, once successful, the  test may look like this:

Jmeter can be used to test and record the performance of any web application. While running any recorded Jmeter script, the components/ recorded files are loaded virtually and end user scenarios are not replicated. Hence to replicate user scenarios, one has to make use of Selenium Webdriver through Jmeter. Following are the steps required to configure Jmeter with Selenium Script:

  • Open Jmeter from command prompt.
  • Right click on the test plan > add > select thread group.
  • Right click on Thread Group > Add > Config Element > Select jp@gc- FirefoxDriver Config.
  • Right click on Thread Group > Add > Sampler > jp@gc- WebDriver Sampler.
  • In the Script section we need to define the selenium script in Java script format.
  • Add the listerner for reporting purpose, Right click on Thread Group > add > Listners > View Results Tree and Summary Report.
  • Now Save the Test Plan as .jmx file

Generatingselenium reports using TestNG-xslt through Ant is quite easy.TestNG-xslt relies upon apache ant to Generate selenium reports.Apache Ant is a Java library andcommand-line tool capable to drive processes described in build filesas targets and extension points dependent upon each other. Primaryuse of Ant is the build of Java applications. Ant supplies a numberof built-in tasks allowing to compile, assemble, test and run Javaapplications. Ant can also be used effectively to build.

About Author