Skip to main content

Posts

Showing posts from 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)

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.

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

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

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, Ar

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

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

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: Project Target (ant execution point and collection of tasks) Tasks (could be as simple as compilation) And there would usually be following targets for Selenium tools - setClassPath - so that ant knows where you jar files are loadTestNG - so that you could use testng task in ant and use it to execute testng tests from ant init - created the build file clean - delete the build file compile - compiles the selenium tests run - executes the selenium tests Here is my project set up for ant -

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);

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

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

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 Statm

Most cliched Selenium questions...

I see following Selenium questions time and again on multiple Selenium forums (StackOverflow, Google Groups, QAForums) - Does Selenium IDE work with IE? How do I read data from excel using Selenium? Should I use selenium 1 or 2? How do I handle js error using Selenium? How do I handle pop up window using Selenium? Does Selenium support Window application? 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.

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

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 she

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 - Writing Safe Selenium api which checks for presence of element before carrying out operation File read and write operation - using text/excel/csv 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.

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(Iterator divIterator=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 capa

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. 

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 fi

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.

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 Seleniu

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

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 st

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

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 - Project is utter crap. None or least (read as none) value is given to testing team, leaving testing aside. Testing team is more interested in blaming each other of not finding a defect than adding any value to team. Your salary is least and you had worst appraisal discussion of your life. So your team members or members in other team are working on test automation. They are using QTP, Selenium and you... we

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 av

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

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

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 .