Wednesday, August 8, 2012

How to Import Data from Web to an Excel Sheet


In order to import data from web and maintain an excel sheet you can simply use the feature of "Web Query" in the Data Tab in MS Excel.

Steps
1. Create a New Excel File
2. Go to Data > Web Query
3. Enter the URL of the Web Site you need to import data from
4. Then it will indicate the possible fields that you can extract data from using Yellow Arrows
5. Select the fields you want
6. Click on Import
7. Select the Sheet or cell range you need to populate the data
8. Ok

When ever you need to update your data, click on Refresh All which will Sync with the Web Site.

Reference: http://www.mrexcel.com/tip103.shtml



Friday, August 3, 2012

How To Automate Testing using Selenium


What is Selenium ?


"Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It also provides a test domain-specific language (Selenese) to write tests in a number of popular programming languages, including C#, Java, Groovy, Perl, PHP, Python and Ruby. The tests can then be run against most modern web browsers. Selenium deploys on Windows, Linux, and Macintosh platforms"  [ Reference: http://en.wikipedia.org/wiki/Selenium_(software) ]

Further you may refer the main web site of Selenium for more details.  [ http://seleniumhq.org/ ]


Selenium IDE



  • As a starting point, it would be nice to first setup Selenium IDE in your Firefox browser ( you can find the xpi from following url :  http://release.seleniumhq.org/selenium-ide/1.9.0/selenium-ide-1.9.0.xpi )
  • Using Selenium IDE you can simply records the steps that you do in the web site and then you can play back them easily. 
  • You may refer this article as a starting guide:  http://seleniumhq.org/docs/02_selenium_ide.html
  • Further you can add assertions to your scripts and verify the values and enhance you scripts.
  • But still if you wish to automate complex work flows in web sites using values from files, xml etc, it is recommended to move to Selenium RC using Java or any language you prefer to write test cases. But still Selenium IDE can used to record the basic flow and then Export to Java (or any supporting language) and then modify them and add more functionality using Java (or the supporting language)

Selenium RC

How to Start Test Automation using Java & Selenium RC

  • Make sure you have downloaded the Selenium Server jar file from above link
  • Record the script using Selenium IDE and export it to Java ( JUNIT )
  • Add the java file to your project
  • Add the Selenium Server jar file to your project as well 
  • Start the selenium server using the command line 
    • Go to the path of the jar file and type  java -jar <selenium server jar name>
  • Run the test case from your Java IDE (eg: inteliJ Idea, Eclipse )
  • You may refer this article for more details http://seleniumhq.org/docs/05_selenium_rc.html
In order to automate a data driven test case using files you may use different techniques to read files from java and then set the values to the relevant places. 

Example: How to read values from Excel files and use in Selenium Test Cases

Selenium Tips
Please refer following links for more tips