Thursday, 20 February 2014

How would you choose to do test automation?

How-would-you-choose
Why Test Automation?

Testing is a vital element of customer satisfaction and an integral part of every software development life cycle today. Software development is all about speed, efficiency and flexibility and so is the role of testing and test automation to support this and remove mechanical, routine and time consuming tasks.
Due to the requirement of speed, management of test data and different test environments; testing needs to be very efficient and effective. This is continuously increasing demand to -automate testing and ensure that the regression testing process happens on a very regular basis (even daily),resulting in a most predictable new build every time, with almost zero manual effort being put into this task, enabling the development team to get instant feedback on the quality of their software application/ product.
Test Automation Maturity Model
Test Automation is a reliable strategy and the only option to optimize testing and meet quality standards within time for any complex application in today’s world.
Across market segments, Test Automation Practice is at different maturity stages. Every stage brings up a unique learning and opportunity to empower yourself to move to the higher stage of maturity.
test-automation-maturity-model
Challenges in conventional approach
Today’s test automation is yet another software development process. Available tools in the market demand programming to build a scalable and maintainable test automation suits. It poses few key challenges:
conventional-test-automation
·         Time to automate is very long (we are not talking about Record and Play back as it is just not maintainable)
·         Maintenance of test suites is very high in today’s frequently changing scenarios. Thousands of lines of test automation code, no documentation, and resource churn create a mess that shifts the complete focus. Your test automation is not ready when it is needed. Now you are burning money, time and efforts just to make that work. Lots of frustration! And no results.
·         Skills are not easily available – every tool has its unique and proprietary approach to interact with application technologies. So you need different teams to deal with different tools because they support different programming languages.
·         And your best assets – subject matter experts, functional experts, manual testers cannot automate because they do not know programming.
·         Cost of tools and special skills prolongs expected ROI
test-automation-maturity-modelTest automation is not a choice anymore. Well, how you do is!

Why do you need sophisticated Object identification and management for Selenium Webdriver

object-identificationRecently, I was attending a session on best practices in test automation. One of hot-button topic between the attendees was Object Management. There were lots of inputs about how to identify run time objects, objects changing properties, etc. there were answers coming all around. To my surprise, the topic did not extend further. For majority of them this is what Object Management means!
Test automation predominantly revolves around GUI, objects i.e. various UI controls. Ability of an automation tool to deal with objects is certainly important when selecting an automation tool for your Application-Under-Test (AUT).  At the same time, how you look at using it for Object Management is just as important.
Object Management is not mere object identification, but a lot more than that. The following list will throw some light on what I mean:
  1. Object Identification – Tool algorithm used to identify objects – Name, ID, Link, XPath, etc. that will work across browsers.  Do I need technical skills to identify objects?
  2. Object Repository – Let me know when objects are added by other users to avoid relearning and improve reusability
  3. Object Maintenance:  Let me know when objects are added or removed within AUT for me understand the impact of object change
In the context of Selenium (http://seleniumhq.org), there is no out-of-the box solution for Object Management – identification and repository.  This furthermore increases the relevance and importance of needing a test automation solution that works in conjunction with Selenium to provide a comprehensive Object Management functionality.
Let us discuss the Object Management points mentioned above in detail.
Object Identification:
Object identification, to be more precise, objects being identified accurately demands certain steps to be followed and is certainly not a straight forward experience in Se-RC or Se-WD.
Se-WD offers a range of locators to point to a specific object in AUT.  To name a few – ID, Name, Xpath, CSS, etc.  Many a times user has to make use of Selenium IDE on Firefox to identify objects which is not a full proof solution. Even in that case, there are limitations such as:
1. User wants to verify text and not performing any other action
2. Se-IDE frequently generates index-based Xpath, which is not the right approach as maintainability becomes an issue
3. Se-IDE locators work only on single html reference at a time. Whereas web technology allows nested html structure with frames. If you want your Se-WD to act on an object which belongs to frame/iframe, you must select the frame first.
Then there are tools such as Firebug that can provide a much deeper understanding of the objects.  The drawback here is that it demands understanding of HTML DOM to help you decide how to deal with objects to derive the best object identification locator.
While I explain this, I am getting more technical and your automation will demand even more technical depth to deal with objects using Se-WD.  This is where a more integrated object identification capability combined with intelligent locator algorithm within an automation tool would be most ideal.
Object Repository: 
Having a centralized Object Repository is an absolute necessity for any test automation initiative to be sustainable.  In a multi-user environment, Object Repository reduces duplication of effort involved in learning objects if another user has already defined those objects.  Only new or changed objects need to be dealt with.  Most automation tools would provide for some form of Object Repository.
What is more important is the depth of functionality offered within the automation tool for Object Repository.  These would include:
  1. Do you know which objects are used in which test cases?
  2. Can you bulk-add objects on a page vs. a one-by-one adding of objects?
  3. Can you identify objects in the Object Repository that are no longer available in the AUT?
  4. How easily can you navigate the thousands of objects that reside in the Object Repository?
Furthermore, in an Agile development environment, can you add object place holders so that as development is happening, even automation can begin in parallel.  You can easily update the object definitions as the AUT is being released to QA for testing and automation.
An automation tool that provides more than just a centralized Object Repository, would help achieve the bigger goal of Object Management.

Object Maintenance: 
How do we manage objects that are learnt so that we can adapt any change in future in a very efficient manner?

A change in application can be introduction of new UI or change in existing UI. In either of the case one must know which objects are already present in the repository and which objects in AUT have undergone a change and require update in Object Repository. Many are lost in this phase, ending up with relearning the objects / making changes to object without knowing the impacted test cases. As a result you have to maintain duplicate objects or you get unnecessary failures during execution.
As mentioned earlier, the first step to help with Object Maintenance is Object Identification.  Smarter object identification helps ensure that you only have to deal with object maintenance, if an object has truly undergone a change.
An automation tool that can help you understand the impact of any object change would go a long way in addressing the headaches associated with Object Management.  For e.g.:
  1. Functionality that provides you a list of test cases that will be impacted by an object change instantly will help faster decision-making and changes.
  2. Ability to update an object once and all test cases using that object are automatically updated
Most currently available tools provide this information post an execution failure – basically, you will be reactive vs. proactive in maintaining objects.  What a productivity drain and time lost!

Impact of Object Management on Automation ROI
Object management that looks beyond the basics of object identification will have a much larger impact on ROI from a test automation exercise.  Incomplete and under-utilized Object Management will have adverse consequences such as:
  1. Productivity slows down
  2. Maintenance efforts increase
  3. Overall cost is increased as against anticipated savings
  4. Above all, readiness of automation suite is not guaranteed when required
Suffice to say that Object Management needs a deeper thought and hence, it is fair to conclude that Object Management mechanism cannot be taken lightly when using Se as your automation technology.