Favourite Quote

Every artist was first an amateur. - Ralph Waldo Emerson The more difficulties one has to encounter, within and without, the more significant and the higher in inspiration his life will be. - Horace Bushnell

Tuesday, February 28, 2012

Getting started with Installation of WebDriver - Java Client


With SELENIUM / WebDriver being most cost effective tool for functional testing these days most of the companies are embracing this open source tool.

Let's get started with installation of WebDriver & configurations as required.

1. Download from the official website of selenium http://code.google.com/p/selenium/downloads/list

1.a Have a look at the screen shot



2. We have downloaded Selenium-2.20 version for java & selenium-server-standalone-2.20.jar was the latest when i wrote the blog

3. I am on a Windows 7 box - Create a dierctory called Selenium & have the downloaded selenium extracted. I have mine within Eclipse as i would use that as my IDE ,placed it within Eclipse for it would be easy mapping the library files a.k.a jars

This is how it would look ,folder structure & files.



Now that we have our Selenium 2 downloaded we need to have java on our box let's get that.

4. Download java from http://www.oracle.com/technetwork/java/javase/downloads/index.html

5. After you are done with installation of java to verify just go to where it is installed & check for version of java

6. Have a look at the screen shot



7. Now that we have jdk , selenium we need an IDE which is Eclipse in our case

8. Download Eclipse from there official website http://www.eclipse.org/downloads/

9. We are all set with downloads that are required to get started,Let's get to configuring as appropriate

10. Click on the eclipse.exe

11. Create a Java Project : Click on File > new > Java Project

12. Give a name to the Project as appropriate

12. Right Click on the Project name within the Project explorer window & click on Properties >> Click on Java Build Path

13. Look at the screen shot.

Screen shot 13


14. Click on Add external jars , now add the selenium-java-2.20.0.jar that we downloaded earlier

15. Again Click on Add External jars,now add the lib folder of C:\selenium-2.20.0\libs

Once you have added all your jar's it shoudl look like above screen shot 13 at step 13

16. Let's also add JUnit jar's as our framework is written in JUnit

17. Click on Java Build Path > Add Library > Will show a list of libraries just like the below screen shot

screen shot 17


Choose appropriate JUnit version

We are now done with our installations and configurations required for selenium-2,junit,java,eclipse
automationwithselenium.blogspot.com-Google pagerank and Worth

Regular expression Extractor - Testing ReCaptcha with JMeter


Most often these days every website that accepts payment want's to add additional security of having ReCaptcha inplace.

It is definitely a challenge to test reCaptcha without turning it off, but allowing to accept same password as against dynamically generated one.

So here's how i load tested reCaptcha using JMeter.

1.It is important that we know how to use the regular expression extractor,So that we retrive params from one request and pass them to another request.

2. Add a HTTP Sampler

3. We need to add Regular expression extractor which is required to retrive values from the response of the previous request. Therefore it would be a post processor.

3.a Right click on the HTTP Sampler > Add > Post Processors > Regular expression Extractor - see the screen shot


3.b Now the Regular Expression Extractor is added have a look at the screen shot,Let's have a closer look at it :



3.c Give appropriate name just like i have given ,It is however optional giving a name will help in debugging issues if it exists

3.d Apply to : leave this to default or choose as appropriate to your requirement

3.e Response Field to check : Leave this to default or choose as appropriate to your requirement

3.f Reference Name : Give a appropriate name here this act's as a variable that stores value retrieved from teh Regular expression

3.g Regular Expression : "params":"(.+?)nonce=(.+?)" Let's get to understanding this we are matching all that is after the params : and then matching the value for nonce

The special characters above are:

( and ) - these enclose the portion of the match string to be returned

. - match any character

+ - one or more times

? - don't be greedy, i.e. stop when first match succeeds

4. As i have previously mentioned it is good to add a DEBUG SAMPLER to understand whether right value is being fetched & for debugging purpose

5. Trick to validate your regular expression is :

5.a Add a View Results Tree

5.b Choose RegExp Tester to Validate if you have written the right expression

have a look at the screen shot


automationwithselenium.blogspot.com-Google pagerank and Worth