Please post your Web Driver questions in official Web Driver forum

Friday, December 30, 2011

2012 - Software Testing Trends

Don't be taken aback if you see following changes in software testing (read people perception) in 2012 -

Management's Disillusionments
  • Tester != Bots
  • Testing != Monkeying around
  • Tester != Project delivery blockers
  • More tester != More defect discoveries
  • Testing != Just keep testing
  • More tester != Less time needed for testing
  • Automation tool != Less manual testing needed != Less testers needed
  • Tester salary = Dev salary (sigh)
  • Testing certificate != Expertise
  • Automated tester !> Manual tester (though vice versa may be true)

Sunday, December 25, 2011

How to write bad UI automation code (a formal guide)

You might find umpteen resources on learning to write UI automation. But rarely you find any guide on writing bad automation code. Bad automation code is not actually "bad" especially when you consider following -
  • Bad automation code keeps you job safe. Well who can understand the code other than you.
  • Gives you an opportunity to ask for more raise as you are the only one who can maintain the code you write
  • Lets you keep your head up as you the geek of your company who knows that abstruse code
 Now coming to writing bad automation code, here are some silver bullets -
  • Record and Replay is the core or writing good (read bad) automation code. It has so many advantages which just out do many others. Biggest being you don't have to write any good code (read bad), tool does it for you. The way to convince decision owners in to enlightening is to let them know that record and replay does not require any special skills. Even your HR can do this.

Saturday, October 22, 2011

Using xPath to reach parent of an element

Well, I am big fan of css locator my self there are times when css locators don't fit requirement. One such requirement is when you want to navigate to parent element of an element and may be parent of parent and even more. Unfortunately css locators don't provide any mechanism to navigate to parent of an element. See this for more.

Of late I came across a scenario when I wanted to click on a link depending upon the text in a text box. Herein parent of text box and parent of link were at the same location. More over there could have been many such combinations in application. Fortunately I just need to pick first such instance and Web Driver any way considers only first instance when multiple locators are found matching an element. Element in question is in following html -















Here I need to click on highlighted anchor on the basis of input element (which is also highlighted in image)

Herein first I need to reach div parent (class = 'left couponmainarea 2) of input element.
This can be reached using parent axes twice from input element -


//input[contains(@value,'.')]/parent::div/parent::div

Now I need to reach previous sibling of div which is another div (class= 'left votes'), which could be achieved using preceding-sibling axes -

//input[contains(@value,'.')]/parent::div/parent::div/preceding-sibling::div

And now I can easily select the anchor tag -


//input[contains(@value,'.')]/parent::div/parent::div/preceding-sibling::div/a[2]


I had posted this question on Web Driver Google group and Luke suggested to use following xPath (basically it avoids using parent word though does the same thing) -

//input[contains(@value, '.')]/../../preceding-sibling::div/a[2]


Pro Tip: Web developers can move their web development and designing environment into cloud having endless hosting space with innovative cloud products from CloudDesktopOnline.com with 24*7 commendable tech-support from www.Apps4Rent.com, You can also add your MS office to your virtual desktop by visiting www.O365CloudExperts.com.

Looks like I can not have only css locators in my tests, at least till there is no Parent selector available in css locator.


Thursday, October 13, 2011

Google, you display "test" ads on publisher site???






Monday, October 3, 2011

Long live Yahoo!

My work at Yahoo! has come to an end and I must show gratitude to those who made my tenure at Yahoo! most memorable one. On my last day we went for team lunch and I was being asked to give a speech and I did not coz I was not feeling that it was any different day for me. Just seemed like an ordinary day.

I wan to begin this post with a name which has disillusioned my cynical attitude towards managers - Padmaja Raghavendra who has been instrumental in having many Yahoo! properties see day of light and I was the fortunate one to have got the opportunity to work with her. She works painstakingly and yet most caring person I met at Yahoo! I wish Indian managers take a cue from her than our IT industry would not be as ill.

Jithin and Partha, two most amenable developer I worked with. A few developers just never lose temper and know what is right under a given situation. It seems impossible that any one would ever be at daggers drawn with them.

My other team members - Vinit, Anand, Arnold (Saravanan) Satya in whose company day passes by in the blink of an eye. When you cease to work in a company these are the good memories you wan to remember forever. I am inclined to believe that it is not the task in hand but the your team which keeps you engaged and encouraged with work. And I got the blend of both.

Sri Vidya, my only TT partner (or may be the only to have courage to ply TT with me :P) and yet another Yahoo! gem.

This posts wold be incomplete if I don't mention Praz. A very geeky guy yet full of humour. His timing are so perfect that I would often suggest him to be a comic script writer than an Engineer. I must say that Yahoo! is what it is because of engineers like Praz and owes big to him.

Ramgopal Reddy who impressed me most when I was being interviewed at Yahoo! He impressed me coz he found me waiting for my next rounds and offered me help if I needed any thing. Now how many us show such attitude towards interview candidates. At least I did not till I had come to Yahoo!

Raghavendra Kulkarni, most inquisitive tester I have come across in my career. He is never out of question and will drain every single piece of information which even you might not be aware of you had. If there were ever a nomination for most curious tester in India, my vote will be for Raghavendra.

Nikhil R and Nikhil  B. Some managers are always calm. And both Nikhils epitomize this.

Last but not the least, two more names - Pranesh, my mentor who I could approach for any thing and Praveen Prakash Desai who made it smooth for me to work at Yahoo! Liberty was the prime thing I had on my mind when I was to begin work with Yahoo! and Praveen got more than I had wished for.

These are few of those sweet memories I would always cherish. Long live Yahoo! long live Yahoos.

Saturday, October 1, 2011

Lollipop of US Visa



There is great charm about on-site (read USA) work in employees of Indian IT service industry. This is also seen as great tactic by your employer to keep you engaged with company and not hop job. You are often offered an on-site trip if you are the project savior and decide to quit. And few of you indeed get to go to client place with great pride. But do you get to go on work visa? By and large answer is NO. And probably you don't even know that you are sent to work on illegal visa, famously known as B1 visa. There is nothing illegal about B1 visa per se but this category of visa allows only business meeting or attending seminars. This is why there is initial cap of 3 months to stay. Once it is stamped by your employer that you would travel on-site, this how whole story goes -
  • You are scheduled for an interview with US consulate. Your HR comes to train you on how you should speak about supposed business trip and not utter a word about work

Tuesday, August 2, 2011

Verify email confirmation using Selenium

Email confirmation seems to be integral part of any registration process.
I came across an application which lets you provide your email address. You can follow the sign up link in you mail and then complete the registration process.
Lets consider we provide GMail address for it. Now if were to use only Selenium then we would have to follow following steps -

Launch GMail using Selenium; Some how search for new mail in the list of available mails; Some how click on it; Parse the mail message; Get the registration link; Follow up with registration process

What do you think of an approach in which you can

Sunday, June 26, 2011

Selenium Tutorial: Selenium Grid 1.0 configuration

I must say I did not have an easy time trying to set up Selenium Grid 1.0 locally. Since I did not have access to multiple machines I was trying to setup hub as well as slave remote control and was following the doc available here. Though documentation is detailed it is tough to have it replicated with your set up. of late I posted about ant build file here and we need to add couple of target to it to be able to work with Selenium grid. I have taken these extra target from the Selenium Grid distribution, these are -












Target - "launch-hub" is used to launch grid hub while target "launch-remote-control" is used to launch remote controls along with set of parameters like - host, hubURL etc, which would be serving to hub.

Selenium Tutorial: Ant Build for Selenium Java project

Ant is a build tool which could be used to have your tests running either from command line or from Hudson CI tool. There is detailed documentation available for ant here but probably you need to know only a little part of it for you selenium tests. The essentials which are needed to know are:
  1. Project
  2. Target (ant execution point and collection of tasks)
  3. Tasks (could be as simple as compilation)
And there would usually be following targets for Selenium tools -
  1. setClassPath - so that ant knows where you jar files are
  2. loadTestNG - so that you could use testng task in ant and use it to execute testng tests from ant
  3. init - created the build file
  4. clean - delete the build file
  5. compile - compiles the selenium tests
  6. run - executes the selenium tests
Here is my project set up for ant -



Thursday, June 23, 2011

Selenium Tutorial: Get attribute of an element

With Selenium 1.0

Let us consider Google Search Box for example and its "max length"is to be retrieved.

Using xPath -
        String var = selenium.getAttribute("//input[@name='q']/@maxlength");
        System.out.println(var);

Using css locator -       
       
        String var = selenium.getAttribute("css=input[name='q']@maxlength");
        System.out.println(var);
      
With Selenium 2.0 (WebDriver)       

Using xPath -
        String var = webDriver.findElement(By.xpath("//input[@name='q']")).getAttribute("maxlength")
        System.out.println(var);

Using css locator -       
       
        String var = webDriver.findElement(By.cssSelector("input[name='q']")).getAttribute("maxlength")
        System.out.println(var);

Wednesday, June 22, 2011

Loving the UI of Google Groups

The new UI of Google Groups has been in existence from a while though I found it only today. I am just in love with how cleaner new UI is and yet Google gives you a chance to file your wish list here


Friday, June 17, 2011

Selenium Tutorial: Pattern Mathing using Selenium

I must confess I have never been admirer of Regular Expression but then there are times you can not escape from it, especially while working on a website which has dynamic contents appeared in static text and you want to validate it. like -

"Validate that this text appears and there is 123 here and 456 here"

And the test condition is 123 and 456 could be any three digits but number if digits should not be more than three.

In a crude way we can at least test this -

Assert.assertTrue(selenium.getText("elementLocator").contains("Validate that this text appears and there is"));
but what if text goes wrong after "and there is"... what if more than 3 digits appear in text.
This is where pattern matching/regular expression comes for our rescue and we can use matches method of String class to achieve same. So the assertion would be -

String text = selenium.getText("elementLocator"); 
Assert.assertTrue(text.matches("Validate that this text appears and there is [0-9]{1,3} here and [0-9]{1,3} here"));
Lets try to understand two strings side by side -

Validate that this text appears and there is 123 here and 456 here
Validate that this text appears and there is [0-9]{1,3} here and [0-9]{1,3} here 

Herein 123 has been replaced with [0-9]{1,3} and 456 has been replaced with [0-9]{1,3} (well, the same set)
[0-9] means matching digit should be from 0 to 9 hence all the digits in 123 would fall in this category and so as all digits available.
{1,3} means number of digits should be at most 3
Now if application text contains more than three characters then AssertionError would be thrown.

Consider you want to tests that number of digits should be exactly three, then you could use following -

Validate that this text appears and there is 123 here and 456 here
Validate that this text appears and there is [0-9]{3} here and [0-9]{3} here 
And if you did not want to keep any constraint on number of digits then use -

Validate that this text appears and there is 123 here and 456 here
Validate that this text appears and there is [0-9]{1,} here and [0-9]{1,} here 
Here syntax {1,} is to match any number of digits

Lets see some text matching now

Validate text and dynamic text 
Validate text and [A-Za-z]{1,} text

Here [A-Za-z] means to match, small or capital letters and {1,} means to match any number of characters as discussed above. If we wanted to restrict match to only small characters then we could have used -


Validate text and dynamic text 
Validate text and [a-z]{1,} text


Examples -
("this is 123 and 2 and this is more garbage text".matches(
               "this is \\d{1,3} and \\d and this is more \\w{1,10} text")
or
"this is 123 and 2 and this is more garbage text".matches(
               "this is \\d{3} and \\d{1} and this is more \\w{1} text")
or
("this is 123 and 2 and this is more garbage text".matches(
               "this is \\d{1,} and \\d{1} and this is more \\w{1,} text")
or
"this is 123 and 2 and this is more garbage text".matches(
               "this is \\d+ and \\d and this is more \\w+ text")
or
"this is 123 and 2 and this is more garbage text".matches(
               "this is \\d{0,} and \\d and this is more \\w{0,} text")
or
"this is 123 and 2 and this is more garbage text".matches(
               "this is \\d* and \\d and this is more \\w* text")
or
"this is 123 and 2 and this is more garbage text".matches(
               "this is \\d* and \\d{0,1} and this is more \\w* text")
or
"this is 123 and 2 and this is more garbage text".matches(
               "this is \\d* and \\d? and this is more \\w* text")
or
"this is 123 and 2 and this is more garbage text".matches(".*")
To revise, important shortcuts are -
           \d is shortcut for [0-9]
    \w is shortcut for [A-Za-z0-9_]
*  is shortcut for occurs 0 or more times, that is {0, }
+ is shortcut for occurs 1 or more times, that is  {1, }
? is shortcut for occurs 0 or once, that is {0, 1}
.* matched any character sequence
"true".matches("[t]rue")
or
"true".matches("[tuv]rue")
or
"true or false".matches("[tuv]rue or [fgh][abc]lse")
subexpression and alteration -
selenium vs qtp".matches("selenium (vs|as) \\w+")

So this was some pattern matching with Selenium tests, I would add on more to this post when I encounter new scenarios for testing.

Friday, June 10, 2011

Beginner to Selenium Java Library, How much java to learn?

You have decided to learn Selenium to automate your web application. But not sure where to begin from. There is already one awesome document available on SeleniumHQ to learn Selenium. But what if you have least or no programming experience. And if you are going to use java client driver of Selenium then how much java knowledge you need?

Herein I have jotted down some java essentials which are needed in order to used java client library of Selenium.
    • OOPS - Encapsulation, Abstraction, Inheritance, Polymorphism. 
      Needless to emphasize on their importance in programming.
      • Introduction to Class, instance variable, instance methods, class variable, class method, Object
      • Constructor, Abstract Class, Interface, method overloading, method overriding, Package
      You definitely need to know when to create a class or interface, how to initialize your instance variables, create methods for test scenarios and bundle your test classes in packages

        • Ctrl Statment. To be able make to make decision in test methods. Should I continue test execution if login fails?
        • Loops. To execute same statements time and again, for example logging in for 5 different accounts using same method.
        • Arrays. You don't want to keep writing variables all overs you test scripts. Wish you could create a large place holder for similar types of variables.
        • Exception Handling. How would you continue with test execution if some thing unexpected happens during test execution?
        • Files and streams. So you want to keep test data out of your java source file, but how would you access them with in your test scripts?
        • Java Generics. Want to work with objects and not primitive data types and at the same time want type safety also.

        • Collection Framework. ArrayList and HashMap is a must to know
        • Multi Threading. How many threads to run for faster execution?
        • JDBC. Because we all love database testing, don't we?

        You can watch Java Training Videos to learn all of these topics

      Saturday, June 4, 2011

      Most cliched Selenium questions...

      I see following Selenium questions time and again on multiple Selenium forums (StackOverflow, Google Groups, QAForums) -

      1. Does Selenium IDE work with IE?
      2. How do I read data from excel using Selenium?
      3. Should I use selenium 1 or 2?
      4. How do I handle js error using Selenium?
      5. How do I handle pop up window using Selenium?
      6. Does Selenium support Window application?
      7. How do I upload a file using Selenium?
      Well I am am not posting solution for any of these problems as net is filled with all possible solutions for these scenarios.


      Tuesday, May 24, 2011

      Selenium Tutorial - Verifiying Application Elements

      Disclaimer: Objective of this post is to demonstrate how I use Selenium to do soft assertion over collection of element. I don't assert in any way that this is right approach and you are most welcome to prove me  wrong.

      So you want to verify collection of elements on you web page. And I assume that you want tests to continue to execute even in the wake of error with some elements. For example you want to test whether text labels for - 'username', 'password' appear on web page. (Though you may like to stop the test execution if 'username', 'password' elements them selves are not there) The worse approach I could think of is to write all assertions in one test, something like -

      public void testElements() {
      Assert.assertTrue(selenium.isElementPresent("UserNameTextLabel"), 
      "Username Text label is not available on page");
      Assert.assertTrue(selenium.isElementPresent("PasswordTextLabel"), 
      "Password Text label is not available on page");
      Some more assertions here
      }

      Why is this worse approach, it is because any failure with one of the assertion will cause test to be aborted, and you definitely want to continue with test execution even if some text labels don't appear on page.
      Now comes another way of doing assertion using Selenium. We can break each assertion in to their individual methods and check for one text label in each method. So you could do some thing like -

      Thursday, May 19, 2011

      Selenium Function Library + File Handler

      Here is my first attempt towards building Selenium Function Library. Here is a class which deals with File handling. Hence test data can be externalized in to notepad, excel, word pad instead of hard coding it in Selenium Scripts. So you can fetch test data using excel, csv etc and supply it to Selenium, more over you can execute same Selenium script for different set of data.

      Java jars which I used here are jxl and Apache HSSF

      /**
       * Performs read/write operations on files
       * 
       */
      public class FileHandler {
      
       /**
        * Retrieves the data from the properties file using variable name.
        * 
        * @param path
        *            to Property file.
        * @param variableName
        *            stored in the properties file.
        * 
        * @return value of property
        * @throws Exception
        */
      
       public static String getDataFromPropertiesFile(String path,
         String variableName) throws Exception {
       }
      
       /**
        * Retrieves the Excel cell value based on the row and column number.
        * 
        * @param path
        * @param sheetNumber
        * @param rowNumber
        * @param col
        * @return cell value
        * @throws Exception
        */
       public static String readExcelData(String path, int sheetNumber,
         int rowNumber, int col) throws Exception {
       }
      
       /**
        * Writes the provided value to the Excel cell based on the row and column
        * number.
        * 
        * @param path
        * @param rowNumber
        * @param col
        * @param addDataToCell
        * @throws Exception
        */
       @SuppressWarnings("deprecation")
       public static void writeToExcel(String path, String sheetName,
         int rowNumber, int col, String addDataToCell) throws Exception {
       }
      
      

      Wednesday, May 11, 2011

      Selenium Automation Framework / Reusbale Functions / Library

      I have had hunch about this from long and finally I am going to work on it. As the name suggests I would be developing Selenium library which could be plugged in and used for web UI automation. And I would be working on Java Selenium client, that is Selenium 1.0 and would extend it for Selenium 2.0. So here is my wish list what I would take up for this -

      1. Writing Safe Selenium api which checks for presence of element before carrying out operation
      2. File read and write operation - using text/excel/csv
      3. HTML parsing, i.e. reading number of rows in table, get table data etc. Such methods are very popular in QTP world and there is no inbuilt api in Selenium for same.

      Tuesday, May 3, 2011

      HTML Parsing using jsoup

      Came across jsoup of late, while automating web accessibility tests using Selenium.
      Selenium gets me the page html and jsoup does the magic of extracting required information from html to find if web page is accessibility compliant or not.
      You would largely be dealing with Document (which in turn extends Element) and Elements classes when using jsoup.

      Consider you want to find all 'class' attributes in "div" of a web page then you could use some thing like -


      Document document = Jsoup.parse(selenium.getHTMLSource);
              Elements elements = document.getElementsByTag("div");
              for(IteratordivIterator=elements.iterator(); divIterator.hasNext();) {
      
                  System.out.println(divIterator.next().attr("class"));
      }
      


      Not only this, if you know the attribute value you could also find out if it appears under correct node. It could be used in automating aria test for attribute role for a web page.



      For a detailed list of jsoup capabilities visit jsoup page at - http://jsoup.org/

      Sunday, May 1, 2011

      A Dream Died

      Not long ago when Dave proposed to have dedicated Selenium site on Stack Exchange. And proposal was badly stuck at 70% and when few us of decided to ask more and more selenium users to commit to it to make it see day of light -










      After weeks of commit and persuading user we reached 92% commit but then. Well Stack Overflow did not like the ides of having a dedicated selenium site and proposed to merge it with another software testing proposal on Stack Exchange, Which was largely looked down upon at by Selenium Community.










      Though we were ready for browser automation proposal but merging Selenium proposal with a field like software testing was way to general for us to accept, though we were ready to have it collaborated with browser automation kind of proposal. 

      Thursday, March 31, 2011

      Did you support Selenium Proposal at area51?


      There is an effort from SeleniumHQ to migrate selenium user forum from Google Groups to more snazzy and user friendly Stack Exchange. You can find more on this here  
      So please go ahead and commit to -  http://area51.stackexchange.com/proposals/4693/selenium

      To do so, you need to login to Stack Exchange site using Google/Yahoo id

























      Now click on Commit button and



















      Fill in a bit of details and yes one more thing is pending yet! You need to confirm your email address only after which your commitment would appear on site.



















       And do pass it on to other Selenium enthusiasts in your contact list.


















      Since most you have been wondering about advantages of Stackoverflow site over Google Groups, here are the couple of pointers -

      # As soon as you type in Title for question in Stack Exchange site, it
      shows related question. This makes it easy to find if such question is
      already asked. No such feature with Google Groups.
      # Being able to tag your question in Stack Exchange site which is not
      possible with Google Groups. This makes searching on such tagged
      questions absolutely easy. No similar feature with Google groups.
      # Formatting of question(bold, italic, hyperlink etc), distinguishing
      code block from rest of the post to make it stand out are excellent
      features of Stack Exchange site. Google groups just can not with stand
      these.
      # You earn reputation for every answers which is marked as right, this
      gives you more credibility on site. Again Google Groups lacks this.
      # Being able to thumbs up or down a specific question or answer, and
      in fact close it eventually if it is off topic for site. No similar
      feature on Google Groups.

      GMail is so Intelligent :-O

      No wonder GMail is used by thousand of users despite hypes of GFail.
      Was to send one mail today with an attachment. Though I mentioned about attachment in the message of body but forgot to attach the file and GMail prompted me about missing attachment. It stated that I am talking about attachment but there is no attachment in mail. Wonder how many such intelligent features are hidden in GMail.






      Friday, March 25, 2011

      Selenium IDE, Selenium 1.0, Selenium 2.0, Selenium RC, Selenium GRID, Web Driver and what not... Part 2

      So we have seen, Selenium IDE, Core and RC in part 1 and its time to know a new booster in the offing for Selenium. By now you would have realized that Selenium greatly suffers from its own implementation design. It uses js to drive a page and suffers from js restriction in a browser. WebDriver originated as different web testing library, which tries to employ best possible solution for a automated tests in a browser. WebDriver for Firefox is implemented as Firefox extension, while for IE it makes use of IE's automation control. When facilities offered by Browser are not enough, WebDriver makes use of Operating System offerings. For example to type in file input box. WebDriver and Selenium are being merged to offer best of both API. They can not be exported to WebDriver overnight. How about the test which are already written in Selenium and WebDriver has solution for this also. WebDriver lets you write new test using WebDriver api, while yet supporting existing Selenium test using WebDriverBackedSelenium. for java client driver. WebDriver also supports headless (without head  without browser) execution of tests. Since there would not any browser interaction in this case so these tests would be faster than tests running on actual browser. But do you really want to sacrifice browser for sake of speed of tests ?

      And we are still not happy with speed of test. We want to run tests on different browsers and all at the same time. Answer is Selenium GRID. One Selenium RC can also be used to invoke multiple browsers, but it would soon exhaust system resources. Grid works with Hub > Slave concept, where one hub (Selenium RC) controls slaves (more Selenium RCs) for invoking browsers on multiple systems.

      At last about Selenium 1.0 and Selenium 2.0, Selenium Remote Control is referred as Selenium 1.0 while Selenium 2.0 is referred as merged Selenium and WebDriver api, which should be future Selenium. You may want to be loyal to Selenium 1.0 before while experimenting with Selenium 2.0 at the same time...

      Thursday, March 24, 2011

      Selenium IDE, Selenium 1.0, Selenium 2.0, Selenium RC, Selenium GRID, Web Driver and what not... Part 1

      Here is my take on nebulous terms (well nebulous for newbie) which are used with Selenium. And what might be your best choice when considering to use Selenium for functional test automation of web applications.

      So your client asks for free functional test automation tool and you stumble upon Selenium and first thing you begin to play with is Selenium IDE , Selenium IDE is not so fancy in comparison to QTP IDE or other Automation tools available in market. But then no Test tool IDE is as good as Eclipse, IntelliJ, Visual Studio. (But why to mention them here!) And now you have begun to use Selenium IDE in  firefox browser (Yes you can use it ONLY with firefox) , created tests and test suites and have seen your tests running on Firefox. Then comes the impediments. You realize the need to running your tests with more browsers, parametrize your tests, do DB validation using your tests, integrate your test with CI environment and lot more. You could do a many of these using Selenium IDE plug-ins but solution will not be very maintainable. Primary reason is - Selenium IDE lets you use only one programming language called - Selenese, which follows HTML type syntax. And its language capabilities are extremely limited in comparison to other languages like Java, C# etc.... and then you hear something evil. You hear about Selenium Core

      The less time you spend with core the better. Though Core is always available with IDE and RC (What is RC !@#@ft#). Core is js library which should be deployed on same application server where your web application is running (Will you really have liberty to do this?) This is to over come Same Origin Policy which has been biggest imitation while working with Selenium. So you soon realize that you can not use core and need a better option. And then you get to know about Selenium Remote Control (RC).

      Selenium Remote Control overcomes two primary drawbacks of Selenium Core -


      1. Deployment of core on application server.
      2. Same Region Policy (did you click on previous hyperlink for this topic?)
      3. Being able to use programming language i.e. java, C#, Python. Perl etc.

      So what magic does Selenium RC does. Selenium RC employs a proxy server in middle of your browser and application server. So the browser requests to application server, but before response is directed back to browser Selenium proxy server injects its code and then it is delivered to browsers. Hence browser is fooled in to thinking as if response (original response and code injected by Selenium RC) was all returned by Application Server. And so overcomes the Same Origin Policy. Not only this Selenium RC also let you write tests in a gamut of programming language i.e. - Java, C#, php, python using your favorite IDE i.e. Intellij, Eclipse, Visual Studio etc. There is option to export tests from Selenium IDE in the programming language of your choice. So does Selenium RC solves all the problems. No it does not. Selenium RC is infamous when it comes to dealing with pop up window, file download/upload, drag and drop etc. and What the hack is WebDriver and we have not yet spoken about those mysterious version Selenium 1.0 and Selenium 2.0

      Next Blog I would detail about remaining Selenium Terms...


      Monday, March 21, 2011

      So what did testing certificate yield me

      I was being asked to write CSTE since almost commencement of my career. There was one extremely diligent (and I mean it) manager with my previous employer who would always ask us to write CSTE or some other testing certificate.
      And I always showed my reluctance towards it. Not because I have any grudge against CSTE (though have extreme grudge against ISTQB) but I have not seen any relation between certificate and testing competency.
      I have worked with

      • Exceptional testers without certificate
      • Exceptional testers with certificate
      • Unexceptional testers without  certificate
      • Unexceptional testers with certificate

      I could never drew any conclusion between testing competency and certificate.

      Back to my manager and I. Soon I confronted a condition. I could get to work on my new assignment only if I wrote QC-9.2, client imposition.
      I was darn bored of not having association with any project and decided to write this certificate. Those days it was 9.2, must be 10+ now.
      It was hardly any study for 1 week, questions were objective and I easily cleared the exam. And so as anyone else with little brain and time in hand.
      So did I get to work for the project? No, project never move beyond pipe line and I was employed in another project working on TestComplete for testing winform application. And yes this time without writing any certification.

      Now back to CSTE, we were asked to write CSTE mandatorily. It was as if, more experienced you are more certificates you are ought to have in your profile.
      Seeing my past experience I was more reluctant than ever to write any more certificate.
      Same diligent manager was promoted as senior manager then associate vice president and then vice president and I still did not write the certificate.

      Same manager is not there with my previous employer and I am also working in a new org and yet I am not a certified tester. I am glad that my new job is never going to force me to write any certificate.
      And if you have not read this yet then do it first in your leisure time - http://www.satisfice.com/blog/archives/36
      I also remember a post on decertifying yourself, though can't Google it now.

      Friday, March 11, 2011

      TestNG - DependsOnMethod which returns a value

      Came across a bizarre scenario while using TestNG of late. I had test with method with a return type and another method being dependent on it. i.e. -

      ###########################################
      public class TestNGTest {
         
          @Test
          public Integer returnsSomething() {
              return new Integer(0);
          }
         
          @Test(dependsOnMethods={"returnsSomething"})
          public void dependentMethod() {
              System.out.println("Hello World");
          }
      }
      ###########################################

      This over simple test does not work and throws exception -

      ###########################################
      org.testng.TestNGException:
      com.core.tests.TestNGTest.dependentMethod() is depending on nonexistent method com.core.tests.TestNGTest.returnsSomething
      ###########################################

      And I wondered about this exception. Ended up in asking this to Cedric and his response was -

      "Methods that return a value are ignored as test methods. Wrap it in a void
      method and depend on that void method."

      ""Because it introduced a lot of false test methods for people using @Test
      annotations at the class level."

      Was not convinced with his thoughts but think that, any method which returns a value should be marked as data provider and not a test method. This separates data providers from test methods and provides better isolation of what should stay with which test method.

      Wednesday, March 9, 2011

      Software Testing - What keeps you engaged or disengaged

      So were you always determined to be software tester (tester by choice) or happened to be (tester by chance). And none of this is better than other. Tester by chance might be as skilled at software testing as tester by choice.
      But the question is what keeps them going, what keeps them engaged in work and some times despite having tested same features time and again. So if you were to list out those pointers what would you say, or better if you had to list what keeps you uninterested (which might be an easy question). So let me list down what might disengage a tester from work -

      1. Project is utter crap. None or least (read as none) value is given to testing team, leaving testing aside.
      2. Testing team is more interested in blaming each other of not finding a defect than adding any value to team.
      3. Your salary is least and you had worst appraisal discussion of your life.
      4. So your team members or members in other team are working on test automation. They are using QTP, Selenium and you... well no chance what so ever. And you think automation will bring you to the level of development team (Could write a blog on this nonsense topic it self)....
      5. Your project manager wants you to test any time and every time. 24/7 testing is the dogma s/he is born with. You are a tester and this makes you liable for testing... forever.
      6. How dare you ask about requirement documents? and how dare you missed that production defect !@#!@#!@#$%#$
      7. So your friend is on extended onsite trip and you, well not even sent for visa stamping till now
      8. You attend all the meetings for project and work, WHERE IS THE TIME FOR TESTING
      9. and 1000 situations you would have faced......... Could you list a few, and those enthusiasts who could list otherwise also....
      For me its the team which matters lots over any thing else. Once happened to work on worse project having every possible difficulty but team dedication kept me going every time I was worn out. I wish every tester gets to work with such great team at least once in their life time....

      Monday, March 7, 2011

      Selenium and Capture Network Traffic

      Had heard of it but never tried it my self till today, when a colleague asked about selenium being capable of recording http traffic or not.

      Did a little Google and found that Selenium 1.0 has api - "captureNetweokTraffic" in DefaultSelenium class, and then needed to know how to use it. To be able to capture network traffic one should start selenium instance as -

      selenium.start("captureNetworkTraffic=true");

      and then launch the application usual way. Once you reach a point after which n/w traffic is to be captured then fire following method -


      selenium.captureNetworkTraffic("xml");
      

      We can pass - "xml", "plain" or "json" as parameter to this method. Since its return type is String, we can assert presence of any specific request on the response received

      Though had some trouble while using captureNetworkTraffic, At times I would encounter Internal Server Error from selenium. Or then expected response string will not be available in String returned by captureNetworkTraffic, Though would always see same available from fire bug. But yet on the whole "captureNetworkTraffic" helped in achieving what I wanted to do.

      Saturday, March 5, 2011

      Familly Ties - Series Review

      My hunger for Comic Sitcoms bumped me on Family Ties. It has total of 7 seasons and was aired between 1982 to 1989. I am very impressed with sound track of series, filled with eternal love.
      More inspiring characters for me in the series is been Meredith Baxter-Birney as Elyse Keaton who plays role of responsible mother of three (and later four) and working women. Though she rarely loses her temper, but when she does then Michael Gross as Steven Keaton is with her to console. They two are the ideal couple for many in the series.
      Then there is Justine Bateman as Mallory Keaton who is funny in her way of not knowing any thing about money but being hard on shopping. 
      Michael J. Fox as Alex P. Keaton is most intellectual person in the series, though he is smug about his abilities especially when none of his sister shows any interest in economics.
      Tina Yothers as Jennifer Keaton is one darling from series and reminds me of Vicky from Small Wonder. She is absolutely skilled at letting Alex know about his intelligence being of no value for her (some thing which Mallory could never do despite being elder to Alex)
      There have been short appearances of Marc Price as Irwin "Skippy" Handelman in some episodes. He plays a dumb head who keeps drolling over Mallory, and Mallory never gives him any chance to come near her barring one episode when both of them were caught in basement.
      And there is new entry in series Brian Bonsall as Andrew Keaton, he is not spoken much in series so far and I can only say that he a cute kid.
      I am on 5th season of series and enjoying watching it. My rating for this series in 7/10 and two thumbs up for those who want a comic sitcom along with family values it showers....


      Sunday, January 9, 2011

      Testing auto suggest using Selenium

      Happened to work on Auto Suggest feature of late and was to automate it using Selenium. Auto Suggest feature is similar to suggestion list which is displayed when user types in search term in Google or Yahoo search boxes and a suggestion list is displayed for typed in term.

      Started my experiments with "type()" method of selenium but of no avail.
      browse through a couple of site and found others have had success using native key press methods. But did not work with me.
      Then came across combination of using both "type" and "typeKeys" and voila it worked.

      selenium.type(getPageElement("AutoSuggest", "SearchBox").trim(), "");
      selenium.typeKeys(getPageElement("AutoSuggest", "SearchBox").trim(), searchTerm);
      

      Though still have some intermittent problems which cause a letter in search term to not be typed in search box in a random fashion, but can live with it for now :-)

      ~T

      Saturday, January 1, 2011

      Selenium Page Objects

      Have been reading about page objects in selenium of late and came across a couple of pointers which I wanted to share here -

      1. If user action causes ctrl to appear on a different page then that corresponding page object should be returned else same page object should be returned.

      2. Test code (Verification/Assertion) should be included in test and should not be part of page Objects them selves

      3. Page object need not represent entire page, it may represent part of page which may appear on site multiple times or multiple times on same page.

      4. Page Object offers the services represented by that page.

      Reference:
      http://www.slideshare.net/dantebriones/using-the-page-object-pattern
      http://www.theautomatedtester.co.uk/tutorials/selenium/page-object-pattern.htm
      http://code.google.com/p/selenium/wiki/PageObjects

      of late contributed an article on Page Object on Selenium Head Quarter. It could be found here.
                                   
      Fork me on GitHub